Commit 2093c3bdb51dfb4367987a71776db2e0c0603f3d

Authored by YunaiV
1 parent 8e1be014

pay: 重构支付客户端,移除 PayCommonResult 累

Showing 20 changed files with 240 additions and 418 deletions
yudao-framework/yudao-spring-boot-starter-biz-pay/src/main/java/cn/iocoder/yudao/framework/pay/core/client/AbstractPayCodeMapping.java deleted
1   -package cn.iocoder.yudao.framework.pay.core.client;
2   -
3   -import cn.iocoder.yudao.framework.common.exception.ErrorCode;
4   -import cn.iocoder.yudao.framework.pay.core.enums.PayFrameworkErrorCodeConstants;
5   -import lombok.extern.slf4j.Slf4j;
6   -
7   -/**
8   - * 将 API 的错误码,转换为通用的错误码
9   - *
10   - * @see PayCommonResult
11   - * @see PayFrameworkErrorCodeConstants
12   - *
13   - * @author 芋道源码
14   - */
15   -@Slf4j
16   -public abstract class AbstractPayCodeMapping {
17   -
18   - public final ErrorCode apply(String apiCode, String apiMsg) {
19   - if (apiCode == null) {
20   - log.error("[apply][API 错误码为空,请排查]");
21   - return PayFrameworkErrorCodeConstants.EXCEPTION;
22   - }
23   - ErrorCode errorCode = this.apply0(apiCode, apiMsg);
24   - if (errorCode == null) {
25   - log.error("[apply][API 错误码({}) 错误提示({}) 无法匹配]", apiCode, apiMsg);
26   - return PayFrameworkErrorCodeConstants.PAY_UNKNOWN;
27   - }
28   - return errorCode;
29   - }
30   -
31   - protected abstract ErrorCode apply0(String apiCode, String apiMsg);
32   -
33   -}
yudao-framework/yudao-spring-boot-starter-biz-pay/src/main/java/cn/iocoder/yudao/framework/pay/core/client/PayClient.java
... ... @@ -5,7 +5,7 @@ import cn.iocoder.yudao.framework.pay.core.client.dto.notify.PayNotifyDataDTO;
5 5 import cn.iocoder.yudao.framework.pay.core.client.dto.notify.PayRefundNotifyDTO;
6 6 import cn.iocoder.yudao.framework.pay.core.client.dto.notify.PayOrderNotifyRespDTO;
7 7 import cn.iocoder.yudao.framework.pay.core.client.dto.order.PayOrderUnifiedReqDTO;
8   -import cn.iocoder.yudao.framework.pay.core.client.dto.refund.PayRefundUnifiedReqDTO;
  8 +import cn.iocoder.yudao.framework.pay.core.client.dto.order.PayOrderUnifiedRespDTO;import cn.iocoder.yudao.framework.pay.core.client.dto.refund.PayRefundUnifiedReqDTO;
9 9 import cn.iocoder.yudao.framework.pay.core.client.dto.refund.PayRefundUnifiedRespDTO;
10 10  
11 11 /**
... ... @@ -28,7 +28,7 @@ public interface PayClient {
28 28 * @param reqDTO 下单信息
29 29 * @return 各支付渠道的返回结果
30 30 */
31   - PayCommonResult<?> unifiedOrder(PayOrderUnifiedReqDTO reqDTO);
  31 + PayOrderUnifiedRespDTO unifiedOrder(PayOrderUnifiedReqDTO reqDTO);
32 32  
33 33 /**
34 34 * 解析支付单的通知结果
... ... @@ -44,7 +44,7 @@ public interface PayClient {
44 44 * @param reqDTO 统一退款请求信息
45 45 * @return 各支付渠道的统一返回结果
46 46 */
47   - PayCommonResult<PayRefundUnifiedRespDTO> unifiedRefund(PayRefundUnifiedReqDTO reqDTO);
  47 + PayRefundUnifiedRespDTO unifiedRefund(PayRefundUnifiedReqDTO reqDTO);
48 48  
49 49 /**
50 50 * 解析支付退款通知数据
... ...
yudao-framework/yudao-spring-boot-starter-biz-pay/src/main/java/cn/iocoder/yudao/framework/pay/core/client/PayCommonResult.java deleted
1   -package cn.iocoder.yudao.framework.pay.core.client;
2   -
3   -import cn.hutool.core.exceptions.ExceptionUtil;
4   -import cn.hutool.core.lang.Assert;
5   -import cn.iocoder.yudao.framework.common.exception.ErrorCode;
6   -import cn.iocoder.yudao.framework.common.pojo.CommonResult;
7   -import cn.iocoder.yudao.framework.pay.core.enums.PayFrameworkErrorCodeConstants;
8   -import lombok.Data;
9   -import lombok.EqualsAndHashCode;
10   -import lombok.ToString;
11   -
12   -/**
13   - * 支付的 CommonResult 拓展类
14   - *
15   - * 考虑到不同的平台,返回的 code 和 msg 是不同的,所以统一额外返回 {@link #apiCode} 和 {@link #apiMsg} 字段
16   - *
17   - * @author 芋道源码
18   - */
19   -@Data
20   -@EqualsAndHashCode(callSuper = true)
21   -@ToString(callSuper = true)
22   -public class PayCommonResult<T> extends CommonResult<T> {
23   -
24   - /**
25   - * API 返回错误码
26   - *
27   - * 由于第三方的错误码可能是字符串,所以使用 String 类型
28   - */
29   - private String apiCode;
30   - /**
31   - * API 返回提示
32   - */
33   - private String apiMsg;
34   -
35   - private PayCommonResult() {
36   - }
37   -
38   - public static <T> PayCommonResult<T> build(String apiCode, String apiMsg, T data, AbstractPayCodeMapping codeMapping) {
39   - Assert.notNull(codeMapping, "参数 codeMapping 不能为空");
40   - PayCommonResult<T> result = new PayCommonResult<T>().setApiCode(apiCode).setApiMsg(apiMsg);
41   - result.setData(data);
42   - // 翻译错误码
43   - if (codeMapping != null) {
44   - ErrorCode errorCode = codeMapping.apply(apiCode, apiMsg);
45   - result.setCode(errorCode.getCode()).setMsg(errorCode.getMsg());
46   - }
47   - return result;
48   - }
49   -
50   - public static <T> PayCommonResult<T> error(Throwable ex) {
51   - PayCommonResult<T> result = new PayCommonResult<>();
52   - result.setCode(PayFrameworkErrorCodeConstants.EXCEPTION.getCode());
53   - result.setMsg(ExceptionUtil.getRootCauseMessage(ex));
54   - return result;
55   - }
56   -
57   -}
yudao-framework/yudao-spring-boot-starter-biz-pay/src/main/java/cn/iocoder/yudao/framework/pay/core/client/impl/AbstractPayClient.java
1 1 package cn.iocoder.yudao.framework.pay.core.client.impl;
2 2  
3   -import cn.hutool.core.date.DatePattern;
4   -import cn.hutool.core.date.DateUtil;
5 3 import cn.hutool.core.date.LocalDateTimeUtil;
6   -import cn.iocoder.yudao.framework.common.util.date.DateUtils;
7   -import cn.iocoder.yudao.framework.common.util.date.LocalDateTimeUtils;
8   -import cn.iocoder.yudao.framework.pay.core.client.AbstractPayCodeMapping;
9 4 import cn.iocoder.yudao.framework.pay.core.client.PayClient;
10 5 import cn.iocoder.yudao.framework.pay.core.client.PayClientConfig;
11   -import cn.iocoder.yudao.framework.pay.core.client.PayCommonResult;
12 6 import cn.iocoder.yudao.framework.pay.core.client.dto.order.PayOrderUnifiedReqDTO;
  7 +import cn.iocoder.yudao.framework.pay.core.client.dto.order.PayOrderUnifiedRespDTO;
13 8 import cn.iocoder.yudao.framework.pay.core.client.dto.refund.PayRefundUnifiedReqDTO;
14 9 import cn.iocoder.yudao.framework.pay.core.client.dto.refund.PayRefundUnifiedRespDTO;
15   -import lombok.extern.slf4j.Slf4j;
  10 +import com.alipay.api.AlipayResponse;import lombok.extern.slf4j.Slf4j;
16 11  
17 12 import javax.validation.Validation;
18   -
19 13 import java.time.LocalDateTime;
20 14  
21 15 import static cn.hutool.core.date.DatePattern.NORM_DATETIME_MS_FORMATTER;
  16 +import static cn.iocoder.yudao.framework.common.exception.util.ServiceExceptionUtil.exception;
  17 +import static cn.iocoder.yudao.framework.common.exception.util.ServiceExceptionUtil.exception0;
22 18 import static cn.iocoder.yudao.framework.common.util.json.JsonUtils.toJsonString;
  19 +import static cn.iocoder.yudao.framework.pay.core.enums.PayFrameworkErrorCodeConstants.PAY_EXCEPTION;
23 20  
24 21 /**
25 22 * 支付客户端的抽象类,提供模板方法,减少子类的冗余代码
... ... @@ -38,18 +35,13 @@ public abstract class AbstractPayClient&lt;Config extends PayClientConfig&gt; implemen
38 35 */
39 36 private final String channelCode;
40 37 /**
41   - * 错误码枚举类
42   - */
43   - protected AbstractPayCodeMapping codeMapping;
44   - /**
45 38 * 支付配置
46 39 */
47 40 protected Config config;
48 41  
49   - public AbstractPayClient(Long channelId, String channelCode, Config config, AbstractPayCodeMapping codeMapping) {
  42 + public AbstractPayClient(Long channelId, String channelCode, Config config) {
50 43 this.channelId = channelId;
51 44 this.channelCode = channelCode;
52   - this.codeMapping = codeMapping;
53 45 this.config = config;
54 46 }
55 47  
... ... @@ -83,41 +75,54 @@ public abstract class AbstractPayClient&lt;Config extends PayClientConfig&gt; implemen
83 75 }
84 76  
85 77 @Override
86   - public final PayCommonResult<?> unifiedOrder(PayOrderUnifiedReqDTO reqDTO) {
  78 + public final PayOrderUnifiedRespDTO unifiedOrder(PayOrderUnifiedReqDTO reqDTO) {
87 79 Validation.buildDefaultValidatorFactory().getValidator().validate(reqDTO);
88 80 // 执行短信发送
89   - PayCommonResult<?> result;
  81 + PayOrderUnifiedRespDTO result;
90 82 try {
91 83 result = doUnifiedOrder(reqDTO);
92 84 } catch (Throwable ex) {
93 85 // 打印异常日志
94 86 log.error("[unifiedOrder][request({}) 发起支付失败]", toJsonString(reqDTO), ex);
95   - // 封装返回
96   - return PayCommonResult.error(ex);
  87 + throw buildException(ex);
97 88 }
98 89 return result;
99 90 }
100 91  
101   - protected abstract PayCommonResult<?> doUnifiedOrder(PayOrderUnifiedReqDTO reqDTO)
  92 + protected abstract PayOrderUnifiedRespDTO doUnifiedOrder(PayOrderUnifiedReqDTO reqDTO)
102 93 throws Throwable;
103 94  
104 95 @Override
105   - public PayCommonResult<PayRefundUnifiedRespDTO> unifiedRefund(PayRefundUnifiedReqDTO reqDTO) {
106   - PayCommonResult<PayRefundUnifiedRespDTO> resp;
  96 + public PayRefundUnifiedRespDTO unifiedRefund(PayRefundUnifiedReqDTO reqDTO) {
  97 + PayRefundUnifiedRespDTO resp;
107 98 try {
108 99 resp = doUnifiedRefund(reqDTO);
109 100 } catch (Throwable ex) {
110 101 // 记录异常日志
111 102 log.error("[unifiedRefund][request({}) 发起退款失败]", toJsonString(reqDTO), ex);
112   - resp = PayCommonResult.error(ex);
  103 + throw buildException(ex);
113 104 }
114 105 return resp;
115 106 }
116 107  
117   - protected abstract PayCommonResult<PayRefundUnifiedRespDTO> doUnifiedRefund(PayRefundUnifiedReqDTO reqDTO) throws Throwable;
  108 + protected abstract PayRefundUnifiedRespDTO doUnifiedRefund(PayRefundUnifiedReqDTO reqDTO) throws Throwable;
118 109  
119 110 // ========== 各种工具方法 ==========
120 111  
  112 + private RuntimeException buildException(Throwable ex) {
  113 + if (ex instanceof RuntimeException) {
  114 + return (RuntimeException) ex;
  115 + }
  116 + throw new RuntimeException(ex);
  117 + }
  118 +
  119 + protected void validateSuccess(AlipayResponse response) {
  120 + if (response.isSuccess()) {
  121 + return;
  122 + }
  123 + throw exception0(PAY_EXCEPTION.getCode(), response.getSubMsg());
  124 + }
  125 +
121 126 protected String formatAmount(Integer amount) {
122 127 return String.valueOf(amount / 100.0);
123 128 }
... ...
yudao-framework/yudao-spring-boot-starter-biz-pay/src/main/java/cn/iocoder/yudao/framework/pay/core/client/impl/alipay/AbstractAlipayClient.java
... ... @@ -2,11 +2,9 @@ package cn.iocoder.yudao.framework.pay.core.client.impl.alipay;
2 2  
3 3 import cn.hutool.core.bean.BeanUtil;
4 4 import cn.hutool.core.date.LocalDateTimeUtil;
5   -import cn.iocoder.yudao.framework.pay.core.client.AbstractPayCodeMapping;
6   -import cn.iocoder.yudao.framework.pay.core.client.PayCommonResult;
7 5 import cn.iocoder.yudao.framework.pay.core.client.dto.notify.PayNotifyDataDTO;
8   -import cn.iocoder.yudao.framework.pay.core.client.dto.notify.PayRefundNotifyDTO;
9 6 import cn.iocoder.yudao.framework.pay.core.client.dto.notify.PayOrderNotifyRespDTO;
  7 +import cn.iocoder.yudao.framework.pay.core.client.dto.notify.PayRefundNotifyDTO;
10 8 import cn.iocoder.yudao.framework.pay.core.client.dto.refund.PayRefundUnifiedReqDTO;
11 9 import cn.iocoder.yudao.framework.pay.core.client.dto.refund.PayRefundUnifiedRespDTO;
12 10 import cn.iocoder.yudao.framework.pay.core.client.impl.AbstractPayClient;
... ... @@ -37,9 +35,8 @@ public abstract class AbstractAlipayClient extends AbstractPayClient&lt;AlipayPayCl
37 35  
38 36 protected DefaultAlipayClient client;
39 37  
40   - public AbstractAlipayClient(Long channelId, String channelCode,
41   - AlipayPayClientConfig config, AbstractPayCodeMapping codeMapping) {
42   - super(channelId, channelCode, config, codeMapping);
  38 + public AbstractAlipayClient(Long channelId, String channelCode, AlipayPayClientConfig config) {
  39 + super(channelId, channelCode, config);
43 40 }
44 41  
45 42 @Override
... ... @@ -106,7 +103,7 @@ public abstract class AbstractAlipayClient extends AbstractPayClient&lt;AlipayPayCl
106 103 * @return 退款请求 Response
107 104 */
108 105 @Override
109   - protected PayCommonResult<PayRefundUnifiedRespDTO> doUnifiedRefund(PayRefundUnifiedReqDTO reqDTO) {
  106 + protected PayRefundUnifiedRespDTO doUnifiedRefund(PayRefundUnifiedReqDTO reqDTO) {
110 107 AlipayTradeRefundModel model=new AlipayTradeRefundModel();
111 108 model.setTradeNo(reqDTO.getChannelOrderNo());
112 109 model.setOutTradeNo(reqDTO.getPayTradeNo());
... ... @@ -127,19 +124,20 @@ public abstract class AbstractAlipayClient extends AbstractPayClient&lt;AlipayPayCl
127 124 //支付宝不返回退款单号,设置为空
128 125 PayRefundUnifiedRespDTO respDTO = new PayRefundUnifiedRespDTO();
129 126 respDTO.setChannelRefundId("");
130   - return PayCommonResult.build(response.getCode(), response.getMsg(), respDTO, codeMapping);
  127 +// return PayCommonResult.build(response.getCode(), response.getMsg(), respDTO, codeMapping); TODO
  128 + return null;
131 129 }
132 130 // 失败。需要抛出异常
133   - return PayCommonResult.build(response.getCode(), response.getMsg(), null, codeMapping);
  131 +// return PayCommonResult.build(response.getCode(), response.getMsg(), null, codeMapping); TODO
  132 + return null;
134 133 } catch (AlipayApiException e) {
135 134 // TODO 记录异常日志
136 135 log.error("[doUnifiedRefund][request({}) 发起退款失败,网络读超时,退款状态未知]", toJsonString(reqDTO), e);
137   - return PayCommonResult.build(e.getErrCode(), e.getErrMsg(), null, codeMapping);
  136 +// return PayCommonResult.build(e.getErrCode(), e.getErrMsg(), null, codeMapping); TODO
  137 + return null;
138 138 }
139 139 }
140 140  
141   -
142   -
143 141 /**
144 142 * 支付宝统一回调参数 str 转 map
145 143 *
... ...
yudao-framework/yudao-spring-boot-starter-biz-pay/src/main/java/cn/iocoder/yudao/framework/pay/core/client/impl/alipay/AlipayBarPayClient.java
1 1 package cn.iocoder.yudao.framework.pay.core.client.impl.alipay;
2 2  
  3 +import cn.hutool.core.map.MapUtil;
3 4 import cn.hutool.core.util.StrUtil;
4   -import cn.iocoder.yudao.framework.pay.core.client.PayCommonResult;
5 5 import cn.iocoder.yudao.framework.pay.core.client.dto.order.PayOrderUnifiedReqDTO;
6 6 import cn.iocoder.yudao.framework.pay.core.client.dto.order.PayOrderUnifiedRespDTO;
7 7 import cn.iocoder.yudao.framework.pay.core.enums.PayChannelEnum;
... ... @@ -12,12 +12,14 @@ import com.alipay.api.request.AlipayTradePayRequest;
12 12 import com.alipay.api.response.AlipayTradePayResponse;
13 13 import lombok.extern.slf4j.Slf4j;
14 14  
15   -import static cn.iocoder.yudao.framework.common.util.json.JsonUtils.toJsonString;
  15 +import static cn.iocoder.yudao.framework.common.exception.enums.GlobalErrorCodeConstants.BAD_REQUEST;
  16 +import static cn.iocoder.yudao.framework.common.exception.util.ServiceExceptionUtil.exception;
  17 +import static cn.iocoder.yudao.framework.common.exception.util.ServiceExceptionUtil.exception0;
16 18  
17 19 /**
18 20 * 支付宝【条码支付】的 PayClient 实现类
19 21 *
20   - * 文档:https://opendocs.alipay.com/open/194/105072
  22 + * 文档:<a href="https://opendocs.alipay.com/open/194/105072">当面付</a>
21 23 *
22 24 * @author 芋道源码
23 25 */
... ... @@ -25,12 +27,16 @@ import static cn.iocoder.yudao.framework.common.util.json.JsonUtils.toJsonString
25 27 public class AlipayBarPayClient extends AbstractAlipayClient {
26 28  
27 29 public AlipayBarPayClient(Long channelId, AlipayPayClientConfig config) {
28   - super(channelId, PayChannelEnum.ALIPAY_BAR.getCode(), config,
29   - new AlipayPayCodeMapping());
  30 + super(channelId, PayChannelEnum.ALIPAY_BAR.getCode(), config);
30 31 }
31 32  
32 33 @Override
33   - public PayCommonResult<PayOrderUnifiedRespDTO> doUnifiedOrder(PayOrderUnifiedReqDTO reqDTO) {
  34 + public PayOrderUnifiedRespDTO doUnifiedOrder(PayOrderUnifiedReqDTO reqDTO) throws AlipayApiException {
  35 + String authCode = MapUtil.getStr(reqDTO.getChannelExtras(), "auth_code");
  36 + if (StrUtil.isEmpty(authCode)) {
  37 + throw exception0(BAD_REQUEST.getCode(), "条形码不能为空");
  38 + }
  39 +
34 40 // 1.1 构建 AlipayTradePayModel 请求
35 41 AlipayTradePayModel model = new AlipayTradePayModel();
36 42 // ① 通用的参数
... ... @@ -39,7 +45,8 @@ public class AlipayBarPayClient extends AbstractAlipayClient {
39 45 model.setBody(reqDTO.getBody());
40 46 model.setTotalAmount(formatAmount(reqDTO.getAmount()));
41 47 model.setScene("bar_code"); // 当面付条码支付场景
42   - // ② 个性化的参数【无】
  48 + // ② 个性化的参数
  49 + model.setAuthCode(authCode);
43 50 // ③ 支付宝条码支付只有一种展示
44 51 String displayMode = PayDisplayModeEnum.BAR_CODE.getMode();
45 52  
... ... @@ -47,20 +54,13 @@ public class AlipayBarPayClient extends AbstractAlipayClient {
47 54 AlipayTradePayRequest request = new AlipayTradePayRequest();
48 55 request.setBizModel(model);
49 56 request.setNotifyUrl(reqDTO.getNotifyUrl());
50   - request.setReturnUrl(reqDTO.getReturnUrl()); // TODO 芋艿,待搞
  57 + request.setReturnUrl(reqDTO.getReturnUrl());
51 58  
52 59 // 2.1 执行请求
53   - AlipayTradePayResponse response;
54   - try {
55   - response = client.execute(request);
56   - } catch (AlipayApiException e) {
57   - log.error("[unifiedOrder][request({}) 发起支付失败]", toJsonString(reqDTO), e);
58   - return PayCommonResult.build(e.getErrCode(), e.getErrMsg(), null, codeMapping);
59   - }
  60 + AlipayTradePayResponse response = client.execute(request);
60 61 // 2.2 处理结果
61   - PayOrderUnifiedRespDTO respDTO = new PayOrderUnifiedRespDTO()
62   - .setDisplayMode(displayMode).setDisplayContent(response.getCode());
63   - return PayCommonResult.build(StrUtil.blankToDefault(response.getCode(),"10000"),
64   - response.getMsg(), respDTO, codeMapping);
  62 + validateSuccess(response);
  63 + return new PayOrderUnifiedRespDTO()
  64 + .setDisplayMode(displayMode).setDisplayContent("");
65 65 }
66 66 }
... ...
yudao-framework/yudao-spring-boot-starter-biz-pay/src/main/java/cn/iocoder/yudao/framework/pay/core/client/impl/alipay/AlipayPayCodeMapping.java deleted
1   -package cn.iocoder.yudao.framework.pay.core.client.impl.alipay;
2   -
3   -import cn.iocoder.yudao.framework.common.exception.ErrorCode;
4   -import cn.iocoder.yudao.framework.common.exception.enums.GlobalErrorCodeConstants;
5   -import cn.iocoder.yudao.framework.pay.core.client.AbstractPayCodeMapping;
6   -
7   -import java.util.Objects;
8   -
9   -/**
10   - * 支付宝的 PayCodeMapping 实现类
11   - *
12   - * @author 芋道源码
13   - */
14   -public class AlipayPayCodeMapping extends AbstractPayCodeMapping {
15   -
16   - @Override
17   - protected ErrorCode apply0(String apiCode, String apiMsg) {
18   - if (Objects.equals(apiCode, "10000")) {
19   - return GlobalErrorCodeConstants.SUCCESS;
20   - }
21   - // alipay wap api code 返回为null, 暂时定为-9999
22   - if (Objects.equals(apiCode, "-9999")) {
23   - return GlobalErrorCodeConstants.SUCCESS;
24   - }
25   - return null;
26   - }
27   -
28   -}
yudao-framework/yudao-spring-boot-starter-biz-pay/src/main/java/cn/iocoder/yudao/framework/pay/core/client/impl/alipay/AlipayPcPayClient.java
... ... @@ -3,8 +3,6 @@ package cn.iocoder.yudao.framework.pay.core.client.impl.alipay;
3 3 import cn.hutool.core.map.MapUtil;
4 4 import cn.hutool.core.util.StrUtil;
5 5 import cn.hutool.http.Method;
6   -import cn.iocoder.yudao.framework.common.util.json.JsonUtils;
7   -import cn.iocoder.yudao.framework.pay.core.client.PayCommonResult;
8 6 import cn.iocoder.yudao.framework.pay.core.client.dto.order.PayOrderUnifiedReqDTO;
9 7 import cn.iocoder.yudao.framework.pay.core.client.dto.order.PayOrderUnifiedRespDTO;
10 8 import cn.iocoder.yudao.framework.pay.core.enums.PayChannelEnum;
... ... @@ -18,9 +16,9 @@ import lombok.extern.slf4j.Slf4j;
18 16 import java.util.Objects;
19 17  
20 18 /**
21   - * 支付宝【PC 网站支付】的 PayClient 实现类
  19 + * 支付宝【PC 网站】的 PayClient 实现类
22 20 *
23   - * 文档:https://opendocs.alipay.com/open/270/105898
  21 + * 文档:<a href="https://opendocs.alipay.com/open/270/105898">电脑网站支付</a>
24 22 *
25 23 * @author XGD
26 24 */
... ... @@ -28,12 +26,11 @@ import java.util.Objects;
28 26 public class AlipayPcPayClient extends AbstractAlipayClient {
29 27  
30 28 public AlipayPcPayClient(Long channelId, AlipayPayClientConfig config) {
31   - super(channelId, PayChannelEnum.ALIPAY_PC.getCode(), config,
32   - new AlipayPayCodeMapping());
  29 + super(channelId, PayChannelEnum.ALIPAY_PC.getCode(), config);
33 30 }
34 31  
35 32 @Override
36   - public PayCommonResult<PayOrderUnifiedRespDTO> doUnifiedOrder(PayOrderUnifiedReqDTO reqDTO) {
  33 + public PayOrderUnifiedRespDTO doUnifiedOrder(PayOrderUnifiedReqDTO reqDTO) throws AlipayApiException {
37 34 // 1.1 构建 AlipayTradePagePayModel 请求
38 35 AlipayTradePagePayModel model = new AlipayTradePagePayModel();
39 36 // ① 通用的参数
... ... @@ -54,26 +51,20 @@ public class AlipayPcPayClient extends AbstractAlipayClient {
54 51 AlipayTradePagePayRequest request = new AlipayTradePagePayRequest();
55 52 request.setBizModel(model);
56 53 request.setNotifyUrl(reqDTO.getNotifyUrl());
57   - request.setReturnUrl(""); // TODO 芋艿,待搞
  54 + request.setReturnUrl(reqDTO.getReturnUrl());
58 55  
59 56 // 2.1 执行请求
60 57 AlipayTradePagePayResponse response;
61   - try {
62   - if (Objects.equals(displayMode, PayDisplayModeEnum.FORM.getMode())) {
63   - response = client.pageExecute(request, Method.POST.name()); // 需要特殊使用 POST 请求
64   - } else {
65   - response = client.pageExecute(request, Method.GET.name());
66   - }
67   - } catch (AlipayApiException e) {
68   - log.error("[unifiedOrder][request({}) 发起支付失败]", JsonUtils.toJsonString(reqDTO), e);
69   - return PayCommonResult.build(e.getErrCode(), e.getErrMsg(), null, codeMapping);
  58 + if (Objects.equals(displayMode, PayDisplayModeEnum.FORM.getMode())) {
  59 + response = client.pageExecute(request, Method.POST.name()); // 需要特殊使用 POST 请求
  60 + } else {
  61 + response = client.pageExecute(request, Method.GET.name());
70 62 }
71 63  
72 64 // 2.2 处理结果
73   - PayOrderUnifiedRespDTO respDTO = new PayOrderUnifiedRespDTO()
74   - .setDisplayMode(displayMode).setDisplayContent(response.getBody());
75   - return PayCommonResult.build(StrUtil.blankToDefault(response.getCode(),"10000"),
76   - response.getMsg(), respDTO, codeMapping);
  65 + validateSuccess(response);
  66 + return new PayOrderUnifiedRespDTO().setDisplayMode(displayMode)
  67 + .setDisplayContent(response.getBody());
77 68 }
78 69  
79 70 /**
... ...
yudao-framework/yudao-spring-boot-starter-biz-pay/src/main/java/cn/iocoder/yudao/framework/pay/core/client/impl/alipay/AlipayQrPayClient.java
1 1 package cn.iocoder.yudao.framework.pay.core.client.impl.alipay;
2 2  
3   -import cn.hutool.core.util.ObjectUtil;
4   -import cn.hutool.core.util.StrUtil;
5   -import cn.iocoder.yudao.framework.pay.core.client.PayCommonResult;
6 3 import cn.iocoder.yudao.framework.pay.core.client.dto.order.PayOrderUnifiedReqDTO;
7 4 import cn.iocoder.yudao.framework.pay.core.client.dto.order.PayOrderUnifiedRespDTO;
8 5 import cn.iocoder.yudao.framework.pay.core.enums.PayChannelEnum;
... ... @@ -13,12 +10,10 @@ import com.alipay.api.request.AlipayTradePrecreateRequest;
13 10 import com.alipay.api.response.AlipayTradePrecreateResponse;
14 11 import lombok.extern.slf4j.Slf4j;
15 12  
16   -import static cn.iocoder.yudao.framework.common.util.json.JsonUtils.toJsonString;
17   -
18 13 /**
19 14 * 支付宝【扫码支付】的 PayClient 实现类
20 15 *
21   - * 文档:https://opendocs.alipay.com/apis/02890k
  16 + * 文档:<a href="https://opendocs.alipay.com/apis/02890k">扫码支付</a>
22 17 *
23 18 * @author 芋道源码
24 19 */
... ... @@ -26,12 +21,11 @@ import static cn.iocoder.yudao.framework.common.util.json.JsonUtils.toJsonString
26 21 public class AlipayQrPayClient extends AbstractAlipayClient {
27 22  
28 23 public AlipayQrPayClient(Long channelId, AlipayPayClientConfig config) {
29   - super(channelId, PayChannelEnum.ALIPAY_QR.getCode(), config,
30   - new AlipayPayCodeMapping());
  24 + super(channelId, PayChannelEnum.ALIPAY_QR.getCode(), config);
31 25 }
32 26  
33 27 @Override
34   - public PayCommonResult<PayOrderUnifiedRespDTO> doUnifiedOrder(PayOrderUnifiedReqDTO reqDTO) {
  28 + public PayOrderUnifiedRespDTO doUnifiedOrder(PayOrderUnifiedReqDTO reqDTO) throws AlipayApiException {
35 29 // 1.1 构建 AlipayTradePrecreateModel 请求
36 30 AlipayTradePrecreateModel model = new AlipayTradePrecreateModel();
37 31 // ① 通用的参数
... ... @@ -39,7 +33,7 @@ public class AlipayQrPayClient extends AbstractAlipayClient {
39 33 model.setSubject(reqDTO.getSubject());
40 34 model.setBody(reqDTO.getBody());
41 35 model.setTotalAmount(formatAmount(reqDTO.getAmount()));
42   - model.setProductCode("FACE_TO_FACE_PAYMENT"); // 销售产品码. 目前扫码支付场景下仅支持 QUICK_WAP_PAY
  36 + model.setProductCode("FACE_TO_FACE_PAYMENT"); // 销售产品码. 目前扫码支付场景下仅支持 FACE_TO_FACE_PAYMENT
43 37 // ② 个性化的参数【无】
44 38 // ③ 支付宝扫码支付只有一种展示,考虑到前端可能希望二维码扫描后,手机打开
45 39 String displayMode = PayDisplayModeEnum.QR_CODE.getMode();
... ... @@ -48,20 +42,13 @@ public class AlipayQrPayClient extends AbstractAlipayClient {
48 42 AlipayTradePrecreateRequest request = new AlipayTradePrecreateRequest();
49 43 request.setBizModel(model);
50 44 request.setNotifyUrl(reqDTO.getNotifyUrl());
51   - request.setReturnUrl(reqDTO.getReturnUrl()); // TODO 芋艿,待搞
  45 + request.setReturnUrl(reqDTO.getReturnUrl());
52 46  
53 47 // 2.1 执行请求
54   - AlipayTradePrecreateResponse response;
55   - try {
56   - response = client.execute(request);
57   - } catch (AlipayApiException e) {
58   - log.error("[unifiedOrder][request({}) 发起支付失败]", toJsonString(reqDTO), e);
59   - return PayCommonResult.build(e.getErrCode(), e.getErrMsg(), null, codeMapping);
60   - }
  48 + AlipayTradePrecreateResponse response = client.execute(request);
61 49 // 2.2 处理结果
62   - PayOrderUnifiedRespDTO respDTO = new PayOrderUnifiedRespDTO()
  50 + validateSuccess(response);
  51 + return new PayOrderUnifiedRespDTO()
63 52 .setDisplayMode(displayMode).setDisplayContent(response.getQrCode());
64   - return PayCommonResult.build(StrUtil.blankToDefault(response.getCode(),"10000"),
65   - response.getMsg(), respDTO, codeMapping);
66 53 }
67 54 }
... ...
yudao-framework/yudao-spring-boot-starter-biz-pay/src/main/java/cn/iocoder/yudao/framework/pay/core/client/impl/alipay/AlipayWapPayClient.java
1 1 package cn.iocoder.yudao.framework.pay.core.client.impl.alipay;
2 2  
3 3 import cn.hutool.core.util.ObjectUtil;
4   -import cn.hutool.core.util.StrUtil;
5 4 import cn.hutool.http.Method;
6   -import cn.iocoder.yudao.framework.pay.core.client.PayCommonResult;
7 5 import cn.iocoder.yudao.framework.pay.core.client.dto.order.PayOrderUnifiedReqDTO;
8 6 import cn.iocoder.yudao.framework.pay.core.client.dto.order.PayOrderUnifiedRespDTO;
9 7 import cn.iocoder.yudao.framework.pay.core.enums.PayChannelEnum;
... ... @@ -14,12 +12,10 @@ import com.alipay.api.request.AlipayTradeWapPayRequest;
14 12 import com.alipay.api.response.AlipayTradeWapPayResponse;
15 13 import lombok.extern.slf4j.Slf4j;
16 14  
17   -import java.util.Objects;
18   -
19 15 /**
20   - * 支付宝【手机 网站】的 PayClient 实现类
  16 + * 支付宝【Wap 网站】的 PayClient 实现类
21 17 *
22   - * 文档:https://opendocs.alipay.com/apis/api_1/alipay.trade.wap.pay
  18 + * 文档:<a href="https://opendocs.alipay.com/apis/api_1/alipay.trade.wap.pay">手机网站支付接口</a>
23 19 *
24 20 * @author 芋道源码
25 21 */
... ... @@ -27,12 +23,11 @@ import java.util.Objects;
27 23 public class AlipayWapPayClient extends AbstractAlipayClient {
28 24  
29 25 public AlipayWapPayClient(Long channelId, AlipayPayClientConfig config) {
30   - super(channelId, PayChannelEnum.ALIPAY_WAP.getCode(), config,
31   - new AlipayPayCodeMapping());
  26 + super(channelId, PayChannelEnum.ALIPAY_WAP.getCode(), config);
32 27 }
33 28  
34 29 @Override
35   - public PayCommonResult<PayOrderUnifiedRespDTO> doUnifiedOrder(PayOrderUnifiedReqDTO reqDTO) {
  30 + public PayOrderUnifiedRespDTO doUnifiedOrder(PayOrderUnifiedReqDTO reqDTO) throws AlipayApiException {
36 31 // 1.1 构建 AlipayTradeWapPayModel 请求
37 32 AlipayTradeWapPayModel model = new AlipayTradeWapPayModel();
38 33 // ① 通用的参数
... ... @@ -50,23 +45,16 @@ public class AlipayWapPayClient extends AbstractAlipayClient {
50 45 AlipayTradeWapPayRequest request = new AlipayTradeWapPayRequest();
51 46 request.setBizModel(model);
52 47 request.setNotifyUrl(reqDTO.getNotifyUrl());
53   - request.setReturnUrl(reqDTO.getReturnUrl()); // TODO 芋艿,待搞
54   - model.setQuitUrl(reqDTO.getReturnUrl()); // TODO 芋艿,待搞
  48 + request.setReturnUrl(reqDTO.getReturnUrl());
  49 + model.setQuitUrl(reqDTO.getReturnUrl());
55 50  
56 51 // 2.1 执行请求
57   - AlipayTradeWapPayResponse response;
58   - try {
59   - response = client.pageExecute(request, Method.GET.name());
60   - } catch (AlipayApiException e) {
61   - return PayCommonResult.build(e.getErrCode(), e.getErrMsg(), null, codeMapping);
62   - }
63   - System.out.println(response.getBody());
  52 + AlipayTradeWapPayResponse response = client.pageExecute(request, Method.GET.name());
64 53  
65 54 // 2.2 处理结果
66   - PayOrderUnifiedRespDTO respDTO = new PayOrderUnifiedRespDTO()
  55 + validateSuccess(response);
  56 + return new PayOrderUnifiedRespDTO()
67 57 .setDisplayMode(displayMode).setDisplayContent(response.getBody());
68   - return PayCommonResult.build(StrUtil.blankToDefault(response.getCode(),"10000"),
69   - response.getMsg(), respDTO, codeMapping);
70 58 }
71 59  
72 60 }
... ...
yudao-framework/yudao-spring-boot-starter-biz-pay/src/main/java/cn/iocoder/yudao/framework/pay/core/client/impl/wx/WXCodeMapping.java deleted
1   -package cn.iocoder.yudao.framework.pay.core.client.impl.wx;
2   -
3   -import cn.hutool.core.util.StrUtil;
4   -import cn.iocoder.yudao.framework.common.exception.ErrorCode;
5   -import cn.iocoder.yudao.framework.common.exception.enums.GlobalErrorCodeConstants;
6   -import cn.iocoder.yudao.framework.pay.core.client.AbstractPayCodeMapping;
7   -
8   -import java.util.Objects;
9   -
10   -import static cn.iocoder.yudao.framework.pay.core.enums.PayFrameworkErrorCodeConstants.*;
11   -
12   -/**
13   - * 微信支付 PayCodeMapping 实现类
14   - *
15   - * @author 芋道源码
16   - */
17   -public class WXCodeMapping extends AbstractPayCodeMapping {
18   -
19   - /**
20   - * 错误码 - 成功
21   - * 由于 weixin-java-pay 封装的 Result 未返回 code,所以自己定义下
22   - */
23   - public static final String CODE_SUCCESS = "SUCCESS";
24   - /**
25   - * 错误提示 - 成功
26   - */
27   - public static final String MESSAGE_SUCCESS = "成功";
28   -
29   - @Override
30   - protected ErrorCode apply0(String apiCode, String apiMsg) {
31   - if (Objects.equals(apiCode, CODE_SUCCESS)) {
32   - return GlobalErrorCodeConstants.SUCCESS;
33   - }
34   - if (Objects.equals(apiCode, "FAIL")) {
35   - if (Objects.equals(apiMsg, "AppID不存在,请检查后再试")) {
36   - return PAY_CONFIG_APP_ID_ERROR;
37   - }
38   - if (Objects.equals(apiMsg, "签名错误,请检查后再试")
39   - || Objects.equals(apiMsg, "签名错误")) {
40   - return PAY_CONFIG_SIGN_ERROR;
41   - }
42   - }
43   - if (Objects.equals(apiCode, "PARAM_ERROR")) {
44   - if (Objects.equals(apiMsg, "无效的openid")) {
45   - return PAY_OPENID_ERROR;
46   - }
47   - }
48   - if (Objects.equals(apiCode, "CustomErrorCode")) {
49   - if (StrUtil.contains(apiMsg, "必填字段")) {
50   - return PAY_PARAM_MISSING;
51   - }
52   - }
53   - return null;
54   - }
55   -
56   -}
yudao-framework/yudao-spring-boot-starter-biz-pay/src/main/java/cn/iocoder/yudao/framework/pay/core/client/impl/wx/WXLitePayClient.java
... ... @@ -7,12 +7,11 @@ import cn.hutool.core.lang.Assert;
7 7 import cn.hutool.core.map.MapUtil;
8 8 import cn.hutool.core.util.StrUtil;
9 9 import cn.iocoder.yudao.framework.common.util.io.FileUtils;
10   -import cn.iocoder.yudao.framework.common.util.object.ObjectUtils;
11   -import cn.iocoder.yudao.framework.pay.core.client.PayCommonResult;
12 10 import cn.iocoder.yudao.framework.pay.core.client.dto.notify.PayNotifyDataDTO;
13   -import cn.iocoder.yudao.framework.pay.core.client.dto.notify.PayRefundNotifyDTO;
14 11 import cn.iocoder.yudao.framework.pay.core.client.dto.notify.PayOrderNotifyRespDTO;
  12 +import cn.iocoder.yudao.framework.pay.core.client.dto.notify.PayRefundNotifyDTO;
15 13 import cn.iocoder.yudao.framework.pay.core.client.dto.order.PayOrderUnifiedReqDTO;
  14 +import cn.iocoder.yudao.framework.pay.core.client.dto.order.PayOrderUnifiedRespDTO;
16 15 import cn.iocoder.yudao.framework.pay.core.client.dto.refund.PayRefundUnifiedReqDTO;
17 16 import cn.iocoder.yudao.framework.pay.core.client.dto.refund.PayRefundUnifiedRespDTO;
18 17 import cn.iocoder.yudao.framework.pay.core.client.impl.AbstractPayClient;
... ... @@ -35,11 +34,6 @@ import java.time.ZoneId;
35 34 import java.util.Date;
36 35 import java.util.Objects;
37 36  
38   -import static cn.iocoder.yudao.framework.common.util.json.JsonUtils.toJsonString;
39   -import static cn.iocoder.yudao.framework.pay.core.client.impl.wx.WXCodeMapping.CODE_SUCCESS;
40   -import static cn.iocoder.yudao.framework.pay.core.client.impl.wx.WXCodeMapping.MESSAGE_SUCCESS;
41   -
42   -
43 37 /**
44 38 * 微信小程序下支付
45 39 *
... ... @@ -51,7 +45,7 @@ public class WXLitePayClient extends AbstractPayClient&lt;WXPayClientConfig&gt; {
51 45 private WxPayService client;
52 46  
53 47 public WXLitePayClient(Long channelId, WXPayClientConfig config) {
54   - super(channelId, PayChannelEnum.WX_LITE.getCode(), config, new WXCodeMapping());
  48 + super(channelId, PayChannelEnum.WX_LITE.getCode(), config);
55 49 }
56 50  
57 51 @Override
... ... @@ -76,28 +70,29 @@ public class WXLitePayClient extends AbstractPayClient&lt;WXPayClientConfig&gt; {
76 70 }
77 71  
78 72 @Override
79   - public PayCommonResult<WxPayMpOrderResult> doUnifiedOrder(PayOrderUnifiedReqDTO reqDTO) {
80   - WxPayMpOrderResult response;
81   - try {
82   - switch (config.getApiVersion()) {
83   - case WXPayClientConfig.API_VERSION_V2:
84   - response = this.unifiedOrderV2(reqDTO);
85   - break;
86   - case WXPayClientConfig.API_VERSION_V3:
87   - WxPayUnifiedOrderV3Result.JsapiResult responseV3 = this.unifiedOrderV3(reqDTO);
88   - // 将 V3 的结果,统一转换成 V2。返回的字段是一致的
89   - response = new WxPayMpOrderResult();
90   - BeanUtil.copyProperties(responseV3, response, true);
91   - break;
92   - default:
93   - throw new IllegalArgumentException(String.format("未知的 API 版本(%s)", config.getApiVersion()));
94   - }
95   - } catch (WxPayException e) {
96   - log.error("[unifiedOrder][request({}) 发起支付失败,原因({})]", toJsonString(reqDTO), e);
97   - return PayCommonResult.build(ObjectUtils.defaultIfNull(e.getErrCode(), e.getReturnCode(), "CustomErrorCode"),
98   - ObjectUtils.defaultIfNull(e.getErrCodeDes(), e.getCustomErrorMsg()), null, codeMapping);
99   - }
100   - return PayCommonResult.build(CODE_SUCCESS, MESSAGE_SUCCESS, response, codeMapping);
  73 + public PayOrderUnifiedRespDTO doUnifiedOrder(PayOrderUnifiedReqDTO reqDTO) {
  74 + throw new UnsupportedOperationException();
  75 +// WxPayMpOrderResult response;
  76 +// try {
  77 +// switch (config.getApiVersion()) {
  78 +// case WXPayClientConfig.API_VERSION_V2:
  79 +// response = this.unifiedOrderV2(reqDTO);
  80 +// break;
  81 +// case WXPayClientConfig.API_VERSION_V3:
  82 +// WxPayUnifiedOrderV3Result.JsapiResult responseV3 = this.unifiedOrderV3(reqDTO);
  83 +// // 将 V3 的结果,统一转换成 V2。返回的字段是一致的
  84 +// response = new WxPayMpOrderResult();
  85 +// BeanUtil.copyProperties(responseV3, response, true);
  86 +// break;
  87 +// default:
  88 +// throw new IllegalArgumentException(String.format("未知的 API 版本(%s)", config.getApiVersion()));
  89 +// }
  90 +// } catch (WxPayException e) {
  91 +// log.error("[unifiedOrder][request({}) 发起支付失败,原因({})]", toJsonString(reqDTO), e);
  92 +// return PayCommonResult.build(ObjectUtils.defaultIfNull(e.getErrCode(), e.getReturnCode(), "CustomErrorCode"),
  93 +// ObjectUtils.defaultIfNull(e.getErrCodeDes(), e.getCustomErrorMsg()), null, codeMapping);
  94 +// }
  95 +// return PayCommonResult.build(CODE_SUCCESS, MESSAGE_SUCCESS, response, codeMapping);
101 96 }
102 97  
103 98 private WxPayMpOrderResult unifiedOrderV2(PayOrderUnifiedReqDTO reqDTO) throws WxPayException {
... ... @@ -204,7 +199,7 @@ public class WXLitePayClient extends AbstractPayClient&lt;WXPayClientConfig&gt; {
204 199  
205 200  
206 201 @Override
207   - protected PayCommonResult<PayRefundUnifiedRespDTO> doUnifiedRefund(PayRefundUnifiedReqDTO reqDTO) throws Throwable {
  202 + protected PayRefundUnifiedRespDTO doUnifiedRefund(PayRefundUnifiedReqDTO reqDTO) {
208 203 //TODO 需要实现
209 204 throw new UnsupportedOperationException();
210 205 }
... ...
yudao-framework/yudao-spring-boot-starter-biz-pay/src/main/java/cn/iocoder/yudao/framework/pay/core/client/impl/wx/WXNativePayClient.java
... ... @@ -6,12 +6,11 @@ import cn.hutool.core.date.LocalDateTimeUtil;
6 6 import cn.hutool.core.lang.Assert;
7 7 import cn.hutool.core.util.StrUtil;
8 8 import cn.iocoder.yudao.framework.common.util.io.FileUtils;
9   -import cn.iocoder.yudao.framework.common.util.object.ObjectUtils;
10   -import cn.iocoder.yudao.framework.pay.core.client.PayCommonResult;
11 9 import cn.iocoder.yudao.framework.pay.core.client.dto.notify.PayNotifyDataDTO;
12   -import cn.iocoder.yudao.framework.pay.core.client.dto.notify.PayRefundNotifyDTO;
13 10 import cn.iocoder.yudao.framework.pay.core.client.dto.notify.PayOrderNotifyRespDTO;
  11 +import cn.iocoder.yudao.framework.pay.core.client.dto.notify.PayRefundNotifyDTO;
14 12 import cn.iocoder.yudao.framework.pay.core.client.dto.order.PayOrderUnifiedReqDTO;
  13 +import cn.iocoder.yudao.framework.pay.core.client.dto.order.PayOrderUnifiedRespDTO;
15 14 import cn.iocoder.yudao.framework.pay.core.client.dto.refund.PayRefundUnifiedReqDTO;
16 15 import cn.iocoder.yudao.framework.pay.core.client.dto.refund.PayRefundUnifiedRespDTO;
17 16 import cn.iocoder.yudao.framework.pay.core.client.impl.AbstractPayClient;
... ... @@ -33,10 +32,6 @@ import java.time.ZoneId;
33 32 import java.util.Date;
34 33 import java.util.Objects;
35 34  
36   -import static cn.iocoder.yudao.framework.common.util.json.JsonUtils.toJsonString;
37   -import static cn.iocoder.yudao.framework.pay.core.client.impl.wx.WXCodeMapping.CODE_SUCCESS;
38   -import static cn.iocoder.yudao.framework.pay.core.client.impl.wx.WXCodeMapping.MESSAGE_SUCCESS;
39   -
40 35 /**
41 36 * 微信 App 支付
42 37 *
... ... @@ -48,7 +43,7 @@ public class WXNativePayClient extends AbstractPayClient&lt;WXPayClientConfig&gt; {
48 43 private WxPayService client;
49 44  
50 45 public WXNativePayClient(Long channelId, WXPayClientConfig config) {
51   - super(channelId, PayChannelEnum.WX_NATIVE.getCode(), config, new WXCodeMapping());
  46 + super(channelId, PayChannelEnum.WX_NATIVE.getCode(), config);
52 47 }
53 48  
54 49 @Override
... ... @@ -73,27 +68,28 @@ public class WXNativePayClient extends AbstractPayClient&lt;WXPayClientConfig&gt; {
73 68 }
74 69  
75 70 @Override
76   - public PayCommonResult<String> doUnifiedOrder(PayOrderUnifiedReqDTO reqDTO) {
77   - // 这里原生的返回的是支付的 url 所以直接使用string接收
78   - // "invokeResponse": "weixin://wxpay/bizpayurl?pr=EGYAem7zz"
79   - String responseV3;
80   - try {
81   - switch (config.getApiVersion()) {
82   - case WXPayClientConfig.API_VERSION_V2:
83   - responseV3 = unifiedOrderV2(reqDTO).getCodeUrl();
84   - break;
85   - case WXPayClientConfig.API_VERSION_V3:
86   - responseV3 = this.unifiedOrderV3(reqDTO);
87   - break;
88   - default:
89   - throw new IllegalArgumentException(String.format("未知的 API 版本(%s)", config.getApiVersion()));
90   - }
91   - } catch (WxPayException e) {
92   - log.error("[unifiedOrder][request({}) 发起支付失败,原因({})]", toJsonString(reqDTO), e);
93   - return PayCommonResult.build(ObjectUtils.defaultIfNull(e.getErrCode(), e.getReturnCode(), "CustomErrorCode"),
94   - ObjectUtils.defaultIfNull(e.getErrCodeDes(), e.getCustomErrorMsg()), null, codeMapping);
95   - }
96   - return PayCommonResult.build(CODE_SUCCESS, MESSAGE_SUCCESS, responseV3, codeMapping);
  71 + public PayOrderUnifiedRespDTO doUnifiedOrder(PayOrderUnifiedReqDTO reqDTO) {
  72 + throw new UnsupportedOperationException();
  73 +// // 这里原生的返回的是支付的 url 所以直接使用string接收
  74 +// // "invokeResponse": "weixin://wxpay/bizpayurl?pr=EGYAem7zz"
  75 +// String responseV3;
  76 +// try {
  77 +// switch (config.getApiVersion()) {
  78 +// case WXPayClientConfig.API_VERSION_V2:
  79 +// responseV3 = unifiedOrderV2(reqDTO).getCodeUrl();
  80 +// break;
  81 +// case WXPayClientConfig.API_VERSION_V3:
  82 +// responseV3 = this.unifiedOrderV3(reqDTO);
  83 +// break;
  84 +// default:
  85 +// throw new IllegalArgumentException(String.format("未知的 API 版本(%s)", config.getApiVersion()));
  86 +// }
  87 +// } catch (WxPayException e) {
  88 +// log.error("[unifiedOrder][request({}) 发起支付失败,原因({})]", toJsonString(reqDTO), e);
  89 +// return PayCommonResult.build(ObjectUtils.defaultIfNull(e.getErrCode(), e.getReturnCode(), "CustomErrorCode"),
  90 +// ObjectUtils.defaultIfNull(e.getErrCodeDes(), e.getCustomErrorMsg()), null, codeMapping);
  91 +// }
  92 +// return PayCommonResult.build(CODE_SUCCESS, MESSAGE_SUCCESS, responseV3, codeMapping);
97 93 }
98 94  
99 95 private WxPayNativeOrderResult unifiedOrderV2(PayOrderUnifiedReqDTO reqDTO) throws WxPayException {
... ... @@ -186,7 +182,7 @@ public class WXNativePayClient extends AbstractPayClient&lt;WXPayClientConfig&gt; {
186 182  
187 183  
188 184 @Override
189   - protected PayCommonResult<PayRefundUnifiedRespDTO> doUnifiedRefund(PayRefundUnifiedReqDTO reqDTO) throws Throwable {
  185 + protected PayRefundUnifiedRespDTO doUnifiedRefund(PayRefundUnifiedReqDTO reqDTO) {
190 186 // TODO 需要实现
191 187 throw new UnsupportedOperationException();
192 188 }
... ...
yudao-framework/yudao-spring-boot-starter-biz-pay/src/main/java/cn/iocoder/yudao/framework/pay/core/client/impl/wx/WXPubPayClient.java
... ... @@ -7,12 +7,11 @@ import cn.hutool.core.lang.Assert;
7 7 import cn.hutool.core.map.MapUtil;
8 8 import cn.hutool.core.util.StrUtil;
9 9 import cn.iocoder.yudao.framework.common.util.io.FileUtils;
10   -import cn.iocoder.yudao.framework.common.util.object.ObjectUtils;
11   -import cn.iocoder.yudao.framework.pay.core.client.PayCommonResult;
12 10 import cn.iocoder.yudao.framework.pay.core.client.dto.notify.PayNotifyDataDTO;
13   -import cn.iocoder.yudao.framework.pay.core.client.dto.notify.PayRefundNotifyDTO;
14 11 import cn.iocoder.yudao.framework.pay.core.client.dto.notify.PayOrderNotifyRespDTO;
  12 +import cn.iocoder.yudao.framework.pay.core.client.dto.notify.PayRefundNotifyDTO;
15 13 import cn.iocoder.yudao.framework.pay.core.client.dto.order.PayOrderUnifiedReqDTO;
  14 +import cn.iocoder.yudao.framework.pay.core.client.dto.order.PayOrderUnifiedRespDTO;
16 15 import cn.iocoder.yudao.framework.pay.core.client.dto.refund.PayRefundUnifiedReqDTO;
17 16 import cn.iocoder.yudao.framework.pay.core.client.dto.refund.PayRefundUnifiedRespDTO;
18 17 import cn.iocoder.yudao.framework.pay.core.client.impl.AbstractPayClient;
... ... @@ -35,10 +34,6 @@ import java.time.LocalDateTime;
35 34 import java.time.ZoneId;
36 35 import java.util.Objects;
37 36  
38   -import static cn.iocoder.yudao.framework.common.util.json.JsonUtils.toJsonString;
39   -import static cn.iocoder.yudao.framework.pay.core.client.impl.wx.WXCodeMapping.CODE_SUCCESS;
40   -import static cn.iocoder.yudao.framework.pay.core.client.impl.wx.WXCodeMapping.MESSAGE_SUCCESS;
41   -
42 37 /**
43 38 * 微信支付(公众号)的 PayClient 实现类
44 39 *
... ... @@ -50,7 +45,7 @@ public class WXPubPayClient extends AbstractPayClient&lt;WXPayClientConfig&gt; {
50 45 private WxPayService client;
51 46  
52 47 public WXPubPayClient(Long channelId, WXPayClientConfig config) {
53   - super(channelId, PayChannelEnum.WX_PUB.getCode(), config, new WXCodeMapping());
  48 + super(channelId, PayChannelEnum.WX_PUB.getCode(), config);
54 49 }
55 50  
56 51 @Override
... ... @@ -75,28 +70,30 @@ public class WXPubPayClient extends AbstractPayClient&lt;WXPayClientConfig&gt; {
75 70 }
76 71  
77 72 @Override
78   - public PayCommonResult<WxPayMpOrderResult> doUnifiedOrder(PayOrderUnifiedReqDTO reqDTO) {
79   - WxPayMpOrderResult response;
80   - try {
81   - switch (config.getApiVersion()) {
82   - case WXPayClientConfig.API_VERSION_V2:
83   - response = this.unifiedOrderV2(reqDTO);
84   - break;
85   - case WXPayClientConfig.API_VERSION_V3:
86   - WxPayUnifiedOrderV3Result.JsapiResult responseV3 = this.unifiedOrderV3(reqDTO);
87   - // 将 V3 的结果,统一转换成 V2。返回的字段是一致的
88   - response = new WxPayMpOrderResult();
89   - BeanUtil.copyProperties(responseV3, response, true);
90   - break;
91   - default:
92   - throw new IllegalArgumentException(String.format("未知的 API 版本(%s)", config.getApiVersion()));
93   - }
94   - } catch (WxPayException e) {
95   - log.error("[unifiedOrder][request({}) 发起支付失败,原因({})]", toJsonString(reqDTO), e);
96   - return PayCommonResult.build(ObjectUtils.defaultIfNull(e.getErrCode(), e.getReturnCode(), "CustomErrorCode"),
97   - ObjectUtils.defaultIfNull(e.getErrCodeDes(), e.getCustomErrorMsg()),null, codeMapping);
98   - }
99   - return PayCommonResult.build(CODE_SUCCESS, MESSAGE_SUCCESS, response, codeMapping);
  73 + public PayOrderUnifiedRespDTO doUnifiedOrder(PayOrderUnifiedReqDTO reqDTO) {
  74 + throw new UnsupportedOperationException();
  75 +//
  76 +// WxPayMpOrderResult response;
  77 +// try {
  78 +// switch (config.getApiVersion()) {
  79 +// case WXPayClientConfig.API_VERSION_V2:
  80 +// response = this.unifiedOrderV2(reqDTO);
  81 +// break;
  82 +// case WXPayClientConfig.API_VERSION_V3:
  83 +// WxPayUnifiedOrderV3Result.JsapiResult responseV3 = this.unifiedOrderV3(reqDTO);
  84 +// // 将 V3 的结果,统一转换成 V2。返回的字段是一致的
  85 +// response = new WxPayMpOrderResult();
  86 +// BeanUtil.copyProperties(responseV3, response, true);
  87 +// break;
  88 +// default:
  89 +// throw new IllegalArgumentException(String.format("未知的 API 版本(%s)", config.getApiVersion()));
  90 +// }
  91 +// } catch (WxPayException e) {
  92 +// log.error("[unifiedOrder][request({}) 发起支付失败,原因({})]", toJsonString(reqDTO), e);
  93 +// return PayCommonResult.build(ObjectUtils.defaultIfNull(e.getErrCode(), e.getReturnCode(), "CustomErrorCode"),
  94 +// ObjectUtils.defaultIfNull(e.getErrCodeDes(), e.getCustomErrorMsg()),null, codeMapping);
  95 +// }
  96 +// return PayCommonResult.build(CODE_SUCCESS, MESSAGE_SUCCESS, response, codeMapping);
100 97 }
101 98  
102 99  
... ... @@ -196,7 +193,7 @@ public class WXPubPayClient extends AbstractPayClient&lt;WXPayClientConfig&gt; {
196 193 }
197 194  
198 195 @Override
199   - protected PayCommonResult<PayRefundUnifiedRespDTO> doUnifiedRefund(PayRefundUnifiedReqDTO reqDTO) throws Throwable {
  196 + protected PayRefundUnifiedRespDTO doUnifiedRefund(PayRefundUnifiedReqDTO reqDTO) throws Throwable {
200 197 // TODO 需要实现
201 198 throw new UnsupportedOperationException();
202 199 }
... ...
yudao-framework/yudao-spring-boot-starter-biz-pay/src/main/java/cn/iocoder/yudao/framework/pay/core/enums/PayFrameworkErrorCodeConstants.java
... ... @@ -5,7 +5,7 @@ import cn.iocoder.yudao.framework.common.exception.ErrorCode;
5 5 /**
6 6 * 支付框架的错误码枚举
7 7 *
8   - * 短信框架,使用 2-002-000-000 段
  8 + * 支付框架,使用 2-002-000-000 段
9 9 *
10 10 * @author 芋道源码
11 11 */
... ... @@ -14,14 +14,16 @@ public interface PayFrameworkErrorCodeConstants {
14 14 ErrorCode PAY_UNKNOWN = new ErrorCode(2002000000, "未知错误,需要解析");
15 15  
16 16 // ========== 配置相关相关 2002000100 ==========
  17 + // todo 芋艿:如下的错误码,怎么处理掉
17 18 ErrorCode PAY_CONFIG_APP_ID_ERROR = new ErrorCode(2002000100, "支付渠道 AppId 不正确");
18 19 ErrorCode PAY_CONFIG_SIGN_ERROR = new ErrorCode(2002000100, "签名错误"); // 例如说,微信支付,配置错了 mchId 或者 mchKey
19 20  
20 21  
21 22 // ========== 其它相关 2002000900 开头 ==========
  23 + // todo 芋艿:如下的错误码,怎么处理掉
22 24 ErrorCode PAY_OPENID_ERROR = new ErrorCode(2002000900, "无效的 openid"); // 例如说,微信 openid 未授权过
23 25 ErrorCode PAY_PARAM_MISSING = new ErrorCode(2002000901, "请求参数缺失"); // 例如说,支付少传了金额
24 26  
25   - ErrorCode EXCEPTION = new ErrorCode(2002000999, "调用异常");
  27 + ErrorCode PAY_EXCEPTION = new ErrorCode(2002000999, "调用异常");
26 28  
27 29 }
... ...
yudao-framework/yudao-spring-boot-starter-biz-pay/src/test/java/cn.iocoder.yudao.framework.pay.core.client.impl/PayClientFactoryImplIntegrationTest.java
... ... @@ -46,8 +46,8 @@ public class PayClientFactoryImplIntegrationTest {
46 46 PayClient client = payClientFactory.getPayClient(channelId);
47 47 // 发起支付
48 48 PayOrderUnifiedReqDTO reqDTO = buildPayOrderUnifiedReqDTO();
49   - CommonResult<?> result = client.unifiedOrder(reqDTO);
50   - System.out.println(result);
  49 +// CommonResult<?> result = client.unifiedOrder(reqDTO);
  50 +// System.out.println(result);
51 51 }
52 52  
53 53 /**
... ... @@ -69,8 +69,8 @@ public class PayClientFactoryImplIntegrationTest {
69 69 PayClient client = payClientFactory.getPayClient(channelId);
70 70 // 发起支付
71 71 PayOrderUnifiedReqDTO reqDTO = buildPayOrderUnifiedReqDTO();
72   - CommonResult<?> result = client.unifiedOrder(reqDTO);
73   - System.out.println(result);
  72 +// CommonResult<?> result = client.unifiedOrder(reqDTO);
  73 +// System.out.println(result);
74 74 }
75 75  
76 76 /**
... ... @@ -93,9 +93,9 @@ public class PayClientFactoryImplIntegrationTest {
93 93 // 发起支付
94 94 PayOrderUnifiedReqDTO reqDTO = buildPayOrderUnifiedReqDTO();
95 95 reqDTO.setNotifyUrl("http://yunai.natapp1.cc/admin-api/pay/notify/callback/18"); // TODO @tina: 这里改成你的 natapp 回调地址
96   - CommonResult<AlipayTradePrecreateResponse> result = (CommonResult<AlipayTradePrecreateResponse>) client.unifiedOrder(reqDTO);
97   - System.out.println(JsonUtils.toJsonString(result));
98   - System.out.println(result.getData().getQrCode());
  96 +// CommonResult<AlipayTradePrecreateResponse> result = (CommonResult<AlipayTradePrecreateResponse>) client.unifiedOrder(reqDTO);
  97 +// System.out.println(JsonUtils.toJsonString(result));
  98 +// System.out.println(result.getData().getQrCode());
99 99 }
100 100  
101 101 /**
... ... @@ -116,8 +116,8 @@ public class PayClientFactoryImplIntegrationTest {
116 116 PayClient client = payClientFactory.getPayClient(channelId);
117 117 // 发起支付
118 118 PayOrderUnifiedReqDTO reqDTO = buildPayOrderUnifiedReqDTO();
119   - CommonResult<?> result = client.unifiedOrder(reqDTO);
120   - System.out.println(JsonUtils.toJsonString(result));
  119 +// CommonResult<?> result = client.unifiedOrder(reqDTO);
  120 +// System.out.println(JsonUtils.toJsonString(result));
121 121 }
122 122  
123 123 private static PayOrderUnifiedReqDTO buildPayOrderUnifiedReqDTO() {
... ...
yudao-framework/yudao-spring-boot-starter-biz-pay/src/test/java/cn.iocoder.yudao.framework.pay.core.client.impl/alipay/AlipayQrPayClientTest.java
1 1 package cn.iocoder.yudao.framework.pay.core.client.impl.alipay;
2 2 import cn.hutool.core.util.ReflectUtil;
3 3 import cn.iocoder.yudao.framework.common.exception.enums.GlobalErrorCodeConstants;
4   -import cn.iocoder.yudao.framework.pay.core.client.PayCommonResult;
5 4 import cn.iocoder.yudao.framework.pay.core.client.dto.order.PayOrderUnifiedReqDTO;
6 5 import cn.iocoder.yudao.framework.pay.core.client.dto.order.PayOrderUnifiedRespDTO;
7 6 import cn.iocoder.yudao.framework.test.core.ut.BaseMockitoUnitTest;
... ... @@ -88,13 +87,13 @@ public class AlipayQrPayClientTest extends BaseMockitoUnitTest {
88 87 }))).thenReturn(response);
89 88  
90 89  
91   - PayCommonResult<PayOrderUnifiedRespDTO> result = client.doUnifiedOrder(reqDTO);
92   - // 断言
93   - assertEquals(response.getCode(), result.getApiCode());
94   - assertEquals(response.getMsg(), result.getApiMsg());
95   - // TODO @tina:这个断言木有过?
96   - assertEquals(GlobalErrorCodeConstants.SUCCESS.getCode(), result.getCode());
97   - assertEquals(GlobalErrorCodeConstants.SUCCESS.getMsg(), result.getMsg());
  90 +// PayCommonResult<PayOrderUnifiedRespDTO> result = client.doUnifiedOrder(reqDTO);
  91 +// // 断言
  92 +// assertEquals(response.getCode(), result.getApiCode());
  93 +// assertEquals(response.getMsg(), result.getApiMsg());
  94 +// // TODO @tina:这个断言木有过?
  95 +// assertEquals(GlobalErrorCodeConstants.SUCCESS.getCode(), result.getCode());
  96 +// assertEquals(GlobalErrorCodeConstants.SUCCESS.getMsg(), result.getMsg());
98 97  
99 98 }
100 99 }
... ...
yudao-module-pay/yudao-module-pay-biz/src/main/java/cn/iocoder/yudao/module/pay/service/order/PayOrderServiceImpl.java
... ... @@ -150,14 +150,11 @@ public class PayOrderServiceImpl implements PayOrderService {
150 150 .setReturnUrl(genChannelReturnUrl(channel))
151 151 // 订单相关字段
152 152 .setAmount(order.getAmount()).setExpireTime(order.getExpireTime());
153   - CommonResult<?> unifiedOrderResult = client.unifiedOrder(unifiedOrderReqDTO);
154   - unifiedOrderResult.checkError();
155   -
156   - PayOrderUnifiedRespDTO xx = (PayOrderUnifiedRespDTO) unifiedOrderResult.getData();
  153 + PayOrderUnifiedRespDTO unifiedOrderRespDTO = client.unifiedOrder(unifiedOrderReqDTO);
157 154  
158 155 // TODO 轮询三方接口,是否已经支付的任务
159 156 // 返回成功
160   - return PayOrderConvert.INSTANCE.convert(xx);
  157 + return PayOrderConvert.INSTANCE.convert(unifiedOrderRespDTO);
161 158 }
162 159  
163 160 private PayOrderDO validatePayOrderCanSubmit(Long id) {
... ...
yudao-module-pay/yudao-module-pay-biz/src/main/java/cn/iocoder/yudao/module/pay/service/refund/PayRefundServiceImpl.java
... ... @@ -3,14 +3,13 @@ package cn.iocoder.yudao.module.pay.service.refund;
3 3 import cn.hutool.core.util.RandomUtil;
4 4 import cn.hutool.core.util.StrUtil;
5 5 import cn.iocoder.yudao.framework.common.exception.util.ServiceExceptionUtil;
  6 +import cn.iocoder.yudao.framework.common.pojo.PageResult;
6 7 import cn.iocoder.yudao.framework.pay.config.PayProperties;
7 8 import cn.iocoder.yudao.framework.pay.core.client.PayClient;
8 9 import cn.iocoder.yudao.framework.pay.core.client.PayClientFactory;
9   -import cn.iocoder.yudao.framework.pay.core.client.PayCommonResult;
10 10 import cn.iocoder.yudao.framework.pay.core.client.dto.notify.PayNotifyDataDTO;
11 11 import cn.iocoder.yudao.framework.pay.core.client.dto.notify.PayRefundNotifyDTO;
12 12 import cn.iocoder.yudao.framework.pay.core.client.dto.refund.PayRefundUnifiedReqDTO;
13   -import cn.iocoder.yudao.framework.pay.core.client.dto.refund.PayRefundUnifiedRespDTO;
14 13 import cn.iocoder.yudao.framework.pay.core.enums.PayNotifyRefundStatusEnum;
15 14 import cn.iocoder.yudao.module.pay.api.refund.dto.PayRefundCreateReqDTO;
16 15 import cn.iocoder.yudao.module.pay.controller.admin.refund.vo.PayRefundExportReqVO;
... ... @@ -22,7 +21,6 @@ import cn.iocoder.yudao.module.pay.dal.dataobject.order.PayOrderExtensionDO;
22 21 import cn.iocoder.yudao.module.pay.dal.dataobject.refund.PayRefundDO;
23 22 import cn.iocoder.yudao.module.pay.dal.mysql.order.PayOrderMapper;
24 23 import cn.iocoder.yudao.module.pay.dal.mysql.refund.PayRefundMapper;
25   -import cn.iocoder.yudao.framework.common.pojo.PageResult;
26 24 import cn.iocoder.yudao.module.pay.enums.ErrorCodeConstants;
27 25 import cn.iocoder.yudao.module.pay.enums.notify.PayNotifyTypeEnum;
28 26 import cn.iocoder.yudao.module.pay.enums.order.PayOrderNotifyStatusEnum;
... ... @@ -169,11 +167,10 @@ public class PayRefundServiceImpl implements PayRefundService {
169 167 .setNotifyUrl(genChannelPayNotifyUrl(channel)) // TODO 芋艿:优化下 notifyUrl
170 168 .setReason(reqDTO.getReason());
171 169 // 向渠道发起退款申请
172   - PayCommonResult<PayRefundUnifiedRespDTO> refundUnifiedResult = client.unifiedRefund(unifiedReqDTO);
  170 + client.unifiedRefund(unifiedReqDTO);
173 171 // 检查是否失败,失败抛出业务异常。
174 172 // TODO 渠道的异常记录。
175 173 // TODO @jason:可以先打个 warn log 哈;
176   - refundUnifiedResult.checkError();
177 174 // 成功在 退款回调中处理
178 175 return payRefundDO.getId();
179 176 }
... ...
yudao-ui-admin/src/views/pay/order/submit.vue
... ... @@ -56,6 +56,32 @@
56 56 <!-- 展示形式:Form -->
57 57 <div ref="formRef" v-html="form.value" />
58 58  
  59 + <!-- 展示形式:BarCode 条形码 -->
  60 + <el-dialog :title="barCode.title" :visible.sync="barCode.visible" width="500px" append-to-body
  61 + :close-on-press-escape="false">
  62 + <el-form ref="form" label-width="80px">
  63 + <el-row>
  64 + <el-col :span="24">
  65 + <el-form-item label="条形码" prop="name">
  66 + <el-input v-model="barCode.value" placeholder="请输入条形码" required />
  67 + </el-form-item>
  68 + </el-col>
  69 + <el-col :span="24">
  70 + <div style="text-align: right">
  71 + 或使用
  72 + <el-link type="danger" target="_blank"
  73 + href="https://baike.baidu.com/item/条码支付/10711903">(扫码枪/扫码盒)</el-link>
  74 + 扫码
  75 + </div>
  76 + </el-col>
  77 + </el-row>
  78 + </el-form>
  79 + <div slot="footer" class="dialog-footer">
  80 + <el-button type="primary" @click="submit0(barCode.channelCode)"
  81 + :disabled="barCode.value.length === 0">确认支付</el-button>
  82 + <el-button @click="barCode.visible = false">取 消</el-button>
  83 + </div>
  84 + </el-dialog>
59 85 </div>
60 86 </template>
61 87 <script>
... ... @@ -104,6 +130,7 @@ export default {
104 130 html: '',
105 131 },
106 132 barCode: { // 展示形式:条形码
  133 + channelCode: '',
107 134 value: '',
108 135 title: '',
109 136 visible: false,
... ... @@ -163,7 +190,12 @@ export default {
163 190 submit(channelCode) {
164 191 // 条形码支付,需要特殊处理
165 192 if (channelCode === PayChannelEnum.ALIPAY_BAR.code) {
166   -
  193 + this.barCode = {
  194 + channelCode: channelCode,
  195 + value: '',
  196 + title: '“支付宝”条码支付',
  197 + visible: true
  198 + }
167 199 return;
168 200 }
169 201  
... ... @@ -190,7 +222,9 @@ export default {
190 222  
191 223 // 打开轮询任务
192 224 this.createQueryInterval()
193   - })
  225 + }).catch(() => {
  226 + this.submitLoading = false
  227 + });
194 228 },
195 229 /** 构建提交支付的额外参数 */
196 230 buildSubmitParam(channelCode) {
... ... @@ -232,12 +266,22 @@ export default {
232 266 // displayMode: PayDisplayModeEnum.FORM.mode
233 267 // }
234 268 }
  269 +
235 270 // ② 支付宝 Wap 支付时,引导手机扫码支付
236 271 if (channelCode === PayChannelEnum.ALIPAY_WAP.code) {
237 272 return {
238 273 displayMode: PayDisplayModeEnum.QR_CODE.mode
239 274 }
240 275 }
  276 +
  277 + // ③ 支付宝 BarCode 支付时,需要传递 authCode 条形码
  278 + if (channelCode === PayChannelEnum.ALIPAY_BAR.code) {
  279 + return {
  280 + "channelExtras": {
  281 + "auth_code": this.barCode.value
  282 + }
  283 + }
  284 + }
241 285 return {}
242 286 },
243 287 /** 提交支付后,IFrame 内置 URL 的展示形式 */
... ...