node-paytmpg 5.3.1 → 5.4.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.
@@ -1,4 +1,14 @@
1
- module.exports = function (modelName, db) {
1
+ module.exports = function (modelName, db, sampleData) {
2
+
3
+ if (db && sampleData && db.create) {
4
+ db.create(modelName, sampleData)
5
+ .then(() => {
6
+ console.log('Model Created in db ', modelName);
7
+ })
8
+ .catch((e) => {
9
+ console.log('Error in creating model ', e);
10
+ });
11
+ }
2
12
 
3
13
  class MultiDbMapper {
4
14
 
@@ -21,12 +31,12 @@ module.exports = function (modelName, db) {
21
31
  }
22
32
 
23
33
  async save() {
24
- var response = await MultiDbMapper.db.insert(MultiDbMapper.modelname, this.objectData,this.objectData[MultiDbMapper.idFieldName]);
25
- if ( typeof response == Object && response.ops[0])
34
+ var response = await MultiDbMapper.db.insert(MultiDbMapper.modelname, this.objectData, this.objectData[MultiDbMapper.idFieldName]);
35
+ if (typeof response == Object && response.ops[0])
26
36
  response = response.ops[0];
27
37
  else
28
38
  response = this.objectData
29
-
39
+
30
40
  MultiDbMapper.sanitizeRequest(response)
31
41
 
32
42
  return response;
@@ -1,16 +1,16 @@
1
- const mongoose=require('mongoose')
2
- let TransactionSchema=mongoose.Schema({
3
-
4
- orderId:String,
5
- cusId:String,
6
- time:Number,
7
- status:String,
8
- name:String,
9
- email:String,
10
- phone:String,
11
- amount:Number,
12
- pname:String,
13
- extra:String
14
-
15
- });
16
- module.exports=mongoose.model('nptransaction',TransactionSchema);
1
+ const mongoose=require('mongoose')
2
+ let TransactionSchema=mongoose.Schema({
3
+
4
+ orderId:String,
5
+ cusId:String,
6
+ time:Number,
7
+ status:String,
8
+ name:String,
9
+ email:String,
10
+ phone:String,
11
+ amount:Number,
12
+ pname:String,
13
+ extra:String
14
+
15
+ });
16
+ module.exports=mongoose.model('nptransaction',TransactionSchema);
@@ -1,12 +1,12 @@
1
- const mongoose = require('mongoose');
2
-
3
- const UserSchema = mongoose.Schema({
4
- email: String,
5
- id: String,
6
- name : String,
7
- phone : String,
8
- }, {
9
- timestamps: true
10
- });
11
-
1
+ const mongoose = require('mongoose');
2
+
3
+ const UserSchema = mongoose.Schema({
4
+ email: String,
5
+ id: String,
6
+ name : String,
7
+ phone : String,
8
+ }, {
9
+ timestamps: true
10
+ });
11
+
12
12
  module.exports = mongoose.model('npuser', UserSchema);
@@ -1,73 +1,73 @@
1
- module.exports = (app, express, callbacks) => {
2
- const bodyParser = require('body-parser');
3
- var exphbs = require('express-handlebars')
4
- var path = require('path')
5
- var packageInfo = require('../../package.json')
6
- var config = (app.get('np_config'))
7
- var pc = require('../controllers/payment_controller.js')(app, callbacks)
8
- var router = express.Router()
9
- app.set('view_path', __dirname + config.view_path)
10
- var vp = app.get('view_path')
11
- if (config.db_url !== undefined) {
12
-
13
- const mongoose = require('mongoose');
14
-
15
- console.log('PaytmPG : Using MongoDB');
16
-
17
- mongoose.Promise = global.Promise;
18
-
19
- mongoose.connect(config.db_url, {
20
- useUnifiedTopology: true,
21
- useNewUrlParser: true
22
- }).then(() => {
23
- console.log("Successfully connected to the database");
24
- }).catch(err => {
25
- console.log('Could not connect to the database. Exiting now...', err);
26
- process.exit();
27
- });
28
-
29
- } else if (app.multidborm !== undefined) {
30
-
31
- console.log('PaytmPG : Using MultiDB ORM');
32
-
33
- }
34
-
35
-
36
-
37
- app.engine('hbs', exphbs({
38
- extname: 'hbs',
39
- defaultLayout: vp + '/layouts/index.hbs',
40
- helpers: {
41
- theme_color: function () {
42
- return config.theme_color;
43
- },
44
- logo: function () {
45
- return config.logo;
46
- }
47
- }
48
- }))
49
-
50
- app.set('view engine', 'handlebars');
51
-
52
- let saveRawBody = function (req, res, buf, encoding) {
53
- req.rawBody = buf.toString();
54
- }
55
- app.use(bodyParser.urlencoded({ extended: true }))
56
- app.use(bodyParser.json({ verify: saveRawBody }))
57
-
58
- app.use("/" + config.path_prefix, express.static(path.join(__dirname, '../../public')));
59
- app.use('/' + config.path_prefix, router);
60
-
61
- router.all('/', pc.init);
62
- router.all('/init', pc.init);
63
-
64
- // router.all('/home', pc.home)
65
- router.all('/callback', pc.callback)
66
- router.all('/api/webhook', pc.webhook)
67
- router.all('/api/status', pc.status)
68
- router.all('/api/createTxn/token', pc.createTxnToken)
69
- router.all('/api/createTxn', pc.createTxn)
70
-
71
-
72
- return router
73
- }
1
+ module.exports = (app, express, callbacks) => {
2
+ const bodyParser = require('body-parser');
3
+ var exphbs = require('express-handlebars')
4
+ var path = require('path')
5
+ var packageInfo = require('../../package.json')
6
+ var config = (app.get('np_config'))
7
+ var pc = require('../controllers/payment_controller.js')(app, callbacks)
8
+ var router = express.Router()
9
+ app.set('view_path', __dirname + config.view_path)
10
+ var vp = app.get('view_path')
11
+ if (config.db_url !== undefined) {
12
+
13
+ const mongoose = require('mongoose');
14
+
15
+ console.log('PaytmPG : Using MongoDB');
16
+
17
+ mongoose.Promise = global.Promise;
18
+
19
+ mongoose.connect(config.db_url, {
20
+ useUnifiedTopology: true,
21
+ useNewUrlParser: true
22
+ }).then(() => {
23
+ console.log("Successfully connected to the database");
24
+ }).catch(err => {
25
+ console.log('Could not connect to the database. Exiting now...', err);
26
+ process.exit();
27
+ });
28
+
29
+ } else if (app.multidborm !== undefined) {
30
+
31
+ console.log('PaytmPG : Using MultiDB ORM');
32
+
33
+ }
34
+
35
+
36
+
37
+ app.engine('hbs', exphbs({
38
+ extname: 'hbs',
39
+ defaultLayout: vp + '/layouts/index.hbs',
40
+ helpers: {
41
+ theme_color: function () {
42
+ return config.theme_color;
43
+ },
44
+ logo: function () {
45
+ return config.logo;
46
+ }
47
+ }
48
+ }))
49
+
50
+ app.set('view engine', 'handlebars');
51
+
52
+ let saveRawBody = function (req, res, buf, encoding) {
53
+ req.rawBody = buf.toString();
54
+ }
55
+ app.use(bodyParser.urlencoded({ extended: true }))
56
+ app.use(bodyParser.json({ verify: saveRawBody }))
57
+
58
+ app.use("/" + config.path_prefix, express.static(path.join(__dirname, '../../public')));
59
+ app.use('/' + config.path_prefix, router);
60
+
61
+ router.all('/', pc.init);
62
+ router.all('/init', pc.init);
63
+
64
+ // router.all('/home', pc.home)
65
+ router.all('/callback', pc.callback)
66
+ router.all('/api/webhook', pc.webhook)
67
+ router.all('/api/status', pc.status)
68
+ router.all('/api/createTxn/token', pc.createTxnToken)
69
+ router.all('/api/createTxn', pc.createTxn)
70
+
71
+
72
+ return router
73
+ }
@@ -1,22 +1,22 @@
1
- <p>
2
- <h4>About</h4>
3
- <div>
4
-
5
- <table border="1">
6
-
7
- <tr>
8
- <td>Name</td><td>{{name}}</td>
9
- </tr>
10
- <tr>
11
- <td>Version</td><td>{{version}}</td>
12
- </tr>
13
- <tr>
14
- <td>Repository</td><td><a href='{{repository.url}}'>GITHUB</a></td>
15
- </tr>
16
-
17
-
18
- </table>
19
-
20
-
21
- </div>
1
+ <p>
2
+ <h4>About</h4>
3
+ <div>
4
+
5
+ <table border="1">
6
+
7
+ <tr>
8
+ <td>Name</td><td>{{name}}</td>
9
+ </tr>
10
+ <tr>
11
+ <td>Version</td><td>{{version}}</td>
12
+ </tr>
13
+ <tr>
14
+ <td>Repository</td><td><a href='{{repository.url}}'>GITHUB</a></td>
15
+ </tr>
16
+
17
+
18
+ </table>
19
+
20
+
21
+ </div>
22
22
  </p>
@@ -1,93 +1,93 @@
1
- <h2>Payment Start</h2>
2
-
3
- <form action="{{action}}" method="POST">
4
- <ul class="form-list">
5
- {{#if check}}
6
-
7
- <li class="form-list__row">
8
- <label>Name</label>
9
- <input type="text" name="NAME" required="" value="{{NAME}}" {{readonly}} />
10
- </li>
11
- {{else}}
12
- <input type="hidden" name="NAME" required="" value="{{NAME}}" {{readonly}} />
13
-
14
- {{/if}}
15
- <li class="form-list__row">
16
- <label>E-Mail</label>
17
- <input type="text" name="EMAIL" required="" value="{{EMAIL}}" {{readonly}} />
18
- </li>
19
-
20
- <li class="form-list__row">
21
- <label>Phone</label>
22
- <input type="text" name="MOBILE_NO" required="" value="{{MOBILE_NO}}" {{readonly}} />
23
- </li>
24
-
25
-
26
- <li class="form-list__row">
27
-
28
- {{#if check}}
29
-
30
- <div>
31
- <label>
32
- Product
33
- </label>
34
- <input type="text" name="PRODUCT_NAME" required="" value="{{PRODUCT_NAME}}" {{readonly}} />
35
- </div>
36
- {{else}}
37
- <input type="hidden" name="PRODUCT_NAME" required="" value="{{PRODUCT_NAME}}" {{readonly}} />
38
- {{/if}}
39
-
40
- </li>
41
- <li class="form-list__row">
42
-
43
- <div>
44
- <label>
45
- Amount
46
- </label>
47
- <input type="text" name="TXN_AMOUNT" required="" value="{{TXN_AMOUNT}}" {{readonly}} />
48
- </div>
49
-
50
- </li>
51
-
52
- {{#if check}}
53
-
54
- <li class="form-list__row form-list__row--agree">
55
- <label>
56
- <input type="checkbox" name="save_cc" checked="checked">
57
- I agree to terms and conditions
58
- </label>
59
- </li>
60
- {{/if}}
61
-
62
- <li>
63
- <button id="show_button" type="submit" class="button">{{BUTTON}}</button>
64
- </li>
65
-
66
- <script>
67
- var button = document.getElementById('show_button')
68
- button.addEventListener('click',hideshow,false);
69
-
70
- function hideshow() {
71
- document.getElementById('show_button').style.display = 'none';
72
- }
73
- </script>
74
-
75
- </ul>
76
-
77
-
78
-
79
- <input type="hidden" name="MID" value="{{MID}}" {{readonly}}>
80
- <input type="hidden" name="WEBSITE" value="{{WEBSITE}}" {{readonly}}>
81
- <input type="hidden" name="ORDER_ID" value="{{ORDER_ID}}" {{readonly}}>
82
- <input type="hidden" name="CUST_ID" value="{{CUST_ID}}" {{readonly}}>
83
- <input type="hidden" name="INDUSTRY_TYPE_ID" value="{{INDUSTRY_TYPE_ID}}" {{readonly}}>
84
- <input type="hidden" name="CHANNEL_ID" value="{{CHANNEL_ID}}" {{readonly}}>
85
- <input type="hidden" name="CALLBACK_URL" value="{{CALLBACK_URL}}" {{readonly}}>
86
- <input type="hidden" name="CHECKSUMHASH" value="{{CHECKSUMHASH}}" {{readonly}}>
87
-
88
-
89
-
90
-
91
-
92
-
1
+ <h2>Payment Start</h2>
2
+
3
+ <form action="{{action}}" method="POST">
4
+ <ul class="form-list">
5
+ {{#if check}}
6
+
7
+ <li class="form-list__row">
8
+ <label>Name</label>
9
+ <input type="text" name="NAME" required="" value="{{NAME}}" {{readonly}} />
10
+ </li>
11
+ {{else}}
12
+ <input type="hidden" name="NAME" required="" value="{{NAME}}" {{readonly}} />
13
+
14
+ {{/if}}
15
+ <li class="form-list__row">
16
+ <label>E-Mail</label>
17
+ <input type="text" name="EMAIL" required="" value="{{EMAIL}}" {{readonly}} />
18
+ </li>
19
+
20
+ <li class="form-list__row">
21
+ <label>Phone</label>
22
+ <input type="text" name="MOBILE_NO" required="" value="{{MOBILE_NO}}" {{readonly}} />
23
+ </li>
24
+
25
+
26
+ <li class="form-list__row">
27
+
28
+ {{#if check}}
29
+
30
+ <div>
31
+ <label>
32
+ Product
33
+ </label>
34
+ <input type="text" name="PRODUCT_NAME" required="" value="{{PRODUCT_NAME}}" {{readonly}} />
35
+ </div>
36
+ {{else}}
37
+ <input type="hidden" name="PRODUCT_NAME" required="" value="{{PRODUCT_NAME}}" {{readonly}} />
38
+ {{/if}}
39
+
40
+ </li>
41
+ <li class="form-list__row">
42
+
43
+ <div>
44
+ <label>
45
+ Amount
46
+ </label>
47
+ <input type="text" name="TXN_AMOUNT" required="" value="{{TXN_AMOUNT}}" {{readonly}} />
48
+ </div>
49
+
50
+ </li>
51
+
52
+ {{#if check}}
53
+
54
+ <li class="form-list__row form-list__row--agree">
55
+ <label>
56
+ <input type="checkbox" name="save_cc" checked="checked">
57
+ I agree to terms and conditions
58
+ </label>
59
+ </li>
60
+ {{/if}}
61
+
62
+ <li>
63
+ <button id="show_button" type="submit" class="button">{{BUTTON}}</button>
64
+ </li>
65
+
66
+ <script>
67
+ var button = document.getElementById('show_button')
68
+ button.addEventListener('click',hideshow,false);
69
+
70
+ function hideshow() {
71
+ document.getElementById('show_button').style.display = 'none';
72
+ }
73
+ </script>
74
+
75
+ </ul>
76
+
77
+
78
+
79
+ <input type="hidden" name="MID" value="{{MID}}" {{readonly}}>
80
+ <input type="hidden" name="WEBSITE" value="{{WEBSITE}}" {{readonly}}>
81
+ <input type="hidden" name="ORDER_ID" value="{{ORDER_ID}}" {{readonly}}>
82
+ <input type="hidden" name="CUST_ID" value="{{CUST_ID}}" {{readonly}}>
83
+ <input type="hidden" name="INDUSTRY_TYPE_ID" value="{{INDUSTRY_TYPE_ID}}" {{readonly}}>
84
+ <input type="hidden" name="CHANNEL_ID" value="{{CHANNEL_ID}}" {{readonly}}>
85
+ <input type="hidden" name="CALLBACK_URL" value="{{CALLBACK_URL}}" {{readonly}}>
86
+ <input type="hidden" name="CHECKSUMHASH" value="{{CHECKSUMHASH}}" {{readonly}}>
87
+
88
+
89
+
90
+
91
+
92
+
93
93
  </form>
@@ -1,58 +1,58 @@
1
- <!DOCTYPE html>
2
- <html>
3
-
4
- <head>
5
- <meta charset="UTF-8">
6
- <title>Secure Pay</title>
7
- <link href="https://fonts.googleapis.com/css?family=Open+Sans:400,600" rel="stylesheet">
8
-
9
- <meta name="viewport" content="width=device-width, initial-scale=1">
10
- <link rel="stylesheet" href="https://cdnjs.cloudflare.com/ajax/libs/normalize/5.0.0/normalize.min.css">
11
- <link rel="stylesheet" href="https://cdnjs.cloudflare.com/ajax/libs/font-awesome/4.7.0/css/font-awesome.min.css">
12
-
13
- <link rel="stylesheet" href="css/style.css">
14
-
15
-
16
- </head>
17
-
18
- <body>
19
-
20
- <div class="modal">
21
- <div class="modal__container">
22
-
23
- <div class="modal__content">
24
-
25
-
26
-
27
-
28
- {{{body}}}
29
-
30
-
31
-
32
- </div> <!-- END: .modal__content -->
33
- </div> <!-- END: .modal__container -->
34
- </div> <!-- END: .modal -->
35
- <script src='https://cdnjs.cloudflare.com/ajax/libs/jquery/3.1.0/jquery.min.js'></script>
36
-
37
- <script src="js/index.js"></script>
38
-
39
-
40
- <style>
41
-
42
- input:focus {
43
- border-color: {{theme_color}};
44
- }
45
- /*
46
- body,
47
- .form-list__row label {
48
- color: #cc0f0f;
49
- }
50
- input {
51
- color: #cc0f0f;
52
- }
53
-
54
- */
55
- </style>
56
- </body>
57
-
1
+ <!DOCTYPE html>
2
+ <html>
3
+
4
+ <head>
5
+ <meta charset="UTF-8">
6
+ <title>Secure Pay</title>
7
+ <link href="https://fonts.googleapis.com/css?family=Open+Sans:400,600" rel="stylesheet">
8
+
9
+ <meta name="viewport" content="width=device-width, initial-scale=1">
10
+ <link rel="stylesheet" href="https://cdnjs.cloudflare.com/ajax/libs/normalize/5.0.0/normalize.min.css">
11
+ <link rel="stylesheet" href="https://cdnjs.cloudflare.com/ajax/libs/font-awesome/4.7.0/css/font-awesome.min.css">
12
+
13
+ <link rel="stylesheet" href="css/style.css">
14
+
15
+
16
+ </head>
17
+
18
+ <body>
19
+
20
+ <div class="modal">
21
+ <div class="modal__container">
22
+
23
+ <div class="modal__content">
24
+
25
+
26
+
27
+
28
+ {{{body}}}
29
+
30
+
31
+
32
+ </div> <!-- END: .modal__content -->
33
+ </div> <!-- END: .modal__container -->
34
+ </div> <!-- END: .modal -->
35
+ <script src='https://cdnjs.cloudflare.com/ajax/libs/jquery/3.1.0/jquery.min.js'></script>
36
+
37
+ <script src="js/index.js"></script>
38
+
39
+
40
+ <style>
41
+
42
+ input:focus {
43
+ border-color: {{theme_color}};
44
+ }
45
+ /*
46
+ body,
47
+ .form-list__row label {
48
+ color: #cc0f0f;
49
+ }
50
+ input {
51
+ color: #cc0f0f;
52
+ }
53
+
54
+ */
55
+ </style>
56
+ </body>
57
+
58
58
  </html>