Skip to content

Commit 9aa2781

Browse files
authored
🎨 #3634 【微信支付】尝试修复服务商模式分账动账通知非法请求、头部信息验证失败的问题
1 parent cfe1f6d commit 9aa2781

File tree

1 file changed

+6
-1
lines changed

1 file changed

+6
-1
lines changed

weixin-java-pay/src/main/java/com/github/binarywang/wxpay/service/impl/ProfitSharingServiceImpl.java

Lines changed: 6 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -7,6 +7,7 @@
77
import com.github.binarywang.wxpay.bean.profitsharing.result.*;
88
import com.github.binarywang.wxpay.bean.result.BaseWxPayResult;
99
import com.github.binarywang.wxpay.exception.WxPayException;
10+
import com.github.binarywang.wxpay.exception.WxSignTestException;
1011
import com.github.binarywang.wxpay.service.ProfitSharingService;
1112
import com.github.binarywang.wxpay.service.WxPayService;
1213
import com.github.binarywang.wxpay.v3.auth.Verifier;
@@ -293,7 +294,11 @@ private ProfitSharingNotifyV3Response parseNotifyData(String data, SignatureHead
293294
* @return true:校验通过 false:校验不通过
294295
*/
295296
private boolean verifyNotifySign(SignatureHeader header, String data) throws WxPayException {
296-
String beforeSign = String.format("%s%n%s%n%s%n", header.getTimeStamp(), header.getNonce(), data);
297+
String wxPaySign = header.getSignature();
298+
if (wxPaySign.startsWith("WECHATPAY/SIGNTEST/")) {
299+
throw new WxSignTestException("微信支付签名探测流量");
300+
}
301+
String beforeSign = String.format("%s\n%s\n%s\n", header.getTimeStamp(), header.getNonce(), data);
297302
Verifier verifier = this.payService.getConfig().getVerifier();
298303
if (verifier == null) {
299304
throw new WxPayException("证书检验对象为空");

0 commit comments

Comments
 (0)