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 ecce6c62f6e95198409d4eee55f6cbf7c8040032..27fe2bfa27a423258ad22708cacce46a88159d59 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