ggez-banking-sdk 0.1.106 → 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
package/dist/api/clients/user.js
CHANGED
@@ -1,748 +1,899 @@
|
|
1
1
|
import { AxiosHelper } from "../../helper";
|
2
2
|
import { ResponseHelper } from "../../helper";
|
3
|
-
import { FillCreatePhoneData, FillCreateIdentificationData, FillCreateEmailData, FillCreateBankAccountData, FillCreateAddressData, FillUpdatePreferencesData, FillUpdatePhoneData, FillUpdatePersonalInfoData, FillUpdateIdentificationData, FillUpdateEmailData, FillUpdateBankAccountData, FillUpdateAddressData, FillDeleteBankAccountData, FillDeleteIdentificationData, FillDeleteEmailData, FillDeletePhoneData, FillUploadDocumentData, FillResetSecurityCodeData, FillResetPasswordData, FillResetSecurityQuestionsData, FillValidateSecurityCodeData, FillCreateUserData, FillCreateUserWithGoogleData, FillMakeBankAccountPrimaryData, FillMakeEmailPrimaryData, FillMakePhonePrimaryData, FillMakeAddressPrimaryData, FillDeleteAddressData, FillConfirmPhoneData, FillConfirmEmailData, FillVerifyEmailData, FillVerifyPhoneData, FillEnrollGoogleAuthData, FillActivateGoogleAuthData, FillDeactivateGoogleAuthData, FillDeleteDeviceData, FillUpdateDeviceData, FillCreateDeviceData, FillLogoutDeviceData, FillCreateTicketData, FillVerifyDeviceData, FillConfirmDeviceData, FillSendEmailOTPData, FillSendPhoneOTPData, FillUploadProfilePictureData, } from "../data";
|
3
|
+
import { FillCreatePhoneData, FillCreateIdentificationData, FillCreateEmailData, FillCreateBankAccountData, FillCreateAddressData, FillUpdatePreferencesData, FillUpdatePhoneData, FillUpdatePersonalInfoData, FillUpdateIdentificationData, FillUpdateEmailData, FillUpdateBankAccountData, FillUpdateAddressData, FillDeleteBankAccountData, FillDeleteIdentificationData, FillDeleteEmailData, FillDeletePhoneData, FillUploadDocumentData, FillResetSecurityCodeData, FillResetPasswordData, FillResetSecurityQuestionsData, FillValidateSecurityCodeData, FillCreateUserData, FillCreateUserWithGoogleData, FillMakeBankAccountPrimaryData, FillMakeEmailPrimaryData, FillMakePhonePrimaryData, FillMakeAddressPrimaryData, FillDeleteAddressData, FillConfirmPhoneData, FillConfirmEmailData, FillVerifyEmailData, FillVerifyPhoneData, FillEnrollGoogleAuthData, FillActivateGoogleAuthData, FillDeactivateGoogleAuthData, FillDeleteDeviceData, FillUpdateDeviceData, FillCreateDeviceData, FillLogoutDeviceData, FillCreateTicketData, FillVerifyDeviceData, FillConfirmDeviceData, FillSendEmailOTPData, FillSendPhoneOTPData, FillUploadProfilePictureData, FillUserData, FillResultByError, } from "../data";
|
4
4
|
import { AuthService, UserService } from "../services";
|
5
5
|
class UserClient {
|
6
|
+
clientData;
|
7
|
+
userService;
|
8
|
+
authService;
|
6
9
|
constructor(clientData) {
|
7
10
|
this.clientData = clientData;
|
8
|
-
// #region "GET"
|
9
|
-
this.GetUser = async (userId, token) => {
|
10
|
-
try {
|
11
|
-
const response = await this.userService.getUser(userId || this.clientData.userId, token);
|
12
|
-
return ResponseHelper.GetSuccessResponse(response, this.clientData.userInfo, "user", "GetUser", "get");
|
13
|
-
}
|
14
|
-
catch (error) {
|
15
|
-
return ResponseHelper.GetErrorResponse(error);
|
16
|
-
}
|
17
|
-
};
|
18
|
-
this.GetTermsAndConditions = async () => {
|
19
|
-
try {
|
20
|
-
const response = await this.userService.getTermsAndConditions(this.clientData.userId);
|
21
|
-
return ResponseHelper.GetSuccessResponse(response, this.clientData.userInfo, "termsAndConditions", "GetTermsAndConditions", "get");
|
22
|
-
}
|
23
|
-
catch (error) {
|
24
|
-
return ResponseHelper.GetErrorResponse(error);
|
25
|
-
}
|
26
|
-
};
|
27
|
-
this.GetSecurity = async () => {
|
28
|
-
try {
|
29
|
-
const response = await this.userService.getSecurity(this.clientData.userId);
|
30
|
-
return ResponseHelper.GetSuccessResponse(response, this.clientData.userInfo, "security", "GetSecurity", "get");
|
31
|
-
}
|
32
|
-
catch (error) {
|
33
|
-
return ResponseHelper.GetErrorResponse(error);
|
34
|
-
}
|
35
|
-
};
|
36
|
-
this.GetPhone = async () => {
|
37
|
-
try {
|
38
|
-
const response = await this.userService.getPhone(this.clientData.userId);
|
39
|
-
return ResponseHelper.GetSuccessResponse(response, this.clientData.userInfo, "phone", "GetPhone", "get");
|
40
|
-
}
|
41
|
-
catch (error) {
|
42
|
-
return ResponseHelper.GetErrorResponse(error);
|
43
|
-
}
|
44
|
-
};
|
45
|
-
this.GetPreferences = async () => {
|
46
|
-
try {
|
47
|
-
const response = await this.userService.getPreferences(this.clientData.userId);
|
48
|
-
return ResponseHelper.GetSuccessResponse(response, this.clientData.userInfo, "preferences", "GetPreferences", "get");
|
49
|
-
}
|
50
|
-
catch (error) {
|
51
|
-
return ResponseHelper.GetErrorResponse(error);
|
52
|
-
}
|
53
|
-
};
|
54
|
-
this.GetPersonalInfo = async () => {
|
55
|
-
try {
|
56
|
-
const response = await this.userService.getPersonalInfo(this.clientData.userId);
|
57
|
-
return ResponseHelper.GetSuccessResponse(response, this.clientData.userInfo, "personal_info", "GetPersonalInfo", "get");
|
58
|
-
}
|
59
|
-
catch (error) {
|
60
|
-
return ResponseHelper.GetErrorResponse(error);
|
61
|
-
}
|
62
|
-
};
|
63
|
-
this.GetLatestHistory = async () => {
|
64
|
-
try {
|
65
|
-
const response = await this.userService.getLatestHistory(this.clientData.userId);
|
66
|
-
return ResponseHelper.GetSuccessResponse(response, this.clientData.userInfo, "history", "GetLatestHistory", "get");
|
67
|
-
}
|
68
|
-
catch (error) {
|
69
|
-
return ResponseHelper.GetErrorResponse(error);
|
70
|
-
}
|
71
|
-
};
|
72
|
-
this.GetIdentification = async () => {
|
73
|
-
try {
|
74
|
-
const response = await this.userService.getIdentification(this.clientData.userId);
|
75
|
-
return ResponseHelper.GetSuccessResponse(response, this.clientData.userInfo, "identification", "GetIdentification", "get");
|
76
|
-
}
|
77
|
-
catch (error) {
|
78
|
-
return ResponseHelper.GetErrorResponse(error);
|
79
|
-
}
|
80
|
-
};
|
81
|
-
this.GetHistory = async () => {
|
82
|
-
try {
|
83
|
-
const response = await this.userService.getHistory(this.clientData.userId);
|
84
|
-
return ResponseHelper.GetSuccessResponse(response, this.clientData.userInfo, "history", "GetHistory", "get");
|
85
|
-
}
|
86
|
-
catch (error) {
|
87
|
-
return ResponseHelper.GetErrorResponse(error);
|
88
|
-
}
|
89
|
-
};
|
90
|
-
this.GetGroup = async () => {
|
91
|
-
try {
|
92
|
-
const response = await this.userService.getGroup(this.clientData.userId);
|
93
|
-
return ResponseHelper.GetSuccessResponse(response, this.clientData.userInfo, "group", "GetGroup", "get");
|
94
|
-
}
|
95
|
-
catch (error) {
|
96
|
-
return ResponseHelper.GetErrorResponse(error);
|
97
|
-
}
|
98
|
-
};
|
99
|
-
this.GetExternalAuth = async () => {
|
100
|
-
try {
|
101
|
-
const response = await this.userService.getExternalAuth(this.clientData.userId);
|
102
|
-
return ResponseHelper.GetSuccessResponse(response, this.clientData.userInfo, "externalAuth", "GetExternalAuth", "get");
|
103
|
-
}
|
104
|
-
catch (error) {
|
105
|
-
return ResponseHelper.GetErrorResponse(error);
|
106
|
-
}
|
107
|
-
};
|
108
|
-
this.GetEmail = async () => {
|
109
|
-
try {
|
110
|
-
const response = await this.userService.getEmail(this.clientData.userId);
|
111
|
-
return ResponseHelper.GetSuccessResponse(response, this.clientData.userInfo, "email", "GetEmail", "get");
|
112
|
-
}
|
113
|
-
catch (error) {
|
114
|
-
return ResponseHelper.GetErrorResponse(error);
|
115
|
-
}
|
116
|
-
};
|
117
|
-
this.GetDocuments = async () => {
|
118
|
-
try {
|
119
|
-
const response = await this.userService.getDocuments(this.clientData.userId);
|
120
|
-
return ResponseHelper.GetSuccessResponse(response, this.clientData.userInfo, "documents", "GetDocuments", "get");
|
121
|
-
}
|
122
|
-
catch (error) {
|
123
|
-
return ResponseHelper.GetErrorResponse(error);
|
124
|
-
}
|
125
|
-
};
|
126
|
-
this.GetCurrency = async () => {
|
127
|
-
try {
|
128
|
-
const response = await this.userService.getCurrency(this.clientData.userId);
|
129
|
-
return ResponseHelper.GetSuccessResponse(response, this.clientData.userInfo, "currency", "GetCurrency", "get");
|
130
|
-
}
|
131
|
-
catch (error) {
|
132
|
-
return ResponseHelper.GetErrorResponse(error);
|
133
|
-
}
|
134
|
-
};
|
135
|
-
this.GetCreditCard = async () => {
|
136
|
-
try {
|
137
|
-
const response = await this.userService.getCreditCard(this.clientData.userId);
|
138
|
-
return ResponseHelper.GetSuccessResponse(response, this.clientData.userInfo, "creditCard", "GetCreditCard", "get");
|
139
|
-
}
|
140
|
-
catch (error) {
|
141
|
-
return ResponseHelper.GetErrorResponse(error);
|
142
|
-
}
|
143
|
-
};
|
144
|
-
this.GetBankAccount = async () => {
|
145
|
-
try {
|
146
|
-
const response = await this.userService.getBankAccount(this.clientData.userId);
|
147
|
-
return ResponseHelper.GetSuccessResponse(response, this.clientData.userInfo, "bank_account", "GetBankAccount", "get");
|
148
|
-
}
|
149
|
-
catch (error) {
|
150
|
-
return ResponseHelper.GetErrorResponse(error);
|
151
|
-
}
|
152
|
-
};
|
153
|
-
this.GetAddress = async () => {
|
154
|
-
try {
|
155
|
-
const response = await this.userService.getAddress(this.clientData.userId);
|
156
|
-
return ResponseHelper.GetSuccessResponse(response, this.clientData.userInfo, "address", "GetAddress", "get");
|
157
|
-
}
|
158
|
-
catch (error) {
|
159
|
-
return ResponseHelper.GetErrorResponse(error);
|
160
|
-
}
|
161
|
-
};
|
162
|
-
this.GetAccount = async () => {
|
163
|
-
try {
|
164
|
-
const response = await this.userService.getAccount(this.clientData.userId);
|
165
|
-
return ResponseHelper.GetSuccessResponse(response, this.clientData.userInfo, "account", "GetAccount", "get");
|
166
|
-
}
|
167
|
-
catch (error) {
|
168
|
-
return ResponseHelper.GetErrorResponse(error);
|
169
|
-
}
|
170
|
-
};
|
171
|
-
this.GetSecurityOperations = async () => {
|
172
|
-
try {
|
173
|
-
const response = await this.userService.getActivity(this.clientData.userId);
|
174
|
-
return ResponseHelper.GetSuccessResponse(response, this.clientData.userInfo, "securityOperations", "GetSecurityOperations", "get");
|
175
|
-
}
|
176
|
-
catch (error) {
|
177
|
-
return ResponseHelper.GetErrorResponse(error);
|
178
|
-
}
|
179
|
-
};
|
180
|
-
this.GetDeviceHistory = async () => {
|
181
|
-
try {
|
182
|
-
const response = await this.userService.getDeviceHistory(this.clientData.userId);
|
183
|
-
return ResponseHelper.GetSuccessResponse(response, this.clientData.userInfo, "deviceHistory", "GetDeviceHistory", "get");
|
184
|
-
}
|
185
|
-
catch (error) {
|
186
|
-
return ResponseHelper.GetErrorResponse(error);
|
187
|
-
}
|
188
|
-
};
|
189
|
-
// #endregion
|
190
|
-
// #region "POST"
|
191
|
-
this.CreateUser = async (data) => {
|
192
|
-
try {
|
193
|
-
const userData = FillCreateUserData(data);
|
194
|
-
const { data: tokenData } = await this.authService.generateLimitedToken();
|
195
|
-
const config = {
|
196
|
-
headers: { Authorization: `Bearer ${tokenData?.access_token}` },
|
197
|
-
};
|
198
|
-
const response = await this.userService.createUser(userData, config);
|
199
|
-
return ResponseHelper.GetSuccessResponse(response, this.clientData.userInfo, "user", "CreateUser");
|
200
|
-
}
|
201
|
-
catch (error) {
|
202
|
-
return ResponseHelper.GetErrorResponse(error);
|
203
|
-
}
|
204
|
-
};
|
205
|
-
this.CreateUserWithGoogle = async (data) => {
|
206
|
-
try {
|
207
|
-
const userData = FillCreateUserWithGoogleData(data);
|
208
|
-
const { data: tokenData } = await this.authService.generateLimitedToken();
|
209
|
-
const config = {
|
210
|
-
headers: { Authorization: `Bearer ${tokenData?.access_token}` },
|
211
|
-
};
|
212
|
-
const response = await this.userService.createUser(userData, config);
|
213
|
-
return ResponseHelper.GetSuccessResponse(response, this.clientData.userInfo, "user", "CreateUserWithGoogle", "create");
|
214
|
-
}
|
215
|
-
catch (error) {
|
216
|
-
return ResponseHelper.GetErrorResponse(error);
|
217
|
-
}
|
218
|
-
};
|
219
|
-
this.CreatePhone = async (data) => {
|
220
|
-
try {
|
221
|
-
const userData = FillCreatePhoneData(data);
|
222
|
-
const response = await this.userService.createPhone(this.clientData.userId, userData);
|
223
|
-
return ResponseHelper.GetSuccessResponse(response, this.clientData.userInfo, "phone", "CreatePhone", "create");
|
224
|
-
}
|
225
|
-
catch (error) {
|
226
|
-
return ResponseHelper.GetErrorResponse(error);
|
227
|
-
}
|
228
|
-
};
|
229
|
-
this.CreateIdentification = async (data) => {
|
230
|
-
try {
|
231
|
-
const userData = FillCreateIdentificationData(data);
|
232
|
-
const response = await this.userService.createIdentification(this.clientData.userId, userData);
|
233
|
-
return ResponseHelper.GetSuccessResponse(response, this.clientData.userInfo, "identification", "CreateIdentification", "create");
|
234
|
-
}
|
235
|
-
catch (error) {
|
236
|
-
return ResponseHelper.GetErrorResponse(error);
|
237
|
-
}
|
238
|
-
};
|
239
|
-
this.CreateExternalAuth = async (data) => {
|
240
|
-
try {
|
241
|
-
const response = await this.userService.createExternalAuth(this.clientData.userId, data);
|
242
|
-
return ResponseHelper.GetSuccessResponse(response, this.clientData.userInfo, "external_auth", "CreateExternalAuth", "create");
|
243
|
-
}
|
244
|
-
catch (error) {
|
245
|
-
return ResponseHelper.GetErrorResponse(error);
|
246
|
-
}
|
247
|
-
};
|
248
|
-
this.CreateEmail = async (data) => {
|
249
|
-
try {
|
250
|
-
const userData = FillCreateEmailData(data);
|
251
|
-
const response = await this.userService.createEmail(this.clientData.userId, userData);
|
252
|
-
return ResponseHelper.GetSuccessResponse(response, this.clientData.userInfo, "email", "CreateEmail", "create");
|
253
|
-
}
|
254
|
-
catch (error) {
|
255
|
-
return ResponseHelper.GetErrorResponse(error);
|
256
|
-
}
|
257
|
-
};
|
258
|
-
this.CreateCurrency = async (data) => {
|
259
|
-
try {
|
260
|
-
const response = await this.userService.createCurrency(this.clientData.userId, data);
|
261
|
-
return ResponseHelper.GetSuccessResponse(response, this.clientData.userInfo, "currency", "CreateCurrency", "create");
|
262
|
-
}
|
263
|
-
catch (error) {
|
264
|
-
return ResponseHelper.GetErrorResponse(error);
|
265
|
-
}
|
266
|
-
};
|
267
|
-
this.CreateCreditCard = async (data) => {
|
268
|
-
try {
|
269
|
-
const response = await this.userService.createCreditCard(this.clientData.userId, data);
|
270
|
-
return ResponseHelper.GetSuccessResponse(response, this.clientData.userInfo, "credit_card", "CreateCreditCard", "create");
|
271
|
-
}
|
272
|
-
catch (error) {
|
273
|
-
return ResponseHelper.GetErrorResponse(error);
|
274
|
-
}
|
275
|
-
};
|
276
|
-
this.CreateTicket = async (data) => {
|
277
|
-
try {
|
278
|
-
const userData = FillCreateTicketData(data);
|
279
|
-
const response = await this.userService.createTicket(this.clientData.userId, userData);
|
280
|
-
return ResponseHelper.GetSuccessResponse(response, this.clientData.userInfo, "ticket", "CreateTicket", "create");
|
281
|
-
}
|
282
|
-
catch (error) {
|
283
|
-
return ResponseHelper.GetErrorResponse(error);
|
284
|
-
}
|
285
|
-
};
|
286
|
-
this.CreateBankAccount = async (data) => {
|
287
|
-
try {
|
288
|
-
const userData = FillCreateBankAccountData(data);
|
289
|
-
const response = await this.userService.createBankAccount(this.clientData.userId, userData);
|
290
|
-
return ResponseHelper.GetSuccessResponse(response, this.clientData.userInfo, "bank_account", "CreateBankAccount", "create");
|
291
|
-
}
|
292
|
-
catch (error) {
|
293
|
-
return ResponseHelper.GetErrorResponse(error);
|
294
|
-
}
|
295
|
-
};
|
296
|
-
this.CreateAddress = async (data) => {
|
297
|
-
try {
|
298
|
-
const userData = FillCreateAddressData(data);
|
299
|
-
const response = await this.userService.createAddress(this.clientData.userId, userData);
|
300
|
-
return ResponseHelper.GetSuccessResponse(response, this.clientData.userInfo, "addresses", "CreateAddress", "create");
|
301
|
-
}
|
302
|
-
catch (error) {
|
303
|
-
return ResponseHelper.GetErrorResponse(error);
|
304
|
-
}
|
305
|
-
};
|
306
|
-
this.CreateDevice = async (data) => {
|
307
|
-
try {
|
308
|
-
const userData = FillCreateDeviceData(data);
|
309
|
-
const response = await this.userService.createDevice(this.clientData.userId, userData);
|
310
|
-
return ResponseHelper.GetSuccessResponse(response, this.clientData.userInfo, "device", "CreateDevice", "create");
|
311
|
-
}
|
312
|
-
catch (error) {
|
313
|
-
return ResponseHelper.GetErrorResponse(error);
|
314
|
-
}
|
315
|
-
};
|
316
|
-
this.SecurityAccess = async (data) => {
|
317
|
-
try {
|
318
|
-
const response = await this.userService.securityAccess(this.clientData.userId, data);
|
319
|
-
return ResponseHelper.GetSuccessResponse(response, this.clientData.userInfo, "security", "SecurityAccess", "create");
|
320
|
-
}
|
321
|
-
catch (error) {
|
322
|
-
return ResponseHelper.GetErrorResponse(error);
|
323
|
-
}
|
324
|
-
};
|
325
|
-
this.UploadDocument = async (data) => {
|
326
|
-
try {
|
327
|
-
const documentData = FillUploadDocumentData(data);
|
328
|
-
const response = await this.userService.uploadDocument(this.clientData.userId, documentData);
|
329
|
-
return ResponseHelper.GetSuccessResponse(response, this.clientData.userInfo, "document", "UploadDocument", "create");
|
330
|
-
}
|
331
|
-
catch (error) {
|
332
|
-
return ResponseHelper.GetErrorResponse(error);
|
333
|
-
}
|
334
|
-
};
|
335
|
-
this.UpdateProfilePicture = async (data) => {
|
336
|
-
try {
|
337
|
-
const documentData = FillUploadProfilePictureData(data);
|
338
|
-
const response = await this.userService.uploadDocument(this.clientData.userId, documentData);
|
339
|
-
return ResponseHelper.GetSuccessResponse(response, this.clientData.userInfo, "personal_info", "UpdateProfilePicture", "updateProfilePicture");
|
340
|
-
}
|
341
|
-
catch (error) {
|
342
|
-
return ResponseHelper.GetErrorResponse(error);
|
343
|
-
}
|
344
|
-
};
|
345
|
-
this.VerifySecurityData = async (data) => {
|
346
|
-
try {
|
347
|
-
const response = await this.userService.verifySecurityData(this.clientData.userId, data);
|
348
|
-
return ResponseHelper.GetSuccessResponse(response, this.clientData.userInfo, "security", "VerifySecurityData", "verify");
|
349
|
-
}
|
350
|
-
catch (error) {
|
351
|
-
return ResponseHelper.GetErrorResponse(error);
|
352
|
-
}
|
353
|
-
};
|
354
|
-
this.VerifyEmail = async (data) => {
|
355
|
-
try {
|
356
|
-
const verifyUserSecurity = FillVerifyEmailData(data);
|
357
|
-
const response = await this.userService.verifySecurityData(this.clientData.userId, verifyUserSecurity);
|
358
|
-
return ResponseHelper.GetSuccessResponse(response, this.clientData.userInfo, "email", "VerifyEmail", "verify");
|
359
|
-
}
|
360
|
-
catch (error) {
|
361
|
-
return ResponseHelper.GetErrorResponse(error);
|
362
|
-
}
|
363
|
-
};
|
364
|
-
this.SendEmailOTP = async (data) => {
|
365
|
-
try {
|
366
|
-
const verifyUserSecurity = FillSendEmailOTPData(data);
|
367
|
-
const response = await this.userService.verifySecurityData(this.clientData.userId, verifyUserSecurity);
|
368
|
-
return ResponseHelper.GetSuccessResponse(response, this.clientData.userInfo, "email", "SendEmailOTP", "verify");
|
369
|
-
}
|
370
|
-
catch (error) {
|
371
|
-
return ResponseHelper.GetErrorResponse(error);
|
372
|
-
}
|
373
|
-
};
|
374
|
-
this.VerifyPhone = async (data) => {
|
375
|
-
try {
|
376
|
-
const verifyUserSecurity = FillVerifyPhoneData(data);
|
377
|
-
const response = await this.userService.verifySecurityData(this.clientData.userId, verifyUserSecurity);
|
378
|
-
return ResponseHelper.GetSuccessResponse(response, this.clientData.userInfo, "phone", "VerifyPhone", "verify");
|
379
|
-
}
|
380
|
-
catch (error) {
|
381
|
-
return ResponseHelper.GetErrorResponse(error);
|
382
|
-
}
|
383
|
-
};
|
384
|
-
this.SendPhoneOTP = async (data) => {
|
385
|
-
try {
|
386
|
-
const verifyUserSecurity = FillSendPhoneOTPData(data);
|
387
|
-
const response = await this.userService.verifySecurityData(this.clientData.userId, verifyUserSecurity);
|
388
|
-
return ResponseHelper.GetSuccessResponse(response, this.clientData.userInfo, "phone", "SendPhoneOTP", "verify");
|
389
|
-
}
|
390
|
-
catch (error) {
|
391
|
-
return ResponseHelper.GetErrorResponse(error);
|
392
|
-
}
|
393
|
-
};
|
394
|
-
this.VerifyDevice = async (data) => {
|
395
|
-
try {
|
396
|
-
const verifyUserSecurity = FillVerifyDeviceData(data);
|
397
|
-
const response = await this.userService.verifySecurityData(this.clientData.userId, verifyUserSecurity);
|
398
|
-
return ResponseHelper.GetSuccessResponse(response, this.clientData.userInfo, "device", "VerifyDevice", "verify");
|
399
|
-
}
|
400
|
-
catch (error) {
|
401
|
-
return ResponseHelper.GetErrorResponse(error);
|
402
|
-
}
|
403
|
-
};
|
404
|
-
this.ConfirmSecurityData = async (data) => {
|
405
|
-
try {
|
406
|
-
const response = await this.userService.confirmSecurityData(this.clientData.userId, data);
|
407
|
-
return ResponseHelper.GetSuccessResponse(response, this.clientData.userInfo, "security", "ConfirmSecurityData", "confirm");
|
408
|
-
}
|
409
|
-
catch (error) {
|
410
|
-
return ResponseHelper.GetErrorResponse(error);
|
411
|
-
}
|
412
|
-
};
|
413
|
-
this.ConfirmEmail = async (data) => {
|
414
|
-
try {
|
415
|
-
const confirmUserSecurity = FillConfirmEmailData(data);
|
416
|
-
const response = await this.userService.confirmSecurityData(this.clientData.userId, confirmUserSecurity);
|
417
|
-
return ResponseHelper.GetSuccessResponse(response, this.clientData.userInfo, "email", "ConfirmEmail", "confirm");
|
418
|
-
}
|
419
|
-
catch (error) {
|
420
|
-
return ResponseHelper.GetErrorResponse(error);
|
421
|
-
}
|
422
|
-
};
|
423
|
-
this.ConfirmPhone = async (data) => {
|
424
|
-
try {
|
425
|
-
const confirmUserSecurity = FillConfirmPhoneData(data);
|
426
|
-
const response = await this.userService.confirmSecurityData(this.clientData.userId, confirmUserSecurity);
|
427
|
-
return ResponseHelper.GetSuccessResponse(response, this.clientData.userInfo, "phone", "ConfirmPhone", "confirm");
|
428
|
-
}
|
429
|
-
catch (error) {
|
430
|
-
return ResponseHelper.GetErrorResponse(error);
|
431
|
-
}
|
432
|
-
};
|
433
|
-
this.ConfirmDevice = async (data) => {
|
434
|
-
try {
|
435
|
-
const confirmUserSecurity = FillConfirmDeviceData(data);
|
436
|
-
const response = await this.userService.confirmSecurityData(this.clientData.userId, confirmUserSecurity);
|
437
|
-
return ResponseHelper.GetSuccessResponse(response, this.clientData.userInfo, "device", "ConfirmDevice", "confirm");
|
438
|
-
}
|
439
|
-
catch (error) {
|
440
|
-
return ResponseHelper.GetErrorResponse(error);
|
441
|
-
}
|
442
|
-
};
|
443
|
-
this.ResetSecurityData = async (data) => {
|
444
|
-
try {
|
445
|
-
const response = await this.userService.resetSecurityData(this.clientData.userId, data);
|
446
|
-
return ResponseHelper.GetSuccessResponse(response, this.clientData.userInfo, "security", "ResetSecurityData", "create");
|
447
|
-
}
|
448
|
-
catch (error) {
|
449
|
-
return ResponseHelper.GetErrorResponse(error);
|
450
|
-
}
|
451
|
-
};
|
452
|
-
this.EnrollGoogleAuth = async () => {
|
453
|
-
try {
|
454
|
-
const userData = FillEnrollGoogleAuthData();
|
455
|
-
const response = await this.userService.enrollGoogleAuth(this.clientData.userId, userData);
|
456
|
-
return ResponseHelper.GetSuccessResponse(response, this.clientData.userInfo, "authentication_data", "EnrollGoogleAuth", "create");
|
457
|
-
}
|
458
|
-
catch (error) {
|
459
|
-
return ResponseHelper.GetErrorResponse(error);
|
460
|
-
}
|
461
|
-
};
|
462
|
-
this.ActivateGoogleAuth = async (data) => {
|
463
|
-
try {
|
464
|
-
const userData = FillActivateGoogleAuthData(data);
|
465
|
-
const response = await this.userService.activateGoogleAuth(this.clientData.userId, userData);
|
466
|
-
return ResponseHelper.GetSuccessResponse(response, this.clientData.userInfo, "authentication_data", "ActivateGoogleAuth", "create");
|
467
|
-
}
|
468
|
-
catch (error) {
|
469
|
-
return ResponseHelper.GetErrorResponse(error);
|
470
|
-
}
|
471
|
-
};
|
472
|
-
this.DeactivateGoogleAuth = async (data) => {
|
473
|
-
try {
|
474
|
-
const userData = FillDeactivateGoogleAuthData(data);
|
475
|
-
const response = await this.userService.deactivateGoogleAuth(this.clientData.userId, userData);
|
476
|
-
return ResponseHelper.GetSuccessResponse(response, this.clientData.userInfo, "authentication_data", "DeactivateGoogleAuth", "create");
|
477
|
-
}
|
478
|
-
catch (error) {
|
479
|
-
return ResponseHelper.GetErrorResponse(error);
|
480
|
-
}
|
481
|
-
};
|
482
|
-
// #endregion
|
483
|
-
// #region "PUT"
|
484
|
-
this.UpdateUser = async (data) => {
|
485
|
-
try {
|
486
|
-
const response = await this.userService.updateUser(this.clientData.userId, data);
|
487
|
-
return ResponseHelper.GetSuccessResponse(response, this.clientData.userInfo, "user", "UpdateUser", "update");
|
488
|
-
}
|
489
|
-
catch (error) {
|
490
|
-
return ResponseHelper.GetErrorResponse(error);
|
491
|
-
}
|
492
|
-
};
|
493
|
-
this.ResetPassword = async (data) => {
|
494
|
-
try {
|
495
|
-
const resetSecurityData = FillResetPasswordData(data);
|
496
|
-
const response = await this.userService.resetSecurityData(this.clientData.userId, resetSecurityData);
|
497
|
-
return ResponseHelper.GetSuccessResponse(response, this.clientData.userInfo, "security", "ResetPassword", "reset");
|
498
|
-
}
|
499
|
-
catch (error) {
|
500
|
-
return ResponseHelper.GetErrorResponse(error);
|
501
|
-
}
|
502
|
-
};
|
503
|
-
this.ResetSecurityCode = async (data) => {
|
504
|
-
try {
|
505
|
-
const resetSecurityData = FillResetSecurityCodeData(data);
|
506
|
-
const response = await this.userService.resetSecurityData(this.clientData.userId, resetSecurityData);
|
507
|
-
return ResponseHelper.GetSuccessResponse(response, this.clientData.userInfo, "security", "ResetSecurityCode", "resetSecurityCode");
|
508
|
-
}
|
509
|
-
catch (error) {
|
510
|
-
return ResponseHelper.GetErrorResponse(error);
|
511
|
-
}
|
512
|
-
};
|
513
|
-
this.ResetSecurityQuestions = async (data) => {
|
514
|
-
try {
|
515
|
-
const resetSecurityData = FillResetSecurityQuestionsData(data);
|
516
|
-
const response = await this.userService.resetSecurityData(this.clientData.userId, resetSecurityData);
|
517
|
-
return ResponseHelper.GetSuccessResponse(response, this.clientData.userInfo, "security", "ResetSecurityQuestions", "resetQuestions");
|
518
|
-
}
|
519
|
-
catch (error) {
|
520
|
-
return ResponseHelper.GetErrorResponse(error);
|
521
|
-
}
|
522
|
-
};
|
523
|
-
this.ValidateSecurityCode = async (data) => {
|
524
|
-
try {
|
525
|
-
const validateUserSecurityData = FillValidateSecurityCodeData(data);
|
526
|
-
const response = await this.userService.validateSecurityData(this.clientData.userId, validateUserSecurityData);
|
527
|
-
return ResponseHelper.GetSuccessResponse(response, this.clientData.userInfo, "security", "ValidateSecurityCode");
|
528
|
-
}
|
529
|
-
catch (error) {
|
530
|
-
return ResponseHelper.GetErrorResponse(error);
|
531
|
-
}
|
532
|
-
};
|
533
|
-
this.UpdatePreferences = async (data) => {
|
534
|
-
try {
|
535
|
-
const userData = FillUpdatePreferencesData(data);
|
536
|
-
const response = await this.userService.updatePreferences(this.clientData.userId, userData);
|
537
|
-
return ResponseHelper.GetSuccessResponse(response, this.clientData.userInfo, "preferences", "UpdatePreferences", "updateObjectInfo");
|
538
|
-
}
|
539
|
-
catch (error) {
|
540
|
-
return ResponseHelper.GetErrorResponse(error);
|
541
|
-
}
|
542
|
-
};
|
543
|
-
this.UpdatePhone = async (data) => {
|
544
|
-
try {
|
545
|
-
const userData = FillUpdatePhoneData(data);
|
546
|
-
const response = await this.userService.updatePhone(this.clientData.userId, userData);
|
547
|
-
return ResponseHelper.GetSuccessResponse(response, this.clientData.userInfo, "phone", "UpdatePhone", "update");
|
548
|
-
}
|
549
|
-
catch (error) {
|
550
|
-
return ResponseHelper.GetErrorResponse(error);
|
551
|
-
}
|
552
|
-
};
|
553
|
-
this.MakePhonePrimary = async (data) => {
|
554
|
-
try {
|
555
|
-
const userData = FillMakePhonePrimaryData(data);
|
556
|
-
const response = await this.userService.updatePhone(this.clientData.userId, userData);
|
557
|
-
return ResponseHelper.GetSuccessResponse(response, this.clientData.userInfo, "phone", "MakePhonePrimary", "updatePrimary");
|
558
|
-
}
|
559
|
-
catch (error) {
|
560
|
-
return ResponseHelper.GetErrorResponse(error);
|
561
|
-
}
|
562
|
-
};
|
563
|
-
this.UpdatePersonalInfo = async (data) => {
|
564
|
-
try {
|
565
|
-
const userData = FillUpdatePersonalInfoData(data);
|
566
|
-
const response = await this.userService.updatePersonalInfo(this.clientData.userId, userData);
|
567
|
-
return ResponseHelper.GetSuccessResponse(response, this.clientData.userInfo, "personal_info", "UpdatePersonalInfo", "update");
|
568
|
-
}
|
569
|
-
catch (error) {
|
570
|
-
return ResponseHelper.GetErrorResponse(error);
|
571
|
-
}
|
572
|
-
};
|
573
|
-
this.UpdateIdentification = async (data) => {
|
574
|
-
try {
|
575
|
-
const userData = FillUpdateIdentificationData(data);
|
576
|
-
const response = await this.userService.updateIdentification(this.clientData.userId, userData);
|
577
|
-
return ResponseHelper.GetSuccessResponse(response, this.clientData.userInfo, "identification", "UpdateIdentification", "update");
|
578
|
-
}
|
579
|
-
catch (error) {
|
580
|
-
return ResponseHelper.GetErrorResponse(error);
|
581
|
-
}
|
582
|
-
};
|
583
|
-
this.UpdateExternalAuth = async (data) => {
|
584
|
-
try {
|
585
|
-
const response = await this.userService.updateExternalAuth(this.clientData.userId, data);
|
586
|
-
return ResponseHelper.GetSuccessResponse(response, this.clientData.userInfo, "external_auth", "UpdateExternalAuth", "update");
|
587
|
-
}
|
588
|
-
catch (error) {
|
589
|
-
return ResponseHelper.GetErrorResponse(error);
|
590
|
-
}
|
591
|
-
};
|
592
|
-
this.UpdateEmail = async (data) => {
|
593
|
-
try {
|
594
|
-
const userData = FillUpdateEmailData(data);
|
595
|
-
const response = await this.userService.updateEmail(this.clientData.userId, userData);
|
596
|
-
return ResponseHelper.GetSuccessResponse(response, this.clientData.userInfo, "email", "UpdateEmail", "update");
|
597
|
-
}
|
598
|
-
catch (error) {
|
599
|
-
return ResponseHelper.GetErrorResponse(error);
|
600
|
-
}
|
601
|
-
};
|
602
|
-
this.MakeEmailPrimary = async (data) => {
|
603
|
-
try {
|
604
|
-
const userData = FillMakeEmailPrimaryData(data);
|
605
|
-
const response = await this.userService.updateEmail(this.clientData.userId, userData);
|
606
|
-
return ResponseHelper.GetSuccessResponse(response, this.clientData.userInfo, "email", "MakeEmailPrimary", "updatePrimary");
|
607
|
-
}
|
608
|
-
catch (error) {
|
609
|
-
return ResponseHelper.GetErrorResponse(error);
|
610
|
-
}
|
611
|
-
};
|
612
|
-
this.UpdateBankAccount = async (data) => {
|
613
|
-
try {
|
614
|
-
const userData = FillUpdateBankAccountData(data);
|
615
|
-
const response = await this.userService.updateBankAccount(this.clientData.userId, userData);
|
616
|
-
return ResponseHelper.GetSuccessResponse(response, this.clientData.userInfo, "bank_account", "UpdateBankAccount", "update");
|
617
|
-
}
|
618
|
-
catch (error) {
|
619
|
-
return ResponseHelper.GetErrorResponse(error);
|
620
|
-
}
|
621
|
-
};
|
622
|
-
this.MakeBankAccountPrimary = async (data) => {
|
623
|
-
try {
|
624
|
-
const userData = FillMakeBankAccountPrimaryData(data);
|
625
|
-
const response = await this.userService.updateBankAccount(this.clientData.userId, userData);
|
626
|
-
return ResponseHelper.GetSuccessResponse(response, this.clientData.userInfo, "bank_account", "MakeBankAccountPrimary", "updatePrimary");
|
627
|
-
}
|
628
|
-
catch (error) {
|
629
|
-
return ResponseHelper.GetErrorResponse(error);
|
630
|
-
}
|
631
|
-
};
|
632
|
-
this.UpdateAddress = async (data) => {
|
633
|
-
try {
|
634
|
-
const userData = FillUpdateAddressData(data);
|
635
|
-
const response = await this.userService.updateAddress(this.clientData.userId, userData);
|
636
|
-
return ResponseHelper.GetSuccessResponse(response, this.clientData.userInfo, "addresses", "UpdateAddress", "update");
|
637
|
-
}
|
638
|
-
catch (error) {
|
639
|
-
return ResponseHelper.GetErrorResponse(error);
|
640
|
-
}
|
641
|
-
};
|
642
|
-
this.MakeAddressPrimary = async (data) => {
|
643
|
-
try {
|
644
|
-
const userData = FillMakeAddressPrimaryData(data);
|
645
|
-
const response = await this.userService.updateAddress(this.clientData.userId, userData);
|
646
|
-
return ResponseHelper.GetSuccessResponse(response, this.clientData.userInfo, "addresses", "MakeAddressPrimary", "updatePrimary");
|
647
|
-
}
|
648
|
-
catch (error) {
|
649
|
-
return ResponseHelper.GetErrorResponse(error);
|
650
|
-
}
|
651
|
-
};
|
652
|
-
this.UpdateDevice = async (data) => {
|
653
|
-
try {
|
654
|
-
const userData = FillUpdateDeviceData(data);
|
655
|
-
let response;
|
656
|
-
if (data.token && data.userId) {
|
657
|
-
const config = AxiosHelper.GetAxiosConfig(data.token, this.clientData.baseUrl, this.clientData.lang);
|
658
|
-
const userService = new UserService(config);
|
659
|
-
response = await userService.updateDevice(data.userId, userData);
|
660
|
-
}
|
661
|
-
else {
|
662
|
-
response = await this.userService.updateDevice(this.clientData.userId, userData);
|
663
|
-
}
|
664
|
-
return ResponseHelper.GetSuccessResponse(response, this.clientData.userInfo, "device", "UpdateDevice", "update");
|
665
|
-
}
|
666
|
-
catch (error) {
|
667
|
-
return ResponseHelper.GetErrorResponse(error);
|
668
|
-
}
|
669
|
-
};
|
670
|
-
this.LogoutDevice = async (data) => {
|
671
|
-
try {
|
672
|
-
const userData = FillLogoutDeviceData(data);
|
673
|
-
const response = await this.userService.logoutDevice(this.clientData.userId, userData);
|
674
|
-
return ResponseHelper.GetSuccessResponse(response, this.clientData.userInfo, "device", "LogoutDevice", "delete");
|
675
|
-
}
|
676
|
-
catch (error) {
|
677
|
-
return ResponseHelper.GetErrorResponse(error);
|
678
|
-
}
|
679
|
-
};
|
680
|
-
// #endregion
|
681
|
-
// #region "DELETE"
|
682
|
-
this.DeleteBankAccount = async (data) => {
|
683
|
-
try {
|
684
|
-
const userData = FillDeleteBankAccountData(data);
|
685
|
-
const response = await this.userService.deleteBankAccount(this.clientData.userId, userData);
|
686
|
-
return ResponseHelper.GetSuccessResponse(response, this.clientData.userInfo, "bank_account", "DeleteBankAccount", "delete");
|
687
|
-
}
|
688
|
-
catch (error) {
|
689
|
-
return ResponseHelper.GetErrorResponse(error);
|
690
|
-
}
|
691
|
-
};
|
692
|
-
this.DeleteIdentification = async (data) => {
|
693
|
-
try {
|
694
|
-
const userData = FillDeleteIdentificationData(data);
|
695
|
-
const response = await this.userService.deleteIdentification(this.clientData.userId, userData);
|
696
|
-
return ResponseHelper.GetSuccessResponse(response, this.clientData.userInfo, "identification", "DeleteIdentification", "delete");
|
697
|
-
}
|
698
|
-
catch (error) {
|
699
|
-
return ResponseHelper.GetErrorResponse(error);
|
700
|
-
}
|
701
|
-
};
|
702
|
-
this.DeleteEmail = async (data) => {
|
703
|
-
try {
|
704
|
-
const userData = FillDeleteEmailData(data);
|
705
|
-
const response = await this.userService.deleteEmail(this.clientData.userId, userData);
|
706
|
-
return ResponseHelper.GetSuccessResponse(response, this.clientData.userInfo, "email", "DeleteEmail", "delete");
|
707
|
-
}
|
708
|
-
catch (error) {
|
709
|
-
return ResponseHelper.GetErrorResponse(error);
|
710
|
-
}
|
711
|
-
};
|
712
|
-
this.DeletePhone = async (data) => {
|
713
|
-
try {
|
714
|
-
const userData = FillDeletePhoneData(data);
|
715
|
-
const response = await this.userService.deletePhone(this.clientData.userId, userData);
|
716
|
-
return ResponseHelper.GetSuccessResponse(response, this.clientData.userInfo, "phone", "DeletePhone", "delete");
|
717
|
-
}
|
718
|
-
catch (error) {
|
719
|
-
return ResponseHelper.GetErrorResponse(error);
|
720
|
-
}
|
721
|
-
};
|
722
|
-
this.DeleteAddress = async (data) => {
|
723
|
-
try {
|
724
|
-
const userData = FillDeleteAddressData(data);
|
725
|
-
const response = await this.userService.deleteAddress(this.clientData.userId, userData);
|
726
|
-
return ResponseHelper.GetSuccessResponse(response, this.clientData.userInfo, "addresses", "DeleteAddress", "delete");
|
727
|
-
}
|
728
|
-
catch (error) {
|
729
|
-
return ResponseHelper.GetErrorResponse(error);
|
730
|
-
}
|
731
|
-
};
|
732
|
-
this.DeleteDevice = async (data) => {
|
733
|
-
try {
|
734
|
-
const userData = FillDeleteDeviceData(data);
|
735
|
-
const response = await this.userService.deleteDevice(this.clientData.userId, userData);
|
736
|
-
return ResponseHelper.GetSuccessResponse(response, this.clientData.userInfo, "device", "DeleteDevice", "delete");
|
737
|
-
}
|
738
|
-
catch (error) {
|
739
|
-
return ResponseHelper.GetErrorResponse(error);
|
740
|
-
}
|
741
|
-
};
|
742
11
|
const { token, baseUrl, nodeUrl, lang } = this.clientData;
|
743
12
|
const config = AxiosHelper.GetAxiosConfig(token, baseUrl, lang);
|
744
13
|
this.userService = new UserService(config);
|
745
14
|
this.authService = new AuthService(config, nodeUrl);
|
746
15
|
}
|
16
|
+
// #region "GET"
|
17
|
+
GetUser = async (userId, token) => {
|
18
|
+
try {
|
19
|
+
const response = await this.userService.getUser(userId || this.clientData.userId, token);
|
20
|
+
return ResponseHelper.GetResponse(response.data);
|
21
|
+
}
|
22
|
+
catch (error) {
|
23
|
+
const result = FillResultByError(error);
|
24
|
+
const userData = FillUserData("result", result);
|
25
|
+
return ResponseHelper.GetErrorResponse(userData, "GetUser");
|
26
|
+
}
|
27
|
+
};
|
28
|
+
GetTermsAndConditions = async () => {
|
29
|
+
try {
|
30
|
+
const response = await this.userService.getTermsAndConditions(this.clientData.userId);
|
31
|
+
return ResponseHelper.GetResponse(response.data);
|
32
|
+
}
|
33
|
+
catch (error) {
|
34
|
+
const result = FillResultByError(error);
|
35
|
+
const userData = FillUserData("result", result);
|
36
|
+
return ResponseHelper.GetErrorResponse(userData, "GetTermsAndConditions");
|
37
|
+
}
|
38
|
+
};
|
39
|
+
GetSecurity = async () => {
|
40
|
+
try {
|
41
|
+
const response = await this.userService.getSecurity(this.clientData.userId);
|
42
|
+
return ResponseHelper.GetResponse(response.data);
|
43
|
+
}
|
44
|
+
catch (error) {
|
45
|
+
const result = FillResultByError(error);
|
46
|
+
const userData = FillUserData("result", result);
|
47
|
+
return ResponseHelper.GetErrorResponse(userData, "GetSecurity");
|
48
|
+
}
|
49
|
+
};
|
50
|
+
GetPhone = async () => {
|
51
|
+
try {
|
52
|
+
const response = await this.userService.getPhone(this.clientData.userId);
|
53
|
+
return ResponseHelper.GetResponse(response.data);
|
54
|
+
}
|
55
|
+
catch (error) {
|
56
|
+
const result = FillResultByError(error);
|
57
|
+
const userData = FillUserData("result", result);
|
58
|
+
return ResponseHelper.GetErrorResponse(userData, "GetPhone");
|
59
|
+
}
|
60
|
+
};
|
61
|
+
GetPreferences = async () => {
|
62
|
+
try {
|
63
|
+
const response = await this.userService.getPreferences(this.clientData.userId);
|
64
|
+
return ResponseHelper.GetResponse(response.data);
|
65
|
+
}
|
66
|
+
catch (error) {
|
67
|
+
const result = FillResultByError(error);
|
68
|
+
const userData = FillUserData("result", result);
|
69
|
+
return ResponseHelper.GetErrorResponse(userData, "GetPreferences");
|
70
|
+
}
|
71
|
+
};
|
72
|
+
GetPersonalInfo = async () => {
|
73
|
+
try {
|
74
|
+
const response = await this.userService.getPersonalInfo(this.clientData.userId);
|
75
|
+
return ResponseHelper.GetResponse(response.data);
|
76
|
+
}
|
77
|
+
catch (error) {
|
78
|
+
const result = FillResultByError(error);
|
79
|
+
const userData = FillUserData("result", result);
|
80
|
+
return ResponseHelper.GetErrorResponse(userData, "GetPersonalInfo");
|
81
|
+
}
|
82
|
+
};
|
83
|
+
GetLatestHistory = async () => {
|
84
|
+
try {
|
85
|
+
const response = await this.userService.getLatestHistory(this.clientData.userId);
|
86
|
+
return ResponseHelper.GetResponse(response.data);
|
87
|
+
}
|
88
|
+
catch (error) {
|
89
|
+
const result = FillResultByError(error);
|
90
|
+
const userData = FillUserData("result", result);
|
91
|
+
return ResponseHelper.GetErrorResponse(userData, "GetLatestHistory");
|
92
|
+
}
|
93
|
+
};
|
94
|
+
GetIdentification = async () => {
|
95
|
+
try {
|
96
|
+
const response = await this.userService.getIdentification(this.clientData.userId);
|
97
|
+
return ResponseHelper.GetResponse(response.data);
|
98
|
+
}
|
99
|
+
catch (error) {
|
100
|
+
const result = FillResultByError(error);
|
101
|
+
const userData = FillUserData("result", result);
|
102
|
+
return ResponseHelper.GetErrorResponse(userData, "GetIdentification");
|
103
|
+
}
|
104
|
+
};
|
105
|
+
GetHistory = async () => {
|
106
|
+
try {
|
107
|
+
const response = await this.userService.getHistory(this.clientData.userId);
|
108
|
+
return ResponseHelper.GetResponse(response.data);
|
109
|
+
}
|
110
|
+
catch (error) {
|
111
|
+
const result = FillResultByError(error);
|
112
|
+
const userData = FillUserData("result", result);
|
113
|
+
return ResponseHelper.GetErrorResponse(userData, "GetHistory");
|
114
|
+
}
|
115
|
+
};
|
116
|
+
GetGroup = async () => {
|
117
|
+
try {
|
118
|
+
const response = await this.userService.getGroup(this.clientData.userId);
|
119
|
+
return ResponseHelper.GetResponse(response.data);
|
120
|
+
}
|
121
|
+
catch (error) {
|
122
|
+
const result = FillResultByError(error);
|
123
|
+
const userData = FillUserData("result", result);
|
124
|
+
return ResponseHelper.GetErrorResponse(userData, "GetGroup");
|
125
|
+
}
|
126
|
+
};
|
127
|
+
GetExternalAuth = async () => {
|
128
|
+
try {
|
129
|
+
const response = await this.userService.getExternalAuth(this.clientData.userId);
|
130
|
+
return ResponseHelper.GetResponse(response.data);
|
131
|
+
}
|
132
|
+
catch (error) {
|
133
|
+
const result = FillResultByError(error);
|
134
|
+
const userData = FillUserData("result", result);
|
135
|
+
return ResponseHelper.GetErrorResponse(userData, "GetExternalAuth");
|
136
|
+
}
|
137
|
+
};
|
138
|
+
GetEmail = async () => {
|
139
|
+
try {
|
140
|
+
const response = await this.userService.getEmail(this.clientData.userId);
|
141
|
+
return ResponseHelper.GetResponse(response.data);
|
142
|
+
}
|
143
|
+
catch (error) {
|
144
|
+
const result = FillResultByError(error);
|
145
|
+
const userData = FillUserData("result", result);
|
146
|
+
return ResponseHelper.GetErrorResponse(userData, "GetEmail");
|
147
|
+
}
|
148
|
+
};
|
149
|
+
GetDocuments = async () => {
|
150
|
+
try {
|
151
|
+
const response = await this.userService.getDocuments(this.clientData.userId);
|
152
|
+
return ResponseHelper.GetResponse(response.data);
|
153
|
+
}
|
154
|
+
catch (error) {
|
155
|
+
const result = FillResultByError(error);
|
156
|
+
const userData = FillUserData("result", result);
|
157
|
+
return ResponseHelper.GetErrorResponse(userData, "GetDocuments");
|
158
|
+
}
|
159
|
+
};
|
160
|
+
GetCurrency = async () => {
|
161
|
+
try {
|
162
|
+
const response = await this.userService.getCurrency(this.clientData.userId);
|
163
|
+
return ResponseHelper.GetResponse(response.data);
|
164
|
+
}
|
165
|
+
catch (error) {
|
166
|
+
const result = FillResultByError(error);
|
167
|
+
const userData = FillUserData("result", result);
|
168
|
+
return ResponseHelper.GetErrorResponse(userData, "GetCurrency");
|
169
|
+
}
|
170
|
+
};
|
171
|
+
GetCreditCard = async () => {
|
172
|
+
try {
|
173
|
+
const response = await this.userService.getCreditCard(this.clientData.userId);
|
174
|
+
return ResponseHelper.GetResponse(response.data);
|
175
|
+
}
|
176
|
+
catch (error) {
|
177
|
+
const result = FillResultByError(error);
|
178
|
+
const userData = FillUserData("result", result);
|
179
|
+
return ResponseHelper.GetErrorResponse(userData, "GetCreditCard");
|
180
|
+
}
|
181
|
+
};
|
182
|
+
GetBankAccount = async () => {
|
183
|
+
try {
|
184
|
+
const response = await this.userService.getBankAccount(this.clientData.userId);
|
185
|
+
return ResponseHelper.GetResponse(response.data);
|
186
|
+
}
|
187
|
+
catch (error) {
|
188
|
+
const result = FillResultByError(error);
|
189
|
+
const userData = FillUserData("result", result);
|
190
|
+
return ResponseHelper.GetErrorResponse(userData, "GetBankAccount");
|
191
|
+
}
|
192
|
+
};
|
193
|
+
GetAddress = async () => {
|
194
|
+
try {
|
195
|
+
const response = await this.userService.getAddress(this.clientData.userId);
|
196
|
+
return ResponseHelper.GetResponse(response.data);
|
197
|
+
}
|
198
|
+
catch (error) {
|
199
|
+
const result = FillResultByError(error);
|
200
|
+
const userData = FillUserData("result", result);
|
201
|
+
return ResponseHelper.GetErrorResponse(userData, "GetAddress");
|
202
|
+
}
|
203
|
+
};
|
204
|
+
GetAccount = async () => {
|
205
|
+
try {
|
206
|
+
const response = await this.userService.getAccount(this.clientData.userId);
|
207
|
+
return ResponseHelper.GetResponse(response.data);
|
208
|
+
}
|
209
|
+
catch (error) {
|
210
|
+
const result = FillResultByError(error);
|
211
|
+
const userData = FillUserData("result", result);
|
212
|
+
return ResponseHelper.GetErrorResponse(userData, "GetAccount");
|
213
|
+
}
|
214
|
+
};
|
215
|
+
GetSecurityOperations = async () => {
|
216
|
+
try {
|
217
|
+
const response = await this.userService.getActivity(this.clientData.userId);
|
218
|
+
return ResponseHelper.GetResponse(response.data);
|
219
|
+
}
|
220
|
+
catch (error) {
|
221
|
+
const result = FillResultByError(error);
|
222
|
+
const userData = FillUserData("result", result);
|
223
|
+
return ResponseHelper.GetErrorResponse(userData, "GetSecurityOperations");
|
224
|
+
}
|
225
|
+
};
|
226
|
+
GetDeviceHistory = async () => {
|
227
|
+
try {
|
228
|
+
const response = await this.userService.getDeviceHistory(this.clientData.userId);
|
229
|
+
return ResponseHelper.GetResponse(response.data);
|
230
|
+
}
|
231
|
+
catch (error) {
|
232
|
+
const result = FillResultByError(error);
|
233
|
+
const userData = FillUserData("result", result);
|
234
|
+
return ResponseHelper.GetErrorResponse(userData, "GetDeviceHistory");
|
235
|
+
}
|
236
|
+
};
|
237
|
+
// #endregion
|
238
|
+
// #region "POST"
|
239
|
+
CreateUser = async (data) => {
|
240
|
+
try {
|
241
|
+
const userData = FillCreateUserData(data);
|
242
|
+
const { data: tokenData } = await this.authService.generateLimitedToken();
|
243
|
+
const config = {
|
244
|
+
headers: { Authorization: `Bearer ${tokenData?.access_token}` },
|
245
|
+
};
|
246
|
+
const response = await this.userService.createUser(userData, config);
|
247
|
+
return ResponseHelper.GetResponse(response.data);
|
248
|
+
}
|
249
|
+
catch (error) {
|
250
|
+
const result = FillResultByError(error);
|
251
|
+
const userData = FillUserData("result", result);
|
252
|
+
return ResponseHelper.GetErrorResponse(userData, "CreateUser");
|
253
|
+
}
|
254
|
+
};
|
255
|
+
CreateUserWithGoogle = async (data) => {
|
256
|
+
try {
|
257
|
+
const userData = FillCreateUserWithGoogleData(data);
|
258
|
+
const { data: tokenData } = await this.authService.generateLimitedToken();
|
259
|
+
const config = {
|
260
|
+
headers: { Authorization: `Bearer ${tokenData?.access_token}` },
|
261
|
+
};
|
262
|
+
const response = await this.userService.createUser(userData, config);
|
263
|
+
return ResponseHelper.GetResponse(response.data);
|
264
|
+
}
|
265
|
+
catch (error) {
|
266
|
+
const result = FillResultByError(error);
|
267
|
+
const userData = FillUserData("result", result);
|
268
|
+
return ResponseHelper.GetErrorResponse(userData, "CreateUserWithGoogle");
|
269
|
+
}
|
270
|
+
};
|
271
|
+
CreatePhone = async (data) => {
|
272
|
+
try {
|
273
|
+
const userData = FillCreatePhoneData(data);
|
274
|
+
const response = await this.userService.createPhone(this.clientData.userId, userData);
|
275
|
+
return ResponseHelper.GetResponse(response.data);
|
276
|
+
}
|
277
|
+
catch (error) {
|
278
|
+
const result = FillResultByError(error);
|
279
|
+
const userData = FillUserData("result", result);
|
280
|
+
return ResponseHelper.GetErrorResponse(userData, "CreatePhone");
|
281
|
+
}
|
282
|
+
};
|
283
|
+
CreateIdentification = async (data) => {
|
284
|
+
try {
|
285
|
+
const userData = FillCreateIdentificationData(data);
|
286
|
+
const response = await this.userService.createIdentification(this.clientData.userId, userData);
|
287
|
+
return ResponseHelper.GetResponse(response.data);
|
288
|
+
}
|
289
|
+
catch (error) {
|
290
|
+
const result = FillResultByError(error);
|
291
|
+
const userData = FillUserData("result", result);
|
292
|
+
return ResponseHelper.GetErrorResponse(userData, "CreateIdentification");
|
293
|
+
}
|
294
|
+
};
|
295
|
+
CreateExternalAuth = async (data) => {
|
296
|
+
try {
|
297
|
+
const response = await this.userService.createExternalAuth(this.clientData.userId, data);
|
298
|
+
return ResponseHelper.GetResponse(response.data);
|
299
|
+
}
|
300
|
+
catch (error) {
|
301
|
+
const result = FillResultByError(error);
|
302
|
+
const userData = FillUserData("result", result);
|
303
|
+
return ResponseHelper.GetErrorResponse(userData, "CreateExternalAuth");
|
304
|
+
}
|
305
|
+
};
|
306
|
+
CreateEmail = async (data) => {
|
307
|
+
try {
|
308
|
+
const userData = FillCreateEmailData(data);
|
309
|
+
const response = await this.userService.createEmail(this.clientData.userId, userData);
|
310
|
+
return ResponseHelper.GetResponse(response.data);
|
311
|
+
}
|
312
|
+
catch (error) {
|
313
|
+
const result = FillResultByError(error);
|
314
|
+
const userData = FillUserData("result", result);
|
315
|
+
return ResponseHelper.GetErrorResponse(userData, "CreateEmail");
|
316
|
+
}
|
317
|
+
};
|
318
|
+
CreateCurrency = async (data) => {
|
319
|
+
try {
|
320
|
+
const response = await this.userService.createCurrency(this.clientData.userId, data);
|
321
|
+
return ResponseHelper.GetResponse(response.data);
|
322
|
+
}
|
323
|
+
catch (error) {
|
324
|
+
const result = FillResultByError(error);
|
325
|
+
const userData = FillUserData("result", result);
|
326
|
+
return ResponseHelper.GetErrorResponse(userData, "CreateCurrency");
|
327
|
+
}
|
328
|
+
};
|
329
|
+
CreateCreditCard = async (data) => {
|
330
|
+
try {
|
331
|
+
const response = await this.userService.createCreditCard(this.clientData.userId, data);
|
332
|
+
return ResponseHelper.GetResponse(response.data);
|
333
|
+
}
|
334
|
+
catch (error) {
|
335
|
+
const result = FillResultByError(error);
|
336
|
+
const userData = FillUserData("result", result);
|
337
|
+
return ResponseHelper.GetErrorResponse(userData, "CreateCreditCard");
|
338
|
+
}
|
339
|
+
};
|
340
|
+
CreateTicket = async (data) => {
|
341
|
+
try {
|
342
|
+
const userData = FillCreateTicketData(data);
|
343
|
+
const response = await this.userService.createTicket(this.clientData.userId, userData);
|
344
|
+
return ResponseHelper.GetResponse(response.data);
|
345
|
+
}
|
346
|
+
catch (error) {
|
347
|
+
const result = FillResultByError(error);
|
348
|
+
const userData = FillUserData("result", result);
|
349
|
+
return ResponseHelper.GetErrorResponse(userData, "CreateTicket");
|
350
|
+
}
|
351
|
+
};
|
352
|
+
CreateBankAccount = async (data) => {
|
353
|
+
try {
|
354
|
+
const userData = FillCreateBankAccountData(data);
|
355
|
+
const response = await this.userService.createBankAccount(this.clientData.userId, userData);
|
356
|
+
return ResponseHelper.GetResponse(response.data);
|
357
|
+
}
|
358
|
+
catch (error) {
|
359
|
+
const result = FillResultByError(error);
|
360
|
+
const userData = FillUserData("result", result);
|
361
|
+
return ResponseHelper.GetErrorResponse(userData, "CreateBankAccount");
|
362
|
+
}
|
363
|
+
};
|
364
|
+
CreateAddress = async (data) => {
|
365
|
+
try {
|
366
|
+
const userData = FillCreateAddressData(data);
|
367
|
+
const response = await this.userService.createAddress(this.clientData.userId, userData);
|
368
|
+
return ResponseHelper.GetResponse(response.data);
|
369
|
+
}
|
370
|
+
catch (error) {
|
371
|
+
const result = FillResultByError(error);
|
372
|
+
const userData = FillUserData("result", result);
|
373
|
+
return ResponseHelper.GetErrorResponse(userData, "CreateAddress");
|
374
|
+
}
|
375
|
+
};
|
376
|
+
CreateDevice = async (data) => {
|
377
|
+
try {
|
378
|
+
const userData = FillCreateDeviceData(data);
|
379
|
+
const response = await this.userService.createDevice(this.clientData.userId, userData);
|
380
|
+
return ResponseHelper.GetResponse(response.data);
|
381
|
+
}
|
382
|
+
catch (error) {
|
383
|
+
const result = FillResultByError(error);
|
384
|
+
const userData = FillUserData("result", result);
|
385
|
+
return ResponseHelper.GetErrorResponse(userData, "CreateDevice");
|
386
|
+
}
|
387
|
+
};
|
388
|
+
SecurityAccess = async (data) => {
|
389
|
+
try {
|
390
|
+
const response = await this.userService.securityAccess(this.clientData.userId, data);
|
391
|
+
return ResponseHelper.GetResponse(response.data);
|
392
|
+
}
|
393
|
+
catch (error) {
|
394
|
+
const result = FillResultByError(error);
|
395
|
+
const userData = FillUserData("result", result);
|
396
|
+
return ResponseHelper.GetErrorResponse(userData, "SecurityAccess");
|
397
|
+
}
|
398
|
+
};
|
399
|
+
UploadDocument = async (data) => {
|
400
|
+
try {
|
401
|
+
const documentData = FillUploadDocumentData(data);
|
402
|
+
const response = await this.userService.uploadDocument(this.clientData.userId, documentData);
|
403
|
+
return ResponseHelper.GetResponse(response.data);
|
404
|
+
}
|
405
|
+
catch (error) {
|
406
|
+
const result = FillResultByError(error);
|
407
|
+
const userData = FillUserData("result", result);
|
408
|
+
return ResponseHelper.GetErrorResponse(userData, "UploadDocument");
|
409
|
+
}
|
410
|
+
};
|
411
|
+
UpdateProfilePicture = async (data) => {
|
412
|
+
try {
|
413
|
+
const documentData = FillUploadProfilePictureData(data);
|
414
|
+
const response = await this.userService.uploadDocument(this.clientData.userId, documentData);
|
415
|
+
return ResponseHelper.GetResponse(response.data);
|
416
|
+
}
|
417
|
+
catch (error) {
|
418
|
+
const result = FillResultByError(error);
|
419
|
+
const userData = FillUserData("result", result);
|
420
|
+
return ResponseHelper.GetErrorResponse(userData, "UpdateProfilePicture");
|
421
|
+
}
|
422
|
+
};
|
423
|
+
VerifySecurityData = async (data) => {
|
424
|
+
try {
|
425
|
+
const response = await this.userService.verifySecurityData(this.clientData.userId, data);
|
426
|
+
return ResponseHelper.GetResponse(response.data);
|
427
|
+
}
|
428
|
+
catch (error) {
|
429
|
+
const result = FillResultByError(error);
|
430
|
+
const userData = FillUserData("result", result);
|
431
|
+
return ResponseHelper.GetErrorResponse(userData, "VerifySecurityData");
|
432
|
+
}
|
433
|
+
};
|
434
|
+
VerifyEmail = async (data) => {
|
435
|
+
try {
|
436
|
+
const verifyUserSecurity = FillVerifyEmailData(data);
|
437
|
+
const response = await this.userService.verifySecurityData(this.clientData.userId, verifyUserSecurity);
|
438
|
+
return ResponseHelper.GetResponse(response.data);
|
439
|
+
}
|
440
|
+
catch (error) {
|
441
|
+
const result = FillResultByError(error);
|
442
|
+
const userData = FillUserData("result", result);
|
443
|
+
return ResponseHelper.GetErrorResponse(userData, "VerifyEmail");
|
444
|
+
}
|
445
|
+
};
|
446
|
+
SendEmailOTP = async (data) => {
|
447
|
+
try {
|
448
|
+
const verifyUserSecurity = FillSendEmailOTPData(data);
|
449
|
+
const response = await this.userService.verifySecurityData(this.clientData.userId, verifyUserSecurity);
|
450
|
+
return ResponseHelper.GetResponse(response.data);
|
451
|
+
}
|
452
|
+
catch (error) {
|
453
|
+
const result = FillResultByError(error);
|
454
|
+
const userData = FillUserData("result", result);
|
455
|
+
return ResponseHelper.GetErrorResponse(userData, "SendEmailOTP");
|
456
|
+
}
|
457
|
+
};
|
458
|
+
VerifyPhone = async (data) => {
|
459
|
+
try {
|
460
|
+
const verifyUserSecurity = FillVerifyPhoneData(data);
|
461
|
+
const response = await this.userService.verifySecurityData(this.clientData.userId, verifyUserSecurity);
|
462
|
+
return ResponseHelper.GetResponse(response.data);
|
463
|
+
}
|
464
|
+
catch (error) {
|
465
|
+
const result = FillResultByError(error);
|
466
|
+
const userData = FillUserData("result", result);
|
467
|
+
return ResponseHelper.GetErrorResponse(userData, "VerifyPhone");
|
468
|
+
}
|
469
|
+
};
|
470
|
+
SendPhoneOTP = async (data) => {
|
471
|
+
try {
|
472
|
+
const verifyUserSecurity = FillSendPhoneOTPData(data);
|
473
|
+
const response = await this.userService.verifySecurityData(this.clientData.userId, verifyUserSecurity);
|
474
|
+
return ResponseHelper.GetResponse(response.data);
|
475
|
+
}
|
476
|
+
catch (error) {
|
477
|
+
const result = FillResultByError(error);
|
478
|
+
const userData = FillUserData("result", result);
|
479
|
+
return ResponseHelper.GetErrorResponse(userData, "SendPhoneOTP");
|
480
|
+
}
|
481
|
+
};
|
482
|
+
VerifyDevice = async (data) => {
|
483
|
+
try {
|
484
|
+
const verifyUserSecurity = FillVerifyDeviceData(data);
|
485
|
+
const response = await this.userService.verifySecurityData(this.clientData.userId, verifyUserSecurity);
|
486
|
+
return ResponseHelper.GetResponse(response.data);
|
487
|
+
}
|
488
|
+
catch (error) {
|
489
|
+
const result = FillResultByError(error);
|
490
|
+
const userData = FillUserData("result", result);
|
491
|
+
return ResponseHelper.GetErrorResponse(userData, "VerifyDevice");
|
492
|
+
}
|
493
|
+
};
|
494
|
+
ConfirmSecurityData = async (data) => {
|
495
|
+
try {
|
496
|
+
const response = await this.userService.confirmSecurityData(this.clientData.userId, data);
|
497
|
+
return ResponseHelper.GetResponse(response.data);
|
498
|
+
}
|
499
|
+
catch (error) {
|
500
|
+
const result = FillResultByError(error);
|
501
|
+
const userData = FillUserData("result", result);
|
502
|
+
return ResponseHelper.GetErrorResponse(userData, "ConfirmSecurityData");
|
503
|
+
}
|
504
|
+
};
|
505
|
+
ConfirmEmail = async (data) => {
|
506
|
+
try {
|
507
|
+
const confirmUserSecurity = FillConfirmEmailData(data);
|
508
|
+
const response = await this.userService.confirmSecurityData(this.clientData.userId, confirmUserSecurity);
|
509
|
+
return ResponseHelper.GetResponse(response.data);
|
510
|
+
}
|
511
|
+
catch (error) {
|
512
|
+
const result = FillResultByError(error);
|
513
|
+
const userData = FillUserData("result", result);
|
514
|
+
return ResponseHelper.GetErrorResponse(userData, "ConfirmEmail");
|
515
|
+
}
|
516
|
+
};
|
517
|
+
ConfirmPhone = async (data) => {
|
518
|
+
try {
|
519
|
+
const confirmUserSecurity = FillConfirmPhoneData(data);
|
520
|
+
const response = await this.userService.confirmSecurityData(this.clientData.userId, confirmUserSecurity);
|
521
|
+
return ResponseHelper.GetResponse(response.data);
|
522
|
+
}
|
523
|
+
catch (error) {
|
524
|
+
const result = FillResultByError(error);
|
525
|
+
const userData = FillUserData("result", result);
|
526
|
+
return ResponseHelper.GetErrorResponse(userData, "ConfirmPhone");
|
527
|
+
}
|
528
|
+
};
|
529
|
+
ConfirmDevice = async (data) => {
|
530
|
+
try {
|
531
|
+
const confirmUserSecurity = FillConfirmDeviceData(data);
|
532
|
+
const response = await this.userService.confirmSecurityData(this.clientData.userId, confirmUserSecurity);
|
533
|
+
return ResponseHelper.GetResponse(response.data);
|
534
|
+
}
|
535
|
+
catch (error) {
|
536
|
+
const result = FillResultByError(error);
|
537
|
+
const userData = FillUserData("result", result);
|
538
|
+
return ResponseHelper.GetErrorResponse(userData, "ConfirmDevice");
|
539
|
+
}
|
540
|
+
};
|
541
|
+
ResetSecurityData = async (data) => {
|
542
|
+
try {
|
543
|
+
const response = await this.userService.resetSecurityData(this.clientData.userId, data);
|
544
|
+
return ResponseHelper.GetResponse(response.data);
|
545
|
+
}
|
546
|
+
catch (error) {
|
547
|
+
const result = FillResultByError(error);
|
548
|
+
const userData = FillUserData("result", result);
|
549
|
+
return ResponseHelper.GetErrorResponse(userData, "ResetSecurityData");
|
550
|
+
}
|
551
|
+
};
|
552
|
+
EnrollGoogleAuth = async () => {
|
553
|
+
try {
|
554
|
+
const userData = FillEnrollGoogleAuthData();
|
555
|
+
const response = await this.userService.enrollGoogleAuth(this.clientData.userId, userData);
|
556
|
+
return ResponseHelper.GetResponse(response.data);
|
557
|
+
}
|
558
|
+
catch (error) {
|
559
|
+
const result = FillResultByError(error);
|
560
|
+
const userData = FillUserData("result", result);
|
561
|
+
return ResponseHelper.GetErrorResponse(userData, "EnrollGoogleAuth");
|
562
|
+
}
|
563
|
+
};
|
564
|
+
ActivateGoogleAuth = async (data) => {
|
565
|
+
try {
|
566
|
+
const userData = FillActivateGoogleAuthData(data);
|
567
|
+
const response = await this.userService.activateGoogleAuth(this.clientData.userId, userData);
|
568
|
+
return ResponseHelper.GetResponse(response.data);
|
569
|
+
}
|
570
|
+
catch (error) {
|
571
|
+
const result = FillResultByError(error);
|
572
|
+
const userData = FillUserData("result", result);
|
573
|
+
return ResponseHelper.GetErrorResponse(userData, "ActivateGoogleAuth");
|
574
|
+
}
|
575
|
+
};
|
576
|
+
DeactivateGoogleAuth = async (data) => {
|
577
|
+
try {
|
578
|
+
const userData = FillDeactivateGoogleAuthData(data);
|
579
|
+
const response = await this.userService.deactivateGoogleAuth(this.clientData.userId, userData);
|
580
|
+
return ResponseHelper.GetResponse(response.data);
|
581
|
+
}
|
582
|
+
catch (error) {
|
583
|
+
const result = FillResultByError(error);
|
584
|
+
const userData = FillUserData("result", result);
|
585
|
+
return ResponseHelper.GetErrorResponse(userData, "DeactivateGoogleAuth");
|
586
|
+
}
|
587
|
+
};
|
588
|
+
// #endregion
|
589
|
+
// #region "PUT"
|
590
|
+
UpdateUser = async (data) => {
|
591
|
+
try {
|
592
|
+
const response = await this.userService.updateUser(this.clientData.userId, data);
|
593
|
+
return ResponseHelper.GetResponse(response.data);
|
594
|
+
}
|
595
|
+
catch (error) {
|
596
|
+
const result = FillResultByError(error);
|
597
|
+
const userData = FillUserData("result", result);
|
598
|
+
return ResponseHelper.GetErrorResponse(userData, "UpdateUser");
|
599
|
+
}
|
600
|
+
};
|
601
|
+
ResetPassword = async (data) => {
|
602
|
+
try {
|
603
|
+
const resetSecurityData = FillResetPasswordData(data);
|
604
|
+
const response = await this.userService.resetSecurityData(this.clientData.userId, resetSecurityData);
|
605
|
+
return ResponseHelper.GetResponse(response.data);
|
606
|
+
}
|
607
|
+
catch (error) {
|
608
|
+
const result = FillResultByError(error);
|
609
|
+
const userData = FillUserData("result", result);
|
610
|
+
return ResponseHelper.GetErrorResponse(userData, "ResetPassword");
|
611
|
+
}
|
612
|
+
};
|
613
|
+
ResetSecurityCode = async (data) => {
|
614
|
+
try {
|
615
|
+
const resetSecurityData = FillResetSecurityCodeData(data);
|
616
|
+
const response = await this.userService.resetSecurityData(this.clientData.userId, resetSecurityData);
|
617
|
+
return ResponseHelper.GetResponse(response.data);
|
618
|
+
}
|
619
|
+
catch (error) {
|
620
|
+
const result = FillResultByError(error);
|
621
|
+
const userData = FillUserData("result", result);
|
622
|
+
return ResponseHelper.GetErrorResponse(userData, "ResetSecurityCode");
|
623
|
+
}
|
624
|
+
};
|
625
|
+
ResetSecurityQuestions = async (data) => {
|
626
|
+
try {
|
627
|
+
const resetSecurityData = FillResetSecurityQuestionsData(data);
|
628
|
+
const response = await this.userService.resetSecurityData(this.clientData.userId, resetSecurityData);
|
629
|
+
return ResponseHelper.GetResponse(response.data);
|
630
|
+
}
|
631
|
+
catch (error) {
|
632
|
+
const result = FillResultByError(error);
|
633
|
+
const userData = FillUserData("result", result);
|
634
|
+
return ResponseHelper.GetErrorResponse(userData, "ResetSecurityQuestions");
|
635
|
+
}
|
636
|
+
};
|
637
|
+
ValidateSecurityCode = async (data) => {
|
638
|
+
try {
|
639
|
+
const validateUserSecurityData = FillValidateSecurityCodeData(data);
|
640
|
+
const response = await this.userService.validateSecurityData(this.clientData.userId, validateUserSecurityData);
|
641
|
+
return ResponseHelper.GetResponse(response.data);
|
642
|
+
}
|
643
|
+
catch (error) {
|
644
|
+
const result = FillResultByError(error);
|
645
|
+
const userData = FillUserData("result", result);
|
646
|
+
return ResponseHelper.GetErrorResponse(userData, "ValidateSecurityCode");
|
647
|
+
}
|
648
|
+
};
|
649
|
+
UpdatePreferences = async (data) => {
|
650
|
+
try {
|
651
|
+
const userData = FillUpdatePreferencesData(data);
|
652
|
+
const response = await this.userService.updatePreferences(this.clientData.userId, userData);
|
653
|
+
return ResponseHelper.GetResponse(response.data);
|
654
|
+
}
|
655
|
+
catch (error) {
|
656
|
+
const result = FillResultByError(error);
|
657
|
+
const userData = FillUserData("result", result);
|
658
|
+
return ResponseHelper.GetErrorResponse(userData, "UpdatePreferences");
|
659
|
+
}
|
660
|
+
};
|
661
|
+
UpdatePhone = async (data) => {
|
662
|
+
try {
|
663
|
+
const userData = FillUpdatePhoneData(data);
|
664
|
+
const response = await this.userService.updatePhone(this.clientData.userId, userData);
|
665
|
+
return ResponseHelper.GetResponse(response.data);
|
666
|
+
}
|
667
|
+
catch (error) {
|
668
|
+
const result = FillResultByError(error);
|
669
|
+
const userData = FillUserData("result", result);
|
670
|
+
return ResponseHelper.GetErrorResponse(userData, "UpdatePhone");
|
671
|
+
}
|
672
|
+
};
|
673
|
+
MakePhonePrimary = async (data) => {
|
674
|
+
try {
|
675
|
+
const userData = FillMakePhonePrimaryData(data);
|
676
|
+
const response = await this.userService.updatePhone(this.clientData.userId, userData);
|
677
|
+
return ResponseHelper.GetResponse(response.data);
|
678
|
+
}
|
679
|
+
catch (error) {
|
680
|
+
const result = FillResultByError(error);
|
681
|
+
const userData = FillUserData("result", result);
|
682
|
+
return ResponseHelper.GetErrorResponse(userData, "MakePhonePrimary");
|
683
|
+
}
|
684
|
+
};
|
685
|
+
UpdatePersonalInfo = async (data) => {
|
686
|
+
try {
|
687
|
+
const userData = FillUpdatePersonalInfoData(data);
|
688
|
+
const response = await this.userService.updatePersonalInfo(this.clientData.userId, userData);
|
689
|
+
return ResponseHelper.GetResponse(response.data);
|
690
|
+
}
|
691
|
+
catch (error) {
|
692
|
+
const result = FillResultByError(error);
|
693
|
+
const userData = FillUserData("result", result);
|
694
|
+
return ResponseHelper.GetErrorResponse(userData, "UpdatePersonalInfo");
|
695
|
+
}
|
696
|
+
};
|
697
|
+
UpdateIdentification = async (data) => {
|
698
|
+
try {
|
699
|
+
const userData = FillUpdateIdentificationData(data);
|
700
|
+
const response = await this.userService.updateIdentification(this.clientData.userId, userData);
|
701
|
+
return ResponseHelper.GetResponse(response.data);
|
702
|
+
}
|
703
|
+
catch (error) {
|
704
|
+
const result = FillResultByError(error);
|
705
|
+
const userData = FillUserData("result", result);
|
706
|
+
return ResponseHelper.GetErrorResponse(userData, "UpdateIdentification");
|
707
|
+
}
|
708
|
+
};
|
709
|
+
UpdateExternalAuth = async (data) => {
|
710
|
+
try {
|
711
|
+
const response = await this.userService.updateExternalAuth(this.clientData.userId, data);
|
712
|
+
return ResponseHelper.GetResponse(response.data);
|
713
|
+
}
|
714
|
+
catch (error) {
|
715
|
+
const result = FillResultByError(error);
|
716
|
+
const userData = FillUserData("result", result);
|
717
|
+
return ResponseHelper.GetErrorResponse(userData, "UpdateExternalAuth");
|
718
|
+
}
|
719
|
+
};
|
720
|
+
UpdateEmail = async (data) => {
|
721
|
+
try {
|
722
|
+
const userData = FillUpdateEmailData(data);
|
723
|
+
const response = await this.userService.updateEmail(this.clientData.userId, userData);
|
724
|
+
return ResponseHelper.GetResponse(response.data);
|
725
|
+
}
|
726
|
+
catch (error) {
|
727
|
+
const result = FillResultByError(error);
|
728
|
+
const userData = FillUserData("result", result);
|
729
|
+
return ResponseHelper.GetErrorResponse(userData, "UpdateEmail");
|
730
|
+
}
|
731
|
+
};
|
732
|
+
MakeEmailPrimary = async (data) => {
|
733
|
+
try {
|
734
|
+
const userData = FillMakeEmailPrimaryData(data);
|
735
|
+
const response = await this.userService.updateEmail(this.clientData.userId, userData);
|
736
|
+
return ResponseHelper.GetResponse(response.data);
|
737
|
+
}
|
738
|
+
catch (error) {
|
739
|
+
const result = FillResultByError(error);
|
740
|
+
const userData = FillUserData("result", result);
|
741
|
+
return ResponseHelper.GetErrorResponse(userData, "MakeEmailPrimary");
|
742
|
+
}
|
743
|
+
};
|
744
|
+
UpdateBankAccount = async (data) => {
|
745
|
+
try {
|
746
|
+
const userData = FillUpdateBankAccountData(data);
|
747
|
+
const response = await this.userService.updateBankAccount(this.clientData.userId, userData);
|
748
|
+
return ResponseHelper.GetResponse(response.data);
|
749
|
+
}
|
750
|
+
catch (error) {
|
751
|
+
const result = FillResultByError(error);
|
752
|
+
const userData = FillUserData("result", result);
|
753
|
+
return ResponseHelper.GetErrorResponse(userData, "UpdateBankAccount");
|
754
|
+
}
|
755
|
+
};
|
756
|
+
MakeBankAccountPrimary = async (data) => {
|
757
|
+
try {
|
758
|
+
const userData = FillMakeBankAccountPrimaryData(data);
|
759
|
+
const response = await this.userService.updateBankAccount(this.clientData.userId, userData);
|
760
|
+
return ResponseHelper.GetResponse(response.data);
|
761
|
+
}
|
762
|
+
catch (error) {
|
763
|
+
const result = FillResultByError(error);
|
764
|
+
const userData = FillUserData("result", result);
|
765
|
+
return ResponseHelper.GetErrorResponse(userData, "MakeBankAccountPrimary");
|
766
|
+
}
|
767
|
+
};
|
768
|
+
UpdateAddress = async (data) => {
|
769
|
+
try {
|
770
|
+
const userData = FillUpdateAddressData(data);
|
771
|
+
const response = await this.userService.updateAddress(this.clientData.userId, userData);
|
772
|
+
return ResponseHelper.GetResponse(response.data);
|
773
|
+
}
|
774
|
+
catch (error) {
|
775
|
+
const result = FillResultByError(error);
|
776
|
+
const userData = FillUserData("result", result);
|
777
|
+
return ResponseHelper.GetErrorResponse(userData, "UpdateAddress");
|
778
|
+
}
|
779
|
+
};
|
780
|
+
MakeAddressPrimary = async (data) => {
|
781
|
+
try {
|
782
|
+
const userData = FillMakeAddressPrimaryData(data);
|
783
|
+
const response = await this.userService.updateAddress(this.clientData.userId, userData);
|
784
|
+
return ResponseHelper.GetResponse(response.data);
|
785
|
+
}
|
786
|
+
catch (error) {
|
787
|
+
const result = FillResultByError(error);
|
788
|
+
const userData = FillUserData("result", result);
|
789
|
+
return ResponseHelper.GetErrorResponse(userData, "MakeAddressPrimary");
|
790
|
+
}
|
791
|
+
};
|
792
|
+
UpdateDevice = async (data) => {
|
793
|
+
try {
|
794
|
+
const userData = FillUpdateDeviceData(data);
|
795
|
+
let response;
|
796
|
+
if (data.token && data.userId) {
|
797
|
+
const config = AxiosHelper.GetAxiosConfig(data.token, this.clientData.baseUrl, this.clientData.lang);
|
798
|
+
const userService = new UserService(config);
|
799
|
+
response = await userService.updateDevice(data.userId, userData);
|
800
|
+
}
|
801
|
+
else {
|
802
|
+
response = await this.userService.updateDevice(this.clientData.userId, userData);
|
803
|
+
}
|
804
|
+
return ResponseHelper.GetResponse(response.data);
|
805
|
+
}
|
806
|
+
catch (error) {
|
807
|
+
const result = FillResultByError(error);
|
808
|
+
const userData = FillUserData("result", result);
|
809
|
+
return ResponseHelper.GetErrorResponse(userData, "UpdateDevice");
|
810
|
+
}
|
811
|
+
};
|
812
|
+
LogoutDevice = async (data) => {
|
813
|
+
try {
|
814
|
+
const userData = FillLogoutDeviceData(data);
|
815
|
+
const response = await this.userService.logoutDevice(this.clientData.userId, userData);
|
816
|
+
return ResponseHelper.GetResponse(response.data);
|
817
|
+
}
|
818
|
+
catch (error) {
|
819
|
+
const result = FillResultByError(error);
|
820
|
+
const userData = FillUserData("result", result);
|
821
|
+
return ResponseHelper.GetErrorResponse(userData, "LogoutDevice");
|
822
|
+
}
|
823
|
+
};
|
824
|
+
// #endregion
|
825
|
+
// #region "DELETE"
|
826
|
+
DeleteAddress = async (data) => {
|
827
|
+
try {
|
828
|
+
const userData = FillDeleteAddressData(data);
|
829
|
+
const response = await this.userService.deleteAddress(this.clientData.userId, userData);
|
830
|
+
return ResponseHelper.GetResponse(response.data);
|
831
|
+
}
|
832
|
+
catch (error) {
|
833
|
+
const result = FillResultByError(error);
|
834
|
+
const userData = FillUserData("result", result);
|
835
|
+
return ResponseHelper.GetErrorResponse(userData, "DeleteAddress");
|
836
|
+
}
|
837
|
+
};
|
838
|
+
DeleteBankAccount = async (data) => {
|
839
|
+
try {
|
840
|
+
const userData = FillDeleteBankAccountData(data);
|
841
|
+
const response = await this.userService.deleteBankAccount(this.clientData.userId, userData);
|
842
|
+
return ResponseHelper.GetResponse(response.data);
|
843
|
+
}
|
844
|
+
catch (error) {
|
845
|
+
const result = FillResultByError(error);
|
846
|
+
const userData = FillUserData("result", result);
|
847
|
+
return ResponseHelper.GetErrorResponse(userData, "DeleteBankAccount");
|
848
|
+
}
|
849
|
+
};
|
850
|
+
DeleteDevice = async (data) => {
|
851
|
+
try {
|
852
|
+
const userData = FillDeleteDeviceData(data);
|
853
|
+
const response = await this.userService.deleteDevice(this.clientData.userId, userData);
|
854
|
+
return ResponseHelper.GetResponse(response.data);
|
855
|
+
}
|
856
|
+
catch (error) {
|
857
|
+
const result = FillResultByError(error);
|
858
|
+
const userData = FillUserData("result", result);
|
859
|
+
return ResponseHelper.GetErrorResponse(userData, "DeleteDevice");
|
860
|
+
}
|
861
|
+
};
|
862
|
+
DeleteEmail = async (data) => {
|
863
|
+
try {
|
864
|
+
const userData = FillDeleteEmailData(data);
|
865
|
+
const response = await this.userService.deleteEmail(this.clientData.userId, userData);
|
866
|
+
return ResponseHelper.GetResponse(response.data);
|
867
|
+
}
|
868
|
+
catch (error) {
|
869
|
+
const result = FillResultByError(error);
|
870
|
+
const userData = FillUserData("result", result);
|
871
|
+
return ResponseHelper.GetErrorResponse(userData, "DeleteEmail");
|
872
|
+
}
|
873
|
+
};
|
874
|
+
DeleteIdentification = async (data) => {
|
875
|
+
try {
|
876
|
+
const userData = FillDeleteIdentificationData(data);
|
877
|
+
const response = await this.userService.deleteIdentification(this.clientData.userId, userData);
|
878
|
+
return ResponseHelper.GetResponse(response.data);
|
879
|
+
}
|
880
|
+
catch (error) {
|
881
|
+
const result = FillResultByError(error);
|
882
|
+
const userData = FillUserData("result", result);
|
883
|
+
return ResponseHelper.GetErrorResponse(userData, "DeleteIdentification");
|
884
|
+
}
|
885
|
+
};
|
886
|
+
DeletePhone = async (data) => {
|
887
|
+
try {
|
888
|
+
const userData = FillDeletePhoneData(data);
|
889
|
+
const response = await this.userService.deletePhone(this.clientData.userId, userData);
|
890
|
+
return ResponseHelper.GetResponse(response.data);
|
891
|
+
}
|
892
|
+
catch (error) {
|
893
|
+
const result = FillResultByError(error);
|
894
|
+
const userData = FillUserData("result", result);
|
895
|
+
return ResponseHelper.GetErrorResponse(userData, "DeletePhone");
|
896
|
+
}
|
897
|
+
};
|
747
898
|
}
|
748
899
|
export { UserClient };
|