refactor(pay): 付款码字段统一为 authCode 并拆分 OAuth 校验文案

落库/查询 barCode 对齐 unipay 入参 authCode,DB 列 bar_code 迁移为 auth_code;validation 拆出 oauthCode 避免与付款码混用。
This commit is contained in:
DaxPay Dev
2026-07-15 11:05:09 +08:00
parent 42b37bd2eb
commit 6551777535
18 changed files with 74 additions and 52 deletions

View File

@@ -0,0 +1,3 @@
-- 付款码列bar_code → auth_code与 unipay 入参 authCode 对齐)
ALTER TABLE pay_normal_order RENAME COLUMN bar_code TO auth_code;
COMMENT ON COLUMN pay_normal_order.auth_code IS '付款码(被扫支付,审计保留)';

View File

@@ -63,6 +63,8 @@ public class PayTradeAdminService {
result.setMethod(normalOrder.getMethod());
result.setChannelAppId(normalOrder.getChannelAppId());
result.setBuyerId(normalOrder.getBuyerId());
result.setOpenid(normalOrder.getOpenid());
result.setAuthCode(normalOrder.getAuthCode());
result.setTradeProduct(normalOrder.getTradeProduct());
result.setTradeWay(normalOrder.getTradeWay());
result.setBankType(normalOrder.getBankType());

View File

@@ -93,7 +93,7 @@ public class GatewayPayOrder extends MchBaseEntity {
/// @see ProductEnum
private String product;
// ===== 支付请求参数(支付时写入,审计保留;网关无被扫,不承载 barCode=====
// ===== 支付请求参数(支付时写入,审计保留;网关无被扫,不承载 authCode=====
/// 微信 openidjsapi/app/miniapp
private String openid;

View File

@@ -92,7 +92,7 @@ public class NormalPayOrder extends MchBaseEntity {
private String openid;
/// 付款码(被扫支付,终态后仍保留供审计)
private String barCode;
private String authCode;
// ===== 时间线(冗余,查询展示用)=====

View File

@@ -137,7 +137,7 @@ public class PayTradeResult extends BaseResult {
/// 付款码(被扫支付)
@Schema(description = "付款码")
private String barCode;
private String authCode;
/// 活动类型
@Schema(description = "活动类型")

View File

@@ -61,7 +61,7 @@ public class NormalPayService {
var mchApp = merchantContextLoader.resolveApp(payParam.getMchNo(), payParam.getAppId());
payParam.setAppId(mchApp.getAppId());
// 付款码: 有 authCode 且 method 空时按前缀识别并回填分钱包 method, 再走路由
resolveBarcodeMethodIfNeeded(payParam);
this.resolveBarcodeMethodIfNeeded(payParam);
// 路由解析:直接指定(已传 channelMchNo)优先,否则按 appId+method 跟随通道路由匹配
payRouteService.resolve(payParam);
var payStrategy = PaymentStrategyFactory.createByProduct(payParam.getProduct(), AbsNormalPayStrategy.class);

View File

@@ -78,7 +78,7 @@ public class PayAssistService {
normalOrder.setLimitPay(payParam.getLimitPay() != null
? String.join(",", payParam.getLimitPay()) : null);
normalOrder.setOpenid(payParam.getOpenId());
normalOrder.setBarCode(payParam.getAuthCode());
normalOrder.setAuthCode(payParam.getAuthCode());
normalOrder.setProduct(payParam.getProduct());
normalOrder.setExtraParam(payParam.getExtraParam());
normalOrder.setGoodsDetail(payParam.getGoodsDetail());

View File

@@ -26,9 +26,9 @@ public class AuthCodeParam extends MerchantPaymentCommonParam {
@Schema(description = "认证类型")
private String authType;
/// 三方通道可以直接获取到OpeId, 可以写入这个至
@Schema(description = "标识码/")
@NotBlank(message = "{validation.field.authCode.notBlank}")
/// 三方通道 OAuth 授权码(换 openId/userId); 亦可直接写入已拿到的 openId
@Schema(description = "授权码")
@NotBlank(message = "{validation.field.oauthCode.notBlank}")
private String authCode;
/// 三方通道可以直接获取到这个值

View File

@@ -40,7 +40,7 @@
"notBlank": "App private key cannot be blank"
},
"appSecret": {
"notBlank": "App secret cannot be blank"
"size": "App secret cannot exceed 512 characters"
},
"douyinMchId": {
"notBlank": "Douyin merchant ID cannot be blank"
@@ -137,7 +137,6 @@
"pass": {
"notNull": "Audit result cannot be blank"
},
"channelMerchantNo": {
"notBlank": "Channel merchant no. cannot be blank"
},
@@ -183,8 +182,8 @@
"notNull": "File type cannot be blank"
},
"authCode": {
"notBlank": "Auth code cannot be blank",
"size": "Auth code cannot exceed 128 characters"
"notBlank": "Payment code cannot be blank",
"size": "Payment code cannot exceed 128 characters"
},
"clientIp": {
"size": "Client IP cannot exceed 64 characters"
@@ -379,9 +378,6 @@
"roleId": {
"notNull": "Role ID cannot be blank"
},
"clientCode": {
"notBlank": "Client code cannot be blank"
},
"code": {
"notBlank": "Code cannot be blank"
},
@@ -585,9 +581,6 @@
"wechatIsvMchAppId": {
"notNull": "WeChat ISV channel merchant app ID cannot be blank"
},
"appSecret": {
"size": "App secret cannot exceed 512 characters"
},
"storeName": {
"notBlank": "Store name cannot be blank"
},
@@ -622,9 +615,6 @@
"ids": {
"notEmpty": "Please select QR code boards"
},
"configName": {
"notBlank": "Config name cannot be blank"
},
"twoFactorCode": {
"notBlank": "Verification code cannot be blank"
},
@@ -749,6 +739,10 @@
},
"fileContent": {
"notBlank": "File content cannot be blank"
},
"oauthCode": {
"notBlank": "Authorization code cannot be blank",
"size": "Authorization code cannot exceed 128 characters"
}
}
}

View File

@@ -182,8 +182,8 @@
"notNull": "Jenis file tidak boleh kosong"
},
"authCode": {
"notBlank": "Kode autentikasi tidak boleh kosong",
"size": "Kode autentikasi tidak boleh melebihi 128 karakter"
"notBlank": "Kode pembayaran tidak boleh kosong",
"size": "Kode pembayaran tidak boleh melebihi 128 karakter"
},
"clientIp": {
"size": "IP klien tidak boleh melebihi 64 karakter"
@@ -739,6 +739,10 @@
},
"fileContent": {
"notBlank": "Konten file tidak boleh kosong"
},
"oauthCode": {
"notBlank": "Kode otorisasi tidak boleh kosong",
"size": "Kode otorisasi tidak boleh melebihi 128 karakter"
}
}
}

View File

@@ -182,8 +182,8 @@
"notNull": "ファイルタイプを空白にすることはできません"
},
"authCode": {
"notBlank": "認証コードを空白にすることはできません",
"size": "認証コードは 128 文字を超えることはできません"
"notBlank": "支払いコードは必須です",
"size": "支払いコードは128文字以内で入力してください"
},
"clientIp": {
"size": "クライアント IP は 64 文字を超えることはできません"
@@ -739,6 +739,10 @@
},
"fileContent": {
"notBlank": "ファイルの内容を空白にすることはできません"
},
"oauthCode": {
"notBlank": "認証コードは必須です",
"size": "認証コードは128文字以内で入力してください"
}
}
}

View File

@@ -182,8 +182,8 @@
"notNull": "파일 형식은 비워둘 수 없습니다."
},
"authCode": {
"notBlank": "인증 코드는 비워둘 수 없습니다.",
"size": "인증 코드는 128자를 초과할 수 없습니다."
"notBlank": "결제 코드는 필수입니다",
"size": "결제 코드는 128자를 초과할 수 없습니다"
},
"clientIp": {
"size": "클라이언트 IP는 64자를 초과할 수 없습니다."
@@ -739,6 +739,10 @@
},
"fileContent": {
"notBlank": "파일 콘텐츠는 비워둘 수 없습니다."
},
"oauthCode": {
"notBlank": "인증 코드는 필수입니다",
"size": "인증 코드는 128자를 초과할 수 없습니다"
}
}
}

View File

@@ -182,8 +182,8 @@
"notNull": "Jenis fail tidak boleh kosong"
},
"authCode": {
"notBlank": "Kod pengesahan tidak boleh kosong",
"size": "Kod pengesahan tidak boleh melebihi 128 aksara"
"notBlank": "Kod pembayaran tidak boleh kosong",
"size": "Kod pembayaran tidak boleh melebihi 128 aksara"
},
"clientIp": {
"size": "IP pelanggan tidak boleh melebihi 64 aksara"
@@ -739,6 +739,10 @@
},
"fileContent": {
"notBlank": "Kandungan fail tidak boleh kosong"
},
"oauthCode": {
"notBlank": "Kod kebenaran tidak boleh kosong",
"size": "Kod kebenaran tidak boleh melebihi 128 aksara"
}
}
}

View File

@@ -182,8 +182,8 @@
"notNull": "ประเภทไฟล์ต้องไม่เว้นว่าง"
},
"authCode": {
"notBlank": "รหัสรับรองความถูกต้องไม่สามารถเว้นว่างได้",
"size": "รหัสรับรองความถูกต้องต้องมีความยาวไม่เกิน 128 ตัวอักษร"
"notBlank": "รหัสชำระเงินต้องไม่เว้นว่าง",
"size": "รหัสชำระเงินต้องไม่เกิน 128 ตัวอักษร"
},
"clientIp": {
"size": "IP ไคลเอ็นต์ต้องมีความยาวไม่เกิน 64 อักขระ"
@@ -739,6 +739,10 @@
},
"fileContent": {
"notBlank": "เนื้อหาไฟล์ต้องไม่เว้นว่าง"
},
"oauthCode": {
"notBlank": "รหัสอนุญาตต้องไม่เว้นว่าง",
"size": "รหัสอนุญาตต้องไม่เกิน 128 ตัวอักษร"
}
}
}

View File

@@ -182,8 +182,8 @@
"notNull": "Loại tệp không được để trống"
},
"authCode": {
"notBlank": "Mã xác thực không được để trống",
"size": "Mã xác thực không được vượt quá 128 ký tự"
"notBlank": "Mã thanh toán không được để trống",
"size": "Mã thanh toán không được vượt quá 128 ký tự"
},
"clientIp": {
"size": "IP khách hàng không thể vượt quá 64 ký tự"
@@ -739,6 +739,10 @@
},
"fileContent": {
"notBlank": "Nội dung tập tin không được để trống"
},
"oauthCode": {
"notBlank": "Mã ủy quyền không được để trống",
"size": "Mã ủy quyền không được vượt quá 128 ký tự"
}
}
}

View File

@@ -19,7 +19,7 @@
"notBlank": "Client Key不能为空"
},
"clientCode": {
"notBlank": "终端不能为空"
"notBlank": "终端编码不可为空"
},
"ip": {
"notValid": "IP地址不合法"
@@ -40,7 +40,7 @@
"notBlank": "应用私钥不可为空"
},
"appSecret": {
"notBlank": "应用密钥不可为空"
"size": "应用密钥不可超过512位"
},
"douyinMchId": {
"notBlank": "抖音商户号不可为空"
@@ -102,7 +102,7 @@
"notBlank": "微信商户Id不可为空"
},
"wxAppId": {
"notBlank": "微信应用appId不可为空"
"notBlank": "微信应用AppId不可为空"
},
"publicKeyId": {
"notBlank": "支付公钥ID不可为空"
@@ -137,7 +137,6 @@
"pass": {
"notNull": "审核结果不可为空"
},
"channelMerchantNo": {
"notBlank": "通道商户号不可为空"
},
@@ -183,7 +182,7 @@
"notNull": "文件类型不能为空"
},
"authCode": {
"notBlank": "标识码不可为空",
"notBlank": "付款码不可为空",
"size": "付款码不可超过128位"
},
"clientIp": {
@@ -360,9 +359,6 @@
"authAppType": {
"notBlank": "认证应用类型不可为空"
},
"wxAppId": {
"notBlank": "微信应用AppId不可为空"
},
"mchName": {
"notBlank": "商户名称不可为空"
},
@@ -382,9 +378,6 @@
"roleId": {
"notNull": "角色ID不可为空"
},
"clientCode": {
"notBlank": "终端编码不可为空"
},
"code": {
"notBlank": "编码不可为空"
},
@@ -588,9 +581,6 @@
"wechatIsvMchAppId": {
"notNull": "微信服务商通道商户应用ID不可为空"
},
"appSecret": {
"size": "应用密钥不可超过512位"
},
"storeName": {
"notBlank": "门店名称不能为空"
},
@@ -625,9 +615,6 @@
"ids": {
"notEmpty": "请选择码牌"
},
"configName": {
"notBlank": "配置名称不能为空"
},
"twoFactorCode": {
"notBlank": "动态验证码不能为空"
},
@@ -752,6 +739,10 @@
},
"fileContent": {
"notBlank": "文件内容不能为空"
},
"oauthCode": {
"notBlank": "授权码不可为空",
"size": "授权码不可超过128位"
}
}
}

View File

@@ -182,7 +182,7 @@
"notNull": "文件類型不能為空"
},
"authCode": {
"notBlank": "標識碼不可為空",
"notBlank": "付款碼不可為空",
"size": "付款碼不可超過128位"
},
"clientIp": {
@@ -739,6 +739,10 @@
},
"fileContent": {
"notBlank": "文件內容不能為空"
},
"oauthCode": {
"notBlank": "授權碼不可為空",
"size": "授權碼不可超過128位"
}
}
}

View File

@@ -182,7 +182,7 @@
"notNull": "檔案型別不能為空"
},
"authCode": {
"notBlank": "標識碼不可為空",
"notBlank": "付款碼不可為空",
"size": "付款碼不可超過128位"
},
"clientIp": {
@@ -739,6 +739,10 @@
},
"fileContent": {
"notBlank": "檔案內容不能為空"
},
"oauthCode": {
"notBlank": "授權碼不可為空",
"size": "授權碼不可超過128位"
}
}
}