|
|
@@ -63,17 +63,9 @@ public class AliPayCommonServiceImpl implements AliPayCommonService {
|
|
|
private final SysConfigService sysConfigService;
|
|
|
|
|
|
@Override
|
|
|
- public String unifiedPayRegister(Long orderId, Integer type, Integer payMode, String returnUrl) throws Exception {
|
|
|
+ public AliPayParams unifiedPayRegister(Long orderId, String productCode, String payMode, String returnUrl) throws Exception {
|
|
|
RegisterOrderDon orderDon = registerOrderDonMapper.selectById(orderId);
|
|
|
Assert.notNull(orderDon, "订单不存在");
|
|
|
- if (type == null) throw BusinessRuntimeException.getInstance("请选择对应支付方式");
|
|
|
- String productCode = StrUtil.EMPTY;
|
|
|
- if (type == 1) {
|
|
|
- productCode = ZfbProductCode.MOBILE_WEB.getProductCode();
|
|
|
- }
|
|
|
- if (type == 2) {
|
|
|
- productCode = ZfbProductCode.PC_WEB.getProductCode();
|
|
|
- }
|
|
|
if (StrUtil.isEmpty(productCode)) throw BusinessRuntimeException.getInstance("支付异常");
|
|
|
//获取支付宝默认商户
|
|
|
String shopId = sysConfigService.getDefaultShopConfigByType("zfb");
|
|
|
@@ -86,7 +78,7 @@ public class AliPayCommonServiceImpl implements AliPayCommonService {
|
|
|
//回调地址
|
|
|
String host = envCommonService.getHost();
|
|
|
String notifyUrl = String.format("%s%s", host, BaseZfbConfig.zfb_register_notify_url);
|
|
|
- if (type == 2 && payMode == 2) {
|
|
|
+ if (ZfbProductCode.MOBILE_WEB.getProductCode().equals(productCode) && BaseZfbConfig.qrPayMode_redirect.equals(payMode)) {
|
|
|
returnUrl = String.format("%s%s", envCommonService.getDomain(), BaseZfbConfig.zfb_register_login_return_url);
|
|
|
}
|
|
|
String subject = "注册服务";
|
|
|
@@ -99,12 +91,11 @@ public class AliPayCommonServiceImpl implements AliPayCommonService {
|
|
|
String.valueOf(payMode),
|
|
|
notifyUrl,
|
|
|
returnUrl);
|
|
|
- String body = aliPayParams.getBody();
|
|
|
- return body;
|
|
|
+ return aliPayParams;
|
|
|
}
|
|
|
|
|
|
@Override
|
|
|
- public String unifiedPay(Long orderId, Integer type, Integer payMode, String returnUrl, String productCode, String mode) throws Exception {
|
|
|
+ public AliPayParams unifiedPay(Long orderId, String payMode, String productCode, String returnUrl) throws Exception {
|
|
|
OrderDon orderDon = orderDonMapper.selectById(orderId);
|
|
|
//获取支付宝默认商户
|
|
|
String appId = sysConfigService.getDefaultShopConfigByType("zfb");
|
|
|
@@ -124,7 +115,7 @@ public class AliPayCommonServiceImpl implements AliPayCommonService {
|
|
|
//回调地址
|
|
|
String host = envCommonService.getHost();
|
|
|
String notifyUrl = String.format("%s%s", host, BaseZfbConfig.notifyUrl);
|
|
|
- if (type == 2 && payMode == 2) {
|
|
|
+ if (ZfbProductCode.MOBILE_WEB.getProductCode().equals(productCode) && BaseZfbConfig.qrPayMode_redirect.equals(payMode)) {
|
|
|
returnUrl = String.format("%s%s", envCommonService.getDomain(), BaseZfbConfig.loginReturnUrl);
|
|
|
}
|
|
|
AliPayParams aliPayParams = builderPayParams(orderDon.getId(),
|
|
|
@@ -136,8 +127,7 @@ public class AliPayCommonServiceImpl implements AliPayCommonService {
|
|
|
String.valueOf(payMode),
|
|
|
notifyUrl,
|
|
|
returnUrl);
|
|
|
- String body = aliPayParams.getBody();
|
|
|
- return body;
|
|
|
+ return aliPayParams;
|
|
|
}
|
|
|
|
|
|
public AliPayParams builderPayParams(Long orderId, String shopId, BigDecimal money, Date orderCreatedTime, String subject, String productCode, String payMode, String notifyUrl, String returnUrl) throws Exception {
|
|
|
@@ -224,6 +214,9 @@ public class AliPayCommonServiceImpl implements AliPayCommonService {
|
|
|
alipayTradePagePayModel.setProductCode(productCode);
|
|
|
//5分钟订单失效时间
|
|
|
alipayTradePagePayModel.setTimeExpire(DateUtil.offsetMinute(orderCreatedTime, 5).toString());
|
|
|
+ if (StrUtil.isEmpty(qrPayMode)) {
|
|
|
+ qrPayMode = BaseZfbConfig.qrPayMode_orderCode;
|
|
|
+ }
|
|
|
alipayTradePagePayModel.setQrPayMode(qrPayMode);
|
|
|
alipayTradePagePayRequest.setBizModel(alipayTradePagePayModel);
|
|
|
return alipayTradePagePayRequest;
|