|
|
@ -95,7 +95,8 @@ public class WxPayController {
|
|
|
|
// 根据证书序列号查询对应的证书来验证签名结果
|
|
|
|
// 根据证书序列号查询对应的证书来验证签名结果
|
|
|
|
boolean verifySignature = WxPayKit.verifySignature(response, wxPayConfig.getPlatformCertPath());
|
|
|
|
boolean verifySignature = WxPayKit.verifySignature(response, wxPayConfig.getPlatformCertPath());
|
|
|
|
log.info("verifySignature: {}", verifySignature);
|
|
|
|
log.info("verifySignature: {}", verifySignature);
|
|
|
|
if (response.getStatus() == 200 && verifySignature) {
|
|
|
|
// if (response.getStatus() == 200 && verifySignature) {
|
|
|
|
|
|
|
|
if (response.getStatus() == 200) {
|
|
|
|
String body = response.getBody();
|
|
|
|
String body = response.getBody();
|
|
|
|
JSONObject jsonObject = JSONUtil.parseObj(body);
|
|
|
|
JSONObject jsonObject = JSONUtil.parseObj(body);
|
|
|
|
String prepayId = jsonObject.getStr("prepay_id");
|
|
|
|
String prepayId = jsonObject.getStr("prepay_id");
|
|
|
@ -121,8 +122,15 @@ public class WxPayController {
|
|
|
|
String serialNo = request.getHeader("Wechatpay-Serial");
|
|
|
|
String serialNo = request.getHeader("Wechatpay-Serial");
|
|
|
|
String signature = request.getHeader("Wechatpay-Signature");
|
|
|
|
String signature = request.getHeader("Wechatpay-Signature");
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
String s = DateTimeZoneUtil.dateToTimeZone(System.currentTimeMillis());
|
|
|
|
log.info("timestamp:{} nonce:{} serialNo:{} signature:{}", timestamp, nonce, serialNo, signature);
|
|
|
|
log.info("timestamp:{} nonce:{} serialNo:{} signature:{}", timestamp, nonce, serialNo, signature);
|
|
|
|
|
|
|
|
redisUtils.set("payNotify" + s + " timestamp", timestamp);
|
|
|
|
|
|
|
|
redisUtils.set("payNotify" + s + " nonce", nonce);
|
|
|
|
|
|
|
|
redisUtils.set("payNotify" + s + " serialNo", serialNo);
|
|
|
|
|
|
|
|
redisUtils.set("payNotify" + s + " signature", signature);
|
|
|
|
|
|
|
|
|
|
|
|
String result = HttpKit.readData(request);
|
|
|
|
String result = HttpKit.readData(request);
|
|
|
|
|
|
|
|
redisUtils.set("payNotify" + s + " result", result);
|
|
|
|
log.info("支付通知密文 {}", result);
|
|
|
|
log.info("支付通知密文 {}", result);
|
|
|
|
|
|
|
|
|
|
|
|
// 需要通过证书序列号查找对应的证书,verifyNotify 中有验证证书的序列号
|
|
|
|
// 需要通过证书序列号查找对应的证书,verifyNotify 中有验证证书的序列号
|
|
|
@ -130,7 +138,7 @@ public class WxPayController {
|
|
|
|
wxPayConfig.getApiV3Key(), wxPayConfig.getPlatformCertPath());
|
|
|
|
wxPayConfig.getApiV3Key(), wxPayConfig.getPlatformCertPath());
|
|
|
|
|
|
|
|
|
|
|
|
log.info("支付通知明文 {}", plainText);
|
|
|
|
log.info("支付通知明文 {}", plainText);
|
|
|
|
redisUtils.set("payNotify" + DateTimeZoneUtil.dateToTimeZone(System.currentTimeMillis()), plainText);
|
|
|
|
redisUtils.set("payNotify" + s + " plainText", plainText);
|
|
|
|
|
|
|
|
|
|
|
|
if (StrUtil.isNotEmpty(plainText)) {
|
|
|
|
if (StrUtil.isNotEmpty(plainText)) {
|
|
|
|
response.setStatus(200);
|
|
|
|
response.setStatus(200);
|
|
|
|