修改退款申请封装
This commit is contained in:
@@ -151,10 +151,11 @@ public class OrderPayment implements Serializable {
|
||||
}
|
||||
|
||||
public static OrderPayment refund(@NonNull Long shopId, @NonNull Long sourceId, @NotBlank String sourceType,
|
||||
@NotBlank String orderNo, @NonNull BigDecimal amount, Long relatedId) {
|
||||
@NotBlank String orderNo, @NonNull BigDecimal amount, Long relatedId, String platformType) {
|
||||
OrderPayment orderPayment = getInstance(shopId, sourceId, sourceType, orderNo, amount, null, relatedId);
|
||||
orderPayment.setPayType(PayTypeConstants.PayType.REFUND);
|
||||
orderPayment.setPayStatus(PayTypeConstants.PayStatus.INIT);
|
||||
orderPayment.setPlatformType(platformType);
|
||||
return orderPayment;
|
||||
}
|
||||
|
||||
|
||||
@@ -12,9 +12,9 @@ import com.czg.order.enums.PayEnums;
|
||||
import com.czg.order.vo.HistoryOrderPrintVo;
|
||||
import com.czg.order.vo.HistoryOrderVo;
|
||||
import com.czg.order.vo.OrderInfoVo;
|
||||
import com.czg.pay.PayNotifyRespDTO;
|
||||
import com.czg.resp.CzgResult;
|
||||
import com.mybatisflex.core.paginate.Page;
|
||||
import com.mybatisflex.core.service.IService;
|
||||
import jakarta.validation.constraints.NotBlank;
|
||||
import org.jetbrains.annotations.NotNull;
|
||||
|
||||
@@ -44,7 +44,7 @@ public interface OrderInfoCustomService {
|
||||
|
||||
CzgResult<Object> mergeOrder(MergeOrderDTO param);
|
||||
|
||||
void payCallBackOrder(@NotBlank String orderNo, @NotNull JSONObject resultJson, int retryCount);
|
||||
void payCallBackOrder(@NotBlank String orderNo, @NotNull PayNotifyRespDTO notifyRespDTO, int retryCount);
|
||||
|
||||
void refundCallBackOrder(@NotBlank String orderNo, @NotNull JSONObject resultJson);
|
||||
|
||||
|
||||
@@ -50,16 +50,22 @@ public class CzgRefundReq {
|
||||
*/
|
||||
private String notifyUrl;
|
||||
|
||||
/**
|
||||
* 支付平台
|
||||
*/
|
||||
private String platform;
|
||||
|
||||
/**
|
||||
* payOrderId和mchOrderNo 二选一 必填
|
||||
*/
|
||||
public CzgRefundReq(@NonNull String mchRefundNo, @NonNull String refundReason, @NonNull Long refundAmount,
|
||||
@NonNull Long orderTotalAmount, String mchOrderNo, String extParam) {
|
||||
@NonNull Long orderTotalAmount, String mchOrderNo, String extParam, String platform) {
|
||||
this.mchRefundNo = mchRefundNo;
|
||||
this.refundReason = refundReason;
|
||||
this.refundAmount = refundAmount;
|
||||
this.orderTotalAmount = orderTotalAmount;
|
||||
this.mchOrderNo = mchOrderNo;
|
||||
this.extParam = extParam;
|
||||
this.platform = platform;
|
||||
}
|
||||
}
|
||||
|
||||
@@ -0,0 +1,67 @@
|
||||
package com.czg.pay;
|
||||
|
||||
import lombok.Data;
|
||||
import lombok.experimental.Accessors;
|
||||
|
||||
/**
|
||||
* 统一支付回调响应数据
|
||||
* @author yjjie
|
||||
* @date 2026/1/15 09:16
|
||||
*/
|
||||
@Data
|
||||
@Accessors(chain = true)
|
||||
public class PayNotifyRespDTO {
|
||||
|
||||
/**
|
||||
* 商户订单号
|
||||
*/
|
||||
private String mchOrderNo;
|
||||
|
||||
/**
|
||||
* 三方订单号
|
||||
*/
|
||||
private String thirdOrderNo;
|
||||
|
||||
/**
|
||||
* 订单状态
|
||||
* INIT - 订单初始化;
|
||||
* TRADE_AWAIT - 待支付;
|
||||
* TRADE_SUCCESS - 支付成功;
|
||||
* TRADE_FAIL -支付失败;
|
||||
* TRADE_CANCEL -交易取消;
|
||||
* TRADE_REFUND -已退款;
|
||||
* REFUND_ING - 退款中;
|
||||
* TRADE_CLOSE -订单关闭
|
||||
*/
|
||||
private String status;
|
||||
|
||||
/**
|
||||
* 支付平台
|
||||
*/
|
||||
private String platform;
|
||||
|
||||
/**
|
||||
* 订单金额 分
|
||||
*/
|
||||
private Long amount;
|
||||
|
||||
/**
|
||||
* 扩展数据
|
||||
*/
|
||||
private String extData;
|
||||
|
||||
/**
|
||||
* 支付成功时间
|
||||
*/
|
||||
private String paySuccessTime;
|
||||
|
||||
/**
|
||||
* 错误信息
|
||||
*/
|
||||
private String errorMsg;
|
||||
|
||||
/**
|
||||
* 回调原始数据
|
||||
*/
|
||||
private String originalData;
|
||||
}
|
||||
@@ -0,0 +1,59 @@
|
||||
package com.czg.pay;
|
||||
|
||||
import lombok.Data;
|
||||
import lombok.experimental.Accessors;
|
||||
|
||||
/**
|
||||
* 退款相应数据
|
||||
* @author yjjie
|
||||
* @date 2026/1/15 11:00
|
||||
*/
|
||||
@Data
|
||||
@Accessors(chain = true)
|
||||
public class RefundRespDTO {
|
||||
|
||||
/**
|
||||
* 退款状态
|
||||
* INIT:初始化
|
||||
* ING:退款中
|
||||
* SUCCESS:退款成功
|
||||
* FAIL:退款失败
|
||||
* CLOSE:退款关闭
|
||||
*/
|
||||
private String status;
|
||||
|
||||
/**
|
||||
* 退款金额
|
||||
*/
|
||||
private Long refundAmount;
|
||||
|
||||
/**
|
||||
* 退款时间
|
||||
*/
|
||||
private String refundTime;
|
||||
|
||||
/**
|
||||
* 三方退款订单号
|
||||
*/
|
||||
private String thirdRefundNo;
|
||||
|
||||
/**
|
||||
* 商户退款订单号
|
||||
*/
|
||||
private String merchantRefundNo;
|
||||
|
||||
/**
|
||||
* 退款失败原因
|
||||
*/
|
||||
private String errMessage;
|
||||
|
||||
/**
|
||||
* 退款相应原始数据
|
||||
*/
|
||||
private String originalData;
|
||||
|
||||
/**
|
||||
* 退款平台
|
||||
*/
|
||||
private String platform;
|
||||
}
|
||||
@@ -59,4 +59,8 @@ public class CzgResult<T> implements Serializable {
|
||||
public static <T> CzgResult<T> failure(CzgRespCode respCode) {
|
||||
return new CzgResult<>(respCode.getCode(), respCode.getMsg(), null);
|
||||
}
|
||||
|
||||
public boolean isSuccess() {
|
||||
return code == 200;
|
||||
}
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user