node-paytmpg 5.2.1 → 5.2.2

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
@@ -193,11 +193,13 @@ module.exports = function (app, callbacks) {
193
193
  "email": params['EMAIL']
194
194
  }
195
195
  };
196
- let checksum = await PaytmChecksum.generateSignature(JSON.stringify(initTxnbody), config.KEY)
197
- let initTxnUrl = config.paytm_url + `/theia/api/v1/initiateTransaction?mid=${params['MID']}&orderId=${params['ORDER_ID']}`;
198
196
  if(config.mode){
199
197
  initTxnbody["enablePaymentMode"] = JSON.parse(config.mode)
200
198
  }
199
+
200
+ let checksum = await PaytmChecksum.generateSignature(JSON.stringify(initTxnbody), config.KEY)
201
+ let initTxnUrl = config.paytm_url + `/theia/api/v1/initiateTransaction?mid=${params['MID']}&orderId=${params['ORDER_ID']}`;
202
+
201
203
  request.post(
202
204
  initTxnUrl,
203
205
  {
@@ -0,0 +1,63 @@
1
+ const PaytmChecksum = require('./checksum/PaytmChecksum.js');
2
+ var request = require('request')
3
+
4
+ let iod = "pay_uuvmP3p282" + Math.floor(Math.random() * 100)
5
+ let initTxnbody = {
6
+ "requestType": "Payment",
7
+ "mid": "mGkXCb73842366174007",
8
+ "websiteName": "DEFAULT",
9
+ "orderId": iod,
10
+ "callbackUrl": "https://securegw.paytm.in/theia/paytmCallback?ORDER_ID=" + iod,
11
+ "txnAmount": {
12
+ "value": "10",
13
+ "currency": "INR"
14
+ },
15
+ "userInfo": {
16
+ "custId": "user_q0W8cX7tjt",
17
+ "mobile": "+918527483275",
18
+ "firstName": "shivesh navin",
19
+ "email": "shiveshnavin@gmail.com"
20
+ },
21
+ "enablePaymentMode": [
22
+ {
23
+ "mode": "UPI"
24
+ },
25
+ {
26
+ "mode": "BALANCE"
27
+ },
28
+ {
29
+ "mode": "NET_BANKING"
30
+ },
31
+ {
32
+ "mode": "DEBIT_CARD"
33
+ },
34
+ {
35
+ "mode": "CREDIT_CARD"
36
+ }
37
+ ]
38
+ };
39
+
40
+ (async () => {
41
+
42
+ let checksum = await PaytmChecksum.generateSignature(JSON.stringify(initTxnbody), "KwA5mZLG_wSBDTTi")
43
+ let initTxnUrl = "https://securegw.paytm.in" + `/theia/api/v1/initiateTransaction?mid=${initTxnbody.mid}&orderId=${initTxnbody.orderId}`;
44
+
45
+
46
+ request.post(
47
+ initTxnUrl,
48
+ {
49
+ json: {
50
+ "body": initTxnbody,
51
+ "head": {
52
+ "signature": checksum,
53
+ "channelId": "WAP"
54
+ }
55
+ }
56
+ },
57
+ function (error, response, body) {
58
+
59
+ console.log(body.body.txnToken)
60
+ console.log(initTxnbody.orderId)
61
+
62
+ });
63
+ })()
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "node-paytmpg",
3
- "version": "5.2.1",
3
+ "version": "5.2.2",
4
4
  "description": "Payment Gateway Integration using NodeJS",
5
5
  "main": "index.js",
6
6
  "scripts": {