|
|
|
@ -95,19 +95,27 @@ public class PayNotifyController { |
|
|
|
log.error("新版本微信公钥的支付回调异常:{}", e.getMessage()); |
|
|
|
} |
|
|
|
|
|
|
|
Transaction transaction = null; |
|
|
|
PayNotifyMessageDTO message = null; |
|
|
|
try { |
|
|
|
log.info("【requestParam】" + JSONObject.toJSON(requestParam)); |
|
|
|
//初始化了 RSAAutoCertificateConfig |
|
|
|
Config config = WechatPayConfig.getInstance(); |
|
|
|
// 初始化解析器 NotificationParser |
|
|
|
NotificationParser parser = new NotificationParser((NotificationConfig) config); |
|
|
|
// 以支付通知回调为例,验签、解密并转换成 Transaction |
|
|
|
transaction = parser.parse(requestParam, Transaction.class); |
|
|
|
log.info("【transaction】" + JSONObject.toJSON(transaction)); |
|
|
|
message = new PayNotifyMessageDTO(); |
|
|
|
message.setOutTradeNo(Long.valueOf(transaction.getOutTradeNo())); |
|
|
|
message.setMemberId(Long.valueOf(transaction.getAttach())); |
|
|
|
message.setTradeStatus(transaction.getTradeState()); |
|
|
|
|
|
|
|
}catch (Exception e){ |
|
|
|
log.error("原支付回调失败: {}", e.getMessage()); |
|
|
|
throw new RuntimeException(e); |
|
|
|
} |
|
|
|
|
|
|
|
log.info("【requestParam】" + JSONObject.toJSON(requestParam)); |
|
|
|
//初始化了 RSAAutoCertificateConfig |
|
|
|
Config config = WechatPayConfig.getInstance(); |
|
|
|
// 初始化解析器 NotificationParser |
|
|
|
NotificationParser parser = new NotificationParser((NotificationConfig) config); |
|
|
|
// 以支付通知回调为例,验签、解密并转换成 Transaction |
|
|
|
Transaction transaction = parser.parse(requestParam, Transaction.class); |
|
|
|
log.info("【transaction】" + JSONObject.toJSON(transaction)); |
|
|
|
PayNotifyMessageDTO message = new PayNotifyMessageDTO(); |
|
|
|
message.setOutTradeNo(Long.valueOf(transaction.getOutTradeNo())); |
|
|
|
message.setMemberId(Long.valueOf(transaction.getAttach())); |
|
|
|
message.setTradeStatus(transaction.getTradeState()); |
|
|
|
if (StrUtil.isEmpty(transaction.getSuccessTime())){ |
|
|
|
throw new RuntimeException("微信支付回调失败"); |
|
|
|
} |
|
|
|
|