diff --git a/weixin-java-pay/src/main/java/com/github/binarywang/wxpay/bean/notify/WxPayRefundNotifyResult.java b/weixin-java-pay/src/main/java/com/github/binarywang/wxpay/bean/notify/WxPayRefundNotifyResult.java index ae86b8c854..8615a2e461 100644 --- a/weixin-java-pay/src/main/java/com/github/binarywang/wxpay/bean/notify/WxPayRefundNotifyResult.java +++ b/weixin-java-pay/src/main/java/com/github/binarywang/wxpay/bean/notify/WxPayRefundNotifyResult.java @@ -273,7 +273,7 @@ public String toString() { * */ @XStreamAlias("refund_recv_accout") - private String refundRecvAccout; + private String refundRecvAccount; /** *
@@ -324,7 +324,7 @@ public void loadXML(Document d) { settlementRefundFee = readXmlInteger(d, "settlement_refund_fee"); refundStatus = readXmlString(d, "refund_status"); successTime = readXmlString(d, "success_time"); - refundRecvAccout = readXmlString(d, "refund_recv_accout"); + refundRecvAccount = readXmlString(d, "refund_recv_accout"); refundAccount = readXmlString(d, "refund_account"); refundRequestSource = readXmlString(d, "refund_request_source"); } diff --git a/weixin-java-pay/src/main/java/com/github/binarywang/wxpay/service/impl/ProfitSharingServiceImpl.java b/weixin-java-pay/src/main/java/com/github/binarywang/wxpay/service/impl/ProfitSharingServiceImpl.java index 6be5ffc8c1..afaa45440a 100644 --- a/weixin-java-pay/src/main/java/com/github/binarywang/wxpay/service/impl/ProfitSharingServiceImpl.java +++ b/weixin-java-pay/src/main/java/com/github/binarywang/wxpay/service/impl/ProfitSharingServiceImpl.java @@ -7,6 +7,7 @@ import com.github.binarywang.wxpay.bean.profitsharing.result.*; import com.github.binarywang.wxpay.bean.result.BaseWxPayResult; import com.github.binarywang.wxpay.exception.WxPayException; +import com.github.binarywang.wxpay.exception.WxSignTestException; import com.github.binarywang.wxpay.service.ProfitSharingService; import com.github.binarywang.wxpay.service.WxPayService; import com.github.binarywang.wxpay.v3.auth.Verifier; @@ -293,7 +294,11 @@ private ProfitSharingNotifyV3Response parseNotifyData(String data, SignatureHead * @return true:校验通过 false:校验不通过 */ private boolean verifyNotifySign(SignatureHeader header, String data) throws WxPayException { - String beforeSign = String.format("%s%n%s%n%s%n", header.getTimeStamp(), header.getNonce(), data); + String wxPaySign = header.getSignature(); + if (wxPaySign.startsWith("WECHATPAY/SIGNTEST/")) { + throw new WxSignTestException("微信支付签名探测流量"); + } + String beforeSign = String.format("%s\n%s\n%s\n", header.getTimeStamp(), header.getNonce(), data); Verifier verifier = this.payService.getConfig().getVerifier(); if (verifier == null) { throw new WxPayException("证书检验对象为空"); diff --git a/weixin-java-pay/src/test/java/com/github/binarywang/wxpay/bean/notify/WxPayRefundNotifyResultTest.java b/weixin-java-pay/src/test/java/com/github/binarywang/wxpay/bean/notify/WxPayRefundNotifyResultTest.java index 963afb2618..e7a22ee6cd 100644 --- a/weixin-java-pay/src/test/java/com/github/binarywang/wxpay/bean/notify/WxPayRefundNotifyResultTest.java +++ b/weixin-java-pay/src/test/java/com/github/binarywang/wxpay/bean/notify/WxPayRefundNotifyResultTest.java @@ -119,7 +119,7 @@ public void testFromXMLFastMode() throws WxPayException { refundNotifyResult.loadReqInfo(xmlDecryptedReqInfo); assertEquals(refundNotifyResult.getReqInfo().getRefundFee().intValue(), 15); assertEquals(refundNotifyResult.getReqInfo().getRefundStatus(), "SUCCESS"); - assertEquals(refundNotifyResult.getReqInfo().getRefundRecvAccout(), "用户零钱"); + assertEquals(refundNotifyResult.getReqInfo().getRefundRecvAccount(), "用户零钱"); System.out.println(refundNotifyResult); } finally { XmlConfig.fastMode = false;