Skip to content

Conversation

Copy link
Contributor

Copilot AI commented Jan 6, 2026

WxSignQueryResult#loadXml 方法使用了错误的字段名 contrace_Expired_time(拼写和大小写错误),导致无法正确解析微信支付 API 返回的 contract_expired_time 字段。

变更内容

  • 修复字段名contrace_Expired_timecontract_expired_time
  • 新增单元测试:验证 XML 解析正确性,包含完整字段和必填字段两种场景

参考

微信官方文档定义:https://pay.weixin.qq.com/doc/v2/merchant/4011987640

同项目中 WxSignStatusNotifyResult 已正确使用 contract_expired_time

Original prompt

This section details on the original issue you should resolve

<issue_title>contract_expired_time 解析有问题</issue_title>
<issue_description>https://pay.weixin.qq.com/doc/v2/merchant/4011987640
根据这个文档里的定义,contract_expired_time字段在com.github.binarywang.wxpay.bean.result.WxSignQueryResult#loadXml方法里被写错了,请修复</issue_description>

Comments on the Issue (you are @copilot in this section)

Custom agent used: 全部用中文
需要用中文,包括PR标题和分析总结过程


💬 We'd love your input! Share your thoughts on Copilot coding agent in our 2 minute survey.

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
Copilot AI requested a review from binarywang January 6, 2026 03:37
@binarywang binarywang marked this pull request as ready for review January 6, 2026 03:38
Copilot AI review requested due to automatic review settings January 6, 2026 03:38
@binarywang
Copy link
Owner

auggie review

@augmentcode
Copy link

augmentcode bot commented Jan 6, 2026

🤖 Augment PR Summary

Summary: 修复在 XML 快速模式下,WxSignQueryResult#loadXml 因字段名拼写/大小写错误导致无法解析 contract_expired_time 的问题。

Changes:

  • 更正字段读取名:contrace_Expired_timecontract_expired_time
  • 新增 WxSignQueryResultTest,用官方文档 XML 示例验证解析结果(完整字段/仅必填字段两种场景)
Technical Notes: 本次修复主要影响 XmlConfig.fastMode=true 时的手动 DOM 解析路径。

🤖 Was this summary useful? React with 👍 or 👎

Copy link

@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. No suggestions at this time.

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

Copy link

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 修复了 WxSignQueryResult 类中 contract_expired_time 字段的解析错误。原代码在 loadXml 方法中使用了错误的字段名 contrace_Expired_time(拼写和大小写错误),导致无法正确解析微信支付 API 返回的协议到期时间字段。

主要变更:

  • 修正字段名:contrace_Expired_timecontract_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。测试覆盖充分,代码风格符合项目规范。未发现需要修改的问题。

Copy link

@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 suggestions posted.

Fix All in Augment

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

- 在 testFromXML 和 testFromXML_RequiredFieldsOnly 测试方法中显式设置 XmlConfig.fastMode = true
- 使用 try-finally 块确保在测试后恢复 fastMode 的默认值
- 这样可以确保测试覆盖到 WxSignQueryResult#loadXml 方法中修复的 contract_expired_time 字段解析逻辑
@binarywang binarywang merged commit 1e075a4 into develop Jan 6, 2026
1 check passed
@binarywang binarywang deleted the copilot/fix-contract-expired-time-issue branch January 6, 2026 05:01
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.

contract_expired_time 解析有问题

2 participants