feat 支付退款修复策略

This commit is contained in:
xxm1995
2024-01-26 16:51:33 +08:00
parent 870fa761de
commit 7b6dbe8d05
81 changed files with 969 additions and 346 deletions

View File

@@ -1,8 +1,12 @@
package cn.bootx.platform.daxpay.code;
import cn.bootx.platform.common.core.exception.DataNotExistException;
import lombok.AllArgsConstructor;
import lombok.Getter;
import java.util.Arrays;
import java.util.Objects;
/**
* 退款状态枚举
* @author xxm
@@ -21,7 +25,16 @@ public enum PayRefundStatusEnum {
/** 编码 */
private final String code;
/** 名称 */
private final String name;
/**
* 根据编码获取枚举
*/
public static PayRefundStatusEnum findByCode(String code){
return Arrays.stream(values())
.filter(statusEnum -> Objects.equals(statusEnum.getCode(), code))
.findFirst()
.orElseThrow(() -> new DataNotExistException("该枚举不存在"));
}
}

View File

@@ -33,7 +33,7 @@ public enum PayStatusEnum {
* 根据编码获取枚举
*/
public static PayStatusEnum findByCode(String code){
return Arrays.stream(PayStatusEnum.values())
return Arrays.stream(values())
.filter(payStatusEnum -> Objects.equals(payStatusEnum.getCode(), code))
.findFirst()
.orElseThrow(() -> new DataNotExistException("该枚举不存在"));

View File

@@ -74,16 +74,6 @@ 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("退款数据不存在"));
}
/**
* 获取支付单的超时时间
*/