From b2a8335cef9c9d85aeca808d500e85b92032585d Mon Sep 17 00:00:00 2001
From: Hentua <wangdoubleone@gmail.com>
Date: Fri, 07 Apr 2023 14:55:51 +0800
Subject: [PATCH] 添加微信支付

---
 src/main/java/cc/mrbird/febs/pay/controller/PayCallBackController.java |   28 +++++++++++++++++++++++-----
 1 files changed, 23 insertions(+), 5 deletions(-)

diff --git a/src/main/java/cc/mrbird/febs/pay/controller/PayCallBackController.java b/src/main/java/cc/mrbird/febs/pay/controller/PayCallBackController.java
index 6616618..57abbe5 100644
--- a/src/main/java/cc/mrbird/febs/pay/controller/PayCallBackController.java
+++ b/src/main/java/cc/mrbird/febs/pay/controller/PayCallBackController.java
@@ -2,17 +2,20 @@
 
 import cc.mrbird.febs.common.entity.FebsResponse;
 import cc.mrbird.febs.pay.properties.AliPayProperties;
+import cc.mrbird.febs.pay.service.IAliPayService;
 import cc.mrbird.febs.pay.service.IPayService;
 import com.alibaba.fastjson.JSONObject;
 import com.alipay.api.AlipayApiException;
 import com.alipay.api.internal.util.AlipaySignature;
+import com.github.binarywang.wxpay.bean.notify.WxPayNotifyResponse;
+import com.github.binarywang.wxpay.bean.notify.WxPayOrderNotifyResult;
+import com.github.binarywang.wxpay.exception.WxPayException;
+import com.github.binarywang.wxpay.service.WxPayService;
 import com.ijpay.alipay.AliPayApi;
 import lombok.extern.slf4j.Slf4j;
+import me.chanjar.weixin.common.service.WxService;
 import org.springframework.beans.factory.annotation.Autowired;
-import org.springframework.web.bind.annotation.GetMapping;
-import org.springframework.web.bind.annotation.PostMapping;
-import org.springframework.web.bind.annotation.RequestMapping;
-import org.springframework.web.bind.annotation.RestController;
+import org.springframework.web.bind.annotation.*;
 
 import javax.annotation.Resource;
 import javax.servlet.http.HttpServletRequest;
@@ -28,10 +31,16 @@
 public class PayCallBackController {
 
     @Autowired
-    private IPayService payService;
+    private IAliPayService payService;
+
+    @Autowired
+    private IPayService wechatPayService;
 
     @Resource
     private AliPayProperties aliPayProperties;
+
+    @Autowired
+    private WxPayService wxPayService;
 
     @RequestMapping("/aliCallBack")
     public String aliPayCallBack(HttpServletRequest request){
@@ -59,4 +68,13 @@
             return "failure";
         }
     }
+
+    @PostMapping(value = "/wxPayCallBack")
+    public String wxPayCallBack(@RequestBody String xmlData) throws WxPayException {
+        log.info("=======微信回调:{}========", xmlData);
+        WxPayOrderNotifyResult notifyResult = this.wxPayService.parseOrderNotifyResult(xmlData);
+
+        wechatPayService.payCallback(notifyResult.toMap());
+        return WxPayNotifyResponse.success("成功");
+    }
 }

--
Gitblit v1.9.1