mirror of
https://gitee.com/huangge1199_admin/vue-pro.git
synced 2024-11-23 07:41:53 +08:00
1. 修复支付宝 App 发起报错的问题
2. 移除微信 H5 支付,基本没人使用,减少复杂性
This commit is contained in:
parent
73e1158836
commit
5ae43a238d
@ -83,7 +83,7 @@ public abstract class AbstractPayClient<Config extends PayClientConfig> implemen
|
|||||||
resp = doUnifiedOrder(reqDTO);
|
resp = doUnifiedOrder(reqDTO);
|
||||||
} catch (Throwable ex) {
|
} catch (Throwable ex) {
|
||||||
// 系统异常,则包装成 PayException 异常抛出
|
// 系统异常,则包装成 PayException 异常抛出
|
||||||
log.error("[unifiedRefund][客户端({}) request({}) 发起支付异常]",
|
log.error("[unifiedOrder][客户端({}) request({}) 发起支付异常]",
|
||||||
getId(), toJsonString(reqDTO), ex);
|
getId(), toJsonString(reqDTO), ex);
|
||||||
throw buildPayException(ex);
|
throw buildPayException(ex);
|
||||||
}
|
}
|
||||||
|
@ -62,7 +62,6 @@ public class PayClientFactoryImpl implements PayClientFactory {
|
|||||||
case WX_APP: return (AbstractPayClient<Config>) new WxAppPayClient(channelId, (WxPayClientConfig) config);
|
case WX_APP: return (AbstractPayClient<Config>) new WxAppPayClient(channelId, (WxPayClientConfig) config);
|
||||||
case WX_BAR: return (AbstractPayClient<Config>) new WxBarPayClient(channelId, (WxPayClientConfig) config);
|
case WX_BAR: return (AbstractPayClient<Config>) new WxBarPayClient(channelId, (WxPayClientConfig) config);
|
||||||
case WX_NATIVE: return (AbstractPayClient<Config>) new WxNativePayClient(channelId, (WxPayClientConfig) config);
|
case WX_NATIVE: return (AbstractPayClient<Config>) new WxNativePayClient(channelId, (WxPayClientConfig) config);
|
||||||
case WX_H5: return (AbstractPayClient<Config>) new WxH5PayClient(channelId, (WxPayClientConfig) config);
|
|
||||||
// 支付宝支付
|
// 支付宝支付
|
||||||
case ALIPAY_WAP: return (AbstractPayClient<Config>) new AlipayWapPayClient(channelId, (AlipayPayClientConfig) config);
|
case ALIPAY_WAP: return (AbstractPayClient<Config>) new AlipayWapPayClient(channelId, (AlipayPayClientConfig) config);
|
||||||
case ALIPAY_QR: return (AbstractPayClient<Config>) new AlipayQrPayClient(channelId, (AlipayPayClientConfig) config);
|
case ALIPAY_QR: return (AbstractPayClient<Config>) new AlipayQrPayClient(channelId, (AlipayPayClientConfig) config);
|
||||||
|
@ -33,8 +33,9 @@ public class AlipayAppPayClient extends AbstractAlipayPayClient {
|
|||||||
// ① 通用的参数
|
// ① 通用的参数
|
||||||
model.setOutTradeNo(reqDTO.getOutTradeNo());
|
model.setOutTradeNo(reqDTO.getOutTradeNo());
|
||||||
model.setSubject(reqDTO.getSubject());
|
model.setSubject(reqDTO.getSubject());
|
||||||
model.setBody(reqDTO.getBody());
|
model.setBody(reqDTO.getBody() + "test");
|
||||||
model.setTotalAmount(formatAmount(reqDTO.getPrice()));
|
model.setTotalAmount(formatAmount(reqDTO.getPrice()));
|
||||||
|
model.setTimeExpire(formatTime(reqDTO.getExpireTime()));
|
||||||
model.setProductCode("QUICK_MSECURITY_PAY"); // 销售产品码:无线快捷支付产品
|
model.setProductCode("QUICK_MSECURITY_PAY"); // 销售产品码:无线快捷支付产品
|
||||||
// ② 个性化的参数【无】
|
// ② 个性化的参数【无】
|
||||||
// ③ 支付宝扫码支付只有一种展示
|
// ③ 支付宝扫码支付只有一种展示
|
||||||
@ -47,12 +48,12 @@ public class AlipayAppPayClient extends AbstractAlipayPayClient {
|
|||||||
request.setReturnUrl(reqDTO.getReturnUrl());
|
request.setReturnUrl(reqDTO.getReturnUrl());
|
||||||
|
|
||||||
// 2.1 执行请求
|
// 2.1 执行请求
|
||||||
AlipayTradeAppPayResponse response = client.execute(request);
|
AlipayTradeAppPayResponse response = client.sdkExecute(request);
|
||||||
// 2.2 处理结果
|
// 2.2 处理结果
|
||||||
if (!response.isSuccess()) {
|
if (!response.isSuccess()) {
|
||||||
return buildClosedPayOrderRespDTO(reqDTO, response);
|
return buildClosedPayOrderRespDTO(reqDTO, response);
|
||||||
}
|
}
|
||||||
return PayOrderRespDTO.waitingOf(displayMode, "",
|
return PayOrderRespDTO.waitingOf(displayMode, response.getBody(),
|
||||||
reqDTO.getOutTradeNo(), response);
|
reqDTO.getOutTradeNo(), response);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -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;
|
|
||||||
}
|
|
||||||
|
|
||||||
}
|
|
@ -21,7 +21,6 @@ public enum PayChannelEnum {
|
|||||||
WX_APP("wx_app", "微信 App 支付", WxPayClientConfig.class),
|
WX_APP("wx_app", "微信 App 支付", WxPayClientConfig.class),
|
||||||
WX_NATIVE("wx_native", "微信 Native 支付", WxPayClientConfig.class),
|
WX_NATIVE("wx_native", "微信 Native 支付", WxPayClientConfig.class),
|
||||||
WX_BAR("wx_bar", "微信付款码支付", WxPayClientConfig.class),
|
WX_BAR("wx_bar", "微信付款码支付", WxPayClientConfig.class),
|
||||||
WX_H5("wx_h5", "微信 H5 支付", WxPayClientConfig.class),
|
|
||||||
|
|
||||||
ALIPAY_PC("alipay_pc", "支付宝 PC 网站支付", AlipayPayClientConfig.class),
|
ALIPAY_PC("alipay_pc", "支付宝 PC 网站支付", AlipayPayClientConfig.class),
|
||||||
ALIPAY_WAP("alipay_wap", "支付宝 Wap 网站支付", AlipayPayClientConfig.class),
|
ALIPAY_WAP("alipay_wap", "支付宝 Wap 网站支付", AlipayPayClientConfig.class),
|
||||||
|
@ -177,6 +177,9 @@ export const PayDisplayModeEnum = {
|
|||||||
},
|
},
|
||||||
QR_CODE: {
|
QR_CODE: {
|
||||||
"mode": "qr_code"
|
"mode": "qr_code"
|
||||||
|
},
|
||||||
|
APP: {
|
||||||
|
"mode": "app"
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -106,7 +106,7 @@ export default {
|
|||||||
code: "alipay_app"
|
code: "alipay_app"
|
||||||
}, {
|
}, {
|
||||||
name: '支付宝扫码支付',
|
name: '支付宝扫码支付',
|
||||||
icon: require("@/assets/images/pay/icon/alipay_app.svg"),
|
icon: require("@/assets/images/pay/icon/alipay_qr.svg"),
|
||||||
code: "alipay_qr"
|
code: "alipay_qr"
|
||||||
}, {
|
}, {
|
||||||
name: '支付宝条码支付',
|
name: '支付宝条码支付',
|
||||||
@ -237,6 +237,8 @@ export default {
|
|||||||
this.displayUrl(channelCode, data)
|
this.displayUrl(channelCode, data)
|
||||||
} else if (data.displayMode === PayDisplayModeEnum.QR_CODE.mode) {
|
} else if (data.displayMode === PayDisplayModeEnum.QR_CODE.mode) {
|
||||||
this.displayQrCode(channelCode, data)
|
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
|
location.href = data.displayContent
|
||||||
this.submitLoading = false
|
this.submitLoading = false
|
||||||
},
|
},
|
||||||
/** 提交支付后(支付宝扫码支付) */
|
/** 提交支付后(扫码支付) */
|
||||||
displayQrCode(channelCode, data) {
|
displayQrCode(channelCode, data) {
|
||||||
let title = '请使用手机浏览器“扫一扫”';
|
let title = '请使用手机浏览器“扫一扫”';
|
||||||
if (channelCode === PayChannelEnum.ALIPAY_WAP.code) {
|
if (channelCode === PayChannelEnum.ALIPAY_WAP.code) {
|
||||||
@ -287,6 +289,14 @@ export default {
|
|||||||
}
|
}
|
||||||
this.submitLoading = false
|
this.submitLoading = false
|
||||||
},
|
},
|
||||||
|
/** 提交支付后(App) */
|
||||||
|
displayApp(channelCode, data) {
|
||||||
|
if (channelCode === PayChannelEnum.ALIPAY_APP.code) {
|
||||||
|
this.$message.error('支付宝 App 无法在网页支付!');
|
||||||
|
}
|
||||||
|
this.submitLoading = false
|
||||||
|
},
|
||||||
|
|
||||||
/** 轮询查询任务 */
|
/** 轮询查询任务 */
|
||||||
createQueryInterval() {
|
createQueryInterval() {
|
||||||
if (this.interval) {
|
if (this.interval) {
|
||||||
|
Loading…
Reference in New Issue
Block a user