Commit 5ae43a238ddf947992185764bbdae96314631366
1 parent
73e11588
1. 修复支付宝 App 发起报错的问题
2. 移除微信 H5 支付,基本没人使用,减少复杂性
Showing
7 changed files
with
21 additions
and
40 deletions
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<Config extends PayClientConfig> implemen |
| 83 | 83 | resp = doUnifiedOrder(reqDTO); |
| 84 | 84 | } catch (Throwable ex) { |
| 85 | 85 | // 系统异常,则包装成 PayException 异常抛出 |
| 86 | - log.error("[unifiedRefund][客户端({}) request({}) 发起支付异常]", | |
| 86 | + log.error("[unifiedOrder][客户端({}) request({}) 发起支付异常]", | |
| 87 | 87 | getId(), toJsonString(reqDTO), ex); |
| 88 | 88 | throw buildPayException(ex); |
| 89 | 89 | } | ... | ... |
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 { |
| 62 | 62 | case WX_APP: return (AbstractPayClient<Config>) new WxAppPayClient(channelId, (WxPayClientConfig) config); |
| 63 | 63 | case WX_BAR: return (AbstractPayClient<Config>) new WxBarPayClient(channelId, (WxPayClientConfig) config); |
| 64 | 64 | case WX_NATIVE: return (AbstractPayClient<Config>) new WxNativePayClient(channelId, (WxPayClientConfig) config); |
| 65 | - case WX_H5: return (AbstractPayClient<Config>) new WxH5PayClient(channelId, (WxPayClientConfig) config); | |
| 66 | 65 | // 支付宝支付 |
| 67 | 66 | case ALIPAY_WAP: return (AbstractPayClient<Config>) new AlipayWapPayClient(channelId, (AlipayPayClientConfig) config); |
| 68 | 67 | case ALIPAY_QR: return (AbstractPayClient<Config>) new AlipayQrPayClient(channelId, (AlipayPayClientConfig) config); | ... | ... |
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 { |
| 33 | 33 | // ① 通用的参数 |
| 34 | 34 | model.setOutTradeNo(reqDTO.getOutTradeNo()); |
| 35 | 35 | model.setSubject(reqDTO.getSubject()); |
| 36 | - model.setBody(reqDTO.getBody()); | |
| 36 | + model.setBody(reqDTO.getBody() + "test"); | |
| 37 | 37 | model.setTotalAmount(formatAmount(reqDTO.getPrice())); |
| 38 | - model.setProductCode(" QUICK_MSECURITY_PAY"); // 销售产品码:无线快捷支付产品 | |
| 38 | + model.setTimeExpire(formatTime(reqDTO.getExpireTime())); | |
| 39 | + model.setProductCode("QUICK_MSECURITY_PAY"); // 销售产品码:无线快捷支付产品 | |
| 39 | 40 | // ② 个性化的参数【无】 |
| 40 | 41 | // ③ 支付宝扫码支付只有一种展示 |
| 41 | 42 | String displayMode = PayOrderDisplayModeEnum.APP.getMode(); |
| ... | ... | @@ -47,12 +48,12 @@ public class AlipayAppPayClient extends AbstractAlipayPayClient { |
| 47 | 48 | request.setReturnUrl(reqDTO.getReturnUrl()); |
| 48 | 49 | |
| 49 | 50 | // 2.1 执行请求 |
| 50 | - AlipayTradeAppPayResponse response = client.execute(request); | |
| 51 | + AlipayTradeAppPayResponse response = client.sdkExecute(request); | |
| 51 | 52 | // 2.2 处理结果 |
| 52 | 53 | if (!response.isSuccess()) { |
| 53 | 54 | return buildClosedPayOrderRespDTO(reqDTO, response); |
| 54 | 55 | } |
| 55 | - return PayOrderRespDTO.waitingOf(displayMode, "", | |
| 56 | + return PayOrderRespDTO.waitingOf(displayMode, response.getBody(), | |
| 56 | 57 | reqDTO.getOutTradeNo(), response); |
| 57 | 58 | } |
| 58 | 59 | ... | ... |
yudao-framework/yudao-spring-boot-starter-biz-pay/src/main/java/cn/iocoder/yudao/framework/pay/core/client/impl/weixin/WxH5PayClient.java deleted
| 1 | -package cn.iocoder.yudao.framework.pay.core.client.impl.weixin; | |
| 2 | - | |
| 3 | -import cn.iocoder.yudao.framework.pay.core.client.dto.order.PayOrderRespDTO; | |
| 4 | -import cn.iocoder.yudao.framework.pay.core.client.dto.order.PayOrderUnifiedReqDTO; | |
| 5 | -import cn.iocoder.yudao.framework.pay.core.enums.channel.PayChannelEnum; | |
| 6 | -import com.github.binarywang.wxpay.constant.WxPayConstants; | |
| 7 | -import com.github.binarywang.wxpay.exception.WxPayException; | |
| 8 | - | |
| 9 | -// TODO 芋艿:未实现 | |
| 10 | -public class WxH5PayClient extends AbstractWxPayClient { | |
| 11 | - | |
| 12 | - public WxH5PayClient(Long channelId, WxPayClientConfig config) { | |
| 13 | - super(channelId, PayChannelEnum.WX_H5.getCode(), config); | |
| 14 | - } | |
| 15 | - | |
| 16 | - @Override | |
| 17 | - protected void doInit() { | |
| 18 | - super.doInit(WxPayConstants.TradeType.MWEB); | |
| 19 | - } | |
| 20 | - | |
| 21 | - @Override | |
| 22 | - protected PayOrderRespDTO doUnifiedOrderV2(PayOrderUnifiedReqDTO reqDTO) throws WxPayException { | |
| 23 | - return null; | |
| 24 | - } | |
| 25 | - | |
| 26 | - @Override | |
| 27 | - protected PayOrderRespDTO doUnifiedOrderV3(PayOrderUnifiedReqDTO reqDTO) throws WxPayException { | |
| 28 | - return null; | |
| 29 | - } | |
| 30 | - | |
| 31 | -} |
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 { |
| 21 | 21 | WX_APP("wx_app", "微信 App 支付", WxPayClientConfig.class), |
| 22 | 22 | WX_NATIVE("wx_native", "微信 Native 支付", WxPayClientConfig.class), |
| 23 | 23 | WX_BAR("wx_bar", "微信付款码支付", WxPayClientConfig.class), |
| 24 | - WX_H5("wx_h5", "微信 H5 支付", WxPayClientConfig.class), | |
| 25 | 24 | |
| 26 | 25 | ALIPAY_PC("alipay_pc", "支付宝 PC 网站支付", AlipayPayClientConfig.class), |
| 27 | 26 | ALIPAY_WAP("alipay_wap", "支付宝 Wap 网站支付", AlipayPayClientConfig.class), | ... | ... |
yudao-ui-admin/src/utils/constants.js
yudao-ui-admin/src/views/pay/cashier/index.vue
| ... | ... | @@ -106,7 +106,7 @@ export default { |
| 106 | 106 | code: "alipay_app" |
| 107 | 107 | }, { |
| 108 | 108 | name: '支付宝扫码支付', |
| 109 | - icon: require("@/assets/images/pay/icon/alipay_app.svg"), | |
| 109 | + icon: require("@/assets/images/pay/icon/alipay_qr.svg"), | |
| 110 | 110 | code: "alipay_qr" |
| 111 | 111 | }, { |
| 112 | 112 | name: '支付宝条码支付', |
| ... | ... | @@ -237,6 +237,8 @@ export default { |
| 237 | 237 | this.displayUrl(channelCode, data) |
| 238 | 238 | } else if (data.displayMode === PayDisplayModeEnum.QR_CODE.mode) { |
| 239 | 239 | this.displayQrCode(channelCode, data) |
| 240 | + } else if (data.displayMode === PayDisplayModeEnum.APP.mode) { | |
| 241 | + this.displayApp(channelCode, data) | |
| 240 | 242 | } |
| 241 | 243 | |
| 242 | 244 | // 打开轮询任务 |
| ... | ... | @@ -270,7 +272,7 @@ export default { |
| 270 | 272 | location.href = data.displayContent |
| 271 | 273 | this.submitLoading = false |
| 272 | 274 | }, |
| 273 | - /** 提交支付后(支付宝扫码支付) */ | |
| 275 | + /** 提交支付后(扫码支付) */ | |
| 274 | 276 | displayQrCode(channelCode, data) { |
| 275 | 277 | let title = '请使用手机浏览器“扫一扫”'; |
| 276 | 278 | if (channelCode === PayChannelEnum.ALIPAY_WAP.code) { |
| ... | ... | @@ -287,6 +289,14 @@ export default { |
| 287 | 289 | } |
| 288 | 290 | this.submitLoading = false |
| 289 | 291 | }, |
| 292 | + /** 提交支付后(App) */ | |
| 293 | + displayApp(channelCode, data) { | |
| 294 | + if (channelCode === PayChannelEnum.ALIPAY_APP.code) { | |
| 295 | + this.$message.error('支付宝 App 无法在网页支付!'); | |
| 296 | + } | |
| 297 | + this.submitLoading = false | |
| 298 | + }, | |
| 299 | + | |
| 290 | 300 | /** 轮询查询任务 */ |
| 291 | 301 | createQueryInterval() { |
| 292 | 302 | if (this.interval) { | ... | ... |