fix 云闪付支付链条

This commit is contained in:
DaxPay
2024-10-09 10:59:24 +08:00
parent eee665926a
commit 6ccd0a0d3b
6 changed files with 18 additions and 20 deletions

View File

@@ -111,7 +111,7 @@ public class UnionPayConfigService {
*/
public UnionPayConfig getUnionPayConfig(){
MchAppLocal mchAppInfo = PaymentContextLocal.get().getMchAppInfo();
ChannelConfig channelConfig = channelConfigCacheService.get(mchAppInfo.getAppId(), ChannelEnum.ALI.getCode());
ChannelConfig channelConfig = channelConfigCacheService.get(mchAppInfo.getAppId(), ChannelEnum.UNION_PAY.getCode());
return UnionPayConfig.convertConfig(channelConfig);
}
@@ -134,9 +134,17 @@ public class UnionPayConfigService {
}
/**
* 生成云闪付支付服务
* 生成云闪付支付接口
*/
public UnionPayKit initPayService(){
UnionPayConfig config = this.getUnionPayConfig();
return this.initPayService(config);
}
/**
* 生成云闪付支付接口
*/
public UnionPayKit initPayService(UnionPayConfig config){
UnionPayConfigStorage unionPayConfigStorage = new UnionPayConfigStorage();
unionPayConfigStorage.setInputCharset(CharsetUtil.UTF_8);
// 商户号
@@ -155,10 +163,12 @@ public class UnionPayConfigService {
unionPayConfigStorage.setKeyPrivateCertPwd(config.getKeyPrivateCertPwd());
//设置证书对应的存储方式,证书流
unionPayConfigStorage.setCertStoreType(CertStoreType.INPUT_STREAM);
// 签名方式
unionPayConfigStorage.setSignType(config.getSignType());
//是否为测试账号,沙箱环境
unionPayConfigStorage.setTest(config.isSandbox());
// 回调地址
unionPayConfigStorage.setNotifyUrl(getNotifyUrl());
// 网络请求配置
HttpConfigStorage httpConfigStorage = new HttpConfigStorage();

View File

@@ -71,7 +71,7 @@ public class UnionPayStrategy extends AbsPayStrategy {
*/
@Override
public PayResultBo doPayHandler() {
UnionPayKit unionPayKit = unionPayConfigService.initPayService(unionPayConfig);
UnionPayKit unionPayKit = unionPayConfigService.initPayService();
return unionPayService.pay(this.getOrder(), this.unionPayParam, unionPayKit);
}
}

View File

@@ -1,7 +1,6 @@
package org.dromara.daxpay.channel.union.strategy;
import lombok.RequiredArgsConstructor;
import org.dromara.daxpay.channel.union.entity.config.UnionPayConfig;
import org.dromara.daxpay.channel.union.sdk.api.UnionPayKit;
import org.dromara.daxpay.channel.union.service.config.UnionPayConfigService;
import org.dromara.daxpay.channel.union.service.refund.UnionPayRefundService;
@@ -27,8 +26,6 @@ public class UnionRefundStrategy extends AbsRefundStrategy {
private final UnionPayConfigService unionPayConfigService;
private UnionPayConfig unionPayConfig;
/**
* 策略标识
*
@@ -39,21 +36,12 @@ public class UnionRefundStrategy extends AbsRefundStrategy {
return ChannelEnum.UNION_PAY.getCode();
}
/**
* 退款前对处理, 初始化微信支付配置
*/
@Override
public void doBeforeRefundHandler() {
this.unionPayConfig = unionPayConfigService.getAndCheckConfig();
}
/**
* 退款操作
*/
@Override
public RefundResultBo doRefundHandler() {
UnionPayKit unionPayKit = unionPayConfigService.initPayService(unionPayConfig);
UnionPayKit unionPayKit = unionPayConfigService.initPayService();
return unionPayRefundService.refund(this.getRefundOrder(), unionPayKit);
}
}

View File

@@ -71,7 +71,7 @@ bootx-platform:
# 使用后端代理访问, 线上请使用 Nginx 配置或者直连方式,效率更高
forward-server-url: http://127.0.0.1:9999
dax-pay:
env: DEMO_
env: DEMO
machine-no: 70
dromara:
# 注意, 不要设置 domain 访问路径, 自行进行拼接访问路径, 来保证可迁移性

View File

@@ -75,7 +75,7 @@ bootx-platform:
# 使用后端代理访问, 线上请使用 Nginx 配置或者直连方式,效率更高
forward-server-url: http://127.0.0.1:9999
dax-pay:
env: DEV_
env: DEV
machine-no: 60
dromara:
# 注意, 不要设置 domain 访问路径, 自行进行拼接访问路径, 来保证可迁移性

View File

@@ -22,7 +22,7 @@ public class DaxPayProperties {
/** 通常为两位内 机器码, 用于区分不同机器生成的流水号 */
private String machineNo = "58";
/** 当前环境,会影响订单号的生成 */
/** 当前环境,会影响订单号的生成, 推荐只使用字母和数字, 部分通道不支持特殊符号, 如云闪付 */
private String env = "";
public void setMachineNo(String machineNo) {