mirror of
https://codeup.aliyun.com/67c68d4e484ca2f0a13ac3c1/ydc/jsowell-charger-web.git
synced 2026-04-20 19:15:35 +08:00
update 支付时获取对应的支付配置
This commit is contained in:
@@ -13,6 +13,9 @@ import java.util.Objects;
|
||||
* adapay配置工厂类
|
||||
*/
|
||||
public class AdapayConfigFactory {
|
||||
/*
|
||||
key为微信小程序appId, value为对应的汇付支付配置
|
||||
*/
|
||||
private static Map<String, AbstractAdapayConfig> configMap = Maps.newHashMap();
|
||||
|
||||
/**
|
||||
@@ -29,11 +32,11 @@ public class AdapayConfigFactory {
|
||||
|
||||
/**
|
||||
* 获取
|
||||
* @param name
|
||||
* @return
|
||||
* @param wechatAppId 微信小程序appId
|
||||
* @return 对应的汇付支付配置
|
||||
*/
|
||||
public static AbstractAdapayConfig getConfig(String name) {
|
||||
return configMap.get(name);
|
||||
public static AbstractAdapayConfig getConfig(String wechatAppId) {
|
||||
return configMap.get(wechatAppId);
|
||||
}
|
||||
|
||||
/**
|
||||
|
||||
@@ -7,9 +7,11 @@ import com.google.common.collect.Maps;
|
||||
import com.huifu.adapay.core.exception.BaseAdaPayException;
|
||||
import com.huifu.adapay.model.*;
|
||||
import com.jsowell.adapay.common.DivMember;
|
||||
import com.jsowell.adapay.config.AbstractAdapayConfig;
|
||||
import com.jsowell.adapay.dto.SettleAccountDTO;
|
||||
import com.jsowell.adapay.dto.UpdateAccountConfigDTO;
|
||||
import com.jsowell.adapay.dto.WithdrawDTO;
|
||||
import com.jsowell.adapay.factory.AdapayConfigFactory;
|
||||
import com.jsowell.adapay.response.*;
|
||||
import com.jsowell.adapay.vo.AdapayAccountBalanceVO;
|
||||
import com.jsowell.adapay.vo.AdapayCorpMemberVO;
|
||||
@@ -659,19 +661,25 @@ public class AdapayMemberService {
|
||||
/**
|
||||
* 创建交易撤销请求
|
||||
* 延迟分账未确认, 调交易撤销接口退款
|
||||
* @param wechatAppId 微信小程序appId
|
||||
*/
|
||||
public PaymentReverseResponse createPaymentReverseRequest(String paymentId, BigDecimal reverseAmt, String merchantKey) {
|
||||
public PaymentReverseResponse createPaymentReverseRequest(String paymentId, BigDecimal reverseAmt, String wechatAppId) {
|
||||
PaymentReverseResponse response;
|
||||
AbstractAdapayConfig config = AdapayConfigFactory.getConfig(wechatAppId);
|
||||
if (config == null) {
|
||||
throw new BusinessException(ReturnCodeEnum.CODE_ADAPAY_CONFIG_IS_NULL_ERROR);
|
||||
}
|
||||
// 延迟分账未确认调撤销调撤销接口退款
|
||||
Map<String, Object> reverseParams = Maps.newHashMap();
|
||||
reverseParams.put("app_id", ADAPAY_APP_ID);
|
||||
reverseParams.put("app_id", config.getAdapayAppId());
|
||||
reverseParams.put("payment_id", paymentId);
|
||||
reverseParams.put("reverse_amt", AdapayUtil.formatAmount(reverseAmt));
|
||||
reverseParams.put("order_no", IdUtils.fastSimpleUUID());
|
||||
reverseParams.put("notify_url", ADAPAY_CALLBACK_URL);
|
||||
reverseParams.put("", "");
|
||||
Map<String, Object> paymentReverse = null;
|
||||
try {
|
||||
paymentReverse = PaymentReverse.create(reverseParams, merchantKey);
|
||||
paymentReverse = PaymentReverse.create(reverseParams, config.getWechatAppId());
|
||||
} catch (BaseAdaPayException e) {
|
||||
log.error("汇付支付创建交易撤销对象error", e);
|
||||
}
|
||||
|
||||
@@ -54,7 +54,7 @@ public class PayOrderDTO {
|
||||
/**
|
||||
* 微信小程序appId
|
||||
*/
|
||||
private String appId;
|
||||
private String wechatAppId;
|
||||
|
||||
@Override
|
||||
public String toString() {
|
||||
|
||||
@@ -22,7 +22,10 @@ public class WeixinPayDTO extends BaseMemberDTO{
|
||||
*/
|
||||
private String attach;
|
||||
|
||||
private String appId;
|
||||
/**
|
||||
* 微信小程序appId
|
||||
*/
|
||||
private String wechatAppId;
|
||||
|
||||
@Override
|
||||
public String toString() {
|
||||
|
||||
@@ -2779,7 +2779,7 @@ public class OrderBasicInfoServiceImpl implements IOrderBasicInfoService {
|
||||
}
|
||||
|
||||
// 获取支付配置
|
||||
AbstractAdapayConfig config = AdapayConfigFactory.getConfig(dto.getAppId());
|
||||
AbstractAdapayConfig config = AdapayConfigFactory.getConfig(dto.getWechatAppId());
|
||||
if (config == null) {
|
||||
throw new BusinessException(ReturnCodeEnum.CODE_ADAPAY_CONFIG_IS_NULL_ERROR);
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user