From 28b65c5608bc62444bf43958e829fffb8fcb82d4 Mon Sep 17 00:00:00 2001 From: foquanlin Date: Sat, 11 Jun 2022 21:50:40 +0800 Subject: [PATCH 1/2] =?UTF-8?q?=E5=9C=A8=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?= =?UTF-8?q?=E8=B0=83=E6=97=B6,=E5=B9=B6=E4=B8=8D=E7=9F=A5=E9=81=93?= =?UTF-8?q?=E9=85=8D=E7=BD=AE=E4=BF=A1=E6=81=AF=E6=98=AF=E5=B1=9E=E4=BA=8E?= =?UTF-8?q?=E5=93=AA=E4=B8=AA=E5=95=86=E6=88=B7,=E5=AF=BC=E8=87=B4?= =?UTF-8?q?=E7=AD=BE=E5=90=8D=E5=A4=B1=E8=B4=A5=20=E8=A7=A3=E5=86=B3?= =?UTF-8?q?=E5=8A=9E=E6=B3=95,=E5=85=88=E8=A7=A3=E6=9E=90xml=E6=96=87?= =?UTF-8?q?=E4=BB=B6,=E5=9C=A8=E8=8E=B7=E5=8F=96mchId,=E7=84=B6=E5=90=8E?= =?UTF-8?q?=E5=9C=A8=E5=88=87=E6=8D=A2=E5=88=B0=E5=AF=B9=E5=BA=94=E5=95=86?= =?UTF-8?q?=E6=88=B7=E9=85=8D=E7=BD=AE=E5=90=8E,=E5=86=8D=E5=81=9A?= =?UTF-8?q?=E7=AD=BE=E5=90=8D=E8=A7=A3=E6=9E=90?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../binarywang/wxpay/service/impl/BaseWxPayServiceImpl.java | 5 +++-- 1 file changed, 3 insertions(+), 2 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..06340e163 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()); } } -- Gitee From 77e4c7d7c212c7fc5a2f19761cb28dce27b7f5a5 Mon Sep 17 00:00:00 2001 From: foquanlin Date: Sat, 11 Jun 2022 21:50:40 +0800 Subject: [PATCH 2/2] =?UTF-8?q?=E5=9C=A8=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?= =?UTF-8?q?=E8=B0=83=E6=97=B6,=E5=B9=B6=E4=B8=8D=E7=9F=A5=E9=81=93?= =?UTF-8?q?=E9=85=8D=E7=BD=AE=E4=BF=A1=E6=81=AF=E6=98=AF=E5=B1=9E=E4=BA=8E?= =?UTF-8?q?=E5=93=AA=E4=B8=AA=E5=95=86=E6=88=B7,=E5=AF=BC=E8=87=B4?= =?UTF-8?q?=E7=AD=BE=E5=90=8D=E5=A4=B1=E8=B4=A5=20=E8=A7=A3=E5=86=B3?= =?UTF-8?q?=E5=8A=9E=E6=B3=95,=E5=85=88=E8=A7=A3=E6=9E=90xml=E6=96=87?= =?UTF-8?q?=E4=BB=B6,=E5=9C=A8=E8=8E=B7=E5=8F=96mchId,=E7=84=B6=E5=90=8E?= =?UTF-8?q?=E5=9C=A8=E5=88=87=E6=8D=A2=E5=88=B0=E5=AF=B9=E5=BA=94=E5=95=86?= =?UTF-8?q?=E6=88=B7=E9=85=8D=E7=BD=AE=E5=90=8E,=E5=86=8D=E5=81=9A?= =?UTF-8?q?=E7=AD=BE=E5=90=8D=E8=A7=A3=E6=9E=90?= 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 -- Gitee