fix: 小程序虚拟支付用户态签名 calcSig 未转小写导致 SIGNATURE_INVALID#3938
Merged
binarywang merged 2 commits intodevelopfrom Mar 21, 2026
Merged
Conversation
在 WxMaXPaySigParams.calcSig() 方法返回值添加 .toLowerCase(), 与 calcPaySig() 保持一致,修复签名大小写问题导致的 SIGNATURE_INVALID -15005 错误。 同时新增 WxMaXPaySigParamsTest 单元测试验证签名均为小写。 Co-authored-by: binarywang <1343140+binarywang@users.noreply.github.com>
Copilot
AI
changed the title
[WIP] Fix user signature case issue in virtual payment
fix: 小程序虚拟支付用户态签名 calcSig 未转小写导致 SIGNATURE_INVALID
Mar 20, 2026
Owner
|
auggie review |
There was a problem hiding this comment.
Pull request overview
该 PR 修复 weixin-java-miniapp 模块中小程序虚拟支付(xpay)用户态签名的大小写不一致问题:calcSig() 计算出的 HMAC-SHA256 签名此前未转换为小写,可能导致微信侧验签失败并返回 SIGNATURE_INVALID -15005。
Changes:
- 修复
WxMaXPaySigParams#calcSig(String):在返回签名结果前补充小写转换,与calcPaySig()行为对齐。 - 新增
WxMaXPaySigParamsTest:覆盖calcSig/calcPaySig返回值为全小写且符合 64 位十六进制 HMAC-SHA256 的断言。
Reviewed changes
Copilot reviewed 2 out of 2 changed files in this pull request and generated no comments.
| File | Description |
|---|---|
| weixin-java-miniapp/src/main/java/cn/binarywang/wx/miniapp/bean/xpay/WxMaXPaySigParams.java | 将用户态签名 calcSig() 的返回值统一转换为小写,避免与微信服务端验签要求不一致 |
| weixin-java-miniapp/src/test/java/cn/binarywang/wx/miniapp/bean/xpay/WxMaXPaySigParamsTest.java | 新增单元测试,验证 calcSig/calcPaySig 的签名输出为小写且为 64 位十六进制字符串 |
🤖 Augment PR Summary概述: 修复小程序虚拟支付用户态签名 变更:
技术说明: 底层 🤖 Was this summary useful? React with 👍 or 👎 |
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.
WxMaXPaySigParams.calcSig()返回的 HMAC-SHA256 签名未转小写,而微信服务端要求签名为全小写十六进制字符串,导致报错SIGNATURE_INVALID -15005。变更
calcSig()返回值添加.toLowerCase(),与同类calcPaySig()行为对齐:WxMaXPaySigParamsTest,覆盖calcSig/calcPaySig均返回全小写 64 字符 HMAC-SHA256 签名的断言Original prompt
📱 Kick off Copilot coding agent tasks wherever you are with GitHub Mobile, available on iOS and Android.