杨杰 1 năm trước cách đây
mục cha
commit
d1a1f134b4

+ 5 - 1
src/main/java/com/llisoft/pay/controller/CallbackWxPayController.java

@@ -1,5 +1,7 @@
 package com.llisoft.pay.controller;
 
+import java.nio.charset.StandardCharsets;
+
 import javax.servlet.http.HttpServletRequest;
 
 import org.slf4j.Logger;
@@ -7,6 +9,7 @@ import org.slf4j.LoggerFactory;
 import org.springframework.beans.factory.annotation.Autowired;
 import org.springframework.http.ResponseEntity;
 import org.springframework.stereotype.Controller;
+import org.springframework.util.StreamUtils;
 import org.springframework.web.bind.annotation.PostMapping;
 import org.springframework.web.bind.annotation.RequestMapping;
 
@@ -29,7 +32,8 @@ public class CallbackWxPayController {
 	@ApiOperation(value="异步通知")
 	@PostMapping(value="/notify")
 	public ResponseEntity.BodyBuilder notify(HttpServletRequest request) throws Exception {
-		logger.debug("收到微信支付异步通知: {}", "");
+		String xml = StreamUtils.copyToString(request.getInputStream(), StandardCharsets.UTF_8);
+		logger.debug("收到微信异步通知: {}", xml);
 		return ResponseEntity.badRequest();
 	}
 	

+ 3 - 3
src/main/java/com/llisoft/pay/service/PayWxV3Service.java

@@ -85,7 +85,7 @@ public class PayWxV3Service {
         request.setMchid(mchid);
         request.setDescription(body);
         request.setOutTradeNo(pid);
-        request.setNotifyUrl(domain + callbackWx);
+        request.setNotifyUrl(callbackWx);
         try {
         	logger.debug("微信Native支付下单请求参数: {}", JsonUtil.toJson(request));
         	com.wechat.pay.java.service.payments.nativepay.model.PrepayResponse response = service.prepay(request);
@@ -130,7 +130,7 @@ public class PayWxV3Service {
         request.setMchid(mchid);
         request.setDescription(body);
         request.setOutTradeNo(pid);
-        request.setNotifyUrl(domain + callbackWx);
+        request.setNotifyUrl(callbackWx);
         try {
         	logger.debug("微信APP支付下单请求参数: {}", JsonUtil.toJson(request));
         	com.wechat.pay.java.service.payments.app.model.PrepayWithRequestPaymentResponse response = service.prepayWithRequestPayment(request);
@@ -178,7 +178,7 @@ public class PayWxV3Service {
         request.setMchid(mchid);
         request.setDescription(body);
         request.setOutTradeNo(pid);
-        request.setNotifyUrl(domain + callbackWx);
+        request.setNotifyUrl(callbackWx);
         try {
         	logger.debug("微信JSAPI支付下单请求参数: {}", JsonUtil.toJson(request));
         	com.wechat.pay.java.service.payments.jsapi.model.PrepayWithRequestPaymentResponse response = service.prepayWithRequestPayment(request);