feat 对账和退款同步接口

This commit is contained in:
xxm1995
2024-01-17 16:48:07 +08:00
parent 273e26bd53
commit c9065c0739
32 changed files with 478 additions and 88 deletions

View File

@@ -0,0 +1,29 @@
package cn.bootx.platform.daxpay.result.order;
import io.swagger.v3.oas.annotations.media.Schema;
import lombok.Data;
import lombok.experimental.Accessors;
/**
* 支付退款通道明细数据
* @author xxm
* @since 2024/1/17
*/
@Data
@Accessors(chain = true)
@Schema(title = "支付退款通道明细数据")
public class RefundOrderChannelResult {
@Schema(description = "通道")
private String channel;
/** 关联支付网关退款请求号 */
@Schema(description = "异步方式关联退款请求号(部分退款情况)")
private String refundRequestNo;
@Schema(description = "异步支付方式")
private boolean async;
@Schema(description = "退款金额")
private Integer amount;
}

View File

@@ -1,7 +1,6 @@
package cn.bootx.platform.daxpay.result.order;
import cn.bootx.platform.daxpay.code.PayRefundStatusEnum;
import cn.bootx.platform.daxpay.entity.RefundableInfo;
import io.swagger.v3.oas.annotations.media.Schema;
import lombok.Data;
import lombok.experimental.Accessors;
@@ -28,9 +27,6 @@ public class RefundOrderResult {
@Schema(description = "退款号")
private String refundNo;
@Schema(description = "异步方式关联退款请求号(部分退款情况)")
private String refundRequestNo;
@Schema(description = "标题")
private String title;
@@ -46,8 +42,8 @@ public class RefundOrderResult {
@Schema(description = "退款时间")
private LocalDateTime refundTime;
@Schema(description = "退款信息列表")
private List<RefundableInfo> refundableInfo;
@Schema(description = "支付退款通道明细数据")
private List<RefundOrderChannelResult> channels;
/**
* @see PayRefundStatusEnum

View File

@@ -2,6 +2,7 @@ package cn.bootx.platform.daxpay.util;
import cn.bootx.platform.common.core.util.LocalDateTimeUtil;
import cn.bootx.platform.daxpay.code.PayChannelEnum;
import cn.bootx.platform.daxpay.entity.RefundableInfo;
import cn.bootx.platform.daxpay.exception.pay.PayAmountAbnormalException;
import cn.bootx.platform.daxpay.exception.pay.PayFailureException;
import cn.bootx.platform.daxpay.param.pay.PayChannelParam;
@@ -13,6 +14,7 @@ import lombok.experimental.UtilityClass;
import java.time.LocalDateTime;
import java.time.temporal.ChronoUnit;
import java.util.List;
import java.util.Objects;
/**
* 支付工具类
@@ -72,6 +74,16 @@ public class PayUtil {
return LocalDateTimeUtil.format(dateTime, DatePattern.PURE_DATETIME_PATTERN);
}
/**
* 过滤出需要的可退款数据
*/
public RefundableInfo refundableInfoFilter(List<RefundableInfo> refundableInfos, PayChannelEnum payChannelEnum){
return refundableInfos.stream()
.filter(o -> Objects.equals(o.getChannel(), payChannelEnum.getCode()))
.findFirst()
.orElseThrow(() -> new PayFailureException("退款数据不存在"));
}
/**
* 获取支付单的超时时间
*/