Преглед на файлове

微信回调验签测试

skyline преди 2 години
родител
ревизия
98e090bf09

+ 1 - 1
entity/src/main/java/com/kym/entity/wechat/TitleWriteNotification.java

@@ -29,6 +29,6 @@ public class TitleWriteNotification {
      * 用户完成发票抬头填写的时间
      */
     @SerializedName("apply_time")
-    private LocalDateTime applyTime;
+    private String applyTime;
 
 }

+ 8 - 2
service/src/main/java/com/kym/service/wechat/impl/WxPayServiceImpl.java

@@ -215,6 +215,14 @@ public class WxPayServiceImpl implements WxPayService {
         return new Object[]{requestParam, parser, no};
     }
 
+
+    /**
+     * 回调签名验证失败排查指引 (body中字段顺序变化造成验签失败是个大坑)
+     * https://developers.weixin.qq.com/community/pay/article/doc/0004a879f60928d89340b8b9f64c13
+     * https://github.com/wechatpay-apiv3/wechatpay-apache-httpclient/issues/152
+     * @param request
+     * @return
+     */
     @SneakyThrows
     Object[] handleWxNotify2(HttpServletRequest request) {
         var no = RandomUtil.randomInt(1000, 9999);
@@ -233,8 +241,6 @@ public class WxPayServiceImpl implements WxPayService {
             result.write(buffer, 0, lenght);
         }
         var body = result.toString();
-        LOGGER.info("【body1】:{}",body);
-
 
         LOGGER.info("微信支付回调{}:\nBody数据:\n{}", no, result);