mirror of
https://codeup.aliyun.com/67c68d4e484ca2f0a13ac3c1/ydc/jsowell-charger-web.git
synced 2026-04-20 02:55:04 +08:00
优化订单退款逻辑
This commit is contained in:
@@ -0,0 +1,84 @@
|
||||
package com.jsowell.adapay.response;
|
||||
|
||||
import lombok.*;
|
||||
|
||||
/**
|
||||
* 支付撤销对象
|
||||
*/
|
||||
@Getter
|
||||
@Setter
|
||||
@NoArgsConstructor
|
||||
@AllArgsConstructor
|
||||
@Builder
|
||||
public class PaymentReverseResponse {
|
||||
/**
|
||||
* Adapay生成的支付撤销对象id
|
||||
*/
|
||||
private String id;
|
||||
|
||||
/**
|
||||
* 支付撤销对象,payment_reverse
|
||||
*/
|
||||
private String object;
|
||||
|
||||
/**
|
||||
* 当前支付撤销状态,参见 状态 说明
|
||||
*/
|
||||
private String status;
|
||||
|
||||
/**
|
||||
* true是prod模式,false是mock模式
|
||||
*/
|
||||
private String prod_mode;
|
||||
|
||||
/**
|
||||
* 请求订单号,只能为英文、数字或者下划线的一种或多种组合,保证在app_id下唯一
|
||||
*/
|
||||
private String order_no;
|
||||
|
||||
/**
|
||||
* 原支付交易id
|
||||
*/
|
||||
private String payment_id;
|
||||
|
||||
/**
|
||||
* 控制台 主页面应用的app_id
|
||||
*/
|
||||
private String app_id;
|
||||
|
||||
/**
|
||||
* 撤销金额,必须大于0,保留两位小数点,如0.10、100.05等
|
||||
*/
|
||||
private String reverse_amt;
|
||||
|
||||
/**
|
||||
* 原支付对象已撤销金额,包括已撤销完成金额和撤销处理中的金额
|
||||
*/
|
||||
private String reversed_amt;
|
||||
|
||||
/**
|
||||
* 当前支付对象已确认金额
|
||||
*/
|
||||
private String confirmed_amt;
|
||||
|
||||
/**
|
||||
* 当前支付确认对象已退款金额,包括已退款完成金额和退款处理中的金额
|
||||
*/
|
||||
private String refunded_amt;
|
||||
|
||||
/**
|
||||
* 创建时间戳
|
||||
*/
|
||||
private String created_time;
|
||||
|
||||
/**
|
||||
*
|
||||
* 撤销成功时间戳
|
||||
*/
|
||||
private String succeed_time;
|
||||
|
||||
/**
|
||||
* 扫码收银台返回的退款交易流水号
|
||||
*/
|
||||
private String channel_no;
|
||||
}
|
||||
@@ -10,10 +10,7 @@ import com.jsowell.adapay.common.DivMember;
|
||||
import com.jsowell.adapay.dto.SettleAccountDTO;
|
||||
import com.jsowell.adapay.dto.UpdateAccountConfigDTO;
|
||||
import com.jsowell.adapay.dto.WithdrawDTO;
|
||||
import com.jsowell.adapay.response.BalancePaymentResponse;
|
||||
import com.jsowell.adapay.response.PaymentConfirmResponse;
|
||||
import com.jsowell.adapay.response.QueryCorpMemberResponse;
|
||||
import com.jsowell.adapay.response.QueryMemberResponse;
|
||||
import com.jsowell.adapay.response.*;
|
||||
import com.jsowell.adapay.vo.AdapayAccountBalanceVO;
|
||||
import com.jsowell.adapay.vo.AdapayCorpMemberVO;
|
||||
import com.jsowell.adapay.vo.AdapayMemberInfoVO;
|
||||
@@ -637,7 +634,7 @@ public class AdapayMemberService {
|
||||
/**
|
||||
* 创建退款请求
|
||||
*/
|
||||
public void createRefundRequest(String paymentId, String refundAmt) {
|
||||
public void createRefundRequest(String paymentId, BigDecimal refundAmt) {
|
||||
// 延迟分账确认的调退款接口
|
||||
Map<String, Object> refundParams = Maps.newHashMap();
|
||||
refundParams.put("refund_amt", AdapayUtil.formatAmount(refundAmt));
|
||||
@@ -655,7 +652,8 @@ public class AdapayMemberService {
|
||||
* 创建交易撤销请求
|
||||
* 延迟分账未确认, 调交易撤销接口退款
|
||||
*/
|
||||
public void createPaymentReverseRequest(String paymentId, String reverseAmt) {
|
||||
public PaymentReverseResponse createPaymentReverseRequest(String paymentId, BigDecimal reverseAmt) {
|
||||
PaymentReverseResponse response;
|
||||
// 延迟分账未确认调撤销调撤销接口退款
|
||||
Map<String, Object> reverseParams = Maps.newHashMap();
|
||||
reverseParams.put("app_id", ADAPAY_APP_ID);
|
||||
@@ -663,11 +661,14 @@ public class AdapayMemberService {
|
||||
reverseParams.put("reverse_amt", AdapayUtil.formatAmount(reverseAmt));
|
||||
reverseParams.put("order_no", IdUtils.fastSimpleUUID());
|
||||
reverseParams.put("notify_url", ADAPAY_CALLBACK_URL);
|
||||
Map<String, Object> paymentReverse = null;
|
||||
try {
|
||||
Map<String, Object> paymentReverse = PaymentReverse.create(reverseParams);
|
||||
log.info("汇付支付创建交易撤销对象:{}", JSON.toJSONString(paymentReverse));
|
||||
paymentReverse = PaymentReverse.create(reverseParams);
|
||||
} catch (BaseAdaPayException e) {
|
||||
log.error("汇付支付创建交易撤销对象error", e);
|
||||
}
|
||||
String jsonString = JSON.toJSONString(paymentReverse);
|
||||
log.info("汇付支付创建交易撤销对象param:{}, result:{}", JSON.toJSONString(reverseParams), jsonString);
|
||||
return JSONObject.parseObject(jsonString, PaymentReverseResponse.class);
|
||||
}
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user