测试问题代码修改

This commit is contained in:
纪寒 2023-11-09 15:33:40 +08:00
parent 2804ba4216
commit 4c8366cdae

View File

@ -140,6 +140,7 @@ public class WeChatPayNotifyServiceImpl implements WeChatPayNotifyService {
resultMap.put("message", "通知验签失败");
return JSON.toJSONString(resultMap);
}
log.info(accountFlag + "微信通知的请求体信息 ===> {}", body);
String nonce = request.getHeader("Wechatpay-Nonce");
String timestamp = request.getHeader("Wechatpay-Timestamp");
String signature = request.getHeader("Wechatpay-Signature");
@ -147,7 +148,12 @@ public class WeChatPayNotifyServiceImpl implements WeChatPayNotifyService {
NotificationRequest notificationRequest = new NotificationRequest.Builder().withSerialNumber(serialNo)
.withNonce(nonce).withTimestamp(timestamp).withSignature(signature).withBody(body).build();
NotificationHandler handler = new NotificationHandler(xylVerifier, xylWeChatPaymentConfig.getXylPaymentKey().getBytes(StandardCharsets.UTF_8));
Notification notification = handler.parse(notificationRequest);
Notification notification = null;
try {
notification = handler.parse(notificationRequest);
} catch (Exception e) {
log.warn("微信支付回调异常,异常信息为:{}", e.getMessage());
}
if (Objects.isNull(notification)) {
log.error(accountFlag + "微信通知验签失败,请求体 ====> {}", body);
response.setStatus(500);