🆕 #1814 微信支付解析扫码支付回调通知增加签名类型的重载方法

This commit is contained in:
Binary Wang 2020-10-25 15:05:58 +08:00
parent c9d8509a11
commit 3c7d470210
2 changed files with 18 additions and 2 deletions

View File

@ -413,6 +413,17 @@ public interface WxPayService {
*/ */
WxPayRefundNotifyResult parseRefundNotifyResult(String xmlData) throws WxPayException; 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 * 详见https://pay.weixin.qq.com/wiki/doc/api/native.php?chapter=6_4

View File

@ -236,19 +236,24 @@ public abstract class BaseWxPayServiceImpl implements WxPayService {
} }
@Override @Override
public WxScanPayNotifyResult parseScanPayNotifyResult(String xmlData) throws WxPayException { public WxScanPayNotifyResult parseScanPayNotifyResult(String xmlData, String signType) throws WxPayException {
try { try {
log.debug("扫码支付回调通知请求参数:{}", xmlData); log.debug("扫码支付回调通知请求参数:{}", xmlData);
WxScanPayNotifyResult result = BaseWxPayResult.fromXML(xmlData, WxScanPayNotifyResult.class); WxScanPayNotifyResult result = BaseWxPayResult.fromXML(xmlData, WxScanPayNotifyResult.class);
log.debug("扫码支付回调通知解析后的对象:{}", result); log.debug("扫码支付回调通知解析后的对象:{}", result);
result.checkResult(this, this.getConfig().getSignType(), false); result.checkResult(this, signType, false);
return result; return result;
} catch (WxPayException e) { } catch (WxPayException e) {
throw e; throw e;
} catch (Exception e) { } catch (Exception e) {
throw new WxPayException("发生异常," + e.getMessage(), 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 @Override