feat:【PAY 支付】示例转账单,改成示例提现单,理解成本更低
This commit is contained in:
@@ -1,6 +1,5 @@
|
||||
package cn.iocoder.yudao.module.pay.api.notify.dto;
|
||||
|
||||
import cn.iocoder.yudao.module.pay.enums.refund.PayRefundStatusEnum;
|
||||
import lombok.AllArgsConstructor;
|
||||
import lombok.Builder;
|
||||
import lombok.Data;
|
||||
|
@@ -1,9 +1,12 @@
|
||||
package cn.iocoder.yudao.module.pay.api.notify.dto;
|
||||
|
||||
import lombok.AllArgsConstructor;
|
||||
import lombok.Builder;
|
||||
import lombok.Data;
|
||||
|
||||
import jakarta.validation.constraints.NotEmpty;
|
||||
import jakarta.validation.constraints.NotNull;
|
||||
import lombok.NoArgsConstructor;
|
||||
|
||||
/**
|
||||
* 转账单的通知 Request DTO
|
||||
@@ -11,14 +14,16 @@ import jakarta.validation.constraints.NotNull;
|
||||
* @author jason
|
||||
*/
|
||||
@Data
|
||||
@Builder
|
||||
@NoArgsConstructor
|
||||
@AllArgsConstructor
|
||||
public class PayTransferNotifyReqDTO {
|
||||
|
||||
// TODO 芋艿:要不要改成 orderId 待定;
|
||||
/**
|
||||
* 商户转账单号
|
||||
*/
|
||||
@NotEmpty(message = "商户转账单号不能为空")
|
||||
private String merchantTransferId;
|
||||
private String merchantOrderId;
|
||||
|
||||
/**
|
||||
* 转账订单编号
|
||||
|
@@ -42,7 +42,7 @@ public class PayTransferCreateReqDTO {
|
||||
* 商户转账单编号
|
||||
*/
|
||||
@NotEmpty(message = "商户转账单编号能为空")
|
||||
private String merchantTransferId;
|
||||
private String merchantOrderId;
|
||||
|
||||
/**
|
||||
* 转账金额,单位:分
|
||||
|
@@ -1,8 +1,11 @@
|
||||
package cn.iocoder.yudao.module.pay.api.transfer.dto;
|
||||
|
||||
import cn.iocoder.yudao.module.pay.enums.PayChannelEnum;
|
||||
import cn.iocoder.yudao.module.pay.enums.transfer.PayTransferStatusEnum;
|
||||
import lombok.Data;
|
||||
|
||||
import java.time.LocalDateTime;
|
||||
|
||||
@Data
|
||||
public class PayTransferRespDTO {
|
||||
|
||||
@@ -16,6 +19,22 @@ public class PayTransferRespDTO {
|
||||
*/
|
||||
private String no;
|
||||
|
||||
/**
|
||||
* 转账渠道编码
|
||||
*
|
||||
* 枚举 {@link PayChannelEnum}
|
||||
*/
|
||||
private String channelCode;
|
||||
|
||||
// ========== 商户相关字段 ==========
|
||||
|
||||
/**
|
||||
* 商户转账单编号
|
||||
*/
|
||||
private String merchantOrderId;
|
||||
|
||||
// ========== 转账相关字段 ==========
|
||||
|
||||
/**
|
||||
* 转账金额,单位:分
|
||||
*/
|
||||
@@ -28,4 +47,10 @@ public class PayTransferRespDTO {
|
||||
*/
|
||||
private Integer status;
|
||||
|
||||
/**
|
||||
* 订单转账成功时间
|
||||
*/
|
||||
private LocalDateTime successTime;
|
||||
|
||||
|
||||
}
|
||||
|
@@ -85,8 +85,12 @@ public interface ErrorCodeConstants {
|
||||
ErrorCode DEMO_ORDER_REFUND_FAIL_REFUND_ORDER_ID_ERROR = new ErrorCode(1_007_900_009, "发起退款失败,退款单编号不匹配");
|
||||
ErrorCode DEMO_ORDER_REFUND_FAIL_REFUND_PRICE_NOT_MATCH = new ErrorCode(1_007_900_010, "发起退款失败,退款单金额不匹配");
|
||||
|
||||
// ========== 示例转账订单 1-007-901-001 ==========
|
||||
ErrorCode DEMO_TRANSFER_NOT_FOUND = new ErrorCode(1_007_901_001, "示例转账单不存在");
|
||||
ErrorCode DEMO_TRANSFER_FAIL_TRANSFER_ID_ERROR = new ErrorCode(1_007_901_002, "转账失败,转账单编号不匹配");
|
||||
ErrorCode DEMO_TRANSFER_FAIL_PRICE_NOT_MATCH = new ErrorCode(1_007_901_003, "转账失败,转账单金额不匹配");
|
||||
// ========== 示例提现单 1-007-901-000 ==========
|
||||
ErrorCode DEMO_WITHDRAW_NOT_FOUND = new ErrorCode(1_007_901_000, "示例提现单不存在");
|
||||
ErrorCode DEMO_WITHDRAW_UPDATE_STATUS_FAIL_PAY_TRANSFER_ID_ERROR = new ErrorCode(1_007_901_001, "更新示例提现单状态失败,支付转账单编号不匹配");
|
||||
ErrorCode DEMO_WITHDRAW_UPDATE_STATUS_FAIL_PAY_TRANSFER_STATUS_NOT_SUCCESS_OR_CLOSED = new ErrorCode(1_007_901_002, "更新示例提现单状态失败,支付转账单状态不是【转账成功】或【转账失败】状态");
|
||||
ErrorCode DEMO_WITHDRAW_UPDATE_STATUS_FAIL_PAY_PRICE_NOT_MATCH = new ErrorCode(1_007_901_003, "更新示例提现单状态失败,支付转账单金额不匹配");
|
||||
ErrorCode DEMO_WITHDRAW_UPDATE_STATUS_FAIL_PAY_MERCHANT_EXISTS = new ErrorCode(1_007_901_004, "更新示例提现单状态失败,支付转账单商户订单号不匹配");
|
||||
ErrorCode DEMO_WITHDRAW_UPDATE_STATUS_FAIL_PAY_CHANNEL_NOT_MATCH = new ErrorCode(1_007_901_005, "更新示例提现单状态失败,支付转账单渠道不匹配");
|
||||
|
||||
}
|
||||
|
@@ -1,8 +1,11 @@
|
||||
package cn.iocoder.yudao.module.pay.enums;
|
||||
|
||||
import cn.iocoder.yudao.framework.common.core.ArrayValuable;
|
||||
import lombok.AllArgsConstructor;
|
||||
import lombok.Getter;
|
||||
|
||||
import java.util.Arrays;
|
||||
|
||||
/**
|
||||
* 支付渠道的编码的枚举
|
||||
*
|
||||
@@ -10,7 +13,7 @@ import lombok.Getter;
|
||||
*/
|
||||
@Getter
|
||||
@AllArgsConstructor
|
||||
public enum PayChannelEnum {
|
||||
public enum PayChannelEnum implements ArrayValuable<String> {
|
||||
|
||||
WX_PUB("wx_pub", "微信 JSAPI 支付"), // 公众号网页
|
||||
WX_LITE("wx_lite", "微信小程序支付"),
|
||||
@@ -28,6 +31,8 @@ public enum PayChannelEnum {
|
||||
|
||||
WALLET("wallet", "钱包支付");
|
||||
|
||||
public static final String[] ARRAYS = Arrays.stream(values()).map(PayChannelEnum::getCode).toArray(String[]::new);
|
||||
|
||||
/**
|
||||
* 编码
|
||||
*
|
||||
@@ -39,4 +44,9 @@ public enum PayChannelEnum {
|
||||
*/
|
||||
private final String name;
|
||||
|
||||
@Override
|
||||
public String[] array() {
|
||||
return ARRAYS;
|
||||
}
|
||||
|
||||
}
|
||||
|
@@ -0,0 +1,42 @@
|
||||
package cn.iocoder.yudao.module.pay.enums.demo;
|
||||
|
||||
import lombok.AllArgsConstructor;
|
||||
import lombok.Getter;
|
||||
|
||||
import java.util.Objects;
|
||||
|
||||
/**
|
||||
* 示例提现单的状态枚举
|
||||
*
|
||||
* @author jason
|
||||
*/
|
||||
@Getter
|
||||
@AllArgsConstructor
|
||||
public enum PayDemoWithdrawStatusEnum {
|
||||
|
||||
WAITING(0, "等待提现"),
|
||||
SUCCESS(10, "提现成功"),
|
||||
CLOSED(20, "提现关闭");
|
||||
|
||||
/**
|
||||
* 状态
|
||||
*/
|
||||
private final Integer status;
|
||||
/**
|
||||
* 状态名
|
||||
*/
|
||||
private final String name;
|
||||
|
||||
public static boolean isSuccess(Integer status) {
|
||||
return Objects.equals(status, SUCCESS.getStatus());
|
||||
}
|
||||
|
||||
public static boolean isClosed(Integer status) {
|
||||
return Objects.equals(status, CLOSED.getStatus());
|
||||
}
|
||||
|
||||
public static boolean isWaiting(Integer status) {
|
||||
return Objects.equals(status, WAITING.getStatus());
|
||||
}
|
||||
|
||||
}
|
@@ -0,0 +1,39 @@
|
||||
package cn.iocoder.yudao.module.pay.enums.demo;
|
||||
|
||||
import cn.iocoder.yudao.framework.common.core.ArrayValuable;
|
||||
import lombok.AllArgsConstructor;
|
||||
import lombok.Getter;
|
||||
|
||||
import java.util.Arrays;
|
||||
|
||||
/**
|
||||
* 示例提现单的类型枚举
|
||||
*
|
||||
* @author owen
|
||||
*/
|
||||
@AllArgsConstructor
|
||||
@Getter
|
||||
public enum PayDemoWithdrawTypeEnum implements ArrayValuable<Integer> {
|
||||
|
||||
WECHAT(2, "微信"),
|
||||
ALIPAY(1, "支付宝"),
|
||||
WALLET(3, "钱包"),
|
||||
;
|
||||
|
||||
public static final Integer[] ARRAYS = Arrays.stream(values()).map(PayDemoWithdrawTypeEnum::getType).toArray(Integer[]::new);
|
||||
|
||||
/**
|
||||
* 类型
|
||||
*/
|
||||
private final Integer type;
|
||||
/**
|
||||
* 名字
|
||||
*/
|
||||
private final String name;
|
||||
|
||||
@Override
|
||||
public Integer[] array() {
|
||||
return ARRAYS;
|
||||
}
|
||||
|
||||
}
|
@@ -48,9 +48,20 @@ public enum PayTransferStatusEnum {
|
||||
* 是否处于待转账或者转账中的状态
|
||||
*
|
||||
* @param status 状态
|
||||
* @return 是否
|
||||
*/
|
||||
public static boolean isWaitingOrProcessing(Integer status) {
|
||||
return isWaiting(status) || isProgressing(status);
|
||||
}
|
||||
|
||||
/**
|
||||
* 是否处于成功或者关闭中的状态
|
||||
*
|
||||
* @param status 状态
|
||||
* @return 是否
|
||||
*/
|
||||
public static boolean isSuccessOrClosed(Integer status) {
|
||||
return isSuccess(status) || isClosed(status);
|
||||
}
|
||||
|
||||
}
|
||||
|
Reference in New Issue
Block a user