node-paytmpg 5.1.3 → 5.1.4

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.
@@ -185,7 +185,7 @@ class OpenMoney {
185
185
  processWebhook(req, res, updateTransaction) {
186
186
  let config = this.config;
187
187
  let events = [
188
- "payment_captured", "payment_pending",
188
+ "payment_captured", "payment_pending",
189
189
  "payment_failed",
190
190
  "payment_cancelled"]
191
191
  if (req.body.event && events.indexOf(req.body.event) > -1) {
@@ -282,11 +282,11 @@ class OpenMoney {
282
282
  })
283
283
  }
284
284
 
285
- renderProcessingPage(params, pmttoken, res) {
285
+ renderProcessingPage(params, pmttoken, res, loadingSVG) {
286
286
  res.writeHead(200, { 'Content-Type': 'text/html' });
287
287
  res.write(`<html><head><title>Merchant Checkout Page</title>
288
288
  <script src="${this.config.script_url}"></script>
289
- </head><body><center><h1>Processing ! Please do not refresh this page...</h1><br>${pmttoken.html}<br></center><script>triggerLayer();</script></body></html>`);
289
+ </head><body><center><h1>Processing ! Please do not refresh this page...</h1><br>${pmttoken.html}<br><br>${loadingSVG}</center><script>triggerLayer();</script></body></html>`);
290
290
  res.end();
291
291
  }
292
292
 
@@ -10,6 +10,57 @@ const PaytmChecksum = require('./checksum/PaytmChecksum.js');
10
10
  const { stat } = require('fs');
11
11
  const { config } = require('process');
12
12
 
13
+ let loadingSVG = ` <svg xmlns="http://www.w3.org/2000/svg" xmlns:xlink="http://www.w3.org/1999/xlink" style="margin:auto;background:#fff;display:block;" width="200px" height="200px" viewBox="0 0 100 100" preserveAspectRatio="xMidYMid">
14
+ <g transform="rotate(0 50 50)">
15
+ <rect x="47" y="24" rx="3" ry="6" width="6" height="12" fill="#0097a7">
16
+ <animate attributeName="opacity" values="1;0" keyTimes="0;1" dur="1s" begin="-0.9166666666666666s" repeatCount="indefinite"></animate>
17
+ </rect>
18
+ </g><g transform="rotate(30 50 50)">
19
+ <rect x="47" y="24" rx="3" ry="6" width="6" height="12" fill="#0097a7">
20
+ <animate attributeName="opacity" values="1;0" keyTimes="0;1" dur="1s" begin="-0.8333333333333334s" repeatCount="indefinite"></animate>
21
+ </rect>
22
+ </g><g transform="rotate(60 50 50)">
23
+ <rect x="47" y="24" rx="3" ry="6" width="6" height="12" fill="#0097a7">
24
+ <animate attributeName="opacity" values="1;0" keyTimes="0;1" dur="1s" begin="-0.75s" repeatCount="indefinite"></animate>
25
+ </rect>
26
+ </g><g transform="rotate(90 50 50)">
27
+ <rect x="47" y="24" rx="3" ry="6" width="6" height="12" fill="#0097a7">
28
+ <animate attributeName="opacity" values="1;0" keyTimes="0;1" dur="1s" begin="-0.6666666666666666s" repeatCount="indefinite"></animate>
29
+ </rect>
30
+ </g><g transform="rotate(120 50 50)">
31
+ <rect x="47" y="24" rx="3" ry="6" width="6" height="12" fill="#0097a7">
32
+ <animate attributeName="opacity" values="1;0" keyTimes="0;1" dur="1s" begin="-0.5833333333333334s" repeatCount="indefinite"></animate>
33
+ </rect>
34
+ </g><g transform="rotate(150 50 50)">
35
+ <rect x="47" y="24" rx="3" ry="6" width="6" height="12" fill="#0097a7">
36
+ <animate attributeName="opacity" values="1;0" keyTimes="0;1" dur="1s" begin="-0.5s" repeatCount="indefinite"></animate>
37
+ </rect>
38
+ </g><g transform="rotate(180 50 50)">
39
+ <rect x="47" y="24" rx="3" ry="6" width="6" height="12" fill="#0097a7">
40
+ <animate attributeName="opacity" values="1;0" keyTimes="0;1" dur="1s" begin="-0.4166666666666667s" repeatCount="indefinite"></animate>
41
+ </rect>
42
+ </g><g transform="rotate(210 50 50)">
43
+ <rect x="47" y="24" rx="3" ry="6" width="6" height="12" fill="#0097a7">
44
+ <animate attributeName="opacity" values="1;0" keyTimes="0;1" dur="1s" begin="-0.3333333333333333s" repeatCount="indefinite"></animate>
45
+ </rect>
46
+ </g><g transform="rotate(240 50 50)">
47
+ <rect x="47" y="24" rx="3" ry="6" width="6" height="12" fill="#0097a7">
48
+ <animate attributeName="opacity" values="1;0" keyTimes="0;1" dur="1s" begin="-0.25s" repeatCount="indefinite"></animate>
49
+ </rect>
50
+ </g><g transform="rotate(270 50 50)">
51
+ <rect x="47" y="24" rx="3" ry="6" width="6" height="12" fill="#0097a7">
52
+ <animate attributeName="opacity" values="1;0" keyTimes="0;1" dur="1s" begin="-0.16666666666666666s" repeatCount="indefinite"></animate>
53
+ </rect>
54
+ </g><g transform="rotate(300 50 50)">
55
+ <rect x="47" y="24" rx="3" ry="6" width="6" height="12" fill="#0097a7">
56
+ <animate attributeName="opacity" values="1;0" keyTimes="0;1" dur="1s" begin="-0.08333333333333333s" repeatCount="indefinite"></animate>
57
+ </rect>
58
+ </g><g transform="rotate(330 50 50)">
59
+ <rect x="47" y="24" rx="3" ry="6" width="6" height="12" fill="#0097a7">
60
+ <animate attributeName="opacity" values="1;0" keyTimes="0;1" dur="1s" begin="0s" repeatCount="indefinite"></animate>
61
+ </rect>
62
+ </g>
63
+ </svg>`
13
64
 
14
65
  function sanitizeRequest(body) {
15
66
 
@@ -175,57 +226,7 @@ module.exports = function (app, callbacks) {
175
226
  <body>
176
227
  <center>
177
228
  <h1>Please donot close this page or press the back button. Processing...</h1>
178
- <svg xmlns="http://www.w3.org/2000/svg" xmlns:xlink="http://www.w3.org/1999/xlink" style="margin:auto;background:#fff;display:block;" width="200px" height="200px" viewBox="0 0 100 100" preserveAspectRatio="xMidYMid">
179
- <g transform="rotate(0 50 50)">
180
- <rect x="47" y="24" rx="3" ry="6" width="6" height="12" fill="#fe718d">
181
- <animate attributeName="opacity" values="1;0" keyTimes="0;1" dur="1s" begin="-0.9166666666666666s" repeatCount="indefinite"></animate>
182
- </rect>
183
- </g><g transform="rotate(30 50 50)">
184
- <rect x="47" y="24" rx="3" ry="6" width="6" height="12" fill="#fe718d">
185
- <animate attributeName="opacity" values="1;0" keyTimes="0;1" dur="1s" begin="-0.8333333333333334s" repeatCount="indefinite"></animate>
186
- </rect>
187
- </g><g transform="rotate(60 50 50)">
188
- <rect x="47" y="24" rx="3" ry="6" width="6" height="12" fill="#fe718d">
189
- <animate attributeName="opacity" values="1;0" keyTimes="0;1" dur="1s" begin="-0.75s" repeatCount="indefinite"></animate>
190
- </rect>
191
- </g><g transform="rotate(90 50 50)">
192
- <rect x="47" y="24" rx="3" ry="6" width="6" height="12" fill="#fe718d">
193
- <animate attributeName="opacity" values="1;0" keyTimes="0;1" dur="1s" begin="-0.6666666666666666s" repeatCount="indefinite"></animate>
194
- </rect>
195
- </g><g transform="rotate(120 50 50)">
196
- <rect x="47" y="24" rx="3" ry="6" width="6" height="12" fill="#fe718d">
197
- <animate attributeName="opacity" values="1;0" keyTimes="0;1" dur="1s" begin="-0.5833333333333334s" repeatCount="indefinite"></animate>
198
- </rect>
199
- </g><g transform="rotate(150 50 50)">
200
- <rect x="47" y="24" rx="3" ry="6" width="6" height="12" fill="#fe718d">
201
- <animate attributeName="opacity" values="1;0" keyTimes="0;1" dur="1s" begin="-0.5s" repeatCount="indefinite"></animate>
202
- </rect>
203
- </g><g transform="rotate(180 50 50)">
204
- <rect x="47" y="24" rx="3" ry="6" width="6" height="12" fill="#fe718d">
205
- <animate attributeName="opacity" values="1;0" keyTimes="0;1" dur="1s" begin="-0.4166666666666667s" repeatCount="indefinite"></animate>
206
- </rect>
207
- </g><g transform="rotate(210 50 50)">
208
- <rect x="47" y="24" rx="3" ry="6" width="6" height="12" fill="#fe718d">
209
- <animate attributeName="opacity" values="1;0" keyTimes="0;1" dur="1s" begin="-0.3333333333333333s" repeatCount="indefinite"></animate>
210
- </rect>
211
- </g><g transform="rotate(240 50 50)">
212
- <rect x="47" y="24" rx="3" ry="6" width="6" height="12" fill="#fe718d">
213
- <animate attributeName="opacity" values="1;0" keyTimes="0;1" dur="1s" begin="-0.25s" repeatCount="indefinite"></animate>
214
- </rect>
215
- </g><g transform="rotate(270 50 50)">
216
- <rect x="47" y="24" rx="3" ry="6" width="6" height="12" fill="#fe718d">
217
- <animate attributeName="opacity" values="1;0" keyTimes="0;1" dur="1s" begin="-0.16666666666666666s" repeatCount="indefinite"></animate>
218
- </rect>
219
- </g><g transform="rotate(300 50 50)">
220
- <rect x="47" y="24" rx="3" ry="6" width="6" height="12" fill="#fe718d">
221
- <animate attributeName="opacity" values="1;0" keyTimes="0;1" dur="1s" begin="-0.08333333333333333s" repeatCount="indefinite"></animate>
222
- </rect>
223
- </g><g transform="rotate(330 50 50)">
224
- <rect x="47" y="24" rx="3" ry="6" width="6" height="12" fill="#fe718d">
225
- <animate attributeName="opacity" values="1;0" keyTimes="0;1" dur="1s" begin="0s" repeatCount="indefinite"></animate>
226
- </rect>
227
- </g>
228
- </svg>
229
+ ${loadingSVG}
229
230
  </center>
230
231
  <form id="cancelform" action="${params['CALLBACK_URL']}" method="post">
231
232
  <input type="hidden" name="TXNID" value="na"/>
@@ -404,14 +405,14 @@ module.exports = function (app, callbacks) {
404
405
  </script>`;
405
406
 
406
407
  res.writeHead(200, { 'Content-Type': 'text/html' });
407
- res.write(`<html><head><title>Merchant Checkout Page</title></head><body><center><h1>Processing ! Please do not refresh this page...</h1><br>${html}<br>${fail}</center></body></html>`);
408
+ res.write(`<html><head><title>Merchant Checkout Page</title></head><body><center><h1>Processing ! Please do not refresh this page...</h1><br>${html}<br>${fail}<br>${loadingSVG}</center></body></html>`);
408
409
  res.end();
409
410
 
410
411
  }
411
412
  else if (config.open_money_url) {
412
413
  try {
413
414
  let pmttoken = await openMoneyInstance.generatePaymentToken(params);
414
- openMoneyInstance.renderProcessingPage(params, pmttoken, res);
415
+ openMoneyInstance.renderProcessingPage(params, pmttoken, res, loadingSVG);
415
416
 
416
417
  var myquery = { orderId: params['ORDER_ID'] };
417
418
  Transaction.findOne(myquery, function (err, objForUpdate) {
@@ -794,7 +795,7 @@ module.exports = function (app, callbacks) {
794
795
  let order = await razorPayInstance.orders.create(options);
795
796
  id = order.id;
796
797
  }
797
- else if(config.open_money_url){
798
+ else if (config.open_money_url) {
798
799
  id = "pay_" + makeid(config.id_length || IDLEN)
799
800
  }
800
801
 
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "node-paytmpg",
3
- "version": "5.1.3",
3
+ "version": "5.1.4",
4
4
  "description": "Payment Gateway Integration using NodeJS",
5
5
  "main": "index.js",
6
6
  "scripts": {