mirror of
https://gitee.com/binary/weixin-java-tools.git
synced 2025-04-05 17:38:05 +08:00
🎨 #1585 微信支付结果异步通知的解析方法增加可以自行指定signType的重载方法
This commit is contained in:
parent
edf1401dbe
commit
da0ce15da6
@ -303,6 +303,17 @@ public interface WxPayService {
|
||||
*/
|
||||
WxPayOrderNotifyResult parseOrderNotifyResult(String xmlData) throws WxPayException;
|
||||
|
||||
/**
|
||||
* 解析支付结果通知.
|
||||
* 详见https://pay.weixin.qq.com/wiki/doc/api/jsapi.php?chapter=9_7
|
||||
*
|
||||
* @param xmlData the xml data
|
||||
* @param signType 签名类型
|
||||
* @return the wx pay order notify result
|
||||
* @throws WxPayException the wx pay exception
|
||||
*/
|
||||
WxPayOrderNotifyResult parseOrderNotifyResult(String xmlData, String signType) throws WxPayException;
|
||||
|
||||
/**
|
||||
* 解析退款结果通知
|
||||
* 详见https://pay.weixin.qq.com/wiki/doc/api/jsapi.php?chapter=9_16&index=9
|
||||
|
@ -154,11 +154,20 @@ public abstract class BaseWxPayServiceImpl implements WxPayService {
|
||||
|
||||
@Override
|
||||
public WxPayOrderNotifyResult parseOrderNotifyResult(String xmlData) throws WxPayException {
|
||||
return this.parseOrderNotifyResult(xmlData, null);
|
||||
}
|
||||
|
||||
@Override
|
||||
public WxPayOrderNotifyResult parseOrderNotifyResult(String xmlData, String signType) throws WxPayException {
|
||||
try {
|
||||
log.debug("微信支付异步通知请求参数:{}", xmlData);
|
||||
WxPayOrderNotifyResult result = WxPayOrderNotifyResult.fromXML(xmlData);
|
||||
if (result.getSignType() != null) {
|
||||
// 如果解析的通知对象中signType有值,则使用它进行验签
|
||||
signType = result.getSignType();
|
||||
}
|
||||
log.debug("微信支付异步通知请求解析后的对象:{}", result);
|
||||
result.checkResult(this, result.getSignType(), false);
|
||||
result.checkResult(this, signType, false);
|
||||
return result;
|
||||
} catch (WxPayException e) {
|
||||
throw e;
|
||||
|
Loading…
Reference in New Issue
Block a user