兼容云闪付各个机构支付返回的相关数据保持统一; 解决微信subappid未传入的问题;

This commit is contained in:
terrfly 2021-09-14 11:10:26 +08:00
parent f1e08b52dc
commit ecc4bd10bb
2 changed files with 13 additions and 1 deletions

View File

@ -15,10 +15,12 @@
*/
package com.jeequan.jeepay.pay.channel.ysfpay.payway;
import cn.hutool.core.date.DateUtil;
import com.alibaba.fastjson.JSON;
import com.alibaba.fastjson.JSONObject;
import com.jeequan.jeepay.core.entity.PayOrder;
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.model.MchAppConfigContext;
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.springframework.stereotype.Service;
import java.util.Date;
/*
* 云闪付 支付宝 jsapi
*
@ -85,8 +89,10 @@ public class AliJsapi extends YsfpayPaymentService {
tradeNo = payDataJSON.getString("tradeNo");
}else{
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);
}else{
tradeNo = prepayId;
}
}
res.setAlipayTradeNo(tradeNo);

View File

@ -16,8 +16,10 @@
package com.jeequan.jeepay.pay.channel.ysfpay.payway;
import com.alibaba.fastjson.JSONObject;
import com.jeequan.jeepay.core.constants.CS;
import com.jeequan.jeepay.core.entity.PayOrder;
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.rqrs.AbstractRS;
import com.jeequan.jeepay.pay.rqrs.payorder.UnifiedOrderRQ;
@ -67,6 +69,10 @@ public class WxJsapi extends YsfpayPaymentService {
//客户端IP
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);
//请求 & 响应成功 判断业务逻辑