-
-
Notifications
You must be signed in to change notification settings - Fork 9k
修复 WxSignQueryResult 中 contract_expired_time 字段解析错误 #3832
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Conversation
Co-authored-by: binarywang <1343140+binarywang@users.noreply.github.com>
|
auggie review |
🤖 Augment PR SummarySummary: 修复在 XML 快速模式下,
XmlConfig.fastMode=true 时的手动 DOM 解析路径。
🤖 Was this summary useful? React with 👍 or 👎 |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Review completed. No suggestions at this time.
Comment augment review to trigger a new review at any time.
There was a problem hiding this 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 修复了 WxSignQueryResult 类中 contract_expired_time 字段的解析错误。原代码在 loadXml 方法中使用了错误的字段名 contrace_Expired_time(拼写和大小写错误),导致无法正确解析微信支付 API 返回的协议到期时间字段。
主要变更:
- 修正字段名:
contrace_Expired_time→contract_expired_time,与微信官方文档和项目中其他类(如WxSignStatusNotifyResult)保持一致 - 新增完整的单元测试,包含两个测试场景:完整字段解析和必填字段解析,验证修复的正确性
Reviewed changes
Copilot reviewed 2 out of 2 changed files in this pull request and generated no comments.
| File | Description |
|---|---|
weixin-java-pay/src/main/java/com/github/binarywang/wxpay/bean/result/WxSignQueryResult.java |
修复 loadXml 方法中 contract_expired_time 字段名的拼写和大小写错误 |
weixin-java-pay/src/test/java/com/github/binarywang/wxpay/bean/result/WxSignQueryResultTest.java |
新增单元测试验证 XML 解析功能,包含完整字段和必填字段两种测试场景 |
审查结论:代码变更正确且必要,修复了明确的 bug。测试覆盖充分,代码风格符合项目规范。未发现需要修改的问题。
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
...in-java-pay/src/test/java/com/github/binarywang/wxpay/bean/result/WxSignQueryResultTest.java
Outdated
Show resolved
Hide resolved
- 在 testFromXML 和 testFromXML_RequiredFieldsOnly 测试方法中显式设置 XmlConfig.fastMode = true - 使用 try-finally 块确保在测试后恢复 fastMode 的默认值 - 这样可以确保测试覆盖到 WxSignQueryResult#loadXml 方法中修复的 contract_expired_time 字段解析逻辑
WxSignQueryResult#loadXml方法使用了错误的字段名contrace_Expired_time(拼写和大小写错误),导致无法正确解析微信支付 API 返回的contract_expired_time字段。变更内容
contrace_Expired_time→contract_expired_time参考
微信官方文档定义:https://pay.weixin.qq.com/doc/v2/merchant/4011987640
同项目中
WxSignStatusNotifyResult已正确使用contract_expired_timeOriginal prompt
💬 We'd love your input! Share your thoughts on Copilot coding agent in our 2 minute survey.