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);
}
}