Skip to content

Commit 3c7d470

Browse files
committed
🆕 #1814 微信支付解析扫码支付回调通知增加签名类型的重载方法
1 parent c9d8509 commit 3c7d470

File tree

2 files changed

+18
-2
lines changed

2 files changed

+18
-2
lines changed

weixin-java-pay/src/main/java/com/github/binarywang/wxpay/service/WxPayService.java

Lines changed: 11 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -413,6 +413,17 @@ WxPayRefundQueryResult refundQuery(String transactionId, String outTradeNo, Stri
413413
*/
414414
WxPayRefundNotifyResult parseRefundNotifyResult(String xmlData) throws WxPayException;
415415

416+
/**
417+
* 解析扫码支付回调通知
418+
* 详见https://pay.weixin.qq.com/wiki/doc/api/native.php?chapter=6_4
419+
*
420+
* @param xmlData the xml data
421+
* @param signType 签名类型
422+
* @return the wx scan pay notify result
423+
* @throws WxPayException the wx pay exception
424+
*/
425+
WxScanPayNotifyResult parseScanPayNotifyResult(String xmlData, String signType) throws WxPayException;
426+
416427
/**
417428
* 解析扫码支付回调通知
418429
* 详见https://pay.weixin.qq.com/wiki/doc/api/native.php?chapter=6_4

weixin-java-pay/src/main/java/com/github/binarywang/wxpay/service/impl/BaseWxPayServiceImpl.java

Lines changed: 7 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -236,19 +236,24 @@ public WxPayRefundNotifyResult parseRefundNotifyResult(String xmlData) throws Wx
236236
}
237237

238238
@Override
239-
public WxScanPayNotifyResult parseScanPayNotifyResult(String xmlData) throws WxPayException {
239+
public WxScanPayNotifyResult parseScanPayNotifyResult(String xmlData, String signType) throws WxPayException {
240240
try {
241241
log.debug("扫码支付回调通知请求参数:{}", xmlData);
242242
WxScanPayNotifyResult result = BaseWxPayResult.fromXML(xmlData, WxScanPayNotifyResult.class);
243243
log.debug("扫码支付回调通知解析后的对象:{}", result);
244-
result.checkResult(this, this.getConfig().getSignType(), false);
244+
result.checkResult(this, signType, false);
245245
return result;
246246
} catch (WxPayException e) {
247247
throw e;
248248
} catch (Exception e) {
249249
throw new WxPayException("发生异常," + e.getMessage(), e);
250250
}
251+
}
251252

253+
@Override
254+
public WxScanPayNotifyResult parseScanPayNotifyResult(String xmlData) throws WxPayException {
255+
final String signType = this.getConfig().getSignType();
256+
return this.parseScanPayNotifyResult(xmlData, signType);
252257
}
253258

254259
@Override

0 commit comments

Comments
 (0)