mirror of
https://gitee.com/dromara/dax-pay.git
synced 2025-09-05 20:18:22 +00:00
feat 支付退款修复策略
This commit is contained in:
@@ -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("该枚举不存在"));
|
||||
}
|
||||
}
|
||||
|
@@ -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("该枚举不存在"));
|
||||
|
@@ -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("退款数据不存在"));
|
||||
}
|
||||
|
||||
/**
|
||||
* 获取支付单的超时时间
|
||||
*/
|
||||
|
Reference in New Issue
Block a user