From 3c7d470210c43c94123c03219ca4ac7f6eed1e7f Mon Sep 17 00:00:00 2001 From: Binary Wang Date: Sun, 25 Oct 2020 15:05:58 +0800 Subject: [PATCH] =?UTF-8?q?:new:=20#1814=20=E5=BE=AE=E4=BF=A1=E6=94=AF?= =?UTF-8?q?=E4=BB=98=E8=A7=A3=E6=9E=90=E6=89=AB=E7=A0=81=E6=94=AF=E4=BB=98?= =?UTF-8?q?=E5=9B=9E=E8=B0=83=E9=80=9A=E7=9F=A5=E5=A2=9E=E5=8A=A0=E7=AD=BE?= =?UTF-8?q?=E5=90=8D=E7=B1=BB=E5=9E=8B=E7=9A=84=E9=87=8D=E8=BD=BD=E6=96=B9?= =?UTF-8?q?=E6=B3=95?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../github/binarywang/wxpay/service/WxPayService.java | 11 +++++++++++ .../wxpay/service/impl/BaseWxPayServiceImpl.java | 9 +++++++-- 2 files changed, 18 insertions(+), 2 deletions(-) diff --git a/weixin-java-pay/src/main/java/com/github/binarywang/wxpay/service/WxPayService.java b/weixin-java-pay/src/main/java/com/github/binarywang/wxpay/service/WxPayService.java index 11e624224..daa8d3597 100644 --- a/weixin-java-pay/src/main/java/com/github/binarywang/wxpay/service/WxPayService.java +++ b/weixin-java-pay/src/main/java/com/github/binarywang/wxpay/service/WxPayService.java @@ -413,6 +413,17 @@ public interface WxPayService { */ WxPayRefundNotifyResult parseRefundNotifyResult(String xmlData) throws WxPayException; + /** + * 解析扫码支付回调通知 + * 详见https://pay.weixin.qq.com/wiki/doc/api/native.php?chapter=6_4 + * + * @param xmlData the xml data + * @param signType 签名类型 + * @return the wx scan pay notify result + * @throws WxPayException the wx pay exception + */ + WxScanPayNotifyResult parseScanPayNotifyResult(String xmlData, String signType) throws WxPayException; + /** * 解析扫码支付回调通知 * 详见https://pay.weixin.qq.com/wiki/doc/api/native.php?chapter=6_4 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 15ca423a2..9bf9e9a8d 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 @@ -236,19 +236,24 @@ public abstract class BaseWxPayServiceImpl implements WxPayService { } @Override - public WxScanPayNotifyResult parseScanPayNotifyResult(String xmlData) throws WxPayException { + public WxScanPayNotifyResult parseScanPayNotifyResult(String xmlData, String signType) throws WxPayException { try { log.debug("扫码支付回调通知请求参数:{}", xmlData); WxScanPayNotifyResult result = BaseWxPayResult.fromXML(xmlData, WxScanPayNotifyResult.class); log.debug("扫码支付回调通知解析后的对象:{}", result); - result.checkResult(this, this.getConfig().getSignType(), false); + result.checkResult(this, signType, false); return result; } catch (WxPayException e) { throw e; } catch (Exception e) { throw new WxPayException("发生异常," + e.getMessage(), e); } + } + @Override + public WxScanPayNotifyResult parseScanPayNotifyResult(String xmlData) throws WxPayException { + final String signType = this.getConfig().getSignType(); + return this.parseScanPayNotifyResult(xmlData, signType); } @Override