转账 - code review 修改

This commit is contained in:
jason
2023-10-25 23:41:59 +08:00
parent 86598dd177
commit 626bd0bd55
24 changed files with 325 additions and 206 deletions

View File

@ -5,6 +5,7 @@ import cn.iocoder.yudao.module.pay.enums.transfer.PayTransferTypeEnum;
import lombok.Data;
import javax.validation.constraints.Min;
import javax.validation.constraints.NotBlank;
import javax.validation.constraints.NotEmpty;
import javax.validation.constraints.NotNull;
import java.util.Map;
@ -21,6 +22,17 @@ public class PayTransferCreateReqDTO {
@NotNull(message = "应用编号不能为空")
private Long appId;
@NotEmpty(message = "转账渠道不能为空")
private String channelCode;
/**
* 转账渠道的额外参数
*/
private Map<String, String> channelExtras;
@NotEmpty(message = "用户 IP 不能为空")
private String userIp;
/**
* 类型
*/
@ -28,11 +40,12 @@ public class PayTransferCreateReqDTO {
@InEnum(PayTransferTypeEnum.class)
private Integer type;
/**
* 商户单编号
* 商户转账单编号
*/
@NotEmpty(message = "商户单编号能为空")
private String merchantOrderId;
@NotEmpty(message = "商户转账单编号能为空")
private String merchantTransferId;
/**
* 转账金额,单位:分
@ -45,9 +58,21 @@ public class PayTransferCreateReqDTO {
* 转账标题
*/
@NotEmpty(message = "转账标题不能为空")
private String title;
private String subject;
@NotEmpty(message = "收款方信息不能为空")
private Map<String, String> payeeInfo;
@NotBlank(message = "支付宝登录号不能为空", groups = {PayTransferTypeEnum.Alipay.class})
private String alipayLogonId;
@NotBlank(message = "支付宝登录号不能为空", groups = {PayTransferTypeEnum.Alipay.class})
private String alipayAccountName;
// ========== 微信转账相关字段 ==========
@NotBlank(message = "微信 openId 不能为空", groups = {PayTransferTypeEnum.WxPay.class})
private String openid;
private String wxAccountName;
}

View File

@ -67,11 +67,11 @@ public interface ErrorCodeConstants {
ErrorCode PAY_TRANSFER_SUBMIT_CHANNEL_ERROR = new ErrorCode(1_007_009_000, "发起转账报错,错误码:{},错误提示:{}");
ErrorCode PAY_TRANSFER_NOT_FOUND = new ErrorCode(1_007_009_001, "转账交易单不存在");
ErrorCode PAY_TRANSFER_STATUS_IS_SUCCESS = new ErrorCode(1_007_009_002, "转账单已成功转账");
ErrorCode PAY_TRANSFER_STATUS_IS_NOT_WAITING = new ErrorCode(1_007_009_003, "转账单不处于待转账");
ErrorCode PAY_TRANSFER_STATUS_IS_NOT_PENDING = new ErrorCode(1_007_009_004, "转账单不处于待转账或转账中");
ErrorCode PAY_TRANSFER_EXTENSION_NOT_FOUND = new ErrorCode(1_007_009_005, "转账交易拓展单不存在");
ErrorCode PAY_TRANSFER_TYPE_AND_CHANNEL_NOT_MATCH = new ErrorCode(1_007_009_006, "转账类型和转账渠道不匹配");
ErrorCode PAY_TRANSFER_EXTENSION_STATUS_IS_NOT_PENDING = new ErrorCode(1_007_009_007, "转账拓展单不处于待转账或转账中");
ErrorCode PAY_TRANSFER_EXISTS = new ErrorCode(1_007_009_003, "已经存在转账单");
ErrorCode PAY_MERCHANT_TRANSFER_EXISTS = new ErrorCode(1_007_009_004, "该笔业务的转账已经存在,请查询相关状态");
ErrorCode PAY_TRANSFER_STATUS_IS_NOT_WAITING = new ErrorCode(1_007_009_005, "转账单不处于待转账");
ErrorCode PAY_TRANSFER_STATUS_IS_NOT_PENDING = new ErrorCode(1_007_009_006, "转账单不处于待转账或转账中");
ErrorCode PAY_TRANSFER_TYPE_AND_CHANNEL_NOT_MATCH = new ErrorCode(1_007_009_008, "转账类型和转账渠道不匹配");
// ========== 示例订单 1-007-900-000 ==========
ErrorCode DEMO_ORDER_NOT_FOUND = new ErrorCode(1_007_900_000, "示例订单不存在");

View File

@ -49,7 +49,7 @@ public enum PayTransferStatusEnum {
* @param status 状态
*/
public static boolean isPendingStatus(Integer status) {
return Objects.equals(status, WAITING.getStatus()) || Objects.equals(status, IN_PROGRESS.status);
return Objects.equals(status, WAITING.getStatus()) || Objects.equals(status, IN_PROGRESS.getStatus());
}
}

View File

@ -21,8 +21,11 @@ public enum PayTransferTypeEnum implements IntArrayValuable {
BANK_CARD(3, "银行卡"),
WALLET_BALANCE(4, "钱包余额");
public static final String ALIPAY_LOGON_ID = "ALIPAY_LOGON_ID";
public static final String ALIPAY_ACCOUNT_NAME = "ALIPAY_ACCOUNT_NAME";
public interface WxPay {
}
public interface Alipay {
}
private final Integer type;
private final String name;