修复 WxSignQueryResult 中 contract_expired_time 字段解析错误#3832
Merged
binarywang merged 3 commits intodevelopfrom Jan 6, 2026
Merged
Conversation
Co-authored-by: binarywang <1343140+binarywang@users.noreply.github.com>
Copilot
AI
changed the title
[WIP] Fix contract_expired_time parsing issue in WxSignQueryResult
修复 WxSignQueryResult 中 contract_expired_time 字段解析错误
Jan 6, 2026
Owner
|
auggie review |
🤖 Augment PR SummarySummary: 修复在 XML 快速模式下,
XmlConfig.fastMode=true 时的手动 DOM 解析路径。
🤖 Was this summary useful? React with 👍 or 👎 |
There was a problem hiding this comment.
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。测试覆盖充分,代码风格符合项目规范。未发现需要修改的问题。
...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 字段解析逻辑
binarywang
pushed a commit
that referenced
this pull request
Jan 6, 2026
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
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.