From df702e8d246fee0043a7e53aeecf92eaf7548752 Mon Sep 17 00:00:00 2001 From: YunaiV Date: Sat, 18 Feb 2023 10:39:48 +0800 Subject: [PATCH] =?UTF-8?q?pay:=20=E4=B8=B4=E6=97=B6=E6=80=A7=E7=9A=84?= =?UTF-8?q?=E6=8F=90=E4=BA=A4=EF=BC=8C=E5=87=86=E5=A4=87=20client=20?= =?UTF-8?q?=E9=83=A8=E5=88=86=E7=9A=84=E9=87=8D=E6=9E=84?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../framework/pay/core/client/PayClient.java | 7 +++- .../dto/{ => notify}/PayNotifyDataDTO.java | 2 +- .../{ => notify}/PayOrderNotifyRespDTO.java | 2 +- .../dto/{ => notify}/PayRefundNotifyDTO.java | 2 +- .../{ => order}/PayOrderUnifiedReqDTO.java | 2 +- .../{ => refund}/PayRefundUnifiedReqDTO.java | 2 +- .../{ => refund}/PayRefundUnifiedRespDTO.java | 2 +- .../core/client/impl/AbstractPayClient.java | 6 ++-- .../impl/alipay/AbstractAlipayClient.java | 12 +++++-- .../client/impl/alipay/AlipayPcPayClient.java | 14 ++++---- .../client/impl/alipay/AlipayQrPayClient.java | 2 +- .../impl/alipay/AlipayWapPayClient.java | 6 ++-- .../core/client/impl/wx/WXLitePayClient.java | 7 +++- .../client/impl/wx/WXNativePayClient.java | 7 +++- .../core/client/impl/wx/WXPubPayClient.java | 7 +++- .../PayClientFactoryImplIntegrationTest.java | 2 +- .../alipay/AlipayQrPayClientTest.java | 2 +- .../admin/notify/PayNotifyController.java | 2 +- .../pay/convert/order/PayOrderConvert.java | 2 +- .../pay/service/order/PayOrderService.java | 2 +- .../service/order/PayOrderServiceImpl.java | 7 ++-- .../pay/service/refund/PayRefundService.java | 2 +- .../service/refund/PayRefundServiceImpl.java | 23 ++++++++++--- yudao-ui-admin/src/views/pay/order/submit.vue | 34 +++++++++++++++++-- 24 files changed, 116 insertions(+), 40 deletions(-) rename yudao-framework/yudao-spring-boot-starter-biz-pay/src/main/java/cn/iocoder/yudao/framework/pay/core/client/dto/{ => notify}/PayNotifyDataDTO.java (88%) rename yudao-framework/yudao-spring-boot-starter-biz-pay/src/main/java/cn/iocoder/yudao/framework/pay/core/client/dto/{ => notify}/PayOrderNotifyRespDTO.java (94%) rename yudao-framework/yudao-spring-boot-starter-biz-pay/src/main/java/cn/iocoder/yudao/framework/pay/core/client/dto/{ => notify}/PayRefundNotifyDTO.java (96%) rename yudao-framework/yudao-spring-boot-starter-biz-pay/src/main/java/cn/iocoder/yudao/framework/pay/core/client/dto/{ => order}/PayOrderUnifiedReqDTO.java (97%) rename yudao-framework/yudao-spring-boot-starter-biz-pay/src/main/java/cn/iocoder/yudao/framework/pay/core/client/dto/{ => refund}/PayRefundUnifiedReqDTO.java (97%) rename yudao-framework/yudao-spring-boot-starter-biz-pay/src/main/java/cn/iocoder/yudao/framework/pay/core/client/dto/{ => refund}/PayRefundUnifiedRespDTO.java (88%) diff --git a/yudao-framework/yudao-spring-boot-starter-biz-pay/src/main/java/cn/iocoder/yudao/framework/pay/core/client/PayClient.java b/yudao-framework/yudao-spring-boot-starter-biz-pay/src/main/java/cn/iocoder/yudao/framework/pay/core/client/PayClient.java index 5cde0d5a0..f933f34a7 100644 --- a/yudao-framework/yudao-spring-boot-starter-biz-pay/src/main/java/cn/iocoder/yudao/framework/pay/core/client/PayClient.java +++ b/yudao-framework/yudao-spring-boot-starter-biz-pay/src/main/java/cn/iocoder/yudao/framework/pay/core/client/PayClient.java @@ -1,7 +1,12 @@ package cn.iocoder.yudao.framework.pay.core.client; -import cn.iocoder.yudao.framework.pay.core.client.dto.*; +import cn.iocoder.yudao.framework.pay.core.client.dto.notify.PayNotifyDataDTO; +import cn.iocoder.yudao.framework.pay.core.client.dto.notify.PayRefundNotifyDTO; +import cn.iocoder.yudao.framework.pay.core.client.dto.notify.PayOrderNotifyRespDTO; +import cn.iocoder.yudao.framework.pay.core.client.dto.order.PayOrderUnifiedReqDTO; +import cn.iocoder.yudao.framework.pay.core.client.dto.refund.PayRefundUnifiedReqDTO; +import cn.iocoder.yudao.framework.pay.core.client.dto.refund.PayRefundUnifiedRespDTO; /** * 支付客户端,用于对接各支付渠道的 SDK,实现发起支付、退款等功能 diff --git a/yudao-framework/yudao-spring-boot-starter-biz-pay/src/main/java/cn/iocoder/yudao/framework/pay/core/client/dto/PayNotifyDataDTO.java b/yudao-framework/yudao-spring-boot-starter-biz-pay/src/main/java/cn/iocoder/yudao/framework/pay/core/client/dto/notify/PayNotifyDataDTO.java similarity index 88% rename from yudao-framework/yudao-spring-boot-starter-biz-pay/src/main/java/cn/iocoder/yudao/framework/pay/core/client/dto/PayNotifyDataDTO.java rename to yudao-framework/yudao-spring-boot-starter-biz-pay/src/main/java/cn/iocoder/yudao/framework/pay/core/client/dto/notify/PayNotifyDataDTO.java index 96425817a..23e20ea73 100644 --- a/yudao-framework/yudao-spring-boot-starter-biz-pay/src/main/java/cn/iocoder/yudao/framework/pay/core/client/dto/PayNotifyDataDTO.java +++ b/yudao-framework/yudao-spring-boot-starter-biz-pay/src/main/java/cn/iocoder/yudao/framework/pay/core/client/dto/notify/PayNotifyDataDTO.java @@ -1,4 +1,4 @@ -package cn.iocoder.yudao.framework.pay.core.client.dto; +package cn.iocoder.yudao.framework.pay.core.client.dto.notify; import lombok.Builder; import lombok.Data; diff --git a/yudao-framework/yudao-spring-boot-starter-biz-pay/src/main/java/cn/iocoder/yudao/framework/pay/core/client/dto/PayOrderNotifyRespDTO.java b/yudao-framework/yudao-spring-boot-starter-biz-pay/src/main/java/cn/iocoder/yudao/framework/pay/core/client/dto/notify/PayOrderNotifyRespDTO.java similarity index 94% rename from yudao-framework/yudao-spring-boot-starter-biz-pay/src/main/java/cn/iocoder/yudao/framework/pay/core/client/dto/PayOrderNotifyRespDTO.java rename to yudao-framework/yudao-spring-boot-starter-biz-pay/src/main/java/cn/iocoder/yudao/framework/pay/core/client/dto/notify/PayOrderNotifyRespDTO.java index 91f3b2a37..ad51fa4b1 100644 --- a/yudao-framework/yudao-spring-boot-starter-biz-pay/src/main/java/cn/iocoder/yudao/framework/pay/core/client/dto/PayOrderNotifyRespDTO.java +++ b/yudao-framework/yudao-spring-boot-starter-biz-pay/src/main/java/cn/iocoder/yudao/framework/pay/core/client/dto/notify/PayOrderNotifyRespDTO.java @@ -1,4 +1,4 @@ -package cn.iocoder.yudao.framework.pay.core.client.dto; +package cn.iocoder.yudao.framework.pay.core.client.dto.notify; import lombok.AllArgsConstructor; import lombok.Builder; diff --git a/yudao-framework/yudao-spring-boot-starter-biz-pay/src/main/java/cn/iocoder/yudao/framework/pay/core/client/dto/PayRefundNotifyDTO.java b/yudao-framework/yudao-spring-boot-starter-biz-pay/src/main/java/cn/iocoder/yudao/framework/pay/core/client/dto/notify/PayRefundNotifyDTO.java similarity index 96% rename from yudao-framework/yudao-spring-boot-starter-biz-pay/src/main/java/cn/iocoder/yudao/framework/pay/core/client/dto/PayRefundNotifyDTO.java rename to yudao-framework/yudao-spring-boot-starter-biz-pay/src/main/java/cn/iocoder/yudao/framework/pay/core/client/dto/notify/PayRefundNotifyDTO.java index edb593d82..487ecc544 100644 --- a/yudao-framework/yudao-spring-boot-starter-biz-pay/src/main/java/cn/iocoder/yudao/framework/pay/core/client/dto/PayRefundNotifyDTO.java +++ b/yudao-framework/yudao-spring-boot-starter-biz-pay/src/main/java/cn/iocoder/yudao/framework/pay/core/client/dto/notify/PayRefundNotifyDTO.java @@ -1,4 +1,4 @@ -package cn.iocoder.yudao.framework.pay.core.client.dto; +package cn.iocoder.yudao.framework.pay.core.client.dto.notify; import cn.iocoder.yudao.framework.pay.core.enums.PayNotifyRefundStatusEnum; import lombok.Builder; diff --git a/yudao-framework/yudao-spring-boot-starter-biz-pay/src/main/java/cn/iocoder/yudao/framework/pay/core/client/dto/PayOrderUnifiedReqDTO.java b/yudao-framework/yudao-spring-boot-starter-biz-pay/src/main/java/cn/iocoder/yudao/framework/pay/core/client/dto/order/PayOrderUnifiedReqDTO.java similarity index 97% rename from yudao-framework/yudao-spring-boot-starter-biz-pay/src/main/java/cn/iocoder/yudao/framework/pay/core/client/dto/PayOrderUnifiedReqDTO.java rename to yudao-framework/yudao-spring-boot-starter-biz-pay/src/main/java/cn/iocoder/yudao/framework/pay/core/client/dto/order/PayOrderUnifiedReqDTO.java index 5314453be..89bf3c1ac 100644 --- a/yudao-framework/yudao-spring-boot-starter-biz-pay/src/main/java/cn/iocoder/yudao/framework/pay/core/client/dto/PayOrderUnifiedReqDTO.java +++ b/yudao-framework/yudao-spring-boot-starter-biz-pay/src/main/java/cn/iocoder/yudao/framework/pay/core/client/dto/order/PayOrderUnifiedReqDTO.java @@ -1,4 +1,4 @@ -package cn.iocoder.yudao.framework.pay.core.client.dto; +package cn.iocoder.yudao.framework.pay.core.client.dto.order; import lombok.Data; import org.hibernate.validator.constraints.Length; diff --git a/yudao-framework/yudao-spring-boot-starter-biz-pay/src/main/java/cn/iocoder/yudao/framework/pay/core/client/dto/PayRefundUnifiedReqDTO.java b/yudao-framework/yudao-spring-boot-starter-biz-pay/src/main/java/cn/iocoder/yudao/framework/pay/core/client/dto/refund/PayRefundUnifiedReqDTO.java similarity index 97% rename from yudao-framework/yudao-spring-boot-starter-biz-pay/src/main/java/cn/iocoder/yudao/framework/pay/core/client/dto/PayRefundUnifiedReqDTO.java rename to yudao-framework/yudao-spring-boot-starter-biz-pay/src/main/java/cn/iocoder/yudao/framework/pay/core/client/dto/refund/PayRefundUnifiedReqDTO.java index 50c933aaa..e19a04aa0 100644 --- a/yudao-framework/yudao-spring-boot-starter-biz-pay/src/main/java/cn/iocoder/yudao/framework/pay/core/client/dto/PayRefundUnifiedReqDTO.java +++ b/yudao-framework/yudao-spring-boot-starter-biz-pay/src/main/java/cn/iocoder/yudao/framework/pay/core/client/dto/refund/PayRefundUnifiedReqDTO.java @@ -1,4 +1,4 @@ -package cn.iocoder.yudao.framework.pay.core.client.dto; +package cn.iocoder.yudao.framework.pay.core.client.dto.refund; import lombok.AllArgsConstructor; import lombok.Builder; diff --git a/yudao-framework/yudao-spring-boot-starter-biz-pay/src/main/java/cn/iocoder/yudao/framework/pay/core/client/dto/PayRefundUnifiedRespDTO.java b/yudao-framework/yudao-spring-boot-starter-biz-pay/src/main/java/cn/iocoder/yudao/framework/pay/core/client/dto/refund/PayRefundUnifiedRespDTO.java similarity index 88% rename from yudao-framework/yudao-spring-boot-starter-biz-pay/src/main/java/cn/iocoder/yudao/framework/pay/core/client/dto/PayRefundUnifiedRespDTO.java rename to yudao-framework/yudao-spring-boot-starter-biz-pay/src/main/java/cn/iocoder/yudao/framework/pay/core/client/dto/refund/PayRefundUnifiedRespDTO.java index d2e280ae5..8a120f7d7 100644 --- a/yudao-framework/yudao-spring-boot-starter-biz-pay/src/main/java/cn/iocoder/yudao/framework/pay/core/client/dto/PayRefundUnifiedRespDTO.java +++ b/yudao-framework/yudao-spring-boot-starter-biz-pay/src/main/java/cn/iocoder/yudao/framework/pay/core/client/dto/refund/PayRefundUnifiedRespDTO.java @@ -1,4 +1,4 @@ -package cn.iocoder.yudao.framework.pay.core.client.dto; +package cn.iocoder.yudao.framework.pay.core.client.dto.refund; import cn.iocoder.yudao.framework.pay.core.enums.PayChannelRefundRespEnum; import lombok.AllArgsConstructor; diff --git a/yudao-framework/yudao-spring-boot-starter-biz-pay/src/main/java/cn/iocoder/yudao/framework/pay/core/client/impl/AbstractPayClient.java b/yudao-framework/yudao-spring-boot-starter-biz-pay/src/main/java/cn/iocoder/yudao/framework/pay/core/client/impl/AbstractPayClient.java index 2ff978dba..7038de66b 100644 --- a/yudao-framework/yudao-spring-boot-starter-biz-pay/src/main/java/cn/iocoder/yudao/framework/pay/core/client/impl/AbstractPayClient.java +++ b/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; import cn.iocoder.yudao.framework.pay.core.client.PayClient; import cn.iocoder.yudao.framework.pay.core.client.PayClientConfig; import cn.iocoder.yudao.framework.pay.core.client.PayCommonResult; -import cn.iocoder.yudao.framework.pay.core.client.dto.PayOrderUnifiedReqDTO; -import cn.iocoder.yudao.framework.pay.core.client.dto.PayRefundUnifiedReqDTO; -import cn.iocoder.yudao.framework.pay.core.client.dto.PayRefundUnifiedRespDTO; +import cn.iocoder.yudao.framework.pay.core.client.dto.order.PayOrderUnifiedReqDTO; +import cn.iocoder.yudao.framework.pay.core.client.dto.refund.PayRefundUnifiedReqDTO; +import cn.iocoder.yudao.framework.pay.core.client.dto.refund.PayRefundUnifiedRespDTO; import lombok.extern.slf4j.Slf4j; import javax.validation.Validation; diff --git a/yudao-framework/yudao-spring-boot-starter-biz-pay/src/main/java/cn/iocoder/yudao/framework/pay/core/client/impl/alipay/AbstractAlipayClient.java b/yudao-framework/yudao-spring-boot-starter-biz-pay/src/main/java/cn/iocoder/yudao/framework/pay/core/client/impl/alipay/AbstractAlipayClient.java index 680d80d77..7630c9402 100644 --- a/yudao-framework/yudao-spring-boot-starter-biz-pay/src/main/java/cn/iocoder/yudao/framework/pay/core/client/impl/alipay/AbstractAlipayClient.java +++ b/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; import cn.hutool.core.date.LocalDateTimeUtil; import cn.iocoder.yudao.framework.pay.core.client.AbstractPayCodeMapping; import cn.iocoder.yudao.framework.pay.core.client.PayCommonResult; -import cn.iocoder.yudao.framework.pay.core.client.dto.*; +import cn.iocoder.yudao.framework.pay.core.client.dto.notify.PayNotifyDataDTO; +import cn.iocoder.yudao.framework.pay.core.client.dto.notify.PayRefundNotifyDTO; +import cn.iocoder.yudao.framework.pay.core.client.dto.notify.PayOrderNotifyRespDTO; +import cn.iocoder.yudao.framework.pay.core.client.dto.refund.PayRefundUnifiedReqDTO; +import cn.iocoder.yudao.framework.pay.core.client.dto.refund.PayRefundUnifiedRespDTO; import cn.iocoder.yudao.framework.pay.core.client.impl.AbstractPayClient; import cn.iocoder.yudao.framework.pay.core.enums.PayNotifyRefundStatusEnum; import com.alipay.api.AlipayApiException; @@ -106,11 +110,15 @@ public abstract class AbstractAlipayClient extends AbstractPayClient refundUnifiedResult = client.unifiedRefund(unifiedReqDTO); @@ -173,6 +178,16 @@ public class PayRefundServiceImpl implements PayRefundService { return payRefundDO.getId(); } + /** + * 根据支付渠道的编码,生成支付渠道的回调地址 + * + * @param channel 支付渠道 + * @return 支付渠道的回调地址 配置地址 + "/" + channel id + */ + private String genChannelPayNotifyUrl(PayChannelDO channel) { + return payProperties.getCallbackUrl() + "/" + channel.getId(); + } + @Override @Transactional(rollbackFor = Exception.class) public void notifyPayRefund(Long channelId, PayNotifyDataDTO notifyData) { diff --git a/yudao-ui-admin/src/views/pay/order/submit.vue b/yudao-ui-admin/src/views/pay/order/submit.vue index fddf383bc..032ff2375 100644 --- a/yudao-ui-admin/src/views/pay/order/submit.vue +++ b/yudao-ui-admin/src/views/pay/order/submit.vue @@ -12,8 +12,9 @@ + - + @@ -46,6 +47,10 @@ :close-on-press-escape="false"> + + +
+