mirror of
https://gitee.com/dromara/dax-pay.git
synced 2025-09-04 19:49:07 +00:00
fix: 修复简单退款选择全部退款时报错问题
This commit is contained in:
@@ -9,8 +9,6 @@ import io.swagger.v3.oas.annotations.media.Schema;
|
||||
import lombok.Data;
|
||||
import lombok.EqualsAndHashCode;
|
||||
|
||||
import javax.validation.constraints.NotNull;
|
||||
|
||||
/**
|
||||
* 简单退款参数,只可以用于非组合的支付订单
|
||||
* @author xxm
|
||||
@@ -44,7 +42,6 @@ public class SimpleRefundParam extends PaymentCommonParam {
|
||||
|
||||
|
||||
@Schema(description = "退款金额")
|
||||
@NotNull(message = "退款金额不可为空")
|
||||
private Integer amount;
|
||||
|
||||
/**
|
||||
|
@@ -127,9 +127,10 @@ public class RefundAssistService {
|
||||
throw new PayFailureException("当前状态["+statusEnum.getName()+"]不允许发起退款操作");
|
||||
}
|
||||
|
||||
// 过滤掉金额为0的退款参数
|
||||
// 过滤掉金额为空和0的退款参数
|
||||
List<RefundChannelParam> channelParams = param.getRefundChannels()
|
||||
.stream()
|
||||
.filter(r -> Objects.nonNull(r.getAmount()))
|
||||
.filter(r -> r.getAmount() > 0)
|
||||
.collect(Collectors.toList());
|
||||
param.setRefundChannels(channelParams);
|
||||
|
@@ -74,8 +74,10 @@ public class RefundService {
|
||||
// 构建退款参数
|
||||
RefundParam refundParam = new RefundParam();
|
||||
BeanUtil.copyProperties(param,refundParam);
|
||||
RefundChannelParam channelParam = new RefundChannelParam().setAmount(param.getAmount());
|
||||
refundParam.setRefundChannels(Collections.singletonList(channelParam));
|
||||
if (!param.isRefundAll()){
|
||||
RefundChannelParam channelParam = new RefundChannelParam().setAmount(param.getAmount());
|
||||
refundParam.setRefundChannels(Collections.singletonList(channelParam));
|
||||
}
|
||||
return this.refundAdapter(refundParam,true);
|
||||
}
|
||||
|
||||
|
Reference in New Issue
Block a user