|
|
@@ -1567,7 +1567,7 @@ public class LiveOrderServiceImpl implements ILiveOrderService {
|
|
|
}
|
|
|
} else if ("wxApp".equals(payment.getPayMode()) && "wx_app".equals(payment.getPayTypeCode())) {
|
|
|
// 处理微信退款
|
|
|
- WxPayService wxPayService = getWxPayService();
|
|
|
+ WxPayService wxPayService = getWxPayService(payment.getAppId(), payType);
|
|
|
WxPayRefundRequest refundRequest = new WxPayRefundRequest();
|
|
|
refundRequest.setOutTradeNo("live-"+payment.getPayCode());
|
|
|
refundRequest.setOutRefundNo("live-"+payment.getPayCode());
|
|
|
@@ -1695,26 +1695,25 @@ public class LiveOrderServiceImpl implements ILiveOrderService {
|
|
|
/**
|
|
|
* 封装微信参数
|
|
|
*
|
|
|
+ * @param appId 应用appId
|
|
|
+ * @param payType 支付类型
|
|
|
* @return
|
|
|
*/
|
|
|
- private WxPayService getWxPayService(){
|
|
|
- SysConfig sysConfig = configService.selectConfigByConfigKey("app.config");
|
|
|
- AppConfig config = new Gson().fromJson(sysConfig.getConfigValue(), AppConfig.class);
|
|
|
- FsCoursePlaySourceConfig fsCoursePlaySourceConfig = fsCoursePlaySourceConfigMapper.selectCoursePlaySourceConfigByAppId(config.getAppId());
|
|
|
- if (fsCoursePlaySourceConfig == null) {
|
|
|
- throw new CustomException("未找到appId对应的小程序配置: " + config.getAppId());
|
|
|
+ private WxPayService getWxPayService(String appId, String payType){
|
|
|
+ MerchantAppConfig merchantAppConfig = merchantAppConfigMapper.selectMerchantAppConfigByAppId(appId, payType);
|
|
|
+ if (merchantAppConfig == null) {
|
|
|
+ throw new CustomException("未找到appId对应的商户配置: " + appId);
|
|
|
}
|
|
|
- MerchantAppConfig merchantAppConfig = merchantAppConfigMapper.selectMerchantAppConfigById(fsCoursePlaySourceConfig.getMerchantConfigId());
|
|
|
- FsPayConfig payConfig1 = JSON.parseObject(merchantAppConfig.getDataJson(), FsPayConfig.class);
|
|
|
+ FsPayConfig fsPayConfig = JSON.parseObject(merchantAppConfig.getDataJson(), FsPayConfig.class);
|
|
|
|
|
|
WxPayConfig payConfig = new WxPayConfig();
|
|
|
payConfig.setAppId(merchantAppConfig.getAppId());
|
|
|
- payConfig.setMchId(payConfig1.getWxMchId());
|
|
|
- payConfig.setMchKey(payConfig1.getWxMchKey());
|
|
|
+ payConfig.setMchId(fsPayConfig.getWxMchId());
|
|
|
+ payConfig.setMchKey(fsPayConfig.getWxMchKey());
|
|
|
payConfig.setSubAppId(StringUtils.trimToNull(null));
|
|
|
payConfig.setSubMchId(StringUtils.trimToNull(null));
|
|
|
- payConfig.setKeyPath(payConfig1.getKeyPath());
|
|
|
- payConfig.setNotifyUrl(payConfig1.getNotifyUrlScrm());
|
|
|
+ payConfig.setKeyPath(fsPayConfig.getKeyPath());
|
|
|
+ payConfig.setNotifyUrl(fsPayConfig.getNotifyUrlScrm());
|
|
|
WxPayServiceImpl payService = new WxPayServiceImpl();
|
|
|
payService.setConfig(payConfig);
|
|
|
return payService;
|
|
|
@@ -1918,7 +1917,7 @@ public class LiveOrderServiceImpl implements ILiveOrderService {
|
|
|
}
|
|
|
}else if (payment.getPayMode() != null &&"wxApp".equals(payment.getPayMode())) {
|
|
|
// 处理微信退款
|
|
|
- WxPayService wxPayService = getWxPayService();
|
|
|
+ WxPayService wxPayService = getWxPayService(payment.getAppId(), payType);
|
|
|
WxPayRefundRequest refundRequest = new WxPayRefundRequest();
|
|
|
refundRequest.setOutTradeNo("live-"+payment.getPayCode());
|
|
|
refundRequest.setOutRefundNo("live-"+payment.getPayCode());
|