Commit df702e8d246fee0043a7e53aeecf92eaf7548752
1 parent
96ecd502
pay: 临时性的提交,准备 client 部分的重构
Showing
24 changed files
with
116 additions
and
40 deletions
yudao-framework/yudao-spring-boot-starter-biz-pay/src/main/java/cn/iocoder/yudao/framework/pay/core/client/PayClient.java
| 1 | package cn.iocoder.yudao.framework.pay.core.client; | 1 | package cn.iocoder.yudao.framework.pay.core.client; |
| 2 | 2 | ||
| 3 | 3 | ||
| 4 | -import cn.iocoder.yudao.framework.pay.core.client.dto.*; | 4 | +import cn.iocoder.yudao.framework.pay.core.client.dto.notify.PayNotifyDataDTO; |
| 5 | +import cn.iocoder.yudao.framework.pay.core.client.dto.notify.PayRefundNotifyDTO; | ||
| 6 | +import cn.iocoder.yudao.framework.pay.core.client.dto.notify.PayOrderNotifyRespDTO; | ||
| 7 | +import cn.iocoder.yudao.framework.pay.core.client.dto.order.PayOrderUnifiedReqDTO; | ||
| 8 | +import cn.iocoder.yudao.framework.pay.core.client.dto.refund.PayRefundUnifiedReqDTO; | ||
| 9 | +import cn.iocoder.yudao.framework.pay.core.client.dto.refund.PayRefundUnifiedRespDTO; | ||
| 5 | 10 | ||
| 6 | /** | 11 | /** |
| 7 | * 支付客户端,用于对接各支付渠道的 SDK,实现发起支付、退款等功能 | 12 | * 支付客户端,用于对接各支付渠道的 SDK,实现发起支付、退款等功能 |
yudao-framework/yudao-spring-boot-starter-biz-pay/src/main/java/cn/iocoder/yudao/framework/pay/core/client/dto/PayNotifyDataDTO.java renamed to yudao-framework/yudao-spring-boot-starter-biz-pay/src/main/java/cn/iocoder/yudao/framework/pay/core/client/dto/notify/PayNotifyDataDTO.java
yudao-framework/yudao-spring-boot-starter-biz-pay/src/main/java/cn/iocoder/yudao/framework/pay/core/client/dto/PayOrderNotifyRespDTO.java renamed to yudao-framework/yudao-spring-boot-starter-biz-pay/src/main/java/cn/iocoder/yudao/framework/pay/core/client/dto/notify/PayOrderNotifyRespDTO.java
yudao-framework/yudao-spring-boot-starter-biz-pay/src/main/java/cn/iocoder/yudao/framework/pay/core/client/dto/PayRefundNotifyDTO.java renamed to yudao-framework/yudao-spring-boot-starter-biz-pay/src/main/java/cn/iocoder/yudao/framework/pay/core/client/dto/notify/PayRefundNotifyDTO.java
| 1 | -package cn.iocoder.yudao.framework.pay.core.client.dto; | 1 | +package cn.iocoder.yudao.framework.pay.core.client.dto.notify; |
| 2 | 2 | ||
| 3 | import cn.iocoder.yudao.framework.pay.core.enums.PayNotifyRefundStatusEnum; | 3 | import cn.iocoder.yudao.framework.pay.core.enums.PayNotifyRefundStatusEnum; |
| 4 | import lombok.Builder; | 4 | import lombok.Builder; |
yudao-framework/yudao-spring-boot-starter-biz-pay/src/main/java/cn/iocoder/yudao/framework/pay/core/client/dto/PayOrderUnifiedReqDTO.java renamed to yudao-framework/yudao-spring-boot-starter-biz-pay/src/main/java/cn/iocoder/yudao/framework/pay/core/client/dto/order/PayOrderUnifiedReqDTO.java
yudao-framework/yudao-spring-boot-starter-biz-pay/src/main/java/cn/iocoder/yudao/framework/pay/core/client/dto/PayRefundUnifiedReqDTO.java renamed to yudao-framework/yudao-spring-boot-starter-biz-pay/src/main/java/cn/iocoder/yudao/framework/pay/core/client/dto/refund/PayRefundUnifiedReqDTO.java
yudao-framework/yudao-spring-boot-starter-biz-pay/src/main/java/cn/iocoder/yudao/framework/pay/core/client/dto/PayRefundUnifiedRespDTO.java renamed to yudao-framework/yudao-spring-boot-starter-biz-pay/src/main/java/cn/iocoder/yudao/framework/pay/core/client/dto/refund/PayRefundUnifiedRespDTO.java
| 1 | -package cn.iocoder.yudao.framework.pay.core.client.dto; | 1 | +package cn.iocoder.yudao.framework.pay.core.client.dto.refund; |
| 2 | 2 | ||
| 3 | import cn.iocoder.yudao.framework.pay.core.enums.PayChannelRefundRespEnum; | 3 | import cn.iocoder.yudao.framework.pay.core.enums.PayChannelRefundRespEnum; |
| 4 | import lombok.AllArgsConstructor; | 4 | import lombok.AllArgsConstructor; |
yudao-framework/yudao-spring-boot-starter-biz-pay/src/main/java/cn/iocoder/yudao/framework/pay/core/client/impl/AbstractPayClient.java
| @@ -4,9 +4,9 @@ import cn.iocoder.yudao.framework.pay.core.client.AbstractPayCodeMapping; | @@ -4,9 +4,9 @@ import cn.iocoder.yudao.framework.pay.core.client.AbstractPayCodeMapping; | ||
| 4 | import cn.iocoder.yudao.framework.pay.core.client.PayClient; | 4 | import cn.iocoder.yudao.framework.pay.core.client.PayClient; |
| 5 | import cn.iocoder.yudao.framework.pay.core.client.PayClientConfig; | 5 | import cn.iocoder.yudao.framework.pay.core.client.PayClientConfig; |
| 6 | import cn.iocoder.yudao.framework.pay.core.client.PayCommonResult; | 6 | import cn.iocoder.yudao.framework.pay.core.client.PayCommonResult; |
| 7 | -import cn.iocoder.yudao.framework.pay.core.client.dto.PayOrderUnifiedReqDTO; | ||
| 8 | -import cn.iocoder.yudao.framework.pay.core.client.dto.PayRefundUnifiedReqDTO; | ||
| 9 | -import cn.iocoder.yudao.framework.pay.core.client.dto.PayRefundUnifiedRespDTO; | 7 | +import cn.iocoder.yudao.framework.pay.core.client.dto.order.PayOrderUnifiedReqDTO; |
| 8 | +import cn.iocoder.yudao.framework.pay.core.client.dto.refund.PayRefundUnifiedReqDTO; | ||
| 9 | +import cn.iocoder.yudao.framework.pay.core.client.dto.refund.PayRefundUnifiedRespDTO; | ||
| 10 | import lombok.extern.slf4j.Slf4j; | 10 | import lombok.extern.slf4j.Slf4j; |
| 11 | 11 | ||
| 12 | import javax.validation.Validation; | 12 | import javax.validation.Validation; |
yudao-framework/yudao-spring-boot-starter-biz-pay/src/main/java/cn/iocoder/yudao/framework/pay/core/client/impl/alipay/AbstractAlipayClient.java
| @@ -4,7 +4,11 @@ import cn.hutool.core.bean.BeanUtil; | @@ -4,7 +4,11 @@ import cn.hutool.core.bean.BeanUtil; | ||
| 4 | import cn.hutool.core.date.LocalDateTimeUtil; | 4 | import cn.hutool.core.date.LocalDateTimeUtil; |
| 5 | import cn.iocoder.yudao.framework.pay.core.client.AbstractPayCodeMapping; | 5 | import cn.iocoder.yudao.framework.pay.core.client.AbstractPayCodeMapping; |
| 6 | import cn.iocoder.yudao.framework.pay.core.client.PayCommonResult; | 6 | import cn.iocoder.yudao.framework.pay.core.client.PayCommonResult; |
| 7 | -import cn.iocoder.yudao.framework.pay.core.client.dto.*; | 7 | +import cn.iocoder.yudao.framework.pay.core.client.dto.notify.PayNotifyDataDTO; |
| 8 | +import cn.iocoder.yudao.framework.pay.core.client.dto.notify.PayRefundNotifyDTO; | ||
| 9 | +import cn.iocoder.yudao.framework.pay.core.client.dto.notify.PayOrderNotifyRespDTO; | ||
| 10 | +import cn.iocoder.yudao.framework.pay.core.client.dto.refund.PayRefundUnifiedReqDTO; | ||
| 11 | +import cn.iocoder.yudao.framework.pay.core.client.dto.refund.PayRefundUnifiedRespDTO; | ||
| 8 | import cn.iocoder.yudao.framework.pay.core.client.impl.AbstractPayClient; | 12 | import cn.iocoder.yudao.framework.pay.core.client.impl.AbstractPayClient; |
| 9 | import cn.iocoder.yudao.framework.pay.core.enums.PayNotifyRefundStatusEnum; | 13 | import cn.iocoder.yudao.framework.pay.core.enums.PayNotifyRefundStatusEnum; |
| 10 | import com.alipay.api.AlipayApiException; | 14 | import com.alipay.api.AlipayApiException; |
| @@ -106,11 +110,15 @@ public abstract class AbstractAlipayClient extends AbstractPayClient<AlipayPayCl | @@ -106,11 +110,15 @@ public abstract class AbstractAlipayClient extends AbstractPayClient<AlipayPayCl | ||
| 106 | AlipayTradeRefundModel model=new AlipayTradeRefundModel(); | 110 | AlipayTradeRefundModel model=new AlipayTradeRefundModel(); |
| 107 | model.setTradeNo(reqDTO.getChannelOrderNo()); | 111 | model.setTradeNo(reqDTO.getChannelOrderNo()); |
| 108 | model.setOutTradeNo(reqDTO.getPayTradeNo()); | 112 | model.setOutTradeNo(reqDTO.getPayTradeNo()); |
| 113 | + | ||
| 109 | model.setOutRequestNo(reqDTO.getMerchantRefundId()); | 114 | model.setOutRequestNo(reqDTO.getMerchantRefundId()); |
| 110 | - model.setRefundAmount(calculateAmount(reqDTO.getAmount()).toString()); | 115 | + model.setRefundAmount(calculateAmount(reqDTO.getAmount() / 2).toString()); |
| 111 | model.setRefundReason(reqDTO.getReason()); | 116 | model.setRefundReason(reqDTO.getReason()); |
| 117 | + | ||
| 112 | AlipayTradeRefundRequest refundRequest = new AlipayTradeRefundRequest(); | 118 | AlipayTradeRefundRequest refundRequest = new AlipayTradeRefundRequest(); |
| 113 | refundRequest.setBizModel(model); | 119 | refundRequest.setBizModel(model); |
| 120 | + refundRequest.setNotifyUrl(reqDTO.getNotifyUrl()); | ||
| 121 | + refundRequest.setReturnUrl(reqDTO.getNotifyUrl()); | ||
| 114 | try { | 122 | try { |
| 115 | AlipayTradeRefundResponse response = client.execute(refundRequest); | 123 | AlipayTradeRefundResponse response = client.execute(refundRequest); |
| 116 | log.info("[doUnifiedRefund][response({}) 发起退款 渠道返回", toJsonString(response)); | 124 | log.info("[doUnifiedRefund][response({}) 发起退款 渠道返回", toJsonString(response)); |
yudao-framework/yudao-spring-boot-starter-biz-pay/src/main/java/cn/iocoder/yudao/framework/pay/core/client/impl/alipay/AlipayPcPayClient.java
| 1 | package cn.iocoder.yudao.framework.pay.core.client.impl.alipay; | 1 | package cn.iocoder.yudao.framework.pay.core.client.impl.alipay; |
| 2 | 2 | ||
| 3 | import cn.hutool.core.util.StrUtil; | 3 | import cn.hutool.core.util.StrUtil; |
| 4 | +import cn.hutool.http.Method; | ||
| 4 | import cn.iocoder.yudao.framework.common.util.json.JsonUtils; | 5 | import cn.iocoder.yudao.framework.common.util.json.JsonUtils; |
| 5 | import cn.iocoder.yudao.framework.pay.core.client.PayCommonResult; | 6 | import cn.iocoder.yudao.framework.pay.core.client.PayCommonResult; |
| 6 | -import cn.iocoder.yudao.framework.pay.core.client.dto.PayOrderUnifiedReqDTO; | 7 | +import cn.iocoder.yudao.framework.pay.core.client.dto.order.PayOrderUnifiedReqDTO; |
| 7 | import cn.iocoder.yudao.framework.pay.core.enums.PayChannelEnum; | 8 | import cn.iocoder.yudao.framework.pay.core.enums.PayChannelEnum; |
| 8 | import com.alibaba.fastjson.JSONObject; | 9 | import com.alibaba.fastjson.JSONObject; |
| 9 | import com.alipay.api.AlipayApiException; | 10 | import com.alipay.api.AlipayApiException; |
| @@ -36,24 +37,25 @@ public class AlipayPcPayClient extends AbstractAlipayClient { | @@ -36,24 +37,25 @@ public class AlipayPcPayClient extends AbstractAlipayClient { | ||
| 36 | JSONObject bizContent = new JSONObject(); | 37 | JSONObject bizContent = new JSONObject(); |
| 37 | // 参数说明可查看: https://opendocs.alipay.com/open/028r8t?scene=22 | 38 | // 参数说明可查看: https://opendocs.alipay.com/open/028r8t?scene=22 |
| 38 | bizContent.put("out_trade_no", reqDTO.getMerchantOrderId()); | 39 | bizContent.put("out_trade_no", reqDTO.getMerchantOrderId()); |
| 39 | - bizContent.put("total_amount", calculateAmount(reqDTO.getAmount())); | ||
| 40 | bizContent.put("subject", reqDTO.getSubject()); | 40 | bizContent.put("subject", reqDTO.getSubject()); |
| 41 | - bizContent.put("product_code", "FAST_INSTANT_TRADE_PAY"); | 41 | + bizContent.put("total_amount", calculateAmount(reqDTO.getAmount())); |
| 42 | + bizContent.put("product_code", "FAST_INSTANT_TRADE_PAY"); // 销售产品码. 目前电脑支付场景下仅支持 FAST_INSTANT_TRADE_PAY | ||
| 42 | // PC扫码支付的方式:支持前置模式和跳转模式。4: 订单码-可定义宽度的嵌入式二维码 | 43 | // PC扫码支付的方式:支持前置模式和跳转模式。4: 订单码-可定义宽度的嵌入式二维码 |
| 43 | - bizContent.put("qr_pay_mode", "4"); | 44 | +// bizContent.put("qr_pay_mode", "4"); |
| 44 | // 自定义二维码宽度 | 45 | // 自定义二维码宽度 |
| 45 | - bizContent.put("qrcode_width", "150"); | 46 | +// bizContent.put("qrcode_width", "150"); |
| 46 | request.setBizContent(bizContent.toJSONString()); | 47 | request.setBizContent(bizContent.toJSONString()); |
| 47 | request.setNotifyUrl(reqDTO.getNotifyUrl()); | 48 | request.setNotifyUrl(reqDTO.getNotifyUrl()); |
| 48 | request.setReturnUrl(""); | 49 | request.setReturnUrl(""); |
| 49 | // 执行请求 | 50 | // 执行请求 |
| 50 | AlipayTradePagePayResponse response; | 51 | AlipayTradePagePayResponse response; |
| 51 | try { | 52 | try { |
| 52 | - response = client.pageExecute(request); | 53 | + response = client.pageExecute(request, Method.GET.name()); |
| 53 | } catch (AlipayApiException e) { | 54 | } catch (AlipayApiException e) { |
| 54 | log.error("[unifiedOrder][request({}) 发起支付失败]", JsonUtils.toJsonString(reqDTO), e); | 55 | log.error("[unifiedOrder][request({}) 发起支付失败]", JsonUtils.toJsonString(reqDTO), e); |
| 55 | return PayCommonResult.build(e.getErrCode(), e.getErrMsg(), null, codeMapping); | 56 | return PayCommonResult.build(e.getErrCode(), e.getErrMsg(), null, codeMapping); |
| 56 | } | 57 | } |
| 58 | + System.out.println(response.getBody()); | ||
| 57 | // 响应为表单格式,前端可嵌入响应的页面或关闭当前支付窗口 | 59 | // 响应为表单格式,前端可嵌入响应的页面或关闭当前支付窗口 |
| 58 | return PayCommonResult.build(StrUtil.blankToDefault(response.getCode(),"10000") ,response.getMsg(), response, codeMapping); | 60 | return PayCommonResult.build(StrUtil.blankToDefault(response.getCode(),"10000") ,response.getMsg(), response, codeMapping); |
| 59 | } | 61 | } |
yudao-framework/yudao-spring-boot-starter-biz-pay/src/main/java/cn/iocoder/yudao/framework/pay/core/client/impl/alipay/AlipayQrPayClient.java
| 1 | package cn.iocoder.yudao.framework.pay.core.client.impl.alipay; | 1 | package cn.iocoder.yudao.framework.pay.core.client.impl.alipay; |
| 2 | 2 | ||
| 3 | import cn.iocoder.yudao.framework.pay.core.client.PayCommonResult; | 3 | import cn.iocoder.yudao.framework.pay.core.client.PayCommonResult; |
| 4 | -import cn.iocoder.yudao.framework.pay.core.client.dto.PayOrderUnifiedReqDTO; | 4 | +import cn.iocoder.yudao.framework.pay.core.client.dto.order.PayOrderUnifiedReqDTO; |
| 5 | import cn.iocoder.yudao.framework.pay.core.enums.PayChannelEnum; | 5 | import cn.iocoder.yudao.framework.pay.core.enums.PayChannelEnum; |
| 6 | import com.alipay.api.AlipayApiException; | 6 | import com.alipay.api.AlipayApiException; |
| 7 | import com.alipay.api.domain.AlipayTradePrecreateModel; | 7 | import com.alipay.api.domain.AlipayTradePrecreateModel; |
yudao-framework/yudao-spring-boot-starter-biz-pay/src/main/java/cn/iocoder/yudao/framework/pay/core/client/impl/alipay/AlipayWapPayClient.java
| 1 | package cn.iocoder.yudao.framework.pay.core.client.impl.alipay; | 1 | package cn.iocoder.yudao.framework.pay.core.client.impl.alipay; |
| 2 | 2 | ||
| 3 | import cn.hutool.core.date.DateUtil; | 3 | import cn.hutool.core.date.DateUtil; |
| 4 | +import cn.hutool.http.Method; | ||
| 4 | import cn.iocoder.yudao.framework.pay.core.client.PayCommonResult; | 5 | import cn.iocoder.yudao.framework.pay.core.client.PayCommonResult; |
| 5 | -import cn.iocoder.yudao.framework.pay.core.client.dto.PayOrderUnifiedReqDTO; | 6 | +import cn.iocoder.yudao.framework.pay.core.client.dto.order.PayOrderUnifiedReqDTO; |
| 6 | import cn.iocoder.yudao.framework.pay.core.enums.PayChannelEnum; | 7 | import cn.iocoder.yudao.framework.pay.core.enums.PayChannelEnum; |
| 7 | import com.alipay.api.AlipayApiException; | 8 | import com.alipay.api.AlipayApiException; |
| 8 | import com.alipay.api.domain.AlipayTradeWapPayModel; | 9 | import com.alipay.api.domain.AlipayTradeWapPayModel; |
| @@ -50,10 +51,11 @@ public class AlipayWapPayClient extends AbstractAlipayClient { | @@ -50,10 +51,11 @@ public class AlipayWapPayClient extends AbstractAlipayClient { | ||
| 50 | // 执行请求 | 51 | // 执行请求 |
| 51 | AlipayTradeWapPayResponse response; | 52 | AlipayTradeWapPayResponse response; |
| 52 | try { | 53 | try { |
| 53 | - response = client.pageExecute(request); | 54 | + response = client.pageExecute(request, Method.GET.name()); |
| 54 | } catch (AlipayApiException e) { | 55 | } catch (AlipayApiException e) { |
| 55 | return PayCommonResult.build(e.getErrCode(), e.getErrMsg(), null, codeMapping); | 56 | return PayCommonResult.build(e.getErrCode(), e.getErrMsg(), null, codeMapping); |
| 56 | } | 57 | } |
| 58 | + System.out.println(response.getBody()); | ||
| 57 | 59 | ||
| 58 | // TODO 芋艿:sub Code | 60 | // TODO 芋艿:sub Code |
| 59 | if(response.isSuccess() && Objects.isNull(response.getCode()) && Objects.nonNull(response.getBody())){ | 61 | if(response.isSuccess() && Objects.isNull(response.getCode()) && Objects.nonNull(response.getBody())){ |
yudao-framework/yudao-spring-boot-starter-biz-pay/src/main/java/cn/iocoder/yudao/framework/pay/core/client/impl/wx/WXLitePayClient.java
| @@ -9,7 +9,12 @@ import cn.hutool.core.util.StrUtil; | @@ -9,7 +9,12 @@ import cn.hutool.core.util.StrUtil; | ||
| 9 | import cn.iocoder.yudao.framework.common.util.io.FileUtils; | 9 | import cn.iocoder.yudao.framework.common.util.io.FileUtils; |
| 10 | import cn.iocoder.yudao.framework.common.util.object.ObjectUtils; | 10 | import cn.iocoder.yudao.framework.common.util.object.ObjectUtils; |
| 11 | import cn.iocoder.yudao.framework.pay.core.client.PayCommonResult; | 11 | import cn.iocoder.yudao.framework.pay.core.client.PayCommonResult; |
| 12 | -import cn.iocoder.yudao.framework.pay.core.client.dto.*; | 12 | +import cn.iocoder.yudao.framework.pay.core.client.dto.notify.PayNotifyDataDTO; |
| 13 | +import cn.iocoder.yudao.framework.pay.core.client.dto.notify.PayRefundNotifyDTO; | ||
| 14 | +import cn.iocoder.yudao.framework.pay.core.client.dto.notify.PayOrderNotifyRespDTO; | ||
| 15 | +import cn.iocoder.yudao.framework.pay.core.client.dto.order.PayOrderUnifiedReqDTO; | ||
| 16 | +import cn.iocoder.yudao.framework.pay.core.client.dto.refund.PayRefundUnifiedReqDTO; | ||
| 17 | +import cn.iocoder.yudao.framework.pay.core.client.dto.refund.PayRefundUnifiedRespDTO; | ||
| 13 | import cn.iocoder.yudao.framework.pay.core.client.impl.AbstractPayClient; | 18 | import cn.iocoder.yudao.framework.pay.core.client.impl.AbstractPayClient; |
| 14 | import cn.iocoder.yudao.framework.pay.core.enums.PayChannelEnum; | 19 | import cn.iocoder.yudao.framework.pay.core.enums.PayChannelEnum; |
| 15 | import com.github.binarywang.wxpay.bean.notify.WxPayOrderNotifyResult; | 20 | import com.github.binarywang.wxpay.bean.notify.WxPayOrderNotifyResult; |
yudao-framework/yudao-spring-boot-starter-biz-pay/src/main/java/cn/iocoder/yudao/framework/pay/core/client/impl/wx/WXNativePayClient.java
| @@ -8,7 +8,12 @@ import cn.hutool.core.util.StrUtil; | @@ -8,7 +8,12 @@ import cn.hutool.core.util.StrUtil; | ||
| 8 | import cn.iocoder.yudao.framework.common.util.io.FileUtils; | 8 | import cn.iocoder.yudao.framework.common.util.io.FileUtils; |
| 9 | import cn.iocoder.yudao.framework.common.util.object.ObjectUtils; | 9 | import cn.iocoder.yudao.framework.common.util.object.ObjectUtils; |
| 10 | import cn.iocoder.yudao.framework.pay.core.client.PayCommonResult; | 10 | import cn.iocoder.yudao.framework.pay.core.client.PayCommonResult; |
| 11 | -import cn.iocoder.yudao.framework.pay.core.client.dto.*; | 11 | +import cn.iocoder.yudao.framework.pay.core.client.dto.notify.PayNotifyDataDTO; |
| 12 | +import cn.iocoder.yudao.framework.pay.core.client.dto.notify.PayRefundNotifyDTO; | ||
| 13 | +import cn.iocoder.yudao.framework.pay.core.client.dto.notify.PayOrderNotifyRespDTO; | ||
| 14 | +import cn.iocoder.yudao.framework.pay.core.client.dto.order.PayOrderUnifiedReqDTO; | ||
| 15 | +import cn.iocoder.yudao.framework.pay.core.client.dto.refund.PayRefundUnifiedReqDTO; | ||
| 16 | +import cn.iocoder.yudao.framework.pay.core.client.dto.refund.PayRefundUnifiedRespDTO; | ||
| 12 | import cn.iocoder.yudao.framework.pay.core.client.impl.AbstractPayClient; | 17 | import cn.iocoder.yudao.framework.pay.core.client.impl.AbstractPayClient; |
| 13 | import cn.iocoder.yudao.framework.pay.core.enums.PayChannelEnum; | 18 | import cn.iocoder.yudao.framework.pay.core.enums.PayChannelEnum; |
| 14 | import com.github.binarywang.wxpay.bean.notify.WxPayOrderNotifyResult; | 19 | import com.github.binarywang.wxpay.bean.notify.WxPayOrderNotifyResult; |
yudao-framework/yudao-spring-boot-starter-biz-pay/src/main/java/cn/iocoder/yudao/framework/pay/core/client/impl/wx/WXPubPayClient.java
| @@ -9,7 +9,12 @@ import cn.hutool.core.util.StrUtil; | @@ -9,7 +9,12 @@ import cn.hutool.core.util.StrUtil; | ||
| 9 | import cn.iocoder.yudao.framework.common.util.io.FileUtils; | 9 | import cn.iocoder.yudao.framework.common.util.io.FileUtils; |
| 10 | import cn.iocoder.yudao.framework.common.util.object.ObjectUtils; | 10 | import cn.iocoder.yudao.framework.common.util.object.ObjectUtils; |
| 11 | import cn.iocoder.yudao.framework.pay.core.client.PayCommonResult; | 11 | import cn.iocoder.yudao.framework.pay.core.client.PayCommonResult; |
| 12 | -import cn.iocoder.yudao.framework.pay.core.client.dto.*; | 12 | +import cn.iocoder.yudao.framework.pay.core.client.dto.notify.PayNotifyDataDTO; |
| 13 | +import cn.iocoder.yudao.framework.pay.core.client.dto.notify.PayRefundNotifyDTO; | ||
| 14 | +import cn.iocoder.yudao.framework.pay.core.client.dto.notify.PayOrderNotifyRespDTO; | ||
| 15 | +import cn.iocoder.yudao.framework.pay.core.client.dto.order.PayOrderUnifiedReqDTO; | ||
| 16 | +import cn.iocoder.yudao.framework.pay.core.client.dto.refund.PayRefundUnifiedReqDTO; | ||
| 17 | +import cn.iocoder.yudao.framework.pay.core.client.dto.refund.PayRefundUnifiedRespDTO; | ||
| 13 | import cn.iocoder.yudao.framework.pay.core.client.impl.AbstractPayClient; | 18 | import cn.iocoder.yudao.framework.pay.core.client.impl.AbstractPayClient; |
| 14 | import cn.iocoder.yudao.framework.pay.core.enums.PayChannelEnum; | 19 | import cn.iocoder.yudao.framework.pay.core.enums.PayChannelEnum; |
| 15 | import com.github.binarywang.wxpay.bean.notify.WxPayOrderNotifyResult; | 20 | import com.github.binarywang.wxpay.bean.notify.WxPayOrderNotifyResult; |
yudao-framework/yudao-spring-boot-starter-biz-pay/src/test/java/cn.iocoder.yudao.framework.pay.core.client.impl/PayClientFactoryImplIntegrationTest.java
| @@ -5,7 +5,7 @@ import cn.hutool.core.util.RandomUtil; | @@ -5,7 +5,7 @@ import cn.hutool.core.util.RandomUtil; | ||
| 5 | import cn.iocoder.yudao.framework.common.pojo.CommonResult; | 5 | import cn.iocoder.yudao.framework.common.pojo.CommonResult; |
| 6 | import cn.iocoder.yudao.framework.common.util.json.JsonUtils; | 6 | import cn.iocoder.yudao.framework.common.util.json.JsonUtils; |
| 7 | import cn.iocoder.yudao.framework.pay.core.client.PayClient; | 7 | import cn.iocoder.yudao.framework.pay.core.client.PayClient; |
| 8 | -import cn.iocoder.yudao.framework.pay.core.client.dto.PayOrderUnifiedReqDTO; | 8 | +import cn.iocoder.yudao.framework.pay.core.client.dto.order.PayOrderUnifiedReqDTO; |
| 9 | import cn.iocoder.yudao.framework.pay.core.client.impl.alipay.AlipayPayClientConfig; | 9 | import cn.iocoder.yudao.framework.pay.core.client.impl.alipay.AlipayPayClientConfig; |
| 10 | import cn.iocoder.yudao.framework.pay.core.client.impl.alipay.AlipayQrPayClient; | 10 | import cn.iocoder.yudao.framework.pay.core.client.impl.alipay.AlipayQrPayClient; |
| 11 | import cn.iocoder.yudao.framework.pay.core.client.impl.alipay.AlipayWapPayClient; | 11 | import cn.iocoder.yudao.framework.pay.core.client.impl.alipay.AlipayWapPayClient; |
yudao-framework/yudao-spring-boot-starter-biz-pay/src/test/java/cn.iocoder.yudao.framework.pay.core.client.impl/alipay/AlipayQrPayClientTest.java
| @@ -2,7 +2,7 @@ package cn.iocoder.yudao.framework.pay.core.client.impl.alipay; | @@ -2,7 +2,7 @@ package cn.iocoder.yudao.framework.pay.core.client.impl.alipay; | ||
| 2 | import cn.hutool.core.util.ReflectUtil; | 2 | import cn.hutool.core.util.ReflectUtil; |
| 3 | import cn.iocoder.yudao.framework.common.exception.enums.GlobalErrorCodeConstants; | 3 | import cn.iocoder.yudao.framework.common.exception.enums.GlobalErrorCodeConstants; |
| 4 | import cn.iocoder.yudao.framework.pay.core.client.PayCommonResult; | 4 | import cn.iocoder.yudao.framework.pay.core.client.PayCommonResult; |
| 5 | -import cn.iocoder.yudao.framework.pay.core.client.dto.PayOrderUnifiedReqDTO; | 5 | +import cn.iocoder.yudao.framework.pay.core.client.dto.order.PayOrderUnifiedReqDTO; |
| 6 | import cn.iocoder.yudao.framework.test.core.ut.BaseMockitoUnitTest; | 6 | import cn.iocoder.yudao.framework.test.core.ut.BaseMockitoUnitTest; |
| 7 | import com.alipay.api.AlipayApiException; | 7 | import com.alipay.api.AlipayApiException; |
| 8 | import com.alipay.api.DefaultAlipayClient; | 8 | import com.alipay.api.DefaultAlipayClient; |
yudao-module-pay/yudao-module-pay-biz/src/main/java/cn/iocoder/yudao/module/pay/controller/admin/notify/PayNotifyController.java
| @@ -3,7 +3,7 @@ package cn.iocoder.yudao.module.pay.controller.admin.notify; | @@ -3,7 +3,7 @@ package cn.iocoder.yudao.module.pay.controller.admin.notify; | ||
| 3 | import cn.iocoder.yudao.framework.operatelog.core.annotations.OperateLog; | 3 | import cn.iocoder.yudao.framework.operatelog.core.annotations.OperateLog; |
| 4 | import cn.iocoder.yudao.framework.pay.core.client.PayClient; | 4 | import cn.iocoder.yudao.framework.pay.core.client.PayClient; |
| 5 | import cn.iocoder.yudao.framework.pay.core.client.PayClientFactory; | 5 | import cn.iocoder.yudao.framework.pay.core.client.PayClientFactory; |
| 6 | -import cn.iocoder.yudao.framework.pay.core.client.dto.PayNotifyDataDTO; | 6 | +import cn.iocoder.yudao.framework.pay.core.client.dto.notify.PayNotifyDataDTO; |
| 7 | import cn.iocoder.yudao.module.pay.service.order.PayOrderService; | 7 | import cn.iocoder.yudao.module.pay.service.order.PayOrderService; |
| 8 | import cn.iocoder.yudao.module.pay.service.refund.PayRefundService; | 8 | import cn.iocoder.yudao.module.pay.service.refund.PayRefundService; |
| 9 | import io.swagger.v3.oas.annotations.Operation; | 9 | import io.swagger.v3.oas.annotations.Operation; |
yudao-module-pay/yudao-module-pay-biz/src/main/java/cn/iocoder/yudao/module/pay/convert/order/PayOrderConvert.java
| 1 | package cn.iocoder.yudao.module.pay.convert.order; | 1 | package cn.iocoder.yudao.module.pay.convert.order; |
| 2 | 2 | ||
| 3 | import cn.iocoder.yudao.framework.common.pojo.PageResult; | 3 | import cn.iocoder.yudao.framework.common.pojo.PageResult; |
| 4 | -import cn.iocoder.yudao.framework.pay.core.client.dto.PayOrderUnifiedReqDTO; | 4 | +import cn.iocoder.yudao.framework.pay.core.client.dto.order.PayOrderUnifiedReqDTO; |
| 5 | import cn.iocoder.yudao.module.pay.api.order.dto.PayOrderCreateReqDTO; | 5 | import cn.iocoder.yudao.module.pay.api.order.dto.PayOrderCreateReqDTO; |
| 6 | import cn.iocoder.yudao.module.pay.api.order.dto.PayOrderRespDTO; | 6 | import cn.iocoder.yudao.module.pay.api.order.dto.PayOrderRespDTO; |
| 7 | import cn.iocoder.yudao.module.pay.controller.admin.order.vo.*; | 7 | import cn.iocoder.yudao.module.pay.controller.admin.order.vo.*; |
yudao-module-pay/yudao-module-pay-biz/src/main/java/cn/iocoder/yudao/module/pay/service/order/PayOrderService.java
| 1 | package cn.iocoder.yudao.module.pay.service.order; | 1 | package cn.iocoder.yudao.module.pay.service.order; |
| 2 | 2 | ||
| 3 | -import cn.iocoder.yudao.framework.pay.core.client.dto.PayNotifyDataDTO; | 3 | +import cn.iocoder.yudao.framework.pay.core.client.dto.notify.PayNotifyDataDTO; |
| 4 | import cn.iocoder.yudao.module.pay.controller.admin.order.vo.PayOrderExportReqVO; | 4 | import cn.iocoder.yudao.module.pay.controller.admin.order.vo.PayOrderExportReqVO; |
| 5 | import cn.iocoder.yudao.module.pay.controller.admin.order.vo.PayOrderPageReqVO; | 5 | import cn.iocoder.yudao.module.pay.controller.admin.order.vo.PayOrderPageReqVO; |
| 6 | import cn.iocoder.yudao.framework.common.pojo.PageResult; | 6 | import cn.iocoder.yudao.framework.common.pojo.PageResult; |
yudao-module-pay/yudao-module-pay-biz/src/main/java/cn/iocoder/yudao/module/pay/service/order/PayOrderServiceImpl.java
| @@ -9,9 +9,9 @@ import cn.iocoder.yudao.framework.common.util.json.JsonUtils; | @@ -9,9 +9,9 @@ import cn.iocoder.yudao.framework.common.util.json.JsonUtils; | ||
| 9 | import cn.iocoder.yudao.framework.pay.config.PayProperties; | 9 | import cn.iocoder.yudao.framework.pay.config.PayProperties; |
| 10 | import cn.iocoder.yudao.framework.pay.core.client.PayClient; | 10 | import cn.iocoder.yudao.framework.pay.core.client.PayClient; |
| 11 | import cn.iocoder.yudao.framework.pay.core.client.PayClientFactory; | 11 | import cn.iocoder.yudao.framework.pay.core.client.PayClientFactory; |
| 12 | -import cn.iocoder.yudao.framework.pay.core.client.dto.PayNotifyDataDTO; | ||
| 13 | -import cn.iocoder.yudao.framework.pay.core.client.dto.PayOrderNotifyRespDTO; | ||
| 14 | -import cn.iocoder.yudao.framework.pay.core.client.dto.PayOrderUnifiedReqDTO; | 12 | +import cn.iocoder.yudao.framework.pay.core.client.dto.notify.PayNotifyDataDTO; |
| 13 | +import cn.iocoder.yudao.framework.pay.core.client.dto.notify.PayOrderNotifyRespDTO; | ||
| 14 | +import cn.iocoder.yudao.framework.pay.core.client.dto.order.PayOrderUnifiedReqDTO; | ||
| 15 | import cn.iocoder.yudao.framework.tenant.core.util.TenantUtils; | 15 | import cn.iocoder.yudao.framework.tenant.core.util.TenantUtils; |
| 16 | import cn.iocoder.yudao.module.pay.api.order.dto.PayOrderCreateReqDTO; | 16 | import cn.iocoder.yudao.module.pay.api.order.dto.PayOrderCreateReqDTO; |
| 17 | import cn.iocoder.yudao.module.pay.controller.admin.order.vo.PayOrderExportReqVO; | 17 | import cn.iocoder.yudao.module.pay.controller.admin.order.vo.PayOrderExportReqVO; |
| @@ -42,7 +42,6 @@ import javax.annotation.Resource; | @@ -42,7 +42,6 @@ import javax.annotation.Resource; | ||
| 42 | import java.time.LocalDateTime; | 42 | import java.time.LocalDateTime; |
| 43 | import java.util.Collection; | 43 | import java.util.Collection; |
| 44 | import java.util.List; | 44 | import java.util.List; |
| 45 | -import java.util.Objects; | ||
| 46 | 45 | ||
| 47 | import static cn.iocoder.yudao.framework.common.exception.util.ServiceExceptionUtil.exception; | 46 | import static cn.iocoder.yudao.framework.common.exception.util.ServiceExceptionUtil.exception; |
| 48 | 47 |
yudao-module-pay/yudao-module-pay-biz/src/main/java/cn/iocoder/yudao/module/pay/service/refund/PayRefundService.java
| 1 | package cn.iocoder.yudao.module.pay.service.refund; | 1 | package cn.iocoder.yudao.module.pay.service.refund; |
| 2 | 2 | ||
| 3 | -import cn.iocoder.yudao.framework.pay.core.client.dto.PayNotifyDataDTO; | 3 | +import cn.iocoder.yudao.framework.pay.core.client.dto.notify.PayNotifyDataDTO; |
| 4 | import cn.iocoder.yudao.module.pay.api.refund.dto.PayRefundCreateReqDTO; | 4 | import cn.iocoder.yudao.module.pay.api.refund.dto.PayRefundCreateReqDTO; |
| 5 | import cn.iocoder.yudao.module.pay.controller.admin.refund.vo.PayRefundExportReqVO; | 5 | import cn.iocoder.yudao.module.pay.controller.admin.refund.vo.PayRefundExportReqVO; |
| 6 | import cn.iocoder.yudao.module.pay.controller.admin.refund.vo.PayRefundPageReqVO; | 6 | import cn.iocoder.yudao.module.pay.controller.admin.refund.vo.PayRefundPageReqVO; |
yudao-module-pay/yudao-module-pay-biz/src/main/java/cn/iocoder/yudao/module/pay/service/refund/PayRefundServiceImpl.java
| @@ -3,13 +3,14 @@ package cn.iocoder.yudao.module.pay.service.refund; | @@ -3,13 +3,14 @@ package cn.iocoder.yudao.module.pay.service.refund; | ||
| 3 | import cn.hutool.core.util.RandomUtil; | 3 | import cn.hutool.core.util.RandomUtil; |
| 4 | import cn.hutool.core.util.StrUtil; | 4 | import cn.hutool.core.util.StrUtil; |
| 5 | import cn.iocoder.yudao.framework.common.exception.util.ServiceExceptionUtil; | 5 | import cn.iocoder.yudao.framework.common.exception.util.ServiceExceptionUtil; |
| 6 | +import cn.iocoder.yudao.framework.pay.config.PayProperties; | ||
| 6 | import cn.iocoder.yudao.framework.pay.core.client.PayClient; | 7 | import cn.iocoder.yudao.framework.pay.core.client.PayClient; |
| 7 | import cn.iocoder.yudao.framework.pay.core.client.PayClientFactory; | 8 | import cn.iocoder.yudao.framework.pay.core.client.PayClientFactory; |
| 8 | import cn.iocoder.yudao.framework.pay.core.client.PayCommonResult; | 9 | import cn.iocoder.yudao.framework.pay.core.client.PayCommonResult; |
| 9 | -import cn.iocoder.yudao.framework.pay.core.client.dto.PayNotifyDataDTO; | ||
| 10 | -import cn.iocoder.yudao.framework.pay.core.client.dto.PayRefundNotifyDTO; | ||
| 11 | -import cn.iocoder.yudao.framework.pay.core.client.dto.PayRefundUnifiedReqDTO; | ||
| 12 | -import cn.iocoder.yudao.framework.pay.core.client.dto.PayRefundUnifiedRespDTO; | 10 | +import cn.iocoder.yudao.framework.pay.core.client.dto.notify.PayNotifyDataDTO; |
| 11 | +import cn.iocoder.yudao.framework.pay.core.client.dto.notify.PayRefundNotifyDTO; | ||
| 12 | +import cn.iocoder.yudao.framework.pay.core.client.dto.refund.PayRefundUnifiedReqDTO; | ||
| 13 | +import cn.iocoder.yudao.framework.pay.core.client.dto.refund.PayRefundUnifiedRespDTO; | ||
| 13 | import cn.iocoder.yudao.framework.pay.core.enums.PayNotifyRefundStatusEnum; | 14 | import cn.iocoder.yudao.framework.pay.core.enums.PayNotifyRefundStatusEnum; |
| 14 | import cn.iocoder.yudao.module.pay.api.refund.dto.PayRefundCreateReqDTO; | 15 | import cn.iocoder.yudao.module.pay.api.refund.dto.PayRefundCreateReqDTO; |
| 15 | import cn.iocoder.yudao.module.pay.controller.admin.refund.vo.PayRefundExportReqVO; | 16 | import cn.iocoder.yudao.module.pay.controller.admin.refund.vo.PayRefundExportReqVO; |
| @@ -55,6 +56,9 @@ import java.util.Objects; | @@ -55,6 +56,9 @@ import java.util.Objects; | ||
| 55 | public class PayRefundServiceImpl implements PayRefundService { | 56 | public class PayRefundServiceImpl implements PayRefundService { |
| 56 | 57 | ||
| 57 | @Resource | 58 | @Resource |
| 59 | + private PayProperties payProperties; | ||
| 60 | + | ||
| 61 | + @Resource | ||
| 58 | private PayClientFactory payClientFactory; | 62 | private PayClientFactory payClientFactory; |
| 59 | 63 | ||
| 60 | @Resource | 64 | @Resource |
| @@ -162,6 +166,7 @@ public class PayRefundServiceImpl implements PayRefundService { | @@ -162,6 +166,7 @@ public class PayRefundServiceImpl implements PayRefundService { | ||
| 162 | .setChannelOrderNo(order.getChannelOrderNo()) | 166 | .setChannelOrderNo(order.getChannelOrderNo()) |
| 163 | .setPayTradeNo(orderExtensionDO.getNo()) | 167 | .setPayTradeNo(orderExtensionDO.getNo()) |
| 164 | .setMerchantRefundId(merchantRefundId) // TODO 芋艿:需要优化 | 168 | .setMerchantRefundId(merchantRefundId) // TODO 芋艿:需要优化 |
| 169 | + .setNotifyUrl(genChannelPayNotifyUrl(channel)) // TODO 芋艿:优化下 notifyUrl | ||
| 165 | .setReason(reqDTO.getReason()); | 170 | .setReason(reqDTO.getReason()); |
| 166 | // 向渠道发起退款申请 | 171 | // 向渠道发起退款申请 |
| 167 | PayCommonResult<PayRefundUnifiedRespDTO> refundUnifiedResult = client.unifiedRefund(unifiedReqDTO); | 172 | PayCommonResult<PayRefundUnifiedRespDTO> refundUnifiedResult = client.unifiedRefund(unifiedReqDTO); |
| @@ -173,6 +178,16 @@ public class PayRefundServiceImpl implements PayRefundService { | @@ -173,6 +178,16 @@ public class PayRefundServiceImpl implements PayRefundService { | ||
| 173 | return payRefundDO.getId(); | 178 | return payRefundDO.getId(); |
| 174 | } | 179 | } |
| 175 | 180 | ||
| 181 | + /** | ||
| 182 | + * 根据支付渠道的编码,生成支付渠道的回调地址 | ||
| 183 | + * | ||
| 184 | + * @param channel 支付渠道 | ||
| 185 | + * @return 支付渠道的回调地址 配置地址 + "/" + channel id | ||
| 186 | + */ | ||
| 187 | + private String genChannelPayNotifyUrl(PayChannelDO channel) { | ||
| 188 | + return payProperties.getCallbackUrl() + "/" + channel.getId(); | ||
| 189 | + } | ||
| 190 | + | ||
| 176 | @Override | 191 | @Override |
| 177 | @Transactional(rollbackFor = Exception.class) | 192 | @Transactional(rollbackFor = Exception.class) |
| 178 | public void notifyPayRefund(Long channelId, PayNotifyDataDTO notifyData) { | 193 | public void notifyPayRefund(Long channelId, PayNotifyDataDTO notifyData) { |
yudao-ui-admin/src/views/pay/order/submit.vue
| @@ -12,8 +12,9 @@ | @@ -12,8 +12,9 @@ | ||
| 12 | </el-descriptions> | 12 | </el-descriptions> |
| 13 | </el-card> | 13 | </el-card> |
| 14 | 14 | ||
| 15 | + | ||
| 15 | <!-- 支付选择框 --> | 16 | <!-- 支付选择框 --> |
| 16 | - <el-card style="margin-top: 10px"> | 17 | + <el-card style="margin-top: 10px" v-loading="submitLoading" element-loading-text="提交支付中..."> |
| 17 | <!-- 支付宝 --> | 18 | <!-- 支付宝 --> |
| 18 | <el-descriptions title="选择支付宝支付"> | 19 | <el-descriptions title="选择支付宝支付"> |
| 19 | </el-descriptions> | 20 | </el-descriptions> |
| @@ -46,6 +47,10 @@ | @@ -46,6 +47,10 @@ | ||
| 46 | :close-on-press-escape="false"> | 47 | :close-on-press-escape="false"> |
| 47 | <qrcode-vue :value="qrCode.url" size="310" level="H" /> | 48 | <qrcode-vue :value="qrCode.url" size="310" level="H" /> |
| 48 | </el-dialog> | 49 | </el-dialog> |
| 50 | + | ||
| 51 | + <!-- 阿里支付 --> | ||
| 52 | + <div ref="alipayWap" v-html="alipayHtml.value" /> | ||
| 53 | + | ||
| 49 | </div> | 54 | </div> |
| 50 | </template> | 55 | </template> |
| 51 | <script> | 56 | <script> |
| @@ -77,12 +82,14 @@ export default { | @@ -77,12 +82,14 @@ export default { | ||
| 77 | wx_pub: require("@/assets/images/pay/icon/wx_pub.svg"), | 82 | wx_pub: require("@/assets/images/pay/icon/wx_pub.svg"), |
| 78 | mock: require("@/assets/images/pay/icon/mock.svg"), | 83 | mock: require("@/assets/images/pay/icon/mock.svg"), |
| 79 | }, | 84 | }, |
| 85 | + submitLoading: false, // 提交支付的 loading | ||
| 80 | qrCode: { // 支付二维码 | 86 | qrCode: { // 支付二维码 |
| 81 | url: '', | 87 | url: '', |
| 82 | title: '', | 88 | title: '', |
| 83 | visible: false, | 89 | visible: false, |
| 84 | }, | 90 | }, |
| 85 | interval: undefined, // 定时任务,轮询是否完成支付 | 91 | interval: undefined, // 定时任务,轮询是否完成支付 |
| 92 | + alipayHtml: '' // 阿里支付的 HTML | ||
| 86 | }; | 93 | }; |
| 87 | }, | 94 | }, |
| 88 | created() { | 95 | created() { |
| @@ -136,14 +143,20 @@ export default { | @@ -136,14 +143,20 @@ export default { | ||
| 136 | }, | 143 | }, |
| 137 | /** 提交支付 */ | 144 | /** 提交支付 */ |
| 138 | submit(channelCode) { | 145 | submit(channelCode) { |
| 146 | + this.submitLoading = true | ||
| 139 | submitOrder({ | 147 | submitOrder({ |
| 140 | id: this.id, | 148 | id: this.id, |
| 141 | channelCode: channelCode | 149 | channelCode: channelCode |
| 142 | }).then(response => { | 150 | }).then(response => { |
| 151 | + const invokeResponse = response.data.invokeResponse | ||
| 143 | // 不同的支付,调用不同的策略 | 152 | // 不同的支付,调用不同的策略 |
| 144 | if (channelCode === PayChannelEnum.ALIPAY_QR.code) { | 153 | if (channelCode === PayChannelEnum.ALIPAY_QR.code) { |
| 145 | - this.submitAfterAlipayQr(response.data.invokeResponse) | 154 | + this.submitAfterAlipayQr(invokeResponse) |
| 155 | + } else if (channelCode === PayChannelEnum.ALIPAY_PC.code | ||
| 156 | + || channelCode === PayChannelEnum.ALIPAY_WAP.code) { | ||
| 157 | + this.submitAfterAlipayPc(invokeResponse) | ||
| 146 | } | 158 | } |
| 159 | + | ||
| 147 | // 打开轮询任务 | 160 | // 打开轮询任务 |
| 148 | this.createQueryInterval() | 161 | this.createQueryInterval() |
| 149 | }) | 162 | }) |
| @@ -155,6 +168,23 @@ export default { | @@ -155,6 +168,23 @@ export default { | ||
| 155 | url: invokeResponse.qrCode, | 168 | url: invokeResponse.qrCode, |
| 156 | visible: true | 169 | visible: true |
| 157 | } | 170 | } |
| 171 | + this.submitLoading = false | ||
| 172 | + }, | ||
| 173 | + /** 提交支付后(支付宝 PC 网站支付) */ | ||
| 174 | + submitAfterAlipayPc(invokeResponse) { | ||
| 175 | + // 渲染支付页面 | ||
| 176 | + this.alipayHtml = { | ||
| 177 | + value: invokeResponse.body, | ||
| 178 | + visible: true | ||
| 179 | + } | ||
| 180 | + // 防抖避免重复支付 | ||
| 181 | + this.$nextTick(() => { | ||
| 182 | + // 提交支付表单 | ||
| 183 | + // this.$refs.alipayWap.children[0].submit(); | ||
| 184 | + // setTimeout(() => { | ||
| 185 | + // this.submitLoading = false | ||
| 186 | + // }, 1000); | ||
| 187 | + }); | ||
| 158 | }, | 188 | }, |
| 159 | /** 轮询查询任务 */ | 189 | /** 轮询查询任务 */ |
| 160 | createQueryInterval() { | 190 | createQueryInterval() { |