李天标 5 vuotta sitten
vanhempi
commit
f51e3f68bb
1 muutettua tiedostoa jossa 18 lisäystä ja 5 poistoa
  1. 18 5
      src/main/java/com/shawn/web/controller/TWeixinController.java

+ 18 - 5
src/main/java/com/shawn/web/controller/TWeixinController.java

@@ -100,8 +100,9 @@ public class TWeixinController extends BaseController<TWeixin,TWeixinExample,TWe
  * You can get Checksum JAR from https://developer.paytm.com/docs/v1/payment-gateway/#code
  * Find your Merchant Key in your Paytm Dashboard at https://dashboard.paytm.com/next/apikeys
  */
+        String checksum2="";
         try { String checksum = CheckSumServiceHelper.getCheckSumServiceHelper().genrateCheckSum("kbzk1DSbJiV_O3p5", body.toString());
-
+            checksum2 = checksum;
         /* head parameters */
         JSONObject head = new JSONObject();
         Long startTs = System.currentTimeMillis(); // 当前时间戳
@@ -126,7 +127,13 @@ public class TWeixinController extends BaseController<TWeixin,TWeixinExample,TWe
 
         /* for Production */
 // URL url = new URL("https://securegw.paytm.in/link/create);
-
+//            TWeixin weixin = new TWeixin();
+//            weixin.setAdminId("1");
+//            weixin.setAvatarUrl(paytmParams.toString().substring(0,200));
+//            weixin.setCreateDate(new Date());
+//            weixin.setModifyDate(new Date());
+//            weixin.setNickName(checksum);
+//            tWeixinService.insert(weixin);
 
             HttpURLConnection connection = (HttpURLConnection) url.openConnection();
             connection.setRequestMethod("POST");
@@ -149,7 +156,7 @@ public class TWeixinController extends BaseController<TWeixin,TWeixinExample,TWe
             exception.printStackTrace();
         }
         return ResponseEntity.status(HttpStatus.OK)
-                .body(new ResultMessage().setCode(true).setData(result).setMessage("success"));
+                .body(new ResultMessage().setCode(true).setData(result).setMessage(checksum2));
     }
     /**
      * 支付成功回调
@@ -173,12 +180,18 @@ public class TWeixinController extends BaseController<TWeixin,TWeixinExample,TWe
             }
 
         }
-
+        TWeixin weixin = new TWeixin();
+        weixin.setAdminId("1");
+        weixin.setAvatarUrl(paytmParams.toString().substring(0,240));
+        weixin.setCreateDate(new Date());
+        weixin.setModifyDate(new Date());
+        weixin.setNickName(paytmChecksum);
+            tWeixinService.insert(weixin);
 /**
  * Verify checksum
  * Find your Merchant Key in your Paytm Dashboard at https://dashboard.paytm.com/next/apikeys
  */
-        boolean isValidChecksum = CheckSumServiceHelper.getCheckSumServiceHelper().verifycheckSum("YOUR_KEY_HERE", paytmParams, paytmChecksum);
+        boolean isValidChecksum = CheckSumServiceHelper.getCheckSumServiceHelper().verifycheckSum("kbzk1DSbJiV_O3p5", paytmParams, paytmChecksum);
         if (isValidChecksum) {
             System.out.append("Checksum Matched");
         } else {