From 5ac2e690c099e4a1f2b87f1344ee07a70f20e583 Mon Sep 17 00:00:00 2001 From: fangyaoxia Date: Tue, 14 Jun 2022 02:36:25 +0000 Subject: [PATCH] =?UTF-8?q?:bug:=20=E3=80=90=E5=BE=AE=E4=BF=A1=E6=94=AF?= =?UTF-8?q?=E4=BB=98=E3=80=91=E4=BF=AE=E5=A4=8D=E5=A4=9A=E5=95=86=E6=88=B7?= =?UTF-8?q?=E6=83=85=E5=86=B5=E4=B8=8B=E5=BE=AE=E4=BF=A1=E5=9B=9E=E8=B0=83?= =?UTF-8?q?=E7=AD=BE=E5=90=8D=E5=A4=B1=E8=B4=A5=E7=9A=84=E9=97=AE=E9=A2=98?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../wxpay/service/impl/BaseWxPayServiceImpl.java | 15 +++++++++------ 1 file changed, 9 insertions(+), 6 deletions(-) diff --git a/weixin-java-pay/src/main/java/com/github/binarywang/wxpay/service/impl/BaseWxPayServiceImpl.java b/weixin-java-pay/src/main/java/com/github/binarywang/wxpay/service/impl/BaseWxPayServiceImpl.java index ecce6c62f..27fe2bfa2 100644 --- a/weixin-java-pay/src/main/java/com/github/binarywang/wxpay/service/impl/BaseWxPayServiceImpl.java +++ b/weixin-java-pay/src/main/java/com/github/binarywang/wxpay/service/impl/BaseWxPayServiceImpl.java @@ -345,9 +345,10 @@ public abstract class BaseWxPayServiceImpl implements WxPayService { if (result.getSignType() != null) { // 如果解析的通知对象中signType有值,则使用它进行验签 signType = result.getSignType(); - } else if (this.getConfig().getSignType() != null) { + } else if (configMap.get(result.getMchId()).getSignType() != null) { // 如果配置中signType有值,则使用它进行验签 - signType = this.getConfig().getSignType(); + signType = configMap.get(result.getMchId()).getSignType(); + this.switchover(result.getMchId()); } } @@ -430,6 +431,7 @@ public abstract class BaseWxPayServiceImpl implements WxPayService { WxPayRefundNotifyResult result; if (XmlConfig.fastMode) { result = BaseWxPayResult.fromXML(xmlData, WxPayRefundNotifyResult.class); + this.switchover(result.getMchId()); result.decryptReqInfo(this.getConfig().getMchKey()); } else { result = WxPayRefundNotifyResult.fromXML(xmlData, this.getConfig().getMchKey()); @@ -465,12 +467,13 @@ public abstract class BaseWxPayServiceImpl implements WxPayService { } @Override - public WxScanPayNotifyResult parseScanPayNotifyResult(String xmlData, String signType) throws WxPayException { + public WxScanPayNotifyResult parseScanPayNotifyResult(String xmlData, @Deprecated String signType) throws WxPayException { try { log.debug("扫码支付回调通知请求参数:{}", xmlData); WxScanPayNotifyResult result = BaseWxPayResult.fromXML(xmlData, WxScanPayNotifyResult.class); + this.switchover(result.getMchId()); log.debug("扫码支付回调通知解析后的对象:{}", result); - result.checkResult(this, signType, false); + result.checkResult(this, this.getConfig().getSignType(), false); return result; } catch (WxPayException e) { throw e; @@ -481,8 +484,8 @@ public abstract class BaseWxPayServiceImpl implements WxPayService { @Override public WxScanPayNotifyResult parseScanPayNotifyResult(String xmlData) throws WxPayException { - final String signType = this.getConfig().getSignType(); - return this.parseScanPayNotifyResult(xmlData, signType); +// final String signType = this.getConfig().getSignType(); + return this.parseScanPayNotifyResult(xmlData, null); } @Override