扫码支付 区分平台
This commit is contained in:
@@ -84,7 +84,7 @@ public class PayServiceImpl implements PayService {
|
|||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public CzgResult<CzgRefundResp> refundOrder(@NonNull Long shopId, @NonNull Long orderId,@NonNull String refundReason,@NonNull BigDecimal refundAmount) {
|
public CzgResult<CzgRefundResp> refundOrder(@NonNull Long shopId, @NonNull Long orderId, @NonNull String refundReason, @NonNull BigDecimal refundAmount) {
|
||||||
|
|
||||||
// refund(shopId, new CzgRefundReq("1", refundReason, refundAmount.multiply(MONEY_RATE).longValue(),
|
// refund(shopId, new CzgRefundReq("1", refundReason, refundAmount.multiply(MONEY_RATE).longValue(),
|
||||||
// "1", refundJsonExtParam));
|
// "1", refundJsonExtParam));
|
||||||
@@ -115,7 +115,6 @@ public class PayServiceImpl implements PayService {
|
|||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
private CzgResult<CzgH5PayResp> h5Pay(@NonNull Long shopId, CzgH5PayReq bizData) {
|
private CzgResult<CzgH5PayResp> h5Pay(@NonNull Long shopId, CzgH5PayReq bizData) {
|
||||||
ShopMerchant shopMerchant = shopMerchantService.getById(shopId);
|
ShopMerchant shopMerchant = shopMerchantService.getById(shopId);
|
||||||
bizData.assignMerchant(shopMerchant.getStoreId(), shopMerchant.getMerchantName(),
|
bizData.assignMerchant(shopMerchant.getStoreId(), shopMerchant.getMerchantName(),
|
||||||
@@ -125,19 +124,19 @@ public class PayServiceImpl implements PayService {
|
|||||||
|
|
||||||
private CzgResult<CzgJsPayResp> jsPay(@NonNull Long shopId, @NonNull String payType, CzgJsPayReq bizData) {
|
private CzgResult<CzgJsPayResp> jsPay(@NonNull Long shopId, @NonNull String payType, CzgJsPayReq bizData) {
|
||||||
ShopMerchant shopMerchant = shopMerchantService.getById(shopId);
|
ShopMerchant shopMerchant = shopMerchantService.getById(shopId);
|
||||||
bizData.setSubAppid("aliPay" .equals(payType) ? shopMerchant.getAlipaySmallAppid() : shopMerchant.getWechatSmallAppid());
|
|
||||||
AssertUtil.isBlank(bizData.getSubAppid(), "暂不可用,请联系商家配置" + ("aliPay" .equals(payType) ? "支付宝" : "微信") + "小程序");
|
AssertUtil.isBlank(bizData.getSubAppid(), "暂不可用,请联系商家配置" + ("aliPay" .equals(payType) ? "支付宝" : "微信") + "小程序");
|
||||||
bizData.assignMerchant(shopMerchant.getStoreId(), shopMerchant.getMerchantName(),
|
bizData.assignMerchant(shopMerchant.getStoreId(), shopMerchant.getMerchantName(),
|
||||||
sysParamsService.getSysParamValue(SysParamCodeEnum.PAY_CZG_NOTIFY_URL.getCode()));
|
sysParamsService.getSysParamValue(SysParamCodeEnum.PAY_CZG_NOTIFY_URL.getCode()));
|
||||||
|
bizData.setSubAppid("aliPay" .equals(payType) ? shopMerchant.getAlipaySmallAppid() : shopMerchant.getWechatSmallAppid());
|
||||||
return czgPayService.jsPay(shopMerchant.getAppId(), shopMerchant.getAppSecret(), bizData);
|
return czgPayService.jsPay(shopMerchant.getAppId(), shopMerchant.getAppSecret(), bizData);
|
||||||
}
|
}
|
||||||
|
|
||||||
private CzgResult<CzgLtPayResp> ltPay(@NonNull Long shopId, String payType, CzgLtPayReq bizData) {
|
private CzgResult<CzgLtPayResp> ltPay(@NonNull Long shopId, String payType, CzgLtPayReq bizData) {
|
||||||
ShopMerchant shopMerchant = shopMerchantService.getById(shopId);
|
ShopMerchant shopMerchant = shopMerchantService.getById(shopId);
|
||||||
bizData.setSubAppid("aliPay" .equals(payType) ? shopMerchant.getAlipaySmallAppid() : shopMerchant.getWechatSmallAppid());
|
|
||||||
AssertUtil.isBlank(bizData.getSubAppid(), "暂不可用,请联系商家配置" + ("aliPay" .equals(payType) ? "支付宝" : "微信") + "小程序");
|
AssertUtil.isBlank(bizData.getSubAppid(), "暂不可用,请联系商家配置" + ("aliPay" .equals(payType) ? "支付宝" : "微信") + "小程序");
|
||||||
bizData.assignMerchant(shopMerchant.getStoreId(), shopMerchant.getMerchantName(),
|
bizData.assignMerchant(shopMerchant.getStoreId(), shopMerchant.getMerchantName(),
|
||||||
sysParamsService.getSysParamValue(SysParamCodeEnum.PAY_CZG_NOTIFY_URL.getCode()));
|
sysParamsService.getSysParamValue(SysParamCodeEnum.PAY_CZG_NOTIFY_URL.getCode()));
|
||||||
|
bizData.setSubAppid("aliPay" .equals(payType) ? shopMerchant.getAlipaySmallAppid() : shopMerchant.getWechatSmallAppid());
|
||||||
return czgPayService.ltPay(shopMerchant.getAppId(), shopMerchant.getAppSecret(), bizData);
|
return czgPayService.ltPay(shopMerchant.getAppId(), shopMerchant.getAppSecret(), bizData);
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -152,6 +151,21 @@ public class PayServiceImpl implements PayService {
|
|||||||
ShopMerchant shopMerchant = shopMerchantService.getById(shopId);
|
ShopMerchant shopMerchant = shopMerchantService.getById(shopId);
|
||||||
bizData.assignMerchant(shopMerchant.getStoreId(), shopMerchant.getMerchantName(),
|
bizData.assignMerchant(shopMerchant.getStoreId(), shopMerchant.getMerchantName(),
|
||||||
sysParamsService.getSysParamValue(SysParamCodeEnum.PAY_CZG_NOTIFY_URL.getCode()));
|
sysParamsService.getSysParamValue(SysParamCodeEnum.PAY_CZG_NOTIFY_URL.getCode()));
|
||||||
|
AssertUtil.isBlank(bizData.getAuthCode(), "扫码失败,请重试");
|
||||||
|
String firstTwoDigitsStr = bizData.getAuthCode().substring(0, 2);
|
||||||
|
|
||||||
|
// 将截取的字符串转换为整数
|
||||||
|
int firstTwoDigits = Integer.parseInt(firstTwoDigitsStr);
|
||||||
|
|
||||||
|
// 判断范围
|
||||||
|
if (firstTwoDigits >= 10 && firstTwoDigits <= 15) {
|
||||||
|
//微信支付
|
||||||
|
bizData.setSubAppid(shopMerchant.getWechatSmallAppid());
|
||||||
|
} else if (firstTwoDigits >= 25 && firstTwoDigits <= 30) {
|
||||||
|
//支付宝支付
|
||||||
|
bizData.setSubAppid(shopMerchant.getAlipaySmallAppid());
|
||||||
|
}
|
||||||
|
|
||||||
return czgPayService.microPay(shopMerchant.getAppId(), shopMerchant.getAppSecret(), bizData);
|
return czgPayService.microPay(shopMerchant.getAppId(), shopMerchant.getAppSecret(), bizData);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
Reference in New Issue
Block a user