mirror of
https://gitee.com/dromara/dax-pay.git
synced 2025-09-03 11:06:46 +00:00
feat 联调wap和web支付
This commit is contained in:
@@ -24,7 +24,8 @@ public enum PayWayEnum {
|
||||
QRCODE("qrcode", "扫码支付"),
|
||||
BARCODE("barcode", "付款码"),
|
||||
// 通用
|
||||
JSAPI("jsapi", "公众号/小程序支付");
|
||||
JSAPI("jsapi", "JSAPI方式"),
|
||||
B2B("b2b", "企业网银");
|
||||
|
||||
/** 编码 */
|
||||
private final String code;
|
||||
|
@@ -18,7 +18,7 @@ public class UnionPayWay {
|
||||
|
||||
// 支付方式
|
||||
private static final List<PayWayEnum> PAY_WAYS = Arrays.asList(PayWayEnum.WAP, PayWayEnum.APP, PayWayEnum.WEB,
|
||||
PayWayEnum.JSAPI, PayWayEnum.QRCODE, PayWayEnum.BARCODE);
|
||||
PayWayEnum.JSAPI, PayWayEnum.QRCODE, PayWayEnum.BARCODE,PayWayEnum.B2B);
|
||||
|
||||
/**
|
||||
* 根据编码获取
|
||||
|
@@ -84,6 +84,10 @@ public class UnionPayService {
|
||||
else if (payWayEnum == PayWayEnum.WAP) {
|
||||
payBody = this.formPay(totalFee, payOrder, unionPayKit, UnionTransactionType.WAP );
|
||||
}
|
||||
// b2b支付
|
||||
else if (payWayEnum == PayWayEnum.B2B) {
|
||||
payBody = this.b2bPay(totalFee, payOrder, unionPayKit);
|
||||
}
|
||||
|
||||
asyncPayInfo.setPayBody(payBody);
|
||||
}
|
||||
@@ -98,11 +102,27 @@ public class UnionPayService {
|
||||
unionPayOrder.setOutTradeNo(String.valueOf(payOrder.getId()));
|
||||
unionPayOrder.setSubject(payOrder.getTitle());
|
||||
unionPayOrder.setPrice(amount);
|
||||
unionPayOrder.setBankType();
|
||||
unionPayOrder.setExpirationTime(expiredTime);
|
||||
unionPayOrder.setTransactionType(type);
|
||||
return unionPayKit.toPay(unionPayOrder);
|
||||
}
|
||||
|
||||
/**
|
||||
* jsapi支付
|
||||
*/
|
||||
private String b2bPay(BigDecimal amount, PayOrder payOrder, UnionPayKit unionPayKit) {
|
||||
Date expiredTime = DateUtil.date(payOrder.getExpiredTime());
|
||||
|
||||
UnionPayOrder unionPayOrder = new UnionPayOrder();
|
||||
unionPayOrder.setOutTradeNo(String.valueOf(payOrder.getId()));
|
||||
unionPayOrder.setSubject(payOrder.getTitle());
|
||||
unionPayOrder.setPrice(amount);
|
||||
unionPayOrder.setExpirationTime(expiredTime);
|
||||
unionPayOrder.setTransactionType(UnionTransactionType.B2B);
|
||||
return unionPayKit.toPay(unionPayOrder);
|
||||
}
|
||||
|
||||
/**
|
||||
* APP支付
|
||||
*/
|
||||
|
@@ -284,14 +284,13 @@ public class UnionPayKit extends UnionPayService {
|
||||
params.put(SDKConstants.param_reqReserved, order.getAddition());
|
||||
}
|
||||
switch (type) {
|
||||
//
|
||||
case WAP:
|
||||
case WEB:
|
||||
//todo PCwap网关跳转支付特殊用法.txt
|
||||
case B2B:
|
||||
params.put(SDKConstants.param_txnAmt, Util.conversionCentAmount(order.getPrice()));
|
||||
params.put("orderDesc", order.getSubject());
|
||||
params.put(SDKConstants.param_payTimeout, getPayTimeout(order.getExpirationTime()));
|
||||
|
||||
params.put(SDKConstants.param_frontUrl, payConfigStorage.getReturnUrl());
|
||||
break;
|
||||
case CONSUME:
|
||||
|
Reference in New Issue
Block a user