mall + pay:

1. 完成支付宝的退款重构
2. 完成 demo 模块的退款接入
This commit is contained in:
YunaiV
2023-07-15 20:36:04 +08:00
parent 518e89dc4b
commit c44ace6011
23 changed files with 339 additions and 280 deletions

View File

@ -20,6 +20,13 @@ public class PayRefundRespDTO {
*/
private Integer status;
/**
* 外部退款号
*
* 对应 PayRefundDO 的 no 字段
*/
private String outRefundNo;
/**
* 渠道退款单号
*

View File

@ -68,7 +68,6 @@ public abstract class AbstractAlipayPayClient extends AbstractPayClient<AlipayPa
model.setOutTradeNo(reqDTO.getOutTradeNo());
model.setOutRequestNo(reqDTO.getOutRefundNo());
model.setRefundAmount(formatAmount(reqDTO.getPrice()));
// model.setRefundAmount(formatAmount(reqDTO.getPrice() / 2));
model.setRefundReason(reqDTO.getReason());
// 1.2 构建 AlipayTradePayRequest 请求
AlipayTradeRefundRequest request = new AlipayTradeRefundRequest();
@ -77,6 +76,7 @@ public abstract class AbstractAlipayPayClient extends AbstractPayClient<AlipayPa
// 2.1 执行请求
AlipayTradeRefundResponse response = client.execute(request);
PayRefundRespDTO refund = new PayRefundRespDTO()
.setOutRefundNo(reqDTO.getOutRefundNo())
.setRawData(response);
// 支付宝只要退款调用返回 success就认为退款成功不需要回调。具体可见 parseNotify 方法的说明。
// 另外,支付宝没有退款单号,所以不用设置