From 4c8366cdae90a7a29d866948f4a4d04f2edd7f5f Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?=E7=BA=AA=E5=AF=92?= <2533659732@qq.com> Date: Thu, 9 Nov 2023 15:33:40 +0800 Subject: [PATCH] =?UTF-8?q?=E6=B5=8B=E8=AF=95=E9=97=AE=E9=A2=98=E4=BB=A3?= =?UTF-8?q?=E7=A0=81=E4=BF=AE=E6=94=B9?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../impl/WeChatPayNotifyServiceImpl.java | 8 +++++++- 1 file changed, 7 insertions(+), 1 deletion(-) diff --git a/xinelu-nurse-applet/src/main/java/com/xinelu/applet/service/wechatpaymentinfo/impl/WeChatPayNotifyServiceImpl.java b/xinelu-nurse-applet/src/main/java/com/xinelu/applet/service/wechatpaymentinfo/impl/WeChatPayNotifyServiceImpl.java index c50932a..8c61dfd 100644 --- a/xinelu-nurse-applet/src/main/java/com/xinelu/applet/service/wechatpaymentinfo/impl/WeChatPayNotifyServiceImpl.java +++ b/xinelu-nurse-applet/src/main/java/com/xinelu/applet/service/wechatpaymentinfo/impl/WeChatPayNotifyServiceImpl.java @@ -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);