Commit ca31cf06 authored by terrfly's avatar terrfly
Browse files

商户、应用、服务商配置信息支持直接数据库查询(第一卷);

parent 30b232b1
......@@ -27,8 +27,11 @@ import com.jeequan.jeepay.core.utils.SeqKit;
import com.jeequan.jeepay.pay.channel.IDivisionService;
import com.jeequan.jeepay.pay.channel.wxpay.kits.WxpayKit;
import com.jeequan.jeepay.pay.model.MchAppConfigContext;
import com.jeequan.jeepay.pay.model.WxServiceWrapper;
import com.jeequan.jeepay.pay.rqrs.msg.ChannelRetMsg;
import com.jeequan.jeepay.pay.service.ConfigContextQueryService;
import lombok.extern.slf4j.Slf4j;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;
import java.math.BigDecimal;
......@@ -45,6 +48,8 @@ import java.util.List;
@Service
public class WxpayDivisionService implements IDivisionService {
@Autowired private ConfigContextQueryService configContextQueryService;
@Override
public String getIfCode() {
return CS.IF_CODE.WXPAY;
......@@ -75,8 +80,10 @@ public class WxpayDivisionService implements IDivisionService {
receiverJSON.put("custom_relation", mchDivisionReceiver.getRelationTypeName());
request.setReceiver(receiverJSON.toJSONString());
WxServiceWrapper wxServiceWrapper = configContextQueryService.getWxServiceWrapper(mchAppConfigContext);
ProfitSharingReceiverResult profitSharingReceiverResult =
mchAppConfigContext.getWxServiceWrapper().getWxPayService().getProfitSharingService().addReceiver(request);
wxServiceWrapper.getWxPayService().getProfitSharingService().addReceiver(request);
// 明确成功
return ChannelRetMsg.confirmSuccess(null);
......@@ -137,7 +144,9 @@ public class WxpayDivisionService implements IDivisionService {
request.setReceivers(receiverJSONArray.toJSONString());
ProfitSharingResult profitSharingResult = mchAppConfigContext.getWxServiceWrapper().getWxPayService().getProfitSharingService().profitSharing(request);
WxServiceWrapper wxServiceWrapper = configContextQueryService.getWxServiceWrapper(mchAppConfigContext);
ProfitSharingResult profitSharingResult = wxServiceWrapper.getWxPayService().getProfitSharingService().profitSharing(request);
return ChannelRetMsg.confirmSuccess(profitSharingResult.getOrderId());
} catch (WxPayException wxPayException) {
......@@ -168,7 +177,9 @@ public class WxpayDivisionService implements IDivisionService {
request.setTransactionId(payOrder.getChannelOrderNo());
request.setOutOrderNo(SeqKit.genDivisionBatchId());
request.setDescription("完结分账");
return mchAppConfigContext.getWxServiceWrapper().getWxPayService().getProfitSharingService().profitSharingFinish(request).getOrderId();
WxServiceWrapper wxServiceWrapper = configContextQueryService.getWxServiceWrapper(mchAppConfigContext);
return wxServiceWrapper.getWxPayService().getProfitSharingService().profitSharingFinish(request).getOrderId();
}
}
......@@ -27,7 +27,10 @@ import com.jeequan.jeepay.pay.channel.IPayOrderQueryService;
import com.jeequan.jeepay.pay.channel.wxpay.kits.WxpayKit;
import com.jeequan.jeepay.pay.channel.wxpay.kits.WxpayV3Util;
import com.jeequan.jeepay.pay.model.MchAppConfigContext;
import com.jeequan.jeepay.pay.model.WxServiceWrapper;
import com.jeequan.jeepay.pay.rqrs.msg.ChannelRetMsg;
import com.jeequan.jeepay.pay.service.ConfigContextQueryService;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;
/*
......@@ -40,6 +43,8 @@ import org.springframework.stereotype.Service;
@Service
public class WxpayPayOrderQueryService implements IPayOrderQueryService {
@Autowired private ConfigContextQueryService configContextQueryService;
@Override
public String getIfCode() {
return CS.IF_CODE.WXPAY;
......@@ -50,7 +55,9 @@ public class WxpayPayOrderQueryService implements IPayOrderQueryService {
try {
if (CS.PAY_IF_VERSION.WX_V2.equals(mchAppConfigContext.getWxServiceWrapper().getApiVersion())) { //V2
WxServiceWrapper wxServiceWrapper = configContextQueryService.getWxServiceWrapper(mchAppConfigContext);
if (CS.PAY_IF_VERSION.WX_V2.equals(wxServiceWrapper.getApiVersion())) { //V2
WxPayOrderQueryRequest req = new WxPayOrderQueryRequest();
......@@ -59,7 +66,7 @@ public class WxpayPayOrderQueryService implements IPayOrderQueryService {
req.setOutTradeNo(payOrder.getPayOrderId());
WxPayService wxPayService = mchAppConfigContext.getWxServiceWrapper().getWxPayService();
WxPayService wxPayService = wxServiceWrapper.getWxPayService();
WxPayOrderQueryResult result = wxPayService.queryOrder(req);
......@@ -75,19 +82,19 @@ public class WxpayPayOrderQueryService implements IPayOrderQueryService {
return ChannelRetMsg.unknown();
}
}else if (CS.PAY_IF_VERSION.WX_V3.equals(mchAppConfigContext.getWxServiceWrapper().getApiVersion())) { //V3
}else if (CS.PAY_IF_VERSION.WX_V3.equals(wxServiceWrapper.getApiVersion())) { //V3
String reqUrl;
String query;
if(mchAppConfigContext.isIsvsubMch()){ // 特约商户
WxpayIsvsubMchParams isvsubMchParams = mchAppConfigContext.getIsvsubMchParamsByIfCode(CS.IF_CODE.WXPAY, WxpayIsvsubMchParams.class);
WxpayIsvsubMchParams isvsubMchParams = (WxpayIsvsubMchParams) configContextQueryService.queryIsvsubMchParams(mchAppConfigContext.getMchNo(), mchAppConfigContext.getAppId(), getIfCode());
reqUrl = String.format("/v3/pay/partner/transactions/out-trade-no/%s", payOrder.getPayOrderId());
query = String.format("?sp_mchid=%s&sub_mchid=%s", mchAppConfigContext.getWxServiceWrapper().getWxPayService().getConfig().getMchId(), isvsubMchParams.getSubMchId());
query = String.format("?sp_mchid=%s&sub_mchid=%s", wxServiceWrapper.getWxPayService().getConfig().getMchId(), isvsubMchParams.getSubMchId());
}else {
reqUrl = String.format("/v3/pay/transactions/out-trade-no/%s", payOrder.getPayOrderId());
query = String.format("?mchid=%s", mchAppConfigContext.getWxServiceWrapper().getWxPayService().getConfig().getMchId());
query = String.format("?mchid=%s", wxServiceWrapper.getWxPayService().getConfig().getMchId());
}
JSONObject resultJSON = WxpayV3Util.queryOrderV3(reqUrl + query, mchAppConfigContext.getWxServiceWrapper().getWxPayService().getConfig());
JSONObject resultJSON = WxpayV3Util.queryOrderV3(reqUrl + query, wxServiceWrapper.getWxPayService().getConfig());
String channelState = resultJSON.getString("trade_state");
if ("SUCCESS".equals(channelState)) {
......
......@@ -23,6 +23,7 @@ import com.jeequan.jeepay.core.entity.PayOrder;
import com.jeequan.jeepay.core.exception.BizException;
import com.jeequan.jeepay.core.model.params.wxpay.WxpayIsvsubMchParams;
import com.jeequan.jeepay.pay.channel.AbstractPaymentService;
import com.jeequan.jeepay.pay.model.WxServiceWrapper;
import com.jeequan.jeepay.pay.rqrs.AbstractRS;
import com.jeequan.jeepay.pay.rqrs.payorder.UnifiedOrderRQ;
import com.jeequan.jeepay.pay.util.PaywayUtil;
......@@ -60,7 +61,10 @@ public class WxpayPaymentService extends AbstractPaymentService {
public AbstractRS pay(UnifiedOrderRQ rq, PayOrder payOrder, MchAppConfigContext mchAppConfigContext) throws Exception {
// 微信API版本
String apiVersion = mchAppConfigContext.getWxServiceWrapper().getApiVersion();
WxServiceWrapper wxServiceWrapper = configContextQueryService.getWxServiceWrapper(mchAppConfigContext);
String apiVersion = wxServiceWrapper.getApiVersion();
if (CS.PAY_IF_VERSION.WX_V2.equals(apiVersion)) {
return PaywayUtil.getRealPaywayService(this, payOrder.getWayCode()).pay(rq, payOrder, mchAppConfigContext);
} else if (CS.PAY_IF_VERSION.WX_V3.equals(apiVersion)) {
......@@ -97,7 +101,7 @@ public class WxpayPaymentService extends AbstractPaymentService {
// 特约商户
if(mchAppConfigContext.isIsvsubMch()){
WxpayIsvsubMchParams isvsubMchParams = mchAppConfigContext.getIsvsubMchParamsByIfCode(getIfCode(), WxpayIsvsubMchParams.class);
WxpayIsvsubMchParams isvsubMchParams = (WxpayIsvsubMchParams) configContextQueryService.queryIsvsubMchParams(mchAppConfigContext.getMchNo(), mchAppConfigContext.getAppId(), getIfCode());
request.setSubMchId(isvsubMchParams.getSubMchId());
if (StringUtils.isNotBlank(isvsubMchParams.getSubMchAppId())) {
request.setSubAppId(isvsubMchParams.getSubMchAppId());
......@@ -137,9 +141,10 @@ public class WxpayPaymentService extends AbstractPaymentService {
reqJSON.put("settle_info", settleInfo);
}
WxPayService wxPayService = mchAppConfigContext.getWxServiceWrapper().getWxPayService();
WxPayService wxPayService = configContextQueryService.getWxServiceWrapper(mchAppConfigContext).getWxPayService();
if(mchAppConfigContext.isIsvsubMch()){ // 特约商户
WxpayIsvsubMchParams isvsubMchParams = mchAppConfigContext.getIsvsubMchParamsByIfCode(getIfCode(), WxpayIsvsubMchParams.class);
WxpayIsvsubMchParams isvsubMchParams = (WxpayIsvsubMchParams) configContextQueryService.queryIsvsubMchParams(mchAppConfigContext.getMchNo(), mchAppConfigContext.getAppId(), getIfCode());
reqJSON.put("sp_appid", wxPayService.getConfig().getAppId());
reqJSON.put("sp_mchid", wxPayService.getConfig().getMchId());
reqJSON.put("sub_mchid", isvsubMchParams.getSubMchId());
......
......@@ -18,16 +18,20 @@ package com.jeequan.jeepay.pay.channel.wxpay;
import com.github.binarywang.wxpay.bean.entpay.EntPayRequest;
import com.github.binarywang.wxpay.bean.entpay.EntPayResult;
import com.github.binarywang.wxpay.exception.WxPayException;
import com.github.binarywang.wxpay.service.WxPayService;
import com.jeequan.jeepay.core.constants.CS;
import com.jeequan.jeepay.core.entity.TransferOrder;
import com.jeequan.jeepay.core.model.params.wxpay.WxpayNormalMchParams;
import com.jeequan.jeepay.pay.channel.ITransferService;
import com.jeequan.jeepay.pay.channel.wxpay.kits.WxpayKit;
import com.jeequan.jeepay.pay.model.MchAppConfigContext;
import com.jeequan.jeepay.pay.model.WxServiceWrapper;
import com.jeequan.jeepay.pay.rqrs.msg.ChannelRetMsg;
import com.jeequan.jeepay.pay.rqrs.transfer.TransferOrderRQ;
import com.jeequan.jeepay.pay.service.ConfigContextQueryService;
import lombok.extern.slf4j.Slf4j;
import org.apache.commons.lang3.StringUtils;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;
/**
......@@ -41,6 +45,8 @@ import org.springframework.stereotype.Service;
@Service
public class WxpayTransferService implements ITransferService {
@Autowired private ConfigContextQueryService configContextQueryService;
@Override
public String getIfCode() {
return CS.IF_CODE.WXPAY;
......@@ -78,8 +84,11 @@ public class WxpayTransferService implements ITransferService {
try {
EntPayRequest request = new EntPayRequest();
request.setMchAppid(mchAppConfigContext.getWxServiceWrapper().getWxPayService().getConfig().getAppId()); // 商户账号appid
request.setMchId(mchAppConfigContext.getWxServiceWrapper().getWxPayService().getConfig().getMchId()); //商户号
WxServiceWrapper wxServiceWrapper = configContextQueryService.getWxServiceWrapper(mchAppConfigContext);
request.setMchAppid(wxServiceWrapper.getWxPayService().getConfig().getAppId()); // 商户账号appid
request.setMchId(wxServiceWrapper.getWxPayService().getConfig().getMchId()); //商户号
request.setPartnerTradeNo(transferOrder.getTransferId()); //商户订单号
request.setOpenid(transferOrder.getAccountNo()); //openid
......@@ -93,7 +102,7 @@ public class WxpayTransferService implements ITransferService {
request.setCheckName("NO_CHECK");
}
EntPayResult entPayResult = mchAppConfigContext.getWxServiceWrapper().getWxPayService().getEntPayService().entPay(request);
EntPayResult entPayResult = wxServiceWrapper.getWxPayService().getEntPayService().entPay(request);
// SUCCESS/FAIL,注意:当状态为FAIL时,存在业务结果未明确的情况。如果状态为FAIL,请务必关注错误代码(err_code字段),通过查询接口确认此次付款的结果。
if("SUCCESS".equalsIgnoreCase(entPayResult.getResultCode())){
......
......@@ -19,8 +19,10 @@ import com.github.binarywang.wxpay.bean.request.BaseWxPayRequest;
import com.github.binarywang.wxpay.exception.WxPayException;
import com.jeequan.jeepay.core.constants.CS;
import com.jeequan.jeepay.core.model.params.wxpay.WxpayIsvsubMchParams;
import com.jeequan.jeepay.core.utils.SpringBeansUtil;
import com.jeequan.jeepay.pay.rqrs.msg.ChannelRetMsg;
import com.jeequan.jeepay.pay.model.MchAppConfigContext;
import com.jeequan.jeepay.pay.service.ConfigContextQueryService;
import org.apache.commons.lang3.StringUtils;
/*
......@@ -40,7 +42,11 @@ public class WxpayKit {
return ;
}
WxpayIsvsubMchParams isvsubMchParams = mchAppConfigContext.getIsvsubMchParamsByIfCode(CS.IF_CODE.WXPAY, WxpayIsvsubMchParams.class);
ConfigContextQueryService configContextQueryService = SpringBeansUtil.getBean(ConfigContextQueryService.class);
WxpayIsvsubMchParams isvsubMchParams =
(WxpayIsvsubMchParams) configContextQueryService.queryIsvsubMchParams(mchAppConfigContext.getMchNo(), mchAppConfigContext.getAppId(), CS.IF_CODE.WXPAY);
req.setSubMchId(isvsubMchParams.getSubMchId());
req.setSubAppId(isvsubMchParams.getSubMchAppId());
}
......
......@@ -25,6 +25,7 @@ import com.github.binarywang.wxpay.service.WxPayService;
import com.jeequan.jeepay.core.entity.PayOrder;
import com.jeequan.jeepay.pay.channel.wxpay.WxpayPaymentService;
import com.jeequan.jeepay.pay.channel.wxpay.kits.WxpayKit;
import com.jeequan.jeepay.pay.model.WxServiceWrapper;
import com.jeequan.jeepay.pay.rqrs.AbstractRS;
import com.jeequan.jeepay.pay.rqrs.payorder.UnifiedOrderRQ;
import com.jeequan.jeepay.pay.rqrs.payorder.payway.WxAppOrderRS;
......@@ -62,7 +63,8 @@ public class WxApp extends WxpayPaymentService {
// 调起上游接口:
// 1. 如果抛异常,则订单状态为: 生成状态,此时没有查单处理操作。 订单将超时关闭
// 2. 接口调用成功, 后续异常需进行捕捉, 如果 逻辑代码出现异常则需要走完正常流程,此时订单状态为: 支付中, 需要查单处理。
WxPayService wxPayService = mchAppConfigContext.getWxServiceWrapper().getWxPayService();
WxServiceWrapper wxServiceWrapper = configContextQueryService.getWxServiceWrapper(mchAppConfigContext);
WxPayService wxPayService = wxServiceWrapper.getWxPayService();
try {
WxPayAppOrderResult payResult = wxPayService.createOrder(req);
JSONObject resJSON = (JSONObject) JSON.toJSON(payResult);
......
......@@ -24,6 +24,7 @@ import com.jeequan.jeepay.core.constants.CS;
import com.jeequan.jeepay.core.entity.PayOrder;
import com.jeequan.jeepay.pay.channel.wxpay.WxpayPaymentService;
import com.jeequan.jeepay.pay.channel.wxpay.kits.WxpayKit;
import com.jeequan.jeepay.pay.model.WxServiceWrapper;
import com.jeequan.jeepay.pay.rqrs.AbstractRS;
import com.jeequan.jeepay.pay.rqrs.payorder.UnifiedOrderRQ;
import com.jeequan.jeepay.pay.rqrs.payorder.payway.WxH5OrderRQ;
......@@ -64,7 +65,9 @@ public class WxH5 extends WxpayPaymentService {
// 调起上游接口:
// 1. 如果抛异常,则订单状态为: 生成状态,此时没有查单处理操作。 订单将超时关闭
// 2. 接口调用成功, 后续异常需进行捕捉, 如果 逻辑代码出现异常则需要走完正常流程,此时订单状态为: 支付中, 需要查单处理。
WxPayService wxPayService = mchAppConfigContext.getWxServiceWrapper().getWxPayService();
WxServiceWrapper wxServiceWrapper = configContextQueryService.getWxServiceWrapper(mchAppConfigContext);
WxPayService wxPayService = wxServiceWrapper.getWxPayService();
try {
WxPayMwebOrderResult wxPayMwebOrderResult = wxPayService.createOrder(req);
......
......@@ -26,6 +26,7 @@ import com.jeequan.jeepay.core.entity.PayOrder;
import com.jeequan.jeepay.core.exception.BizException;
import com.jeequan.jeepay.pay.channel.wxpay.WxpayPaymentService;
import com.jeequan.jeepay.pay.channel.wxpay.kits.WxpayKit;
import com.jeequan.jeepay.pay.model.WxServiceWrapper;
import com.jeequan.jeepay.pay.rqrs.AbstractRS;
import com.jeequan.jeepay.pay.rqrs.payorder.UnifiedOrderRQ;
import com.jeequan.jeepay.pay.rqrs.payorder.payway.WxJsapiOrderRQ;
......@@ -76,7 +77,8 @@ public class WxJsapi extends WxpayPaymentService {
// 调起上游接口:
// 1. 如果抛异常,则订单状态为: 生成状态,此时没有查单处理操作。 订单将超时关闭
// 2. 接口调用成功, 后续异常需进行捕捉, 如果 逻辑代码出现异常则需要走完正常流程,此时订单状态为: 支付中, 需要查单处理。
WxPayService wxPayService = mchAppConfigContext.getWxServiceWrapper().getWxPayService();
WxServiceWrapper wxServiceWrapper = configContextQueryService.getWxServiceWrapper(mchAppConfigContext);
WxPayService wxPayService = wxServiceWrapper.getWxPayService();
try {
WxPayMpOrderResult payResult = wxPayService.createOrder(req);
JSONObject resJSON = (JSONObject) JSON.toJSON(payResult);
......
......@@ -26,6 +26,7 @@ import com.jeequan.jeepay.core.entity.PayOrder;
import com.jeequan.jeepay.core.exception.BizException;
import com.jeequan.jeepay.pay.channel.wxpay.WxpayPaymentService;
import com.jeequan.jeepay.pay.channel.wxpay.kits.WxpayKit;
import com.jeequan.jeepay.pay.model.WxServiceWrapper;
import com.jeequan.jeepay.pay.rqrs.AbstractRS;
import com.jeequan.jeepay.pay.rqrs.payorder.UnifiedOrderRQ;
import com.jeequan.jeepay.pay.rqrs.payorder.payway.WxJsapiOrderRQ;
......@@ -74,7 +75,8 @@ public class WxLite extends WxpayPaymentService {
// 调起上游接口:
// 1. 如果抛异常,则订单状态为: 生成状态,此时没有查单处理操作。 订单将超时关闭
// 2. 接口调用成功, 后续异常需进行捕捉, 如果 逻辑代码出现异常则需要走完正常流程,此时订单状态为: 支付中, 需要查单处理。
WxPayService wxPayService = mchAppConfigContext.getWxServiceWrapper().getWxPayService();
WxServiceWrapper wxServiceWrapper = configContextQueryService.getWxServiceWrapper(mchAppConfigContext);
WxPayService wxPayService = wxServiceWrapper.getWxPayService();
try {
WxPayMpOrderResult payResult = wxPayService.createOrder(req);
JSONObject resJSON = (JSONObject) JSON.toJSON(payResult);
......
......@@ -24,6 +24,7 @@ import com.jeequan.jeepay.core.constants.CS;
import com.jeequan.jeepay.core.entity.PayOrder;
import com.jeequan.jeepay.pay.channel.wxpay.WxpayPaymentService;
import com.jeequan.jeepay.pay.channel.wxpay.kits.WxpayKit;
import com.jeequan.jeepay.pay.model.WxServiceWrapper;
import com.jeequan.jeepay.pay.rqrs.AbstractRS;
import com.jeequan.jeepay.pay.rqrs.payorder.UnifiedOrderRQ;
import com.jeequan.jeepay.pay.rqrs.payorder.payway.WxNativeOrderRQ;
......@@ -65,7 +66,8 @@ public class WxNative extends WxpayPaymentService {
// 调起上游接口:
// 1. 如果抛异常,则订单状态为: 生成状态,此时没有查单处理操作。 订单将超时关闭
// 2. 接口调用成功, 后续异常需进行捕捉, 如果 逻辑代码出现异常则需要走完正常流程,此时订单状态为: 支付中, 需要查单处理。
WxPayService wxPayService = mchAppConfigContext.getWxServiceWrapper().getWxPayService();
WxServiceWrapper wxServiceWrapper = configContextQueryService.getWxServiceWrapper(mchAppConfigContext);
WxPayService wxPayService = wxServiceWrapper.getWxPayService();
try {
WxPayNativeOrderResult wxPayNativeOrderResult = wxPayService.createOrder(req);
......
......@@ -24,6 +24,7 @@ import com.jeequan.jeepay.pay.channel.wxpay.WxpayPaymentService;
import com.jeequan.jeepay.pay.channel.wxpay.kits.WxpayKit;
import com.jeequan.jeepay.pay.channel.wxpay.kits.WxpayV3Util;
import com.jeequan.jeepay.pay.model.MchAppConfigContext;
import com.jeequan.jeepay.pay.model.WxServiceWrapper;
import com.jeequan.jeepay.pay.rqrs.AbstractRS;
import com.jeequan.jeepay.pay.rqrs.msg.ChannelRetMsg;
import com.jeequan.jeepay.pay.rqrs.payorder.UnifiedOrderRQ;
......@@ -49,7 +50,8 @@ public class WxApp extends WxpayPaymentService {
@Override
public AbstractRS pay(UnifiedOrderRQ rq, PayOrder payOrder, MchAppConfigContext mchAppConfigContext) {
WxPayService wxPayService = mchAppConfigContext.getWxServiceWrapper().getWxPayService();
WxServiceWrapper wxServiceWrapper = configContextQueryService.getWxServiceWrapper(mchAppConfigContext);
WxPayService wxPayService = wxServiceWrapper.getWxPayService();
wxPayService.getConfig().setTradeType(WxPayConstants.TradeType.APP);
// 构造请求数据
......
......@@ -25,6 +25,7 @@ import com.jeequan.jeepay.pay.channel.wxpay.WxpayPaymentService;
import com.jeequan.jeepay.pay.channel.wxpay.kits.WxpayKit;
import com.jeequan.jeepay.pay.channel.wxpay.kits.WxpayV3Util;
import com.jeequan.jeepay.pay.model.MchAppConfigContext;
import com.jeequan.jeepay.pay.model.WxServiceWrapper;
import com.jeequan.jeepay.pay.rqrs.AbstractRS;
import com.jeequan.jeepay.pay.rqrs.msg.ChannelRetMsg;
import com.jeequan.jeepay.pay.rqrs.payorder.UnifiedOrderRQ;
......@@ -53,7 +54,8 @@ public class WxH5 extends WxpayPaymentService {
WxH5OrderRQ bizRQ = (WxH5OrderRQ) rq;
WxPayService wxPayService = mchAppConfigContext.getWxServiceWrapper().getWxPayService();
WxServiceWrapper wxServiceWrapper = configContextQueryService.getWxServiceWrapper(mchAppConfigContext);
WxPayService wxPayService = wxServiceWrapper.getWxPayService();
wxPayService.getConfig().setTradeType(WxPayConstants.TradeType.MWEB);
// 构造请求数据
......
......@@ -24,6 +24,7 @@ import com.jeequan.jeepay.pay.channel.wxpay.WxpayPaymentService;
import com.jeequan.jeepay.pay.channel.wxpay.kits.WxpayKit;
import com.jeequan.jeepay.pay.channel.wxpay.kits.WxpayV3Util;
import com.jeequan.jeepay.pay.model.MchAppConfigContext;
import com.jeequan.jeepay.pay.model.WxServiceWrapper;
import com.jeequan.jeepay.pay.rqrs.AbstractRS;
import com.jeequan.jeepay.pay.rqrs.msg.ChannelRetMsg;
import com.jeequan.jeepay.pay.rqrs.payorder.UnifiedOrderRQ;
......@@ -52,8 +53,8 @@ public class WxJsapi extends WxpayPaymentService {
public AbstractRS pay(UnifiedOrderRQ rq, PayOrder payOrder, MchAppConfigContext mchAppConfigContext) throws Exception{
WxJsapiOrderRQ bizRQ = (WxJsapiOrderRQ) rq;
WxPayService wxPayService = mchAppConfigContext.getWxServiceWrapper().getWxPayService();
WxServiceWrapper wxServiceWrapper = configContextQueryService.getWxServiceWrapper(mchAppConfigContext);
WxPayService wxPayService = wxServiceWrapper.getWxPayService();
// 构造请求数据
JSONObject reqJSON = buildV3OrderRequest(payOrder, mchAppConfigContext);
......
......@@ -24,6 +24,7 @@ import com.jeequan.jeepay.pay.channel.wxpay.WxpayPaymentService;
import com.jeequan.jeepay.pay.channel.wxpay.kits.WxpayKit;
import com.jeequan.jeepay.pay.channel.wxpay.kits.WxpayV3Util;
import com.jeequan.jeepay.pay.model.MchAppConfigContext;
import com.jeequan.jeepay.pay.model.WxServiceWrapper;
import com.jeequan.jeepay.pay.rqrs.AbstractRS;
import com.jeequan.jeepay.pay.rqrs.msg.ChannelRetMsg;
import com.jeequan.jeepay.pay.rqrs.payorder.UnifiedOrderRQ;
......@@ -52,7 +53,8 @@ public class WxLite extends WxpayPaymentService {
public AbstractRS pay(UnifiedOrderRQ rq, PayOrder payOrder, MchAppConfigContext mchAppConfigContext) throws Exception{
WxJsapiOrderRQ bizRQ = (WxJsapiOrderRQ) rq;
WxPayService wxPayService = mchAppConfigContext.getWxServiceWrapper().getWxPayService();
WxServiceWrapper wxServiceWrapper = configContextQueryService.getWxServiceWrapper(mchAppConfigContext);
WxPayService wxPayService = wxServiceWrapper.getWxPayService();
// 构造请求数据
JSONObject reqJSON = buildV3OrderRequest(payOrder, mchAppConfigContext);
......
......@@ -25,6 +25,7 @@ import com.jeequan.jeepay.pay.channel.wxpay.WxpayPaymentService;
import com.jeequan.jeepay.pay.channel.wxpay.kits.WxpayKit;
import com.jeequan.jeepay.pay.channel.wxpay.kits.WxpayV3Util;
import com.jeequan.jeepay.pay.model.MchAppConfigContext;
import com.jeequan.jeepay.pay.model.WxServiceWrapper;
import com.jeequan.jeepay.pay.rqrs.AbstractRS;
import com.jeequan.jeepay.pay.rqrs.msg.ChannelRetMsg;
import com.jeequan.jeepay.pay.rqrs.payorder.UnifiedOrderRQ;
......@@ -53,7 +54,9 @@ public class WxNative extends WxpayPaymentService {
WxNativeOrderRQ bizRQ = (WxNativeOrderRQ) rq;
WxPayService wxPayService = mchAppConfigContext.getWxServiceWrapper().getWxPayService();
WxServiceWrapper wxServiceWrapper = configContextQueryService.getWxServiceWrapper(mchAppConfigContext);
WxPayService wxPayService = wxServiceWrapper.getWxPayService();
// 构造请求数据
JSONObject reqJSON = buildV3OrderRequest(payOrder, mchAppConfigContext);
......
......@@ -64,7 +64,7 @@ public class XxpayChannelRefundNoticeService extends AbstractChannelRefundNotice
@Override
public ChannelRetMsg doNotice(HttpServletRequest request, Object params, RefundOrder refundOrder, MchAppConfigContext mchAppConfigContext, NoticeTypeEnum noticeTypeEnum) {
try {
XxpayNormalMchParams xxpayParams = mchAppConfigContext.getNormalMchParamsByIfCode(getIfCode(), XxpayNormalMchParams.class);
XxpayNormalMchParams xxpayParams = (XxpayNormalMchParams)configContextQueryService.queryNormalMchParams(mchAppConfigContext.getMchNo(), mchAppConfigContext.getAppId(), getIfCode());
// 获取请求参数
JSONObject jsonParams = (JSONObject) params;
......
......@@ -81,7 +81,7 @@ public class YsfpayPaymentService extends AbstractPaymentService {
}
reqParams.put("serProvId", isvParams.getSerProvId()); //云闪付服务商标识
YsfpayIsvsubMchParams isvsubMchParams = mchAppConfigContext.getIsvsubMchParamsByIfCode(getIfCode(), YsfpayIsvsubMchParams.class);
YsfpayIsvsubMchParams isvsubMchParams = (YsfpayIsvsubMchParams) configContextQueryService.queryIsvsubMchParams(mchAppConfigContext.getMchNo(), mchAppConfigContext.getAppId(), getIfCode());
reqParams.put("merId", isvsubMchParams.getMerId()); // 商户号
//签名
......
......@@ -29,6 +29,7 @@ import com.jeequan.jeepay.pay.rqrs.division.DivisionReceiverBindRQ;
import com.jeequan.jeepay.pay.rqrs.division.DivisionReceiverBindRS;
import com.jeequan.jeepay.pay.rqrs.msg.ChannelRetMsg;
import com.jeequan.jeepay.pay.rqrs.transfer.TransferOrderRS;
import com.jeequan.jeepay.pay.service.ConfigContextQueryService;
import com.jeequan.jeepay.pay.service.ConfigContextService;
import com.jeequan.jeepay.service.impl.MchDivisionReceiverGroupService;
import com.jeequan.jeepay.service.impl.MchDivisionReceiverService;
......@@ -53,7 +54,7 @@ import java.util.Date;
@RestController
public class MchDivisionReceiverBindController extends ApiController {
@Autowired private ConfigContextService configContextService;
@Autowired private ConfigContextQueryService configContextQueryService;
@Autowired private PayInterfaceConfigService payInterfaceConfigService;
@Autowired private MchDivisionReceiverService mchDivisionReceiverService;
@Autowired private MchDivisionReceiverGroupService mchDivisionReceiverGroupService;
......@@ -72,7 +73,7 @@ public class MchDivisionReceiverBindController extends ApiController {
// 商户配置信息
MchAppConfigContext mchAppConfigContext = configContextService.getMchAppConfigContext(bizRQ.getMchNo(), bizRQ.getAppId());
MchAppConfigContext mchAppConfigContext = configContextQueryService.queryMchInfoAndAppInfo(bizRQ.getMchNo(), bizRQ.getAppId());
if(mchAppConfigContext == null){
throw new BizException("获取商户应用信息失败");
}
......
......@@ -29,6 +29,7 @@ import com.jeequan.jeepay.pay.model.MchAppConfigContext;
import com.jeequan.jeepay.pay.rqrs.division.PayOrderDivisionExecRQ;
import com.jeequan.jeepay.pay.rqrs.division.PayOrderDivisionExecRS;
import com.jeequan.jeepay.pay.rqrs.msg.ChannelRetMsg;
import com.jeequan.jeepay.pay.service.ConfigContextQueryService;
import com.jeequan.jeepay.pay.service.ConfigContextService;
import com.jeequan.jeepay.pay.service.PayOrderDivisionProcessService;
import com.jeequan.jeepay.service.impl.MchDivisionReceiverGroupService;
......@@ -56,7 +57,7 @@ import java.util.Set;
@RestController
public class PayOrderDivisionExecController extends ApiController {
@Autowired private ConfigContextService configContextService;
@Autowired private ConfigContextQueryService configContextQueryService;
@Autowired private PayOrderService payOrderService;
@Autowired private MchDivisionReceiverService mchDivisionReceiverService;
@Autowired private MchDivisionReceiverGroupService mchDivisionReceiverGroupService;
......@@ -95,7 +96,7 @@ public class PayOrderDivisionExecController extends ApiController {
this.checkReceiverList(receiverList, payOrder.getIfCode(), bizRQ.getMchNo(), bizRQ.getAppId());
// 商户配置信息
MchAppConfigContext mchAppConfigContext = configContextService.getMchAppConfigContext(bizRQ.getMchNo(), bizRQ.getAppId());
MchAppConfigContext mchAppConfigContext = configContextQueryService.queryMchInfoAndAppInfo(bizRQ.getMchNo(), bizRQ.getAppId());
if(mchAppConfigContext == null){
throw new BizException("获取商户应用信息失败");
}
......
......@@ -16,8 +16,6 @@
package com.jeequan.jeepay.pay.ctrl.payorder;
import cn.hutool.core.date.DateUtil;
import com.baomidou.mybatisplus.core.conditions.update.LambdaUpdateWrapper;
import com.jeequan.jeepay.components.mq.model.PayOrderDivisionMQ;
import com.jeequan.jeepay.components.mq.model.PayOrderReissueMQ;
import com.jeequan.jeepay.components.mq.vender.IMQSender;
import com.jeequan.jeepay.core.constants.CS;
......@@ -31,15 +29,13 @@ import com.jeequan.jeepay.core.utils.*;
import com.jeequan.jeepay.pay.channel.IPaymentService;
import com.jeequan.jeepay.pay.ctrl.ApiController;
import com.jeequan.jeepay.pay.exception.ChannelException;
import com.jeequan.jeepay.pay.model.IsvConfigContext;
import com.jeequan.jeepay.pay.model.MchAppConfigContext;
import com.jeequan.jeepay.pay.rqrs.msg.ChannelRetMsg;
import com.jeequan.jeepay.pay.rqrs.payorder.UnifiedOrderRQ;
import com.jeequan.jeepay.pay.rqrs.payorder.UnifiedOrderRS;
import com.jeequan.jeepay.pay.rqrs.payorder.payway.QrCashierOrderRQ;
import com.jeequan.jeepay.pay.rqrs.payorder.payway.QrCashierOrderRS;
import com.jeequan.jeepay.pay.service.ConfigContextService;
import com.jeequan.jeepay.pay.service.PayMchNotifyService;
import com.jeequan.jeepay.pay.service.ConfigContextQueryService;
import com.jeequan.jeepay.pay.service.PayOrderProcessService;
import com.jeequan.jeepay.service.impl.MchPayPassageService;
import com.jeequan.jeepay.service.impl.PayOrderService;
......@@ -64,7 +60,7 @@ public abstract class AbstractPayOrderController extends ApiController {
@Autowired private MchPayPassageService mchPayPassageService;
@Autowired private PayOrderService payOrderService;
@Autowired private ConfigContextService configContextService;
@Autowired private ConfigContextQueryService configContextQueryService;
@Autowired private PayOrderProcessService payOrderProcessService;
@Autowired private SysConfigService sysConfigService;
@Autowired private IMQSender mqSender;
......@@ -126,7 +122,7 @@ public abstract class AbstractPayOrderController extends ApiController {
}
//获取支付参数 (缓存数据) 和 商户信息
MchAppConfigContext mchAppConfigContext = configContextService.getMchAppConfigContext(mchNo, appId);
MchAppConfigContext mchAppConfigContext = configContextQueryService.queryMchInfoAndAppInfo(mchNo, appId);
if(mchAppConfigContext == null){
throw new BizException("获取商户应用信息失败");
}
......@@ -283,20 +279,16 @@ public abstract class AbstractPayOrderController extends ApiController {
if(mchAppConfigContext.getMchType() == MchInfo.TYPE_NORMAL){ //普通商户
if(mchAppConfigContext.getNormalMchParamsByIfCode(ifCode) == null){
if(configContextQueryService.queryNormalMchParams(mchAppConfigContext.getMchNo(), mchAppConfigContext.getAppId(), ifCode) == null){
throw new BizException("商户应用参数未配置");
}
}else if(mchAppConfigContext.getMchType() == MchInfo.TYPE_ISVSUB){ //特约商户
mchAppConfigContext = configContextService.getMchAppConfigContext(mchAppConfigContext.getMchNo(), mchAppConfigContext.getAppId());
if(mchAppConfigContext == null || mchAppConfigContext.getIsvsubMchParamsByIfCode(ifCode) == null){
if(configContextQueryService.queryIsvsubMchParams(mchAppConfigContext.getMchNo(), mchAppConfigContext.getAppId(), ifCode) == null){
throw new BizException("特约商户参数未配置");
}
IsvConfigContext isvConfigContext = configContextService.getIsvConfigContext(mchAppConfigContext.getMchInfo().getIsvNo());
if(isvConfigContext == null || isvConfigContext.getIsvParamsByIfCode(ifCode) == null){
if(configContextQueryService.queryIsvParams(mchAppConfigContext.getMchInfo().getIsvNo(), ifCode) == null){
throw new BizException("服务商参数未配置");
}
}
......@@ -396,7 +388,7 @@ public abstract class AbstractPayOrderController extends ApiController {
bizRS.setErrMsg(bizRS.getChannelRetMsg() != null ? bizRS.getChannelRetMsg().getChannelErrMsg() : null);
}
return ApiRes.okWithSign(bizRS, configContextService.getMchAppConfigContext(bizRQ.getMchNo(), bizRQ.getAppId()).getMchApp().getAppSecret());
return ApiRes.okWithSign(bizRS, configContextQueryService.queryMchApp(bizRQ.getMchNo(), bizRQ.getAppId()).getAppSecret());
}
......
Supports Markdown
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment