rts2003-so 1.4.2 → 1.4.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.
Files changed (3) hide show
  1. package/README.md +2 -2
  2. package/index.js +11 -11
  3. package/package.json +1 -1
package/README.md CHANGED
@@ -19,12 +19,12 @@ $ npm install --save rts2003-so
19
19
  const { SingleSignOn, RTS2003_SO_ENDPOINT, RTS2003_SO_CLIENT_KEY, RTS2003_SO_SECRET_KEY } = require('rts2003-so');
20
20
 
21
21
  process.env.RTS2003_SO_ENDPOINT = 'custom-endpoint';
22
- process.env.RTS2003_SO_CLIENT_KEY = 'custom-client-id';
22
+ process.env.RTS2003_SO_CLIENT_ID = 'custom-client-id';
23
23
  process.env.RTS2003_SO_SECRET_KEY = 'custom-secret-key';
24
24
 
25
25
  // show env
26
26
  console.log('ENDPOINT Key:', RTS2003_SO_ENDPOINT);
27
- console.log('CLIENT_KEY Key:', RTS2003_SO_CLIENT_KEY);
27
+ console.log('CLIENT_ID Key:', RTS2003_SO_CLIENT_ID);
28
28
  console.log('SECRET_KEY Key:', RTS2003_SO_SECRET_KEY);
29
29
 
30
30
  // use new class
package/index.js CHANGED
@@ -1,11 +1,11 @@
1
1
  const fetch = (...args) => import('node-fetch').then(({default: fetch}) => fetch(...args));
2
2
 
3
3
  const RTS2003_SO_ENDPOINT = process.env.RTS2003_SO_ENDPOINT || '';
4
- const RTS2003_SO_CLIENT_KEY = process.env.RTS2003_SO_CLIENT_KEY || '';
4
+ const RTS2003_SO_CLIENT_ID = process.env.RTS2003_SO_CLIENT_ID || '';
5
5
  const RTS2003_SO_SECRET_KEY = process.env.RTS2003_SO_SECRET_KEY || '';
6
6
 
7
7
  class SingleSignOn {
8
- constructor(endpoint = RTS2003_SO_ENDPOINT, clientId = RTS2003_SO_CLIENT_KEY, secretKey = RTS2003_SO_SECRET_KEY) {
8
+ constructor(endpoint = RTS2003_SO_ENDPOINT, clientId = RTS2003_SO_CLIENT_ID, secretKey = RTS2003_SO_SECRET_KEY) {
9
9
  this.endpoint = endpoint;
10
10
  this.clientId = clientId;
11
11
  this.secretKey = secretKey;
@@ -31,16 +31,16 @@ class SingleSignOn {
31
31
  if (!dataToSend.email) {
32
32
  return { message: "Field email not found", statusCode: 400, error: false };
33
33
  }
34
- if (!secret_key.first_name) {
34
+ if (!dataToSend.first_name) {
35
35
  return { message: "Field first_name not found", statusCode: 400, error: false };
36
36
  }
37
- if (!secret_key.last_name) {
37
+ if (!dataToSend.last_name) {
38
38
  return { message: "Field last_name not found", statusCode: 400, error: false };
39
39
  }
40
- if (!secret_key.is_active) {
40
+ if (!dataToSend.is_active) {
41
41
  return { message: "Field is_active not found", statusCode: 400, error: false };
42
42
  }
43
- if (!secret_key.created_by) {
43
+ if (!dataToSend.created_by) {
44
44
  return { message: "Field created_by not found", statusCode: 400, error: false };
45
45
  }
46
46
 
@@ -77,16 +77,16 @@ class SingleSignOn {
77
77
  if (!dataToSend.id) {
78
78
  return { message: "Field id not found", statusCode: 400, error: false };
79
79
  }
80
- if (!secret_key.first_name) {
80
+ if (!dataToSend.first_name) {
81
81
  return { message: "Field first_name not found", statusCode: 400, error: false };
82
82
  }
83
- if (!secret_key.last_name) {
83
+ if (!dataToSend.last_name) {
84
84
  return { message: "Field last_name not found", statusCode: 400, error: false };
85
85
  }
86
- if (!secret_key.is_active) {
86
+ if (!dataToSend.is_active) {
87
87
  return { message: "Field is_active not found", statusCode: 400, error: false };
88
88
  }
89
- if (!secret_key.updated_by) {
89
+ if (!dataToSend.updated_by) {
90
90
  return { message: "Field updated_by not found", statusCode: 400, error: false };
91
91
  }
92
92
 
@@ -120,7 +120,7 @@ class SingleSignOn {
120
120
  if (!dataToSend.id) {
121
121
  return { message: "Field id not found", statusCode: 400, error: false };
122
122
  }
123
- if (!secret_key.deleted_by) {
123
+ if (!dataToSend.deleted_by) {
124
124
  return { message: "Field deleted_by not found", statusCode: 400, error: false };
125
125
  }
126
126
 
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "rts2003-so",
3
- "version": "1.4.2",
3
+ "version": "1.4.4",
4
4
  "description": "RTS2003 SO is service order, manage user, like re-token, logout, register, update, delete, update password, get user.",
5
5
  "main": "index.js",
6
6
  "scripts": {