node-paytmpg 8.0.5 → 8.0.8

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.
@@ -341,10 +341,25 @@ class SubscriptionController {
341
341
  async getSubscriptions(req, res) {
342
342
  try {
343
343
  const clientId = req.query.clientId || req.query.client_id || req.headers['x-client-id'] || '';
344
+ const userId = req.query.userId || req.query.user_id || req.query.cusId;
345
+ const userEmail = req.query.userEmail || req.query.user_email || req.query.email;
344
346
  const query = {};
345
347
  if (clientId) {
346
348
  query.clientId = clientId;
347
349
  }
350
+ if (userId) {
351
+ query.cusId = userId;
352
+ }
353
+ if (userEmail) {
354
+ const user = await this.db.getOne(this.tableNames.USER, { email: userEmail }).catch(() => null);
355
+ if (user) {
356
+ query.cusId = user.id;
357
+ }
358
+ else {
359
+ res.send({ limit: 20, offset: 0, count: 0, subscriptions: [] });
360
+ return;
361
+ }
362
+ }
348
363
  const limit = Math.min(parseInt(req.query.limit, 10) || 20, 100);
349
364
  const offset = Math.max(parseInt(req.query.offset, 10) || 0, 0);
350
365
  const subs = await this.db.get(this.tableNames.SUBSCRIPTION, query, {
@@ -115,7 +115,7 @@ function validateOpenMoneyConfig(config) {
115
115
  function withClientConfigOverrides(config, req, orderData) {
116
116
  let _client = config;
117
117
  if (config.getClientConfig && (req || (orderData === null || orderData === void 0 ? void 0 : orderData.clientId))) {
118
- const clientId = (orderData === null || orderData === void 0 ? void 0 : orderData.clientId) || req.headers['x-client-id'] || req.query.client_id || req.body.client_id || req.body.CLIENT_ID || req.query.CLIENT_ID;
118
+ const clientId = (orderData === null || orderData === void 0 ? void 0 : orderData.clientId) || req.headers['x-client-id'] || req.query.client_id || req.body.client_id || req.body.CLIENT_ID || req.body.clientId || req.query.clientId || req.query.CLIENT_ID;
119
119
  if (clientId) {
120
120
  const clientConfig = config.getClientConfig(clientId);
121
121
  if (clientConfig) {
package/dist/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "node-paytmpg",
3
- "version": "8.0.5",
3
+ "version": "8.0.8",
4
4
  "description": "Payment Gateway Integration using NodeJS",
5
5
  "main": "dist/index.js",
6
6
  "types": "dist/index.d.ts",
@@ -8,6 +8,7 @@
8
8
  "start": "node example.js",
9
9
  "clean": "node -e \"require('fs').rmSync('dist', { recursive: true, force: true })\"",
10
10
  "build:ts": "tsc -p tsconfig.json",
11
+ "release": "npm run build && git add . && git add package.json && git commit -m Update-files | npm version patch && npm login && npm publish && git add package.json && git commit -m Update-version | git push",
11
12
  "copy:views": "copyfiles -u 1 \"app/views/**/*\" dist/app",
12
13
  "copy:public": "copyfiles -u 1 \"public/**/*\" dist/public",
13
14
  "build": "npm-run-all clean build:ts copy:views copy:public",
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "node-paytmpg",
3
- "version": "8.0.5",
3
+ "version": "8.0.8",
4
4
  "description": "Payment Gateway Integration using NodeJS",
5
5
  "main": "dist/index.js",
6
6
  "types": "dist/index.d.ts",
@@ -8,6 +8,7 @@
8
8
  "start": "node example.js",
9
9
  "clean": "node -e \"require('fs').rmSync('dist', { recursive: true, force: true })\"",
10
10
  "build:ts": "tsc -p tsconfig.json",
11
+ "release": "npm run build && git add . && git add package.json && git commit -m Update-files | npm version patch && npm login && npm publish && git add package.json && git commit -m Update-version | git push",
11
12
  "copy:views": "copyfiles -u 1 \"app/views/**/*\" dist/app",
12
13
  "copy:public": "copyfiles -u 1 \"public/**/*\" dist/public",
13
14
  "build": "npm-run-all clean build:ts copy:views copy:public",