fix: 保留小程序纯签约 version 字段兼容性#4074
Conversation
There was a problem hiding this comment.
Pull request overview
该 PR 针对 小程序纯签约请求参数中的 WxMaEntrustRequest.version 做兼容性处理:保留对外 API(getter/setter/Builder)但避免其进入请求序列化与签名计算,从而防止因微信接口不支持该字段导致的签名校验失败。
Changes:
- 将
version标记为@Deprecated,并在 XML 序列化中通过@XStreamOmitField排除,同时使用transient避免进入 JSON 输出。 - 在签名计算中通过覆写
getIgnoredParamsForSign()显式忽略version。 - 新增
WxMaEntrustRequestTest,覆盖 JSON、普通 XML、快速 XML 输出不包含version,以及签名忽略version的行为。
Reviewed changes
Copilot reviewed 2 out of 2 changed files in this pull request and generated 2 comments.
| File | Description |
|---|---|
| weixin-java-pay/src/main/java/com/github/binarywang/wxpay/bean/request/WxMaEntrustRequest.java | 将 version 兼容保留但从序列化与签名中排除,避免影响小程序纯签约签名校验。 |
| weixin-java-pay/src/test/java/com/github/binarywang/wxpay/bean/request/WxMaEntrustRequestTest.java | 新增回归测试,验证 version 不进入 JSON/XML(含 fastMode)且不参与签名。 |
🤖 Augment PR SummarySummary: 本 PR 修复小程序纯签约请求中携带
🤖 Was this summary useful? React with 👍 or 👎 |
Co-authored-by: Copilot Autofix powered by AI <175728472+Copilot@users.noreply.github.com>
There was a problem hiding this comment.
💡 Codex Review
Here are some automated review suggestions for this pull request.
Reviewed commit: f2260125c3
ℹ️ About Codex in GitHub
Your team has set up Codex to review pull requests in this repo. Reviews are triggered when you
- Open a pull request for review
- Mark a draft as ready
- Comment "@codex review".
If Codex has suggestions, it will comment; otherwise it will react with 👍.
Codex can also answer questions or update the PR. Try commenting "@codex address that feedback".
变更内容
原因
微信小程序纯签约接口不支持 version;该字段出现在请求参数中会导致签名校验失败。
验证