Wechat-Group / WxJava

微信开发 Java SDK ,支持包括微信支付,开放平台,小程序,企业微信,视频号,公众号等的后端开发
Apache License 2.0
29.76k stars 8.54k forks source link

投诉通知验签错误 #3288

Open je45 opened 4 months ago

je45 commented 4 months ago

简要描述

微信支付投诉通知验签错误,通知头部签名Base64解码异常。

模块版本情况

详细描述

导致的原因是因为微信的签名探测,会生成"WECHATPAY/SIGNTEST/"开头的签名值,导致签名base64解码异常。 希望能统一处理下微信签名探测流量。

日志

java.lang.IllegalArgumentException: Last unit does not have enough valid bits
    at java.util.Base64$Decoder.decode0(Base64.java:734) ~[?:1.8.0_391]
    at java.util.Base64$Decoder.decode(Base64.java:526) ~[?:1.8.0_391]
    at java.util.Base64$Decoder.decode(Base64.java:549) ~[?:1.8.0_391]
    at com.github.binarywang.wxpay.v3.auth.CertificatesVerifier.verify(CertificatesVerifier.java:33) ~[weixin-java-pay-4.6.0.jar:?]
    at com.github.binarywang.wxpay.v3.auth.CertificatesVerifier.verify(CertificatesVerifier.java:46) ~[weixin-java-pay-4.6.0.jar:?]
    at com.github.binarywang.wxpay.v3.auth.AutoUpdateCertificatesVerifier.verify(AutoUpdateCertificatesVerifier.java:121) ~[weixin-java-pay-4.6.0.jar:?]
    at com.github.binarywang.wxpay.service.impl.BaseWxPayServiceImpl.verifyNotifySign(BaseWxPayServiceImpl.java:351) ~[weixin-java-pay-4.6.0.jar:?]
    at com.github.binarywang.wxpay.service.impl.BaseWxPayServiceImpl.parseComplaintNotifyResult(BaseWxPayServiceImpl.java:1294) ~[weixin-java-pay-4.6.0.jar:?]
binarywang commented 4 months ago

你有什么修复办法,可以直接提交代码

stale[bot] commented 2 months ago

This issue has been automatically marked as stale because it has not had recent activity. It will be closed if no further activity occurs. Thank you for your contributions.

geqiliang commented 1 week ago
com.github.binarywang weixin-java-pay 4.6.5.B 我已经更新pom到最新版 发现还是会报这个异常,异常后回调请求会第二次 执行来正确更新订单状态,是否是通过重新进行回调请求解决了这个异常问题