ggez-banking-sdk 0.1.105 → 0.1.107
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.
- package/dist/api/clients/account.d.ts +8 -8
- package/dist/api/clients/account.js +26 -19
- package/dist/api/clients/auth.d.ts +22 -17
- package/dist/api/clients/auth.js +57 -42
- package/dist/api/clients/blockchain.d.ts +16 -16
- package/dist/api/clients/blockchain.js +52 -42
- package/dist/api/clients/ipAddressAndLocation.js +15 -13
- package/dist/api/clients/limited.d.ts +42 -32
- package/dist/api/clients/limited.js +100 -82
- package/dist/api/clients/order.d.ts +4 -4
- package/dist/api/clients/order.js +16 -12
- package/dist/api/clients/organization.d.ts +23 -18
- package/dist/api/clients/organization.js +57 -45
- package/dist/api/clients/promotion.d.ts +28 -13
- package/dist/api/clients/promotion.js +32 -30
- package/dist/api/clients/transaction.d.ts +9 -9
- package/dist/api/clients/transaction.js +30 -24
- package/dist/api/clients/user.d.ts +387 -301
- package/dist/api/clients/user.js +886 -735
- package/dist/api/data/account.d.ts +3 -0
- package/dist/api/data/account.js +8 -0
- package/dist/api/data/blockchain.d.ts +2 -1
- package/dist/api/data/blockchain.js +11 -1
- package/dist/api/data/index.d.ts +2 -0
- package/dist/api/data/index.js +2 -0
- package/dist/api/data/order.d.ts +2 -1
- package/dist/api/data/order.js +15 -1
- package/dist/api/data/organization.d.ts +2 -1
- package/dist/api/data/organization.js +26 -1
- package/dist/api/data/result.d.ts +9 -0
- package/dist/api/data/result.js +48 -0
- package/dist/api/data/transaction.d.ts +4 -2
- package/dist/api/data/transaction.js +24 -1
- package/dist/api/data/user/confirmUserSecurity.d.ts +3 -0
- package/dist/api/data/user/confirmUserSecurity.js +12 -0
- package/dist/api/data/user/forgetSecurityData.d.ts +3 -0
- package/dist/api/data/user/forgetSecurityData.js +10 -0
- package/dist/api/data/user/index.d.ts +8 -8
- package/dist/api/data/user/index.js +8 -161
- package/dist/api/data/user/user.d.ts +6 -0
- package/dist/api/data/user/user.js +159 -0
- package/dist/api/data/user/validateLimitedSecurity.d.ts +3 -0
- package/dist/api/data/user/validateLimitedSecurity.js +10 -0
- package/dist/api/data/user/validateSecurityData.d.ts +3 -0
- package/dist/api/data/user/validateSecurityData.js +11 -0
- package/dist/api/data/user/verifyUserSecurity.d.ts +3 -0
- package/dist/api/data/user/verifyUserSecurity.js +11 -0
- package/dist/api/services/account.js +1 -1
- package/dist/api/services/auth.js +4 -5
- package/dist/api/services/base.d.ts +1 -1
- package/dist/api/services/base.js +1 -0
- package/dist/api/services/blockchain.js +5 -9
- package/dist/api/services/ipAddressAndLocation.js +10 -10
- package/dist/api/services/limited.js +2 -1
- package/dist/api/services/order.js +2 -3
- package/dist/api/services/organization.d.ts +2 -2
- package/dist/api/services/organization.js +7 -10
- package/dist/api/services/promotion.js +1 -1
- package/dist/api/services/transaction.d.ts +2 -2
- package/dist/api/services/transaction.js +3 -5
- package/dist/api/services/user.js +65 -127
- package/dist/constants/structure.d.ts +1 -0
- package/dist/constants/structure.js +1 -0
- package/dist/helper/api/axiosHelper.js +71 -71
- package/dist/helper/api/responseHelper.d.ts +12 -11
- package/dist/helper/api/responseHelper.js +24 -25
- package/dist/helper/cipherHelper.js +95 -97
- package/dist/helper/clientHelper.js +1 -0
- package/dist/helper/cookiesHelper.d.ts +5 -0
- package/dist/helper/cookiesHelper.js +169 -126
- package/dist/helper/deviceHelper.js +31 -31
- package/dist/helper/userHelper.d.ts +12 -2
- package/dist/helper/userHelper.js +69 -2
- package/dist/index.d.ts +1 -1
- package/dist/index.js +1 -1
- package/dist/tsconfig.tsbuildinfo +1 -1
- package/dist/types/banking/common/ResultSet.d.ts +10 -0
- package/dist/types/banking/common/ResultSet.js +1 -0
- package/dist/types/banking/common/index.d.ts +1 -0
- package/dist/types/banking/entities/address.d.ts +1 -0
- package/dist/types/banking/oauth/tokenData.d.ts +3 -1
- package/dist/types/banking/transaction/index.d.ts +1 -0
- package/dist/types/banking/transaction/transactionResultInquiry.d.ts +9 -0
- package/dist/types/banking/transaction/transactionResultInquiry.js +1 -0
- package/dist/types/helper/index.d.ts +4 -3
- package/dist/types/helper/index.js +1 -3
- package/dist/types/helper/userHelper.d.ts +17 -0
- package/dist/types/helper/userHelper.js +2 -0
- package/package.json +2 -2
@@ -3,9 +3,10 @@ import { BaseService } from "./base";
|
|
3
3
|
import { IPAddressAndLocationService } from "./ipAddressAndLocation";
|
4
4
|
import { AxiosHelper, GeoHelper } from "../../helper";
|
5
5
|
class UserService extends BaseService {
|
6
|
+
url;
|
7
|
+
endpoint = Endpoints.User;
|
6
8
|
constructor(config) {
|
7
9
|
super(config);
|
8
|
-
this.endpoint = Endpoints.User;
|
9
10
|
this.axiosInstance.interceptors.request.use(async (req) => {
|
10
11
|
const locationService = new IPAddressAndLocationService(config);
|
11
12
|
const geoCoordinates = await GeoHelper.GetGeoCoordinates(locationService);
|
@@ -16,326 +17,263 @@ class UserService extends BaseService {
|
|
16
17
|
// #region "GET"
|
17
18
|
async getUser(userId, token) {
|
18
19
|
const url = this.resolveURL(`/${userId}`);
|
19
|
-
|
20
|
+
return this.GET(url, undefined, {
|
20
21
|
headers: { Authorization: `Bearer ${token}` },
|
21
22
|
});
|
22
|
-
return response;
|
23
23
|
}
|
24
24
|
async getTermsAndConditions(userId) {
|
25
25
|
const url = this.resolveURL(`${UserEndpoints.TermsAndConditions}/${userId}`);
|
26
|
-
|
27
|
-
return response;
|
26
|
+
return this.GET(url);
|
28
27
|
}
|
29
28
|
async getSecurity(userId) {
|
30
29
|
const url = this.resolveURL(`${UserEndpoints.Security}/${userId}`);
|
31
|
-
|
32
|
-
return response;
|
30
|
+
return this.GET(url);
|
33
31
|
}
|
34
32
|
async getPhone(userId) {
|
35
33
|
const url = this.resolveURL(`${UserEndpoints.Phone}/${userId}`);
|
36
|
-
|
37
|
-
return response;
|
34
|
+
return this.GET(url);
|
38
35
|
}
|
39
36
|
async getPreferences(userId) {
|
40
37
|
const url = this.resolveURL(`${UserEndpoints.Preferences}/${userId}`);
|
41
|
-
|
42
|
-
return response;
|
38
|
+
return this.GET(url);
|
43
39
|
}
|
44
40
|
async getPersonalInfo(userId) {
|
45
41
|
const url = this.resolveURL(`${UserEndpoints.PersonalInfo}/${userId}`);
|
46
|
-
|
47
|
-
return response;
|
42
|
+
return this.GET(url);
|
48
43
|
}
|
49
44
|
async getLatestHistory(userId) {
|
50
45
|
const url = this.resolveURL(`${UserEndpoints.HistoryLatest}/${userId}`);
|
51
|
-
|
52
|
-
return response;
|
46
|
+
return this.GET(url);
|
53
47
|
}
|
54
48
|
async getIdentification(userId) {
|
55
49
|
const url = this.resolveURL(`${UserEndpoints.Identification}/${userId}`);
|
56
|
-
|
57
|
-
return response;
|
50
|
+
return this.GET(url);
|
58
51
|
}
|
59
52
|
async getHistory(userId) {
|
60
53
|
const url = this.resolveURL(`${UserEndpoints.HistoryLatest}/${userId}`);
|
61
|
-
|
62
|
-
return response;
|
54
|
+
return this.GET(url);
|
63
55
|
}
|
64
56
|
async getGroup(userId) {
|
65
57
|
const url = this.resolveURL(`${UserEndpoints.Group}/${userId}`);
|
66
|
-
|
67
|
-
return response;
|
58
|
+
return this.GET(url);
|
68
59
|
}
|
69
60
|
async getExternalAuth(userId) {
|
70
61
|
const url = this.resolveURL(`${UserEndpoints.ExternalAuth}/${userId}`);
|
71
|
-
|
72
|
-
return response;
|
62
|
+
return this.GET(url);
|
73
63
|
}
|
74
64
|
async getEmail(userId) {
|
75
65
|
const url = this.resolveURL(`${UserEndpoints.Email}/${userId}`);
|
76
|
-
|
77
|
-
return response;
|
66
|
+
return this.GET(url);
|
78
67
|
}
|
79
68
|
async getDocuments(userId) {
|
80
69
|
const url = this.resolveURL(`${UserEndpoints.Documents}/${userId}`);
|
81
|
-
|
82
|
-
return response;
|
70
|
+
return this.GET(url);
|
83
71
|
}
|
84
72
|
async getCurrency(userId) {
|
85
73
|
const url = this.resolveURL(`${UserEndpoints.Currency}/${userId}`);
|
86
|
-
|
87
|
-
return response;
|
74
|
+
return this.GET(url);
|
88
75
|
}
|
89
76
|
async getCreditCard(userId) {
|
90
77
|
const url = this.resolveURL(`${UserEndpoints.CreditCard}/${userId}`);
|
91
|
-
|
92
|
-
return response;
|
78
|
+
return this.GET(url);
|
93
79
|
}
|
94
80
|
async getBankAccount(userId) {
|
95
81
|
const url = this.resolveURL(`${UserEndpoints.BankAccount}/${userId}`);
|
96
|
-
|
97
|
-
return response;
|
82
|
+
return this.GET(url);
|
98
83
|
}
|
99
84
|
async getAddress(userId) {
|
100
85
|
const url = this.resolveURL(`${UserEndpoints.Address}/${userId}`);
|
101
|
-
|
102
|
-
return response;
|
86
|
+
return this.GET(url);
|
103
87
|
}
|
104
88
|
async getAccount(userId) {
|
105
89
|
const url = this.resolveURL(`${UserEndpoints.Account}/${userId}`);
|
106
|
-
|
107
|
-
return response;
|
90
|
+
return this.GET(url);
|
108
91
|
}
|
109
92
|
async getDeviceHistory(userId) {
|
110
93
|
const url = this.resolveURL(`${UserEndpoints.DeviceHistory}/${userId}`);
|
111
|
-
|
112
|
-
return response;
|
94
|
+
return this.GET(url);
|
113
95
|
}
|
114
96
|
async getActivity(userId) {
|
115
97
|
const url = this.resolveURL(`${UserEndpoints.Activity}/${userId}`);
|
116
|
-
|
117
|
-
return response;
|
98
|
+
return this.GET(url);
|
118
99
|
}
|
119
100
|
// #endregion
|
120
101
|
// #region "POST"
|
121
102
|
async createUser(payload, config) {
|
122
103
|
const url = this.resolveURL();
|
123
|
-
|
124
|
-
return response;
|
104
|
+
return this.POST(url, payload, config);
|
125
105
|
}
|
126
106
|
async createPhone(userId, payload) {
|
127
107
|
const url = this.resolveURL(`${UserEndpoints.Phone}/${userId}`);
|
128
|
-
|
129
|
-
return response;
|
108
|
+
return this.POST(url, payload);
|
130
109
|
}
|
131
110
|
async createDevice(userId, payload) {
|
132
111
|
const url = this.resolveURL(`${UserEndpoints.Device}/${userId}`);
|
133
|
-
|
134
|
-
return response;
|
112
|
+
return this.POST(url, payload);
|
135
113
|
}
|
136
114
|
async createIdentification(userId, payload) {
|
137
115
|
const url = this.resolveURL(`${UserEndpoints.Identification}/${userId}`);
|
138
|
-
|
139
|
-
return response;
|
116
|
+
return this.POST(url, payload);
|
140
117
|
}
|
141
118
|
async createExternalAuth(userId, payload) {
|
142
119
|
const url = this.resolveURL(`${UserEndpoints.ExternalAuth}/${userId}`);
|
143
|
-
|
144
|
-
return response;
|
120
|
+
return this.POST(url, payload);
|
145
121
|
}
|
146
122
|
async createEmail(userId, payload) {
|
147
123
|
const url = this.resolveURL(`${UserEndpoints.Email}/${userId}`);
|
148
|
-
|
149
|
-
return response;
|
124
|
+
return this.POST(url, payload);
|
150
125
|
}
|
151
126
|
async createCurrency(userId, payload) {
|
152
127
|
const url = this.resolveURL(`${UserEndpoints.Currency}/${userId}`);
|
153
|
-
|
154
|
-
return response;
|
128
|
+
return this.POST(url, payload);
|
155
129
|
}
|
156
130
|
async createCreditCard(userId, payload) {
|
157
131
|
const url = this.resolveURL(`${UserEndpoints.CreditCard}/${userId}`);
|
158
|
-
|
159
|
-
return response;
|
132
|
+
return this.POST(url, payload);
|
160
133
|
}
|
161
134
|
async createBankAccount(userId, payload) {
|
162
135
|
const url = this.resolveURL(`${UserEndpoints.BankAccount}/${userId}`);
|
163
|
-
|
164
|
-
return response;
|
136
|
+
return this.POST(url, payload);
|
165
137
|
}
|
166
138
|
async createAddress(userId, payload) {
|
167
139
|
const url = this.resolveURL(`${UserEndpoints.Address}/${userId}`);
|
168
|
-
|
169
|
-
return response;
|
140
|
+
return this.POST(url, payload);
|
170
141
|
}
|
171
142
|
async createTicket(userId, payload) {
|
172
143
|
const url = this.resolveURL(`${UserEndpoints.Ticket}/${userId}`);
|
173
|
-
|
174
|
-
return response;
|
144
|
+
return this.POST(url, payload);
|
175
145
|
}
|
176
146
|
async securityAccess(userId, payload) {
|
177
147
|
const url = this.resolveURL(`${UserEndpoints.SecurityAccess}/${userId}`);
|
178
|
-
|
179
|
-
return response;
|
148
|
+
return this.POST(url, payload);
|
180
149
|
}
|
181
150
|
async uploadDocument(userId, payload) {
|
182
151
|
const url = this.resolveURL(`${UserEndpoints.Document}/${userId}`);
|
183
|
-
|
184
|
-
return response;
|
152
|
+
return this.POST(url, payload);
|
185
153
|
}
|
186
154
|
async confirmSecurityData(userId, payload) {
|
187
155
|
const url = this.resolveURL(`${UserEndpoints.SecurityConfirm}/${userId}`);
|
188
|
-
|
189
|
-
return response;
|
156
|
+
return this.POST(url, payload);
|
190
157
|
}
|
191
158
|
async validateSecurityData(userId, payload) {
|
192
159
|
const url = this.resolveURL(`${UserEndpoints.SecurityValidate}/${userId}`);
|
193
|
-
|
194
|
-
return response;
|
160
|
+
return this.POST(url, payload);
|
195
161
|
}
|
196
162
|
async verifySecurityData(userId, payload) {
|
197
163
|
const url = this.resolveURL(`${UserEndpoints.SecurityVerify}/${userId}`);
|
198
|
-
|
199
|
-
return response;
|
164
|
+
return this.POST(url, payload);
|
200
165
|
}
|
201
166
|
async resetSecurityData(userId, payload) {
|
202
167
|
const url = this.resolveURL(`${UserEndpoints.SecurityReset}/${userId}`);
|
203
|
-
|
204
|
-
return response;
|
168
|
+
return this.POST(url, payload);
|
205
169
|
}
|
206
170
|
async enrollGoogleAuth(userId, payload) {
|
207
171
|
const url = this.resolveURL(`${UserEndpoints.AuthEnroll}/${userId}`);
|
208
|
-
|
209
|
-
return response;
|
172
|
+
return this.POST(url, payload);
|
210
173
|
}
|
211
174
|
async activateGoogleAuth(userId, payload) {
|
212
175
|
const url = this.resolveURL(`${UserEndpoints.AuthActivate}/${userId}`);
|
213
|
-
|
214
|
-
return response;
|
176
|
+
return this.POST(url, payload);
|
215
177
|
}
|
216
178
|
async deactivateGoogleAuth(userId, payload) {
|
217
179
|
const url = this.resolveURL(`${UserEndpoints.AuthDeactivate}/${userId}`);
|
218
|
-
|
219
|
-
return response;
|
180
|
+
return this.POST(url, payload);
|
220
181
|
}
|
221
182
|
async deleteGoogleAuth(userId, payload) {
|
222
183
|
const url = this.resolveURL(`${UserEndpoints.AuthDelete}/${userId}`);
|
223
|
-
|
224
|
-
return response;
|
184
|
+
return this.POST(url, payload);
|
225
185
|
}
|
226
186
|
// #endregion
|
227
187
|
// #region "PUT"
|
228
188
|
async updateUser(userId, payload) {
|
229
189
|
const url = this.resolveURL(`/${userId}`);
|
230
|
-
|
231
|
-
return response;
|
190
|
+
return this.PUT(url, payload);
|
232
191
|
}
|
233
192
|
async updateSecurity(userId, payload) {
|
234
193
|
const url = this.resolveURL(`${UserEndpoints.Security}/${userId}`);
|
235
|
-
|
236
|
-
return response;
|
194
|
+
return this.PUT(url, payload);
|
237
195
|
}
|
238
196
|
async updatePreferences(userId, payload) {
|
239
197
|
const url = this.resolveURL(`${UserEndpoints.Preferences}/${userId}`);
|
240
|
-
|
241
|
-
return response;
|
198
|
+
return this.PUT(url, payload);
|
242
199
|
}
|
243
200
|
async updateDevice(userId, payload) {
|
244
201
|
const url = this.resolveURL(`${UserEndpoints.Device}/${userId}`);
|
245
|
-
|
246
|
-
return response;
|
202
|
+
return this.PUT(url, payload);
|
247
203
|
}
|
248
204
|
async logoutDevice(userId, payload) {
|
249
205
|
const url = this.resolveURL(`${UserEndpoints.DeviceLogout}/${userId}`);
|
250
|
-
|
251
|
-
return response;
|
206
|
+
return this.PUT(url, payload);
|
252
207
|
}
|
253
208
|
async updatePhone(userId, payload) {
|
254
209
|
const url = this.resolveURL(`${UserEndpoints.Phone}/${userId}`);
|
255
|
-
|
256
|
-
return response;
|
210
|
+
return this.PUT(url, payload);
|
257
211
|
}
|
258
212
|
async updatePersonalInfo(userId, payload) {
|
259
213
|
const url = this.resolveURL(`${UserEndpoints.PersonalInfo}/${userId}`);
|
260
|
-
|
261
|
-
return response;
|
214
|
+
return this.PUT(url, payload);
|
262
215
|
}
|
263
216
|
async updateIdentification(userId, payload) {
|
264
217
|
const url = this.resolveURL(`${UserEndpoints.Identification}/${userId}`);
|
265
|
-
|
266
|
-
return response;
|
218
|
+
return this.PUT(url, payload);
|
267
219
|
}
|
268
220
|
async updateExternalAuth(userId, payload) {
|
269
221
|
const url = this.resolveURL(`${UserEndpoints.ExternalAuth}/${userId}`);
|
270
|
-
|
271
|
-
return response;
|
222
|
+
return this.PUT(url, payload);
|
272
223
|
}
|
273
224
|
async updateEmail(userId, payload) {
|
274
225
|
const url = this.resolveURL(`${UserEndpoints.Email}/${userId}`);
|
275
|
-
|
276
|
-
return response;
|
226
|
+
return this.PUT(url, payload);
|
277
227
|
}
|
278
228
|
async updateCreditCard(userId, payload) {
|
279
229
|
const url = this.resolveURL(`${UserEndpoints.CreditCard}/${userId}`);
|
280
|
-
|
281
|
-
return response;
|
230
|
+
return this.PUT(url, payload);
|
282
231
|
}
|
283
232
|
async updateBankAccount(userId, payload) {
|
284
233
|
const url = this.resolveURL(`${UserEndpoints.BankAccount}/${userId}`);
|
285
|
-
|
286
|
-
return response;
|
234
|
+
return this.PUT(url, payload);
|
287
235
|
}
|
288
236
|
async updateAddress(userId, payload) {
|
289
237
|
const url = this.resolveURL(`${UserEndpoints.Address}/${userId}`);
|
290
|
-
|
291
|
-
return response;
|
238
|
+
return this.PUT(url, payload);
|
292
239
|
}
|
293
240
|
// #endregion
|
294
241
|
// #region "DELETE"
|
295
242
|
async deleteUser(userId) {
|
296
243
|
const url = this.resolveURL(`/${userId}`);
|
297
|
-
|
298
|
-
return response;
|
244
|
+
return this.DELETE(url);
|
299
245
|
}
|
300
246
|
async deleteCreditCard(userId) {
|
301
247
|
const url = this.resolveURL(`${UserEndpoints.CreditCard}/${userId}`);
|
302
|
-
|
303
|
-
return response;
|
248
|
+
return this.DELETE(url);
|
304
249
|
}
|
305
250
|
async deleteAddress(userId, payload) {
|
306
251
|
const url = this.resolveURL(`${UserEndpoints.Address}/${userId}`);
|
307
|
-
|
308
|
-
return response;
|
252
|
+
return this.DELETE(url, payload);
|
309
253
|
}
|
310
254
|
async deleteDevice(userId, payload) {
|
311
255
|
const url = this.resolveURL(`${UserEndpoints.Device}/${userId}`);
|
312
|
-
|
313
|
-
return response;
|
256
|
+
return this.DELETE(url, payload);
|
314
257
|
}
|
315
258
|
async deleteBankAccount(userId, payload) {
|
316
259
|
const url = this.resolveURL(`${UserEndpoints.BankAccount}/${userId}`);
|
317
|
-
|
318
|
-
return response;
|
260
|
+
return this.DELETE(url, payload);
|
319
261
|
}
|
320
262
|
async deleteIdentification(userId, payload) {
|
321
263
|
const url = this.resolveURL(`${UserEndpoints.Identification}/${userId}`);
|
322
|
-
|
323
|
-
return response;
|
264
|
+
return this.DELETE(url, payload);
|
324
265
|
}
|
325
266
|
async deleteEmail(userId, payload) {
|
326
267
|
const url = this.resolveURL(`${UserEndpoints.Email}/${userId}`);
|
327
|
-
|
328
|
-
return response;
|
268
|
+
return this.DELETE(url, payload);
|
329
269
|
}
|
330
270
|
async deletePhone(userId, payload) {
|
331
271
|
const url = this.resolveURL(`${UserEndpoints.Phone}/${userId}`);
|
332
|
-
|
333
|
-
return response;
|
272
|
+
return this.DELETE(url, payload);
|
334
273
|
}
|
335
274
|
async deleteExternalAuth(userId) {
|
336
275
|
const url = this.resolveURL(`${UserEndpoints.ExternalAuth}/${userId}`);
|
337
|
-
|
338
|
-
return response;
|
276
|
+
return this.DELETE(url);
|
339
277
|
}
|
340
278
|
}
|
341
279
|
export { UserService };
|
@@ -75,5 +75,6 @@ declare const SystemResponses: {
|
|
75
75
|
readonly Invalid_Token: "5025";
|
76
76
|
readonly Token_Is_Not_Active: "5035";
|
77
77
|
readonly Invalid_Authentication_Code: "6049";
|
78
|
+
readonly Internal_Server_Error: "7001";
|
78
79
|
};
|
79
80
|
export { BlockchainActions, StructTicketMessageDescriptionCodes, SystemResponses, };
|
@@ -2,80 +2,80 @@ import { HeaderKeys } from "../../constants";
|
|
2
2
|
import { GenerateSourceID } from "../../utils";
|
3
3
|
import { DateTimeHelper } from "../dateTimeHelper";
|
4
4
|
class AxiosHelper {
|
5
|
-
|
6
|
-
|
7
|
-
|
8
|
-
|
9
|
-
|
10
|
-
|
11
|
-
|
12
|
-
|
13
|
-
|
14
|
-
|
15
|
-
|
16
|
-
|
17
|
-
|
18
|
-
|
5
|
+
static GetAxiosConfig = (token, baseURL, lang, installationId) => {
|
6
|
+
const config = {
|
7
|
+
headers: {
|
8
|
+
[HeaderKeys.ContentType]: "application/json",
|
9
|
+
[HeaderKeys.Language]: lang,
|
10
|
+
[HeaderKeys.InstallationID]: installationId,
|
11
|
+
[HeaderKeys.ShowSensitiveData]: "1",
|
12
|
+
[HeaderKeys.ShowCustomField]: "1",
|
13
|
+
[HeaderKeys.ShowTicket]: "1",
|
14
|
+
[HeaderKeys.GenerateJwt]: "true",
|
15
|
+
},
|
16
|
+
baseURL: baseURL,
|
17
|
+
withCredentials: true,
|
18
|
+
};
|
19
|
+
if (token) {
|
20
|
+
config.headers.Authorization = `Bearer ${token}`;
|
21
|
+
}
|
22
|
+
return config;
|
19
23
|
};
|
20
|
-
|
21
|
-
config
|
22
|
-
|
23
|
-
|
24
|
-
|
25
|
-
|
26
|
-
|
27
|
-
|
28
|
-
|
29
|
-
|
30
|
-
|
31
|
-
|
32
|
-
|
33
|
-
|
34
|
-
|
35
|
-
},
|
36
|
-
baseURL: baseURL,
|
37
|
-
withCredentials: true,
|
24
|
+
static GetAuthAxiosConfig = (baseURL, lang, installationId) => {
|
25
|
+
const config = {
|
26
|
+
headers: {
|
27
|
+
[HeaderKeys.ContentType]: "application/x-www-form-urlencoded",
|
28
|
+
[HeaderKeys.Language]: lang,
|
29
|
+
[HeaderKeys.InstallationID]: installationId,
|
30
|
+
[HeaderKeys.ShowSensitiveData]: "1",
|
31
|
+
[HeaderKeys.ShowCustomField]: "1",
|
32
|
+
[HeaderKeys.ShowTicket]: "1",
|
33
|
+
[HeaderKeys.GenerateJwt]: "true",
|
34
|
+
},
|
35
|
+
baseURL: baseURL,
|
36
|
+
withCredentials: true,
|
37
|
+
};
|
38
|
+
return config;
|
38
39
|
};
|
39
|
-
|
40
|
-
|
41
|
-
|
42
|
-
|
43
|
-
|
44
|
-
|
45
|
-
|
46
|
-
|
47
|
-
|
48
|
-
|
49
|
-
|
50
|
-
|
51
|
-
|
52
|
-
|
53
|
-
|
54
|
-
|
55
|
-
|
56
|
-
|
57
|
-
|
58
|
-
req.data
|
59
|
-
|
60
|
-
|
61
|
-
|
62
|
-
|
63
|
-
baseResult.time_zone_name = DateTimeHelper.GetClientTimeZoneName();
|
40
|
+
static AddAxiosConfigHeader = (config, key, value) => {
|
41
|
+
if (!config.headers)
|
42
|
+
config.headers = {};
|
43
|
+
config.headers[key] = value;
|
44
|
+
};
|
45
|
+
static InjectRequiredHeaders = (req) => {
|
46
|
+
req.headers.set(HeaderKeys.SourceID, GenerateSourceID());
|
47
|
+
req.headers.set(HeaderKeys.TimeZone, DateTimeHelper.GetClientTimeZone());
|
48
|
+
return req;
|
49
|
+
};
|
50
|
+
static InjectBaseBodyProperties = (req) => {
|
51
|
+
try {
|
52
|
+
if (req.data) {
|
53
|
+
if (typeof req.data == "string") {
|
54
|
+
const baseResult = JSON.parse(req.data);
|
55
|
+
baseResult.time_zone = DateTimeHelper.GetClientTimeZone();
|
56
|
+
baseResult.time_zone_name = DateTimeHelper.GetClientTimeZoneName();
|
57
|
+
req.data = JSON.stringify(baseResult);
|
58
|
+
}
|
59
|
+
else if (typeof req.data == "object") {
|
60
|
+
const baseResult = req.data;
|
61
|
+
baseResult.time_zone = DateTimeHelper.GetClientTimeZone();
|
62
|
+
baseResult.time_zone_name = DateTimeHelper.GetClientTimeZoneName();
|
63
|
+
}
|
64
64
|
}
|
65
65
|
}
|
66
|
-
|
67
|
-
|
68
|
-
|
69
|
-
|
70
|
-
|
66
|
+
catch (error) {
|
67
|
+
console.error("Error parsing request data:", error);
|
68
|
+
}
|
69
|
+
finally {
|
70
|
+
return req;
|
71
|
+
}
|
72
|
+
};
|
73
|
+
static InjectGeoCoordinates = (req, geoCoordinates) => {
|
74
|
+
if (req.data && typeof req.data === "object") {
|
75
|
+
const data = req.data;
|
76
|
+
data.geo_coordinates = geoCoordinates;
|
77
|
+
}
|
71
78
|
return req;
|
72
|
-
}
|
73
|
-
}
|
74
|
-
AxiosHelper.InjectGeoCoordinates = (req, geoCoordinates) => {
|
75
|
-
if (req.data && typeof req.data === "object") {
|
76
|
-
const data = req.data;
|
77
|
-
data.geo_coordinates = geoCoordinates;
|
78
|
-
}
|
79
|
-
return req;
|
80
|
-
};
|
79
|
+
};
|
80
|
+
}
|
81
81
|
export { AxiosHelper };
|
@@ -1,16 +1,17 @@
|
|
1
|
-
import {
|
1
|
+
import { BaseResult, Result } from "../../types";
|
2
2
|
declare class ResponseHelper {
|
3
|
-
static
|
4
|
-
|
5
|
-
|
6
|
-
|
7
|
-
|
3
|
+
static GetResponse: <T extends BaseResult>(data: T) => {
|
4
|
+
data: T;
|
5
|
+
success: boolean;
|
6
|
+
message: string;
|
7
|
+
error: any;
|
8
8
|
};
|
9
|
-
static GetErrorResponse: (
|
10
|
-
|
11
|
-
|
12
|
-
|
13
|
-
|
9
|
+
static GetErrorResponse: <T extends BaseResult>(data: T, functionName: string) => {
|
10
|
+
data: T;
|
11
|
+
success: boolean;
|
12
|
+
message: string;
|
13
|
+
error: string;
|
14
14
|
};
|
15
|
+
static IsApproved: (result: Result) => boolean;
|
15
16
|
}
|
16
17
|
export { ResponseHelper };
|
@@ -1,30 +1,29 @@
|
|
1
|
-
|
2
|
-
import UserHelper from "../userHelper";
|
1
|
+
import { SystemResponses } from "../../constants";
|
3
2
|
class ResponseHelper {
|
4
|
-
|
5
|
-
|
6
|
-
|
7
|
-
|
8
|
-
|
9
|
-
|
10
|
-
|
3
|
+
static GetResponse = (data) => {
|
4
|
+
return {
|
5
|
+
data: data,
|
6
|
+
success: this.IsApproved(data?.result),
|
7
|
+
message: data?.result?.message,
|
8
|
+
error: null,
|
9
|
+
};
|
10
|
+
};
|
11
|
+
static GetErrorResponse = (data, functionName) => {
|
12
|
+
// should log to sentry
|
11
13
|
return {
|
12
|
-
|
13
|
-
|
14
|
-
message:
|
15
|
-
|
14
|
+
data: data,
|
15
|
+
success: false,
|
16
|
+
message: data.result.message,
|
17
|
+
error: data.result.message,
|
16
18
|
};
|
17
|
-
}
|
18
|
-
catch (error) {
|
19
|
-
return _a.GetErrorResponse(error);
|
20
|
-
}
|
21
|
-
};
|
22
|
-
ResponseHelper.GetErrorResponse = (error) => {
|
23
|
-
return {
|
24
|
-
response: error.response,
|
25
|
-
status: "failed",
|
26
|
-
newUser: null,
|
27
|
-
message: error.message,
|
28
19
|
};
|
29
|
-
|
20
|
+
static IsApproved = (result) => {
|
21
|
+
const { code } = result;
|
22
|
+
if (code == SystemResponses.Approved ||
|
23
|
+
code == SystemResponses.Create_User_Completed_Partially) {
|
24
|
+
return true;
|
25
|
+
}
|
26
|
+
return false;
|
27
|
+
};
|
28
|
+
}
|
30
29
|
export { ResponseHelper };
|