Skip to content

feat: 补充微信小程序虚拟支付错误码枚举(268490001-268490024)#3955

Open
Copilot wants to merge 3 commits intodevelopfrom
copilot/add-wechat-mini-program-error-codes
Open

feat: 补充微信小程序虚拟支付错误码枚举(268490001-268490024)#3955
Copilot wants to merge 3 commits intodevelopfrom
copilot/add-wechat-mini-program-error-codes

Conversation

Copy link
Copy Markdown
Contributor

Copilot AI commented Apr 7, 2026

微信小程序虚拟支付 API 新增了 22 个错误码(268490001~268490024),WxMaErrorMsgEnum 中缺少对应枚举值。

变更

  • WxMaErrorMsgEnum.java:在枚举末尾新增 22 个虚拟支付错误码(官方文档中 268490010 与 268490017 不存在,跳过),并统一描述中的"账户"写法(帐户账户
  • WxMaErrorMsgEnumTest.java(新增):验证所有新增错误码可通过 findMsgByCode() 正确查找,以及缺失编号返回 null
CODE_268490001(268490001, "openid错误"),
CODE_268490002(268490002, "请求参数字段错误,具体看errmsg"),
CODE_268490003(268490003, "签名错误"),
// ... 共 22 个错误码
CODE_268490024(268490024, "广告金充值金额必须大于0"),

参考文档:虚拟支付订单查询 API

Copilot AI changed the title [WIP] Add WeChat mini program virtual payment error codes feat: 补充微信小程序虚拟支付错误码枚举(268490001-268490024) Apr 7, 2026
Copilot AI requested a review from binarywang April 7, 2026 09:19
@binarywang binarywang marked this pull request as ready for review April 8, 2026 02:31
Copilot AI review requested due to automatic review settings April 8, 2026 02:31
@augmentcode
Copy link
Copy Markdown

augmentcode bot commented Apr 8, 2026

🤖 Augment PR Summary

Summary: This PR fills in missing WeChat Mini Program virtual payment error-code mappings (268490001–268490024) in WxMaErrorMsgEnum.

Changes:

  • Added 22 new enum values for virtual payment errors (skipping undocumented 268490010 and 268490017).
  • Added a TestNG test (WxMaErrorMsgEnumTest) to validate findMsgByCode() resolves the new codes and returns null for missing ones.

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 👎

Copy link
Copy Markdown

@augmentcode augmentcode bot left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Review completed. 1 suggestion posted.

Fix All in Augment

Comment augment review to trigger a new review at any time.

*
* @author GitHub Copilot
*/
@Test
Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

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

Fix This in Augment

🤖 Was this useful? React with 👍 or 👎, or 🚀 if it prevented an incident/outage.

Copy link
Copy Markdown

Copilot AI left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

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 测试,验证新增错误码与缺失编号的查找行为

Comment on lines +11 to +12
*
* @author GitHub Copilot
Copy link

Copilot AI Apr 8, 2026

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

该测试类的文件头 Javadoc 增加了 @author GitHub Copilot,但同包下已有测试类(如 WxErrorTest.java)通常不写作者信息;同时把工具名作为作者也容易造成归属信息不准确。建议删除该 author 行或改为实际贡献者/按项目惯例处理。

Suggested change
*
* @author GitHub Copilot

Copilot uses AI. Check for mistakes.
Comment on lines +17 to +20
public void testFindMsgByCodeForExistingCode() {
String msg = WxMaErrorMsgEnum.findMsgByCode(40001);
assertNotNull(msg);
}
Copy link

Copilot AI Apr 8, 2026

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

testFindMsgByCodeForExistingCode() 目前只断言返回值非空,无法验证返回的文案是否与枚举映射正确(例如误映射到其它错误码也会通过)。建议对一个稳定的已知错误码断言精确的期望消息,或直接复用/覆盖到本次新增的虚拟支付错误码用例中。

Copilot uses AI. Check for mistakes.
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

微信小程序虚拟支付->错误码->Enum补充

3 participants