| | |
| | | import java.io.IOException; |
| | | import java.nio.charset.StandardCharsets; |
| | | import java.security.GeneralSecurityException; |
| | | import java.util.Collection; |
| | | import java.util.Enumeration; |
| | | import java.util.Map; |
| | | import java.util.Objects; |
| | | |
| | |
| | | String eventType = responseData.getEventType(); |
| | | |
| | | int resultType = 1; |
| | | String resultMessage = ""; |
| | | if(WxPayNotifyEventTypeEnum.TRANSACTION_SUCCESS.getCode().equals(eventType)){ |
| | | PartnerTransactionsNotifyResult notifyResult = wxService.getEcommerceService().parsePartnerNotifyResult(notifyData, signatureHeader); |
| | | PartnerTransactionsResult result = notifyResult.getResult(); |
| | | // 支付通知回调 |
| | | if("SUCCESS".equals(result.getTradeState())){ |
| | | orderService.payBack(result); |
| | | } |
| | | resultMessage = GSON.toJson(notifyResult); |
| | | } else if(WxPayNotifyEventTypeEnum.REFUND_SUCCESS.getCode().equals(eventType) |
| | | || WxPayNotifyEventTypeEnum.REFUND_ABNORMAL.getCode().equals(eventType) |
| | | || WxPayNotifyEventTypeEnum.REFUND_CLOSED.getCode().equals(eventType)){ |
| | | String resultMessage = notifyData; |
| | | |
| | | RefundNotifyResult result = wxService.getEcommerceService().parseRefundNotifyResult(notifyData, signatureHeader); |
| | | orderService.orderRefundBack(result); |
| | | resultType = 2; |
| | | resultMessage = GSON.toJson(result); |
| | | try { |
| | | if (WxPayNotifyEventTypeEnum.TRANSACTION_SUCCESS.getCode().equals(eventType)) { |
| | | PartnerTransactionsNotifyResult notifyResult = wxService.getEcommerceService().parsePartnerNotifyResult(notifyData, signatureHeader); |
| | | PartnerTransactionsResult result = notifyResult.getResult(); |
| | | // 支付通知回调 |
| | | if ("SUCCESS".equals(result.getTradeState())) { |
| | | orderService.payBack(result); |
| | | } |
| | | resultMessage = GSON.toJson(notifyResult); |
| | | } else if (WxPayNotifyEventTypeEnum.REFUND_SUCCESS.getCode().equals(eventType) |
| | | || WxPayNotifyEventTypeEnum.REFUND_ABNORMAL.getCode().equals(eventType) |
| | | || WxPayNotifyEventTypeEnum.REFUND_CLOSED.getCode().equals(eventType)) { |
| | | |
| | | RefundNotifyResult result = wxService.getEcommerceService().parseRefundNotifyResult(notifyData, signatureHeader); |
| | | orderService.orderRefundBack(result); |
| | | resultType = 2; |
| | | resultMessage = GSON.toJson(result); |
| | | } |
| | | |
| | | }catch (Exception e){ |
| | | log.info("微信支付/退款通知异常: {}", e.getMessage()); |
| | | } |
| | | // 保存支付/退款回调信息 |
| | | backMessageService.saveBackMessage(resultType, resultMessage); |
| | | |
| | | return WxPayNotifyV3Response.success("成功"); |
| | | } |
| | | |
| | |
| | | |
| | | ProfitSharingNotifyNewResult notifyResult = getProfitSharingNotifyData(notifyData, signatureHeader); |
| | | ProfitSharingNotifyResult result = notifyResult.getResult(); |
| | | String eventType = "-1"; |
| | | String resultMessage = notifyData; |
| | | try { |
| | | eventType = notifyResult.getRawData().getEventType(); |
| | | if (WxPayNotifyEventTypeEnum.PROFIT_SHARING_SUCCESS.getCode().equals(eventType)) { |
| | | // 分账通知回调 |
| | | orderService.profitSharingBack(result); |
| | | } |
| | | |
| | | String eventType = notifyResult.getRawData().getEventType(); |
| | | if(WxPayNotifyEventTypeEnum.PROFIT_SHARING_SUCCESS.getCode().equals(eventType)){ |
| | | // 分账通知回调 |
| | | orderService.profitSharingBack(result); |
| | | resultMessage = GSON.toJson(notifyResult); |
| | | }catch (Exception e){ |
| | | log.info("微信分账通知通知异常: {}", e.getMessage()); |
| | | } |
| | | |
| | | String resultMessage = GSON.toJson(notifyResult); |
| | | // 保存记录分账回调信息 |
| | | backMessageService.saveBackMessage(3, resultMessage); |
| | | |