mirror of
https://codeup.aliyun.com/67c68d4e484ca2f0a13ac3c1/ydc/jsowell-charger-web.git
synced 2026-06-12 03:09:48 +08:00
update 支付时获取对应的支付配置
This commit is contained in:
@@ -124,7 +124,7 @@ public class PayController extends BaseController {
|
||||
Map<String, Object> map = null;
|
||||
if (isLock) {
|
||||
String appId = request.getHeader("appId");
|
||||
dto.setAppId(appId);
|
||||
dto.setWechatAppId(appId);
|
||||
map = orderService.payOrder(dto);
|
||||
}
|
||||
response = new RestApiResponse<>(map);
|
||||
@@ -258,7 +258,7 @@ public class PayController extends BaseController {
|
||||
}
|
||||
dto.setMemberId(memberId);
|
||||
// 设置appId
|
||||
dto.setAppId(request.getHeader("appId"));
|
||||
dto.setWechatAppId(request.getHeader("appId"));
|
||||
// 获取openId
|
||||
MemberBasicInfo memberBasicInfo = memberBasicInfoService.selectInfoByMemberId(memberId);
|
||||
if (memberBasicInfo == null) {
|
||||
@@ -353,7 +353,7 @@ public class PayController extends BaseController {
|
||||
Map<String, Object> map = null;
|
||||
if (isLock) {
|
||||
String appId = request.getHeader("appId");
|
||||
dto.setAppId(appId);
|
||||
dto.setWechatAppId(appId);
|
||||
map = orderService.payOrder(dto);
|
||||
}
|
||||
response = new RestApiResponse<>(map);
|
||||
|
||||
@@ -600,7 +600,7 @@ public class MemberService {
|
||||
*/
|
||||
public Map<String, Object> rechargeBalanceWithAdapay(WeixinPayDTO dto) {
|
||||
// 获取支付配置
|
||||
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);
|
||||
}
|
||||
|
||||
@@ -11,6 +11,7 @@ import com.google.common.collect.Lists;
|
||||
import com.google.common.collect.Sets;
|
||||
import com.huifu.adapay.core.AdapayCore;
|
||||
import com.huifu.adapay.core.util.AdapaySign;
|
||||
import com.jsowell.adapay.response.PaymentReverseResponse;
|
||||
import com.jsowell.common.constant.Constants;
|
||||
import com.jsowell.common.core.domain.vo.AuthorizedDeptVO;
|
||||
import com.jsowell.common.core.domain.ykc.RealTimeMonitorData;
|
||||
@@ -934,7 +935,7 @@ public class OrderService {
|
||||
corpMemberSucceeded(data);
|
||||
} else if (AdapayEventEnum.payment_reverse_succeeded.getValue().equals(type)) {
|
||||
// 支付撤销成功
|
||||
|
||||
paymentReverseSucceeded(data);
|
||||
} else if (AdapayEventEnum.cash_succeeded.getValue().equals(type)) {
|
||||
cashSucceeded(data);
|
||||
} else if (AdapayEventEnum.cash_failed.getValue().equals(type)) {
|
||||
@@ -1099,4 +1100,16 @@ public class OrderService {
|
||||
clearingWithdrawInfoService.updateByPrimaryKeySelective(clearingWithdrawInfo);
|
||||
}
|
||||
|
||||
/**
|
||||
* 支付撤销成功
|
||||
*/
|
||||
private void paymentReverseSucceeded(String data) throws JsonProcessingException {
|
||||
JSONObject jsonObject = JSON.parseObject(data);
|
||||
ObjectMapper mapper = new ObjectMapper();
|
||||
mapper.setPropertyNamingStrategy(PropertyNamingStrategies.SNAKE_CASE);
|
||||
PaymentReverseResponse paymentReverseResponse = mapper.readValue(jsonObject.toJSONString(), PaymentReverseResponse.class);
|
||||
log.info("支付撤销成功 paymentReverseResponse:{}", JSON.toJSONString(paymentReverseResponse));
|
||||
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
@@ -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