浏览代码

支付回调

yeguodong 3 月之前
父节点
当前提交
c33cc9cf27

+ 1 - 1
src/main/java/cn/hnthyy/thmz/controller/pay/NongPayController.java

@@ -52,7 +52,7 @@ public class NongPayController {
      * @return
      */
     @RequestMapping(value = "/notifyCodeImg", method = RequestMethod.POST)
-    public String notifyCodeImg(@RequestBody Map<String, Object> body) {
+    public String notifyCodeImg(@RequestParam Map<String, Object> body) {
         return nongPayService.notifyCodeImg(body);
     }
 }

+ 10 - 5
src/main/java/cn/hnthyy/thmz/service/pay/NongPayService.java

@@ -76,7 +76,10 @@ public class NongPayService {
 //        body.put("amount", payAmount);
         body.put("subject", body.get("subject"));
         body.put("body", body.get("body"));
-        body.put("notifyUrl", "https://hadln.net:9443/mz/thmz/NongPay/notifyCodeImg");
+        String notifyUrl = "http://218.93.214.118:6080/NongPay/notify"
+                .trim()
+                .replaceAll("\\s+", "");
+        body.put("notifyUrl", notifyUrl);
         JSONObject channelExtra = new JSONObject();
         channelExtra.put("payDataType", "codeImgUrl");
         body.put("channelExtra", JSONObject.toJSONString(channelExtra));
@@ -153,9 +156,11 @@ public class NongPayService {
 
 
     public static void main(String[] args) {
-        String amount = "10";
-        BigDecimal amountBigDecimal = new BigDecimal(amount);
-        String payAmount = String.valueOf(amountBigDecimal.multiply(new BigDecimal(100)).setScale(0, RoundingMode.HALF_UP));
-        System.out.println(payAmount);
+        Map<String, String> body = new HashMap<>();
+        String notifyUrl = "https://hadln.net:20443/mz/thmz/NongPay/notifyCodeImg";
+        body.put("notifyUrl", notifyUrl);
+        System.out.println("生成的notifyUrl: " + notifyUrl);
+        System.out.println("body中的notifyUrl: " + body.get("notifyUrl"));
+        System.out.println(notifyUrl.equals(body.get("https: //hadln.net:20443/mz/thmz/NongPay/notifyCodeImg")));
     }
 }