|
|
@@ -17,6 +17,7 @@ import io.swagger.v3.oas.annotations.tags.Tag;
|
|
|
import org.springframework.web.bind.annotation.*;
|
|
|
|
|
|
import javax.imageio.ImageIO;
|
|
|
+import javax.servlet.http.HttpServletRequest;
|
|
|
import javax.servlet.http.HttpServletResponse;
|
|
|
import java.awt.image.BufferedImage;
|
|
|
import java.net.URLEncoder;
|
|
|
@@ -129,6 +130,21 @@ public class PaymentController {
|
|
|
return Result.success(result);
|
|
|
}
|
|
|
|
|
|
+ /**
|
|
|
+ * 微信支付v3回调(JSON格式,含签名)
|
|
|
+ * 接收微信支付结果通知,更新订单状态
|
|
|
+ */
|
|
|
+ @Operation(summary = "微信支付v3回调")
|
|
|
+ @PostMapping("/wechat/v3-notify")
|
|
|
+ public String handleV3Notify(@RequestBody String body, HttpServletRequest request) {
|
|
|
+ String signature = request.getHeader("Wechatpay-Signature");
|
|
|
+ Map<String, Object> result = paymentService.handleWechatNotify(body, signature);
|
|
|
+ if (result != null && "SUCCESS".equals(result.get("code"))) {
|
|
|
+ return "{\"code\":\"SUCCESS\"}";
|
|
|
+ }
|
|
|
+ return "{\"code\":\"FAIL\"}";
|
|
|
+ }
|
|
|
+
|
|
|
/**
|
|
|
* 处理微信支付回调
|
|
|
*/
|