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 c2c850b61..5a0ec1214 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 @@ -83,7 +83,7 @@ public abstract class AbstractPayClient implemen resp = doUnifiedOrder(reqDTO); } catch (Throwable ex) { // 系统异常,则包装成 PayException 异常抛出 - log.error("[unifiedRefund][客户端({}) request({}) 发起支付异常]", + log.error("[unifiedOrder][客户端({}) request({}) 发起支付异常]", getId(), toJsonString(reqDTO), ex); throw buildPayException(ex); } diff --git a/yudao-framework/yudao-spring-boot-starter-biz-pay/src/main/java/cn/iocoder/yudao/framework/pay/core/client/impl/PayClientFactoryImpl.java b/yudao-framework/yudao-spring-boot-starter-biz-pay/src/main/java/cn/iocoder/yudao/framework/pay/core/client/impl/PayClientFactoryImpl.java index cafc3585b..5c57dd009 100644 --- a/yudao-framework/yudao-spring-boot-starter-biz-pay/src/main/java/cn/iocoder/yudao/framework/pay/core/client/impl/PayClientFactoryImpl.java +++ b/yudao-framework/yudao-spring-boot-starter-biz-pay/src/main/java/cn/iocoder/yudao/framework/pay/core/client/impl/PayClientFactoryImpl.java @@ -62,7 +62,6 @@ public class PayClientFactoryImpl implements PayClientFactory { case WX_APP: return (AbstractPayClient) new WxAppPayClient(channelId, (WxPayClientConfig) config); case WX_BAR: return (AbstractPayClient) new WxBarPayClient(channelId, (WxPayClientConfig) config); case WX_NATIVE: return (AbstractPayClient) new WxNativePayClient(channelId, (WxPayClientConfig) config); - case WX_H5: return (AbstractPayClient) new WxH5PayClient(channelId, (WxPayClientConfig) config); // 支付宝支付 case ALIPAY_WAP: return (AbstractPayClient) new AlipayWapPayClient(channelId, (AlipayPayClientConfig) config); case ALIPAY_QR: return (AbstractPayClient) new AlipayQrPayClient(channelId, (AlipayPayClientConfig) config); diff --git a/yudao-framework/yudao-spring-boot-starter-biz-pay/src/main/java/cn/iocoder/yudao/framework/pay/core/client/impl/alipay/AlipayAppPayClient.java b/yudao-framework/yudao-spring-boot-starter-biz-pay/src/main/java/cn/iocoder/yudao/framework/pay/core/client/impl/alipay/AlipayAppPayClient.java index d949dd4b7..da9e8aad3 100644 --- a/yudao-framework/yudao-spring-boot-starter-biz-pay/src/main/java/cn/iocoder/yudao/framework/pay/core/client/impl/alipay/AlipayAppPayClient.java +++ b/yudao-framework/yudao-spring-boot-starter-biz-pay/src/main/java/cn/iocoder/yudao/framework/pay/core/client/impl/alipay/AlipayAppPayClient.java @@ -33,9 +33,10 @@ public class AlipayAppPayClient extends AbstractAlipayPayClient { // ① 通用的参数 model.setOutTradeNo(reqDTO.getOutTradeNo()); model.setSubject(reqDTO.getSubject()); - model.setBody(reqDTO.getBody()); + model.setBody(reqDTO.getBody() + "test"); model.setTotalAmount(formatAmount(reqDTO.getPrice())); - model.setProductCode(" QUICK_MSECURITY_PAY"); // 销售产品码:无线快捷支付产品 + model.setTimeExpire(formatTime(reqDTO.getExpireTime())); + model.setProductCode("QUICK_MSECURITY_PAY"); // 销售产品码:无线快捷支付产品 // ② 个性化的参数【无】 // ③ 支付宝扫码支付只有一种展示 String displayMode = PayOrderDisplayModeEnum.APP.getMode(); @@ -47,12 +48,12 @@ public class AlipayAppPayClient extends AbstractAlipayPayClient { request.setReturnUrl(reqDTO.getReturnUrl()); // 2.1 执行请求 - AlipayTradeAppPayResponse response = client.execute(request); + AlipayTradeAppPayResponse response = client.sdkExecute(request); // 2.2 处理结果 if (!response.isSuccess()) { return buildClosedPayOrderRespDTO(reqDTO, response); } - return PayOrderRespDTO.waitingOf(displayMode, "", + return PayOrderRespDTO.waitingOf(displayMode, response.getBody(), reqDTO.getOutTradeNo(), response); } diff --git a/yudao-framework/yudao-spring-boot-starter-biz-pay/src/main/java/cn/iocoder/yudao/framework/pay/core/client/impl/weixin/WxH5PayClient.java b/yudao-framework/yudao-spring-boot-starter-biz-pay/src/main/java/cn/iocoder/yudao/framework/pay/core/client/impl/weixin/WxH5PayClient.java deleted file mode 100644 index 8e39619cb..000000000 --- a/yudao-framework/yudao-spring-boot-starter-biz-pay/src/main/java/cn/iocoder/yudao/framework/pay/core/client/impl/weixin/WxH5PayClient.java +++ /dev/null @@ -1,31 +0,0 @@ -package cn.iocoder.yudao.framework.pay.core.client.impl.weixin; - -import cn.iocoder.yudao.framework.pay.core.client.dto.order.PayOrderRespDTO; -import cn.iocoder.yudao.framework.pay.core.client.dto.order.PayOrderUnifiedReqDTO; -import cn.iocoder.yudao.framework.pay.core.enums.channel.PayChannelEnum; -import com.github.binarywang.wxpay.constant.WxPayConstants; -import com.github.binarywang.wxpay.exception.WxPayException; - -// TODO 芋艿:未实现 -public class WxH5PayClient extends AbstractWxPayClient { - - public WxH5PayClient(Long channelId, WxPayClientConfig config) { - super(channelId, PayChannelEnum.WX_H5.getCode(), config); - } - - @Override - protected void doInit() { - super.doInit(WxPayConstants.TradeType.MWEB); - } - - @Override - protected PayOrderRespDTO doUnifiedOrderV2(PayOrderUnifiedReqDTO reqDTO) throws WxPayException { - return null; - } - - @Override - protected PayOrderRespDTO doUnifiedOrderV3(PayOrderUnifiedReqDTO reqDTO) throws WxPayException { - return null; - } - -} diff --git a/yudao-framework/yudao-spring-boot-starter-biz-pay/src/main/java/cn/iocoder/yudao/framework/pay/core/enums/channel/PayChannelEnum.java b/yudao-framework/yudao-spring-boot-starter-biz-pay/src/main/java/cn/iocoder/yudao/framework/pay/core/enums/channel/PayChannelEnum.java index 44055e16d..78bb85f1a 100644 --- a/yudao-framework/yudao-spring-boot-starter-biz-pay/src/main/java/cn/iocoder/yudao/framework/pay/core/enums/channel/PayChannelEnum.java +++ b/yudao-framework/yudao-spring-boot-starter-biz-pay/src/main/java/cn/iocoder/yudao/framework/pay/core/enums/channel/PayChannelEnum.java @@ -21,7 +21,6 @@ public enum PayChannelEnum { WX_APP("wx_app", "微信 App 支付", WxPayClientConfig.class), WX_NATIVE("wx_native", "微信 Native 支付", WxPayClientConfig.class), WX_BAR("wx_bar", "微信付款码支付", WxPayClientConfig.class), - WX_H5("wx_h5", "微信 H5 支付", WxPayClientConfig.class), ALIPAY_PC("alipay_pc", "支付宝 PC 网站支付", AlipayPayClientConfig.class), ALIPAY_WAP("alipay_wap", "支付宝 Wap 网站支付", AlipayPayClientConfig.class), diff --git a/yudao-ui-admin/src/utils/constants.js b/yudao-ui-admin/src/utils/constants.js index a4805096d..9b79031c9 100644 --- a/yudao-ui-admin/src/utils/constants.js +++ b/yudao-ui-admin/src/utils/constants.js @@ -177,6 +177,9 @@ export const PayDisplayModeEnum = { }, QR_CODE: { "mode": "qr_code" + }, + APP: { + "mode": "app" } } diff --git a/yudao-ui-admin/src/views/pay/cashier/index.vue b/yudao-ui-admin/src/views/pay/cashier/index.vue index 7569a3b04..fba93235b 100644 --- a/yudao-ui-admin/src/views/pay/cashier/index.vue +++ b/yudao-ui-admin/src/views/pay/cashier/index.vue @@ -106,7 +106,7 @@ export default { code: "alipay_app" }, { name: '支付宝扫码支付', - icon: require("@/assets/images/pay/icon/alipay_app.svg"), + icon: require("@/assets/images/pay/icon/alipay_qr.svg"), code: "alipay_qr" }, { name: '支付宝条码支付', @@ -237,6 +237,8 @@ export default { this.displayUrl(channelCode, data) } else if (data.displayMode === PayDisplayModeEnum.QR_CODE.mode) { this.displayQrCode(channelCode, data) + } else if (data.displayMode === PayDisplayModeEnum.APP.mode) { + this.displayApp(channelCode, data) } // 打开轮询任务 @@ -270,7 +272,7 @@ export default { location.href = data.displayContent this.submitLoading = false }, - /** 提交支付后(支付宝扫码支付) */ + /** 提交支付后(扫码支付) */ displayQrCode(channelCode, data) { let title = '请使用手机浏览器“扫一扫”'; if (channelCode === PayChannelEnum.ALIPAY_WAP.code) { @@ -287,6 +289,14 @@ export default { } this.submitLoading = false }, + /** 提交支付后(App) */ + displayApp(channelCode, data) { + if (channelCode === PayChannelEnum.ALIPAY_APP.code) { + this.$message.error('支付宝 App 无法在网页支付!'); + } + this.submitLoading = false + }, + /** 轮询查询任务 */ createQueryInterval() { if (this.interval) {