fix 微信服务商退款和回调处理错误

This commit is contained in:
bootx
2025-05-11 14:48:36 +08:00
parent df7bb4a0db
commit 25e6e8fd8f
4 changed files with 7 additions and 3 deletions

View File

@@ -73,7 +73,7 @@ public class WechatPayCallbackService {
callbackInfo.setCallbackType(TradeTypeEnum.PAY)
.setChannel(isv? ChannelEnum.WECHAT_ISV.getCode():ChannelEnum.WECHAT.getCode());
WechatPayConfig config = wechatPayConfigService.getAndCheckConfig(false);
WechatPayConfig config = wechatPayConfigService.getAndCheckConfig(isv);
WxPayService wxPayService = wechatPayConfigService.wxJavaSdk(config);
// v2 或 v3
if (Objects.equals(config.getApiVersion(), WechatPayCode.API_V2)) {

View File

@@ -75,7 +75,7 @@ public class WechatRefundCallbackService {
callbackInfo.setCallbackType(TradeTypeEnum.REFUND)
.setChannel(isv? ChannelEnum.WECHAT_ISV.getCode():ChannelEnum.WECHAT.getCode());
WechatPayConfig config = wechatPayConfigService.getAndCheckConfig(false);
WechatPayConfig config = wechatPayConfigService.getAndCheckConfig(isv);
WxPayService wxPayService = wechatPayConfigService.wxJavaSdk(config);
// v2 或 v3
if (Objects.equals(config.getApiVersion(), WechatPayCode.API_V2)) {

View File

@@ -66,7 +66,7 @@ public class WechatTransferCallbackService {
CallbackLocal callbackInfo = PaymentContextLocal.get().getCallbackInfo();
callbackInfo.setChannel(isv? ChannelEnum.WECHAT_ISV.getCode():ChannelEnum.WECHAT.getCode())
.setCallbackType(TradeTypeEnum.TRANSFER);
WechatPayConfig config = wechatPayConfigService.getAndCheckConfig(false);
WechatPayConfig config = wechatPayConfigService.getAndCheckConfig(isv);
WxPayService wxPayService = wechatPayConfigService.wxJavaSdk(config);
// V3 回调接收处理
String body = JakartaServletUtil.getBody(request);

View File

@@ -1,5 +1,6 @@
package org.dromara.daxpay.channel.wechat.service.payment.refund;
import cn.hutool.core.util.StrUtil;
import org.dromara.daxpay.channel.wechat.entity.config.WechatPayConfig;
import org.dromara.daxpay.channel.wechat.enums.WechatRefundStatusEnum;
import org.dromara.daxpay.channel.wechat.service.payment.config.WechatPayConfigService;
@@ -48,6 +49,9 @@ public class WechatSubRefundV3Service {
.setOutTradeNo(refundOrder.getOrderNo())
.setAmount(amount)
.setSubMchid(config.getSubMchId());
if (StrUtil.isBlank(request.getReason())){
request.setReason("退款");
}
try {
WxPayRefundV3Result result = wxPayService.refundV3(request);