123
This commit is contained in:
@@ -116,3 +116,7 @@ knife4j:
|
|||||||
cai:
|
cai:
|
||||||
enable-api-encryption: false
|
enable-api-encryption: false
|
||||||
open-pay-proxy: false
|
open-pay-proxy: false
|
||||||
|
proxy-ip: 159.75.218.177
|
||||||
|
proxy-host: 7693
|
||||||
|
home-name: 知予
|
||||||
|
coin-name: 知钻
|
||||||
|
|||||||
@@ -116,6 +116,12 @@ public enum SystemConfigEnum {
|
|||||||
ANCHOR_JOIN_AGREEMENT("/#/agreement/anchor-join", "主播入驻协议地址",SystemConfigGroupEnum.SYSTEM),
|
ANCHOR_JOIN_AGREEMENT("/#/agreement/anchor-join", "主播入驻协议地址",SystemConfigGroupEnum.SYSTEM),
|
||||||
PAY_CUSTOM("", "支付定向测试",SystemConfigGroupEnum.SYSTEM),
|
PAY_CUSTOM("", "支付定向测试",SystemConfigGroupEnum.SYSTEM),
|
||||||
WS_SOCKET_URL("ws://localhost:8080/ws?token=%s&room_id=%s", "ws通讯地址",SystemConfigGroupEnum.SYSTEM),
|
WS_SOCKET_URL("ws://localhost:8080/ws?token=%s&room_id=%s", "ws通讯地址",SystemConfigGroupEnum.SYSTEM),
|
||||||
|
V12_PRIVATE_KEY_PATH("/home/server/api/sign/6888803128553.pfx", "V12德商私钥路径",SystemConfigGroupEnum.SYSTEM),
|
||||||
|
V12_PRIVATE_KEY_PASSWORD("926645", "V12德商私钥密码",SystemConfigGroupEnum.SYSTEM),
|
||||||
|
V12_XIAOCHENGXU_ORG_ID("gh_62790d4f9c57", "V12德商小程序原始id",SystemConfigGroupEnum.SYSTEM),
|
||||||
|
V12_XIAOCHENGXU_PATH("pages/zf/index?", "V12德商小程序页面路径",SystemConfigGroupEnum.SYSTEM),
|
||||||
|
V12_WX_APP_ID("wxae39c7eed3221d26", "微信开放平台ID",SystemConfigGroupEnum.SYSTEM),
|
||||||
|
|
||||||
;
|
;
|
||||||
|
|
||||||
|
|
||||||
|
|||||||
@@ -2,7 +2,10 @@ package com.ruoyi.cai.trdpay.handle;
|
|||||||
|
|
||||||
import com.alibaba.fastjson2.JSON;
|
import com.alibaba.fastjson2.JSON;
|
||||||
import com.alibaba.fastjson2.JSONObject;
|
import com.alibaba.fastjson2.JSONObject;
|
||||||
|
import com.ruoyi.cai.config.CaiProperties;
|
||||||
import com.ruoyi.cai.domain.PayTrdConfig;
|
import com.ruoyi.cai.domain.PayTrdConfig;
|
||||||
|
import com.ruoyi.cai.enums.SystemConfigEnum;
|
||||||
|
import com.ruoyi.cai.manager.SystemConfigManager;
|
||||||
import com.ruoyi.cai.pay.PayManager;
|
import com.ruoyi.cai.pay.PayManager;
|
||||||
import com.ruoyi.cai.pay.PayOrderInfoDTO;
|
import com.ruoyi.cai.pay.PayOrderInfoDTO;
|
||||||
import com.ruoyi.cai.pay.PayReturnResp;
|
import com.ruoyi.cai.pay.PayReturnResp;
|
||||||
@@ -40,12 +43,12 @@ public class PayTrdV12Service implements PayTrdService {
|
|||||||
private OrderLogsService orderLogsService;
|
private OrderLogsService orderLogsService;
|
||||||
@Autowired
|
@Autowired
|
||||||
private PayManager payManager;
|
private PayManager payManager;
|
||||||
|
@Autowired
|
||||||
|
private CaiProperties caiProperties;
|
||||||
|
@Autowired
|
||||||
|
private SystemConfigManager systemConfigManager;
|
||||||
|
|
||||||
private static final String PRIVATE_KEY_PATH = "/home/server/api/sign/6888806128148.pfx";
|
|
||||||
// private static final String PRIVATE_KEY_PATH = "D:\\mmm\\6888806128148.pfx";
|
|
||||||
private static final String PRIVATE_KEY_PASSWORD = "926645";
|
|
||||||
private static final String PUBLIC_KEY_PATH = "/home/server/api/sign/sand_pro.cer";
|
private static final String PUBLIC_KEY_PATH = "/home/server/api/sign/sand_pro.cer";
|
||||||
// private static final String PUBLIC_KEY_PATH = "D:\\mmm\\sand_pro.cer";
|
|
||||||
|
|
||||||
|
|
||||||
private boolean init = false;
|
private boolean init = false;
|
||||||
@@ -54,8 +57,11 @@ public class PayTrdV12Service implements PayTrdService {
|
|||||||
|
|
||||||
public synchronized void init(String accessMid){
|
public synchronized void init(String accessMid){
|
||||||
if(!init){
|
if(!init){
|
||||||
|
String privateKeyPath = systemConfigManager.getSystemConfig(SystemConfigEnum.V12_PRIVATE_KEY_PATH);
|
||||||
|
String privateKeyPassword = systemConfigManager.getSystemConfig(SystemConfigEnum.V12_PRIVATE_KEY_PASSWORD);
|
||||||
|
log.info("初始化德商SDK privateKeyPath:{} privateKeyPassword:{}", privateKeyPath, privateKeyPassword);
|
||||||
sandPublicKey = RSAUtil.getPublicKeyByPath(PUBLIC_KEY_PATH);
|
sandPublicKey = RSAUtil.getPublicKeyByPath(PUBLIC_KEY_PATH);
|
||||||
merchantPrivateKey = RSAUtil.getPrivateKeyByPath(PRIVATE_KEY_PATH, PRIVATE_KEY_PASSWORD);
|
merchantPrivateKey = RSAUtil.getPrivateKeyByPath(privateKeyPath, privateKeyPassword);
|
||||||
init = true;
|
init = true;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@@ -74,7 +80,7 @@ public class PayTrdV12Service implements PayTrdService {
|
|||||||
TradeCreateBizRequest bizRequest = new TradeCreateBizRequest();
|
TradeCreateBizRequest bizRequest = new TradeCreateBizRequest();
|
||||||
bizRequest.setMid(payTrdConfig.getMchId());
|
bizRequest.setMid(payTrdConfig.getMchId());
|
||||||
bizRequest.setOutOrderNo(payOrderInfoDTO.getOrderNo());
|
bizRequest.setOutOrderNo(payOrderInfoDTO.getOrderNo());
|
||||||
bizRequest.setDescription("知予-"+payOrderInfoDTO.getSubject());
|
bizRequest.setDescription(caiProperties.getHomeName() + "-"+payOrderInfoDTO.getSubject());
|
||||||
bizRequest.setGoodsClass(GoodsClassEnum.GC99.getCode());
|
bizRequest.setGoodsClass(GoodsClassEnum.GC99.getCode());
|
||||||
bizRequest.setAmount(payOrderInfoDTO.getPrice());
|
bizRequest.setAmount(payOrderInfoDTO.getPrice());
|
||||||
PayerInfo payerInfo = new PayerInfo();
|
PayerInfo payerInfo = new PayerInfo();
|
||||||
@@ -88,10 +94,13 @@ public class PayTrdV12Service implements PayTrdService {
|
|||||||
* miniProgramType : 0
|
* miniProgramType : 0
|
||||||
*/
|
*/
|
||||||
PayerInfo.PayExtra payExtra = new PayerInfo.PayExtra();
|
PayerInfo.PayExtra payExtra = new PayerInfo.PayExtra();
|
||||||
|
String wxAppId = systemConfigManager.getSystemConfig(SystemConfigEnum.V12_WX_APP_ID);
|
||||||
|
String orgId = systemConfigManager.getSystemConfig(SystemConfigEnum.V12_XIAOCHENGXU_ORG_ID);
|
||||||
|
String wxPath = systemConfigManager.getSystemConfig(SystemConfigEnum.V12_XIAOCHENGXU_PATH);
|
||||||
payExtra.setFuncCode(FuncCodeEnum.FC02010005.getCode()); // 收银台功能编码
|
payExtra.setFuncCode(FuncCodeEnum.FC02010005.getCode()); // 收银台功能编码
|
||||||
payExtra.setSubAppId("wxae39c7eed3221d26"); // 移动应用appid,微信开放平台获取,wx开头
|
payExtra.setSubAppId(wxAppId); // 移动应用appid,微信开放平台获取,wx开头
|
||||||
payExtra.setGhOriId("gh_40fd947b7d3f"); // 小程序原始id,微信公众平台获取,gh_开头
|
payExtra.setGhOriId(orgId); // 小程序原始id,微信公众平台获取,gh_开头
|
||||||
payExtra.setPathUrl("pages/zf/index?"); // 拉起小程序页面,默认地址:pages/zf/index?
|
payExtra.setPathUrl(wxPath); // 拉起小程序页面,默认地址:pages/zf/index?
|
||||||
payExtra.setMiniProgramType("0"); // 小程序版本,0-正式版 1-开发版 2-体验版
|
payExtra.setMiniProgramType("0"); // 小程序版本,0-正式版 1-开发版 2-体验版
|
||||||
payExtraList.add(payExtra);
|
payExtraList.add(payExtra);
|
||||||
payerInfo.setPayExtra(payExtraList);
|
payerInfo.setPayExtra(payExtraList);
|
||||||
|
|||||||
Reference in New Issue
Block a user