mirror of
https://codeup.aliyun.com/67c68d4e484ca2f0a13ac3c1/ydc/jsowell-charger-web.git
synced 2026-04-21 11:35:12 +08:00
优化订单退款逻辑
This commit is contained in:
@@ -68,6 +68,7 @@ public class AdapayMemberService {
|
||||
|
||||
/**
|
||||
* 创建结算账户
|
||||
*
|
||||
* @param dto
|
||||
* @throws BaseAdaPayException
|
||||
* @throws BusinessException
|
||||
@@ -88,7 +89,7 @@ public class AdapayMemberService {
|
||||
* @throws Exception
|
||||
*/
|
||||
@Transactional(readOnly = false, propagation = Propagation.REQUIRED)
|
||||
public void createMember(SettleAccountDTO dto) throws BaseAdaPayException, BusinessException {
|
||||
public void createMember(SettleAccountDTO dto) throws BaseAdaPayException, BusinessException {
|
||||
AdapayMemberAccount adapayMemberAccount = adapayMemberAccountService.selectByMerchantId(dto.getMerchantId());
|
||||
if (adapayMemberAccount != null) {
|
||||
log.error("通过merchantId:{}, 没有查询到结算账户配置", dto.getMerchantId());
|
||||
@@ -449,6 +450,7 @@ public class AdapayMemberService {
|
||||
|
||||
/**
|
||||
* 提现逻辑
|
||||
*
|
||||
* @param dto
|
||||
* @throws BaseAdaPayException
|
||||
*/
|
||||
@@ -511,6 +513,7 @@ public class AdapayMemberService {
|
||||
|
||||
/**
|
||||
* 更新汇付会员信息
|
||||
*
|
||||
* @param dto
|
||||
* @return
|
||||
* @throws BaseAdaPayException
|
||||
@@ -553,10 +556,11 @@ public class AdapayMemberService {
|
||||
/**
|
||||
* 创建交易确认请求/创建分账请求
|
||||
* 这个方法只适用于给一个用户分账
|
||||
* @param paymentId 支付对象id
|
||||
*
|
||||
* @param paymentId 支付对象id
|
||||
* @param adapayMemberAccount 收到该张的汇付会员信息
|
||||
* @param confirmAmt 确认的金额
|
||||
* @param orderCode 订单编号
|
||||
* @param confirmAmt 确认的金额
|
||||
* @param orderCode 订单编号
|
||||
*/
|
||||
public PaymentConfirmResponse createPaymentConfirmRequest(String paymentId, AdapayMemberAccount adapayMemberAccount, BigDecimal confirmAmt, String orderCode) {
|
||||
// 调汇付的分账接口 确认交易
|
||||
@@ -591,13 +595,14 @@ public class AdapayMemberService {
|
||||
|
||||
/**
|
||||
* 创建余额支付请求
|
||||
*
|
||||
* @param outMemberId 出账用户的member_id, 若为商户本身时,请传入0
|
||||
* @param inMemberId 入账用户的member_id, 若为商户本身时,请传入0
|
||||
* @param transAmt 交易金额, 必须大于0,保留两位小数点,如0.10、100.05等
|
||||
* @param title 标题
|
||||
* @param desc 描述信息
|
||||
* @param inMemberId 入账用户的member_id, 若为商户本身时,请传入0
|
||||
* @param transAmt 交易金额, 必须大于0,保留两位小数点,如0.10、100.05等
|
||||
* @param title 标题
|
||||
* @param desc 描述信息
|
||||
*/
|
||||
public BalancePaymentResponse createBalancePaymentRequest(String outMemberId, String inMemberId, String transAmt, String title, String desc){
|
||||
public BalancePaymentResponse createBalancePaymentRequest(String outMemberId, String inMemberId, String transAmt, String title, String desc) {
|
||||
Map<String, Object> balanceParam = Maps.newHashMap();
|
||||
balanceParam.put("app_id", ADAPAY_APP_ID);
|
||||
balanceParam.put("adapay_func_code", "settle_accounts.balancePay");
|
||||
@@ -634,18 +639,21 @@ public class AdapayMemberService {
|
||||
/**
|
||||
* 创建退款请求
|
||||
*/
|
||||
public void createRefundRequest(String paymentId, BigDecimal refundAmt) {
|
||||
public RefundResponse createRefundRequest(String paymentId, BigDecimal refundAmt) {
|
||||
// 延迟分账确认的调退款接口
|
||||
Map<String, Object> refundParams = Maps.newHashMap();
|
||||
refundParams.put("refund_amt", AdapayUtil.formatAmount(refundAmt));
|
||||
refundParams.put("refund_order_no", IdUtils.fastSimpleUUID());
|
||||
refundParams.put("notify_url", ADAPAY_CALLBACK_URL);
|
||||
Map<String, Object> resultResponse = null;
|
||||
try {
|
||||
Map<String, Object> response = Refund.create(paymentId, refundParams);
|
||||
log.info("汇付支付创建退款对象:{}", JSON.toJSONString(response));
|
||||
resultResponse = Refund.create(paymentId, refundParams);
|
||||
} catch (BaseAdaPayException e) {
|
||||
log.error("汇付支付创建退款对象error", e);
|
||||
}
|
||||
String jsonString = JSON.toJSONString(resultResponse);
|
||||
log.info("汇付支付创建退款对象param:{}, result:{}", JSON.toJSONString(refundParams), JSON.toJSONString(jsonString));
|
||||
return JSONObject.parseObject(jsonString, RefundResponse.class);
|
||||
}
|
||||
|
||||
/**
|
||||
|
||||
Reference in New Issue
Block a user