mirror of
https://github.com/jeequan/jeepay
synced 2024-11-17 23:08:03 +08:00
兼容云闪付各个机构支付返回的相关数据保持统一; 解决微信subappid未传入的问题;
This commit is contained in:
parent
f1e08b52dc
commit
ecc4bd10bb
@ -15,10 +15,12 @@
|
|||||||
*/
|
*/
|
||||||
package com.jeequan.jeepay.pay.channel.ysfpay.payway;
|
package com.jeequan.jeepay.pay.channel.ysfpay.payway;
|
||||||
|
|
||||||
|
import cn.hutool.core.date.DateUtil;
|
||||||
import com.alibaba.fastjson.JSON;
|
import com.alibaba.fastjson.JSON;
|
||||||
import com.alibaba.fastjson.JSONObject;
|
import com.alibaba.fastjson.JSONObject;
|
||||||
import com.jeequan.jeepay.core.entity.PayOrder;
|
import com.jeequan.jeepay.core.entity.PayOrder;
|
||||||
import com.jeequan.jeepay.core.exception.BizException;
|
import com.jeequan.jeepay.core.exception.BizException;
|
||||||
|
import com.jeequan.jeepay.core.utils.DateKit;
|
||||||
import com.jeequan.jeepay.pay.channel.ysfpay.YsfpayPaymentService;
|
import com.jeequan.jeepay.pay.channel.ysfpay.YsfpayPaymentService;
|
||||||
import com.jeequan.jeepay.pay.model.MchAppConfigContext;
|
import com.jeequan.jeepay.pay.model.MchAppConfigContext;
|
||||||
import com.jeequan.jeepay.pay.rqrs.AbstractRS;
|
import com.jeequan.jeepay.pay.rqrs.AbstractRS;
|
||||||
@ -30,6 +32,8 @@ import com.jeequan.jeepay.pay.util.ApiResBuilder;
|
|||||||
import org.apache.commons.lang3.StringUtils;
|
import org.apache.commons.lang3.StringUtils;
|
||||||
import org.springframework.stereotype.Service;
|
import org.springframework.stereotype.Service;
|
||||||
|
|
||||||
|
import java.util.Date;
|
||||||
|
|
||||||
/*
|
/*
|
||||||
* 云闪付 支付宝 jsapi
|
* 云闪付 支付宝 jsapi
|
||||||
*
|
*
|
||||||
@ -85,8 +89,10 @@ public class AliJsapi extends YsfpayPaymentService {
|
|||||||
tradeNo = payDataJSON.getString("tradeNo");
|
tradeNo = payDataJSON.getString("tradeNo");
|
||||||
}else{
|
}else{
|
||||||
String prepayId = payDataJSON.getString("prepayId");
|
String prepayId = payDataJSON.getString("prepayId");
|
||||||
if(prepayId != null && prepayId.length() > 2){
|
if(prepayId != null && prepayId.length() > 2 && !prepayId.startsWith(DateUtil.format(new Date(), "yyyy"))){
|
||||||
tradeNo = prepayId.substring(2);
|
tradeNo = prepayId.substring(2);
|
||||||
|
}else{
|
||||||
|
tradeNo = prepayId;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
res.setAlipayTradeNo(tradeNo);
|
res.setAlipayTradeNo(tradeNo);
|
||||||
|
@ -16,8 +16,10 @@
|
|||||||
package com.jeequan.jeepay.pay.channel.ysfpay.payway;
|
package com.jeequan.jeepay.pay.channel.ysfpay.payway;
|
||||||
|
|
||||||
import com.alibaba.fastjson.JSONObject;
|
import com.alibaba.fastjson.JSONObject;
|
||||||
|
import com.jeequan.jeepay.core.constants.CS;
|
||||||
import com.jeequan.jeepay.core.entity.PayOrder;
|
import com.jeequan.jeepay.core.entity.PayOrder;
|
||||||
import com.jeequan.jeepay.core.exception.BizException;
|
import com.jeequan.jeepay.core.exception.BizException;
|
||||||
|
import com.jeequan.jeepay.core.model.params.wxpay.WxpayIsvParams;
|
||||||
import com.jeequan.jeepay.pay.channel.ysfpay.YsfpayPaymentService;
|
import com.jeequan.jeepay.pay.channel.ysfpay.YsfpayPaymentService;
|
||||||
import com.jeequan.jeepay.pay.rqrs.AbstractRS;
|
import com.jeequan.jeepay.pay.rqrs.AbstractRS;
|
||||||
import com.jeequan.jeepay.pay.rqrs.payorder.UnifiedOrderRQ;
|
import com.jeequan.jeepay.pay.rqrs.payorder.UnifiedOrderRQ;
|
||||||
@ -67,6 +69,10 @@ public class WxJsapi extends YsfpayPaymentService {
|
|||||||
//客户端IP
|
//客户端IP
|
||||||
reqParams.put("customerIp", StringUtils.defaultIfEmpty(payOrder.getClientIp(), "127.0.0.1"));
|
reqParams.put("customerIp", StringUtils.defaultIfEmpty(payOrder.getClientIp(), "127.0.0.1"));
|
||||||
|
|
||||||
|
// 获取微信官方配置 的appId
|
||||||
|
WxpayIsvParams wxpayIsvParams = mchAppConfigContext.getIsvConfigContext().getIsvParamsByIfCode(CS.IF_CODE.WXPAY, WxpayIsvParams.class);
|
||||||
|
reqParams.put("subAppId", wxpayIsvParams.getAppId()); //用户ID
|
||||||
|
|
||||||
// 发送请求并返回订单状态
|
// 发送请求并返回订单状态
|
||||||
JSONObject resJSON = packageParamAndReq("/gateway/api/pay/unifiedorder", reqParams, logPrefix, mchAppConfigContext.getIsvConfigContext(), mchAppConfigContext);
|
JSONObject resJSON = packageParamAndReq("/gateway/api/pay/unifiedorder", reqParams, logPrefix, mchAppConfigContext.getIsvConfigContext(), mchAppConfigContext);
|
||||||
//请求 & 响应成功, 判断业务逻辑
|
//请求 & 响应成功, 判断业务逻辑
|
||||||
|
Loading…
Reference in New Issue
Block a user