|
@@ -44,14 +44,20 @@ public class WXPayCallbackEndpoint {
|
|
|
|
|
|
|
|
@PostMapping("/wxpay/callback")
|
|
@PostMapping("/wxpay/callback")
|
|
|
public String callback(HttpServletRequest request, HttpServletResponse response) {
|
|
public String callback(HttpServletRequest request, HttpServletResponse response) {
|
|
|
- log.debug("WXPayCallback");
|
|
|
|
|
|
|
+ log.info("WXPayCallback");
|
|
|
|
|
|
|
|
try {
|
|
try {
|
|
|
|
|
|
|
|
SignatureHeader signatureHeader = httpRequestToSignatureHeader(request);
|
|
SignatureHeader signatureHeader = httpRequestToSignatureHeader(request);
|
|
|
String s = StreamUtils.copyToString(request.getInputStream(), Charset.defaultCharset());
|
|
String s = StreamUtils.copyToString(request.getInputStream(), Charset.defaultCharset());
|
|
|
|
|
|
|
|
|
|
+ log.info("验签开始.s:{}", s);
|
|
|
|
|
+ log.info("验签开始.signatureHeader:{}", signatureHeader.toString());
|
|
|
|
|
+
|
|
|
WxPayOrderNotifyV3Result wxPayOrderNotifyV3Result = wxPayService.parseOrderNotifyV3Result(s, signatureHeader);
|
|
WxPayOrderNotifyV3Result wxPayOrderNotifyV3Result = wxPayService.parseOrderNotifyV3Result(s, signatureHeader);
|
|
|
|
|
+
|
|
|
|
|
+ log.info("验签成功.");
|
|
|
|
|
+
|
|
|
WxPayOrderNotifyV3Result.DecryptNotifyResult decryptNotifyResult = wxPayOrderNotifyV3Result.getResult();
|
|
WxPayOrderNotifyV3Result.DecryptNotifyResult decryptNotifyResult = wxPayOrderNotifyV3Result.getResult();
|
|
|
|
|
|
|
|
XingxiUnifiedpayCallbackResultDTO xingxiUnifiedpayCallbackResultDTO = decryptNotifyResultToBiandanUnifiedpayCallbackResultDTO(decryptNotifyResult);
|
|
XingxiUnifiedpayCallbackResultDTO xingxiUnifiedpayCallbackResultDTO = decryptNotifyResultToBiandanUnifiedpayCallbackResultDTO(decryptNotifyResult);
|
|
@@ -63,27 +69,30 @@ public class WXPayCallbackEndpoint {
|
|
|
String outTradeNo = xingxiUnifiedpayCallbackResultDTO.getOutTradeNo();
|
|
String outTradeNo = xingxiUnifiedpayCallbackResultDTO.getOutTradeNo();
|
|
|
String callUnifiedpayComponent = xingxiUnifiedpayCallbackResultDTO.getCallUnifiedpayComponent();
|
|
String callUnifiedpayComponent = xingxiUnifiedpayCallbackResultDTO.getCallUnifiedpayComponent();
|
|
|
|
|
|
|
|
|
|
+ log.info("outTradeNo:{}", outTradeNo);
|
|
|
|
|
+ log.info("tradeState:{}", tradeState);
|
|
|
|
|
+
|
|
|
PaymentInfo dbPaymentInfo = xingxiUnifiedpayExtMapper.selectLockPaymentInfoByOutTradeNo(outTradeNo);
|
|
PaymentInfo dbPaymentInfo = xingxiUnifiedpayExtMapper.selectLockPaymentInfoByOutTradeNo(outTradeNo);
|
|
|
if (dbPaymentInfo != null && "SUCCESS".equals(tradeState)) {
|
|
if (dbPaymentInfo != null && "SUCCESS".equals(tradeState)) {
|
|
|
dbPaymentInfo.setUpdateUser(callUnifiedpayComponent);
|
|
dbPaymentInfo.setUpdateUser(callUnifiedpayComponent);
|
|
|
dbPaymentInfo.setUpdateTime(new Date());
|
|
dbPaymentInfo.setUpdateTime(new Date());
|
|
|
updatePaymentInfo(dbPaymentInfo, xingxiUnifiedpayCallbackDTO);
|
|
updatePaymentInfo(dbPaymentInfo, xingxiUnifiedpayCallbackDTO);
|
|
|
Long orderId = dbPaymentInfo.getOrderId();
|
|
Long orderId = dbPaymentInfo.getOrderId();
|
|
|
-
|
|
|
|
|
|
|
+ log.info("orderId:{}", orderId);
|
|
|
// lock
|
|
// lock
|
|
|
Order dbOrder = xingxiUnifiedpayExtMapper.selectLockOrderByOrderId(orderId);
|
|
Order dbOrder = xingxiUnifiedpayExtMapper.selectLockOrderByOrderId(orderId);
|
|
|
dbOrder.setUpdateTime(dbPaymentInfo.getUpdateTime());
|
|
dbOrder.setUpdateTime(dbPaymentInfo.getUpdateTime());
|
|
|
dbOrder.setUpdateUser(dbPaymentInfo.getUpdateUser());
|
|
dbOrder.setUpdateUser(dbPaymentInfo.getUpdateUser());
|
|
|
|
|
|
|
|
updateOrderStatus(dbOrder);
|
|
updateOrderStatus(dbOrder);
|
|
|
-
|
|
|
|
|
|
|
+ log.info("update order status success");
|
|
|
// 发送订单支付完成事件消息
|
|
// 发送订单支付完成事件消息
|
|
|
orderPayedEvent(dbOrder);
|
|
orderPayedEvent(dbOrder);
|
|
|
-
|
|
|
|
|
|
|
+ log.info("send order orderPayedEvent");
|
|
|
}
|
|
}
|
|
|
|
|
|
|
|
} catch (Exception e) {
|
|
} catch (Exception e) {
|
|
|
- log.debug("处理微信支付回调通知失败!!!!");
|
|
|
|
|
|
|
+ log.info("处理微信支付回调通知失败!!!!:{}", e.getMessage());
|
|
|
return "FAIL";
|
|
return "FAIL";
|
|
|
}
|
|
}
|
|
|
|
|
|