feat: 补充微信小程序虚拟支付错误码枚举(268490001-268490024)#3955
Conversation
Agent-Logs-Url: https://github.com/binarywang/WxJava/sessions/e2f3a940-549d-4294-98dd-5796b952e568 Co-authored-by: binarywang <1343140+binarywang@users.noreply.github.com>
Agent-Logs-Url: https://github.com/binarywang/WxJava/sessions/e2f3a940-549d-4294-98dd-5796b952e568 Co-authored-by: binarywang <1343140+binarywang@users.noreply.github.com>
🤖 Augment PR SummarySummary: This PR fills in missing WeChat Mini Program virtual payment error-code mappings (268490001–268490024) in Changes:
Technical Notes: Error messages are sourced from the official virtual payment API documentation and are verified via string equality in tests. 🤖 Was this summary useful? React with 👍 or 👎 |
| * | ||
| * @author GitHub Copilot | ||
| */ | ||
| @Test |
There was a problem hiding this comment.
weixin-java-common/src/test/java/me/chanjar/weixin/common/error/WxMaErrorMsgEnumTest.java:14 This module’s surefire config runs TestNG via src/test/resources/testng.xml, and this new test class isn’t listed there, so it may never execute in CI. Consider adding it to the suite (or switching the suite to package scanning) so the new assertions actually run.
Severity: medium
🤖 Was this useful? React with 👍 or 👎, or 🚀 if it prevented an incident/outage.
There was a problem hiding this comment.
Pull request overview
该 PR 为 WxMaErrorMsgEnum 补齐微信小程序「虚拟支付」相关新增错误码(268490001~268490024,跳过文档缺失的 268490010/268490017),并新增单元测试验证 findMsgByCode() 对新增错误码的查找结果以及缺失编号返回 null。
Changes:
- 在
WxMaErrorMsgEnum末尾新增 22 个虚拟支付错误码枚举值,并补充对应文档链接注释 - 新增
WxMaErrorMsgEnumTest,覆盖新增错误码的查找结果与缺失编号返回null
Reviewed changes
Copilot reviewed 2 out of 2 changed files in this pull request and generated 2 comments.
| File | Description |
|---|---|
| weixin-java-common/src/main/java/me/chanjar/weixin/common/error/WxMaErrorMsgEnum.java | 增加虚拟支付错误码枚举常量,完善错误码覆盖面 |
| weixin-java-common/src/test/java/me/chanjar/weixin/common/error/WxMaErrorMsgEnumTest.java | 新增 TestNG 测试,验证新增错误码与缺失编号的查找行为 |
| * | ||
| * @author GitHub Copilot |
There was a problem hiding this comment.
该测试类的文件头 Javadoc 增加了 @author GitHub Copilot,但同包下已有测试类(如 WxErrorTest.java)通常不写作者信息;同时把工具名作为作者也容易造成归属信息不准确。建议删除该 author 行或改为实际贡献者/按项目惯例处理。
| * | |
| * @author GitHub Copilot |
| public void testFindMsgByCodeForExistingCode() { | ||
| String msg = WxMaErrorMsgEnum.findMsgByCode(40001); | ||
| assertNotNull(msg); | ||
| } |
There was a problem hiding this comment.
testFindMsgByCodeForExistingCode() 目前只断言返回值非空,无法验证返回的文案是否与枚举映射正确(例如误映射到其它错误码也会通过)。建议对一个稳定的已知错误码断言精确的期望消息,或直接复用/覆盖到本次新增的虚拟支付错误码用例中。
微信小程序虚拟支付 API 新增了 22 个错误码(268490001~268490024),
WxMaErrorMsgEnum中缺少对应枚举值。变更
WxMaErrorMsgEnum.java:在枚举末尾新增 22 个虚拟支付错误码(官方文档中 268490010 与 268490017 不存在,跳过),并统一描述中的"账户"写法(帐户→账户)WxMaErrorMsgEnumTest.java(新增):验证所有新增错误码可通过findMsgByCode()正确查找,以及缺失编号返回null参考文档:虚拟支付订单查询 API