| | |
| | | import com.ruoyi.order.service.order.OrderService; |
| | | import io.swagger.annotations.Api; |
| | | import io.swagger.annotations.ApiOperation; |
| | | import lombok.extern.log4j.Log4j2; |
| | | import org.springframework.beans.factory.annotation.Autowired; |
| | | import org.springframework.web.bind.annotation.*; |
| | | |
| | |
| | | @Api(value = "微信通知控制", tags = "微信通知控制", description = "微信通知控制") |
| | | @RestController |
| | | @RequestMapping("/app/notify") |
| | | @Log4j2 |
| | | public class NotifyController extends BaseController { |
| | | |
| | | public static final String WECHAT_PAY_SERIAL = "Wechatpay-Serial"; |
| | |
| | | |
| | | // 获取请求头 |
| | | SignatureHeader signatureHeader = getSignatureHeader(response); |
| | | |
| | | log.info("微信支付/退款通知: {}", notifyData); |
| | | |
| | | NotifyResponse responseData = GSON.fromJson(notifyData, NotifyResponse.class); |
| | | String eventType = responseData.getEventType(); |
| | |
| | | // 保存支付/退款回调信息 |
| | | backMessageService.saveBackMessage(resultType, resultMessage); |
| | | |
| | | |
| | | return WxPayNotifyV3Response.success("成功"); |
| | | } |
| | | |
| | |
| | | public String profitSharingNotify(@RequestBody String notifyData, HttpServletRequest request, HttpServletResponse response) throws WxPayException { |
| | | ProfitSharingV3Service sharingV3Service = wxService.getProfitSharingV3Service(); |
| | | // ProfitSharingNotifyResult |
| | | log.info("微信分账通知: {}", notifyData); |
| | | |
| | | // 获取请求头 |
| | | SignatureHeader signatureHeader = getSignatureHeader(response); |
| | |
| | | signatureHeader.setSigned(response.getHeader(WECHAT_PAY_SIGNATURE)); |
| | | signatureHeader.setNonce(response.getHeader(WECHAT_PAY_NONCE)); |
| | | signatureHeader.setTimeStamp(response.getHeader(WECHAT_PAY_TIMESTAMP)); |
| | | |
| | | log.info("timeStamp:{} nonce : {} signed:{} serialNo:{}", |
| | | signatureHeader.getTimeStamp(), |
| | | signatureHeader.getNonce(), |
| | | signatureHeader.getSigned(), |
| | | signatureHeader.getSerialNo()); |
| | | |
| | | return signatureHeader; |
| | | } |
| | | } |