code review 退款逻辑

This commit is contained in:
YunaiV
2021-12-30 09:08:11 +08:00
parent d556eae556
commit 67aaf28832
10 changed files with 67 additions and 52 deletions

View File

@ -28,6 +28,7 @@ public class PayRefundUnifiedReqDTO {
*/
private String userIp;
// TODO @jason这个是否为非必传字段呀只需要传递 payTradeNo 字段即可。尽可能精简
/**
* https://api.mch.weixin.qq.com/v3/refund/domestic/refunds 中的 transaction_id
* https://opendocs.alipay.com/apis alipay.trade.refund 中的 trade_no
@ -35,7 +36,6 @@ public class PayRefundUnifiedReqDTO {
*/
private String channelOrderNo;
/**
* https://api.mch.weixin.qq.com/v3/refund/domestic/refunds 中的 out_trade_no
* https://opendocs.alipay.com/apis alipay.trade.refund 中的 out_trade_no
@ -43,24 +43,22 @@ public class PayRefundUnifiedReqDTO {
*/
private String payTradeNo;
// TODO @jason这个字段要不就使用 merchantRefundId更直接
/**
* https://api.mch.weixin.qq.com/v3/refund/domestic/refunds 中的 out_refund_no
* https://opendocs.alipay.com/apis alipay.trade.refund 中的 out_request_no
* https://opendocs.alipay.com/apis alipay.trade.refund 中的 out_trade_no
* 退款请求单号 同一退款请求单号多次请求只退一笔。
* 使用 商户的退款单号。{PayRefundDO 字段 merchantRefundNo}
*/
@NotEmpty(message = "退款请求单号")
private String refundReqNo;
/**
* 退款原因
*/
@NotEmpty(message = "退款原因不能为空")
private String reason;
/**
* 退款金额,单位:分
*/
@ -68,12 +66,10 @@ public class PayRefundUnifiedReqDTO {
@DecimalMin(value = "0", inclusive = false, message = "支付金额必须大于零")
private Long amount;
/**
* 退款结果 notify 回调地址, 支付宝退款不需要回调地址, 微信需要
*/
@URL(message = "支付结果的 notify 回调地址必须是 URL 格式")
private String notifyUrl;
}

View File

@ -17,11 +17,14 @@ import lombok.experimental.Accessors;
@AllArgsConstructor
@Data
public class PayRefundUnifiedRespDTO {
// TODO @jason可以合并下。退款处理中、成功都是成功其它就业务失败。这样可以复用 PayCommonResult这个 RespDTO 可以返回渠道的退款编号
/**
* 渠道的退款结果
*/
private PayChannelRefundRespEnum channelResp;
// TODO @jsonchannelReturnCode 和 channelReturnMsg 放到 PayCommonResult 里噶
/**
* 渠道返回码
*/

View File

@ -11,6 +11,7 @@ import lombok.Getter;
@Getter
@AllArgsConstructor
public enum PayChannelRefundRespEnum {
SUCCESS(1, "退款成功"),
FAILURE(2, "退款失败"),
PROCESSING(3,"退款处理中"),
@ -18,4 +19,5 @@ public enum PayChannelRefundRespEnum {
private final Integer status;
private final String name;
}