ggez-banking-sdk 0.0.1 → 0.0.3

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (115) hide show
  1. package/dist/bank-system/constants/enum.d.ts +1057 -0
  2. package/dist/bank-system/constants/enum.js +1110 -0
  3. package/dist/bank-system/constants/index.d.ts +1 -0
  4. package/dist/bank-system/constants/index.js +17 -0
  5. package/dist/bank-system/content/accountCurrencies.d.ts +12 -0
  6. package/dist/bank-system/content/accountCurrencies.js +37 -0
  7. package/dist/bank-system/content/countries.d.ts +24 -0
  8. package/dist/bank-system/content/countries.js +6472 -0
  9. package/dist/bank-system/content/currencies.d.ts +32 -0
  10. package/dist/bank-system/content/currencies.js +5836 -0
  11. package/dist/bank-system/content/index.d.ts +4 -0
  12. package/dist/bank-system/content/index.js +12 -0
  13. package/dist/bank-system/content/state.d.ts +6 -0
  14. package/dist/bank-system/content/state.js +350 -0
  15. package/dist/bank-system/helper/data.d.ts +46 -0
  16. package/dist/bank-system/helper/data.js +57 -0
  17. package/dist/bank-system/helper/dataStructure.d.ts +3220 -0
  18. package/dist/bank-system/helper/dataStructure.js +1051 -0
  19. package/dist/bank-system/helper/index.d.ts +28 -0
  20. package/dist/bank-system/helper/index.js +394 -0
  21. package/dist/bank-system/interfaces/accountInterface.d.ts +26 -0
  22. package/dist/bank-system/interfaces/accountInterface.js +2 -0
  23. package/dist/bank-system/interfaces/bankingSystemInterface.d.ts +306 -0
  24. package/dist/bank-system/interfaces/bankingSystemInterface.js +2 -0
  25. package/dist/bank-system/interfaces/deviceInterface.d.ts +34 -0
  26. package/dist/bank-system/interfaces/deviceInterface.js +2 -0
  27. package/dist/bank-system/interfaces/index.d.ts +4 -0
  28. package/dist/bank-system/interfaces/index.js +20 -0
  29. package/dist/bank-system/interfaces/interface.d.ts +460 -0
  30. package/dist/bank-system/interfaces/interface.js +2 -0
  31. package/dist/bank-system/interfaces/organizationInterface.d.ts +118 -0
  32. package/dist/bank-system/interfaces/organizationInterface.js +2 -0
  33. package/dist/bank-system/interfaces/signInterface.d.ts +89 -0
  34. package/dist/bank-system/interfaces/signInterface.js +2 -0
  35. package/dist/bank-system/interfaces/transactionInterface.d.ts +17 -0
  36. package/dist/bank-system/interfaces/transactionInterface.js +2 -0
  37. package/dist/bank-system/restApi/index.d.ts +8 -0
  38. package/dist/bank-system/restApi/index.js +41 -0
  39. package/dist/bank-system/services/account.d.ts +33 -0
  40. package/dist/bank-system/services/account.js +129 -0
  41. package/dist/bank-system/services/addresses.d.ts +48 -0
  42. package/dist/bank-system/services/addresses.js +130 -0
  43. package/dist/bank-system/services/auth.d.ts +71 -0
  44. package/dist/bank-system/services/auth.js +250 -0
  45. package/dist/bank-system/services/bankAccount.d.ts +48 -0
  46. package/dist/bank-system/services/bankAccount.js +131 -0
  47. package/dist/bank-system/services/device.d.ts +46 -0
  48. package/dist/bank-system/services/device.js +212 -0
  49. package/dist/bank-system/services/document.d.ts +15 -0
  50. package/dist/bank-system/services/document.js +58 -0
  51. package/dist/bank-system/services/email.d.ts +70 -0
  52. package/dist/bank-system/services/email.js +175 -0
  53. package/dist/bank-system/services/history.d.ts +14 -0
  54. package/dist/bank-system/services/history.js +55 -0
  55. package/dist/bank-system/services/identification.d.ts +37 -0
  56. package/dist/bank-system/services/identification.js +107 -0
  57. package/dist/bank-system/services/index.d.ts +17 -0
  58. package/dist/bank-system/services/index.js +35 -0
  59. package/dist/bank-system/services/organization.d.ts +28 -0
  60. package/dist/bank-system/services/organization.js +129 -0
  61. package/dist/bank-system/services/personalInfo.d.ts +26 -0
  62. package/dist/bank-system/services/personalInfo.js +91 -0
  63. package/dist/bank-system/services/phone.d.ts +70 -0
  64. package/dist/bank-system/services/phone.js +175 -0
  65. package/dist/bank-system/services/security.d.ts +114 -0
  66. package/dist/bank-system/services/security.js +267 -0
  67. package/dist/bank-system/services/token.d.ts +11 -0
  68. package/dist/bank-system/services/token.js +83 -0
  69. package/dist/bank-system/services/transaction.d.ts +9 -0
  70. package/dist/bank-system/services/transaction.js +62 -0
  71. package/dist/bank-system/services/verifyAndConfirm.d.ts +116 -0
  72. package/dist/bank-system/services/verifyAndConfirm.js +308 -0
  73. package/dist/bank-system/utils/chainAddressMasking.d.ts +2 -0
  74. package/dist/bank-system/utils/chainAddressMasking.js +12 -0
  75. package/dist/bank-system/utils/copyText.d.ts +5 -0
  76. package/dist/bank-system/utils/copyText.js +22 -0
  77. package/dist/bank-system/utils/countryAndCurrencyData.d.ts +11 -0
  78. package/dist/bank-system/utils/countryAndCurrencyData.js +22 -0
  79. package/dist/bank-system/utils/enumToOption.d.ts +4 -0
  80. package/dist/bank-system/utils/enumToOption.js +18 -0
  81. package/dist/bank-system/utils/fillDeviceDetails.d.ts +23 -0
  82. package/dist/bank-system/utils/fillDeviceDetails.js +44 -0
  83. package/dist/bank-system/utils/generateOneLiner.d.ts +1 -0
  84. package/dist/bank-system/utils/generateOneLiner.js +17 -0
  85. package/dist/bank-system/utils/generateSourceId.d.ts +1 -0
  86. package/dist/bank-system/utils/generateSourceId.js +13 -0
  87. package/dist/bank-system/utils/getCountryName.d.ts +1 -0
  88. package/dist/bank-system/utils/getCountryName.js +16 -0
  89. package/dist/bank-system/utils/getEnumName.d.ts +1 -0
  90. package/dist/bank-system/utils/getEnumName.js +10 -0
  91. package/dist/bank-system/utils/getStateByCountryCode.d.ts +1 -0
  92. package/dist/bank-system/utils/getStateByCountryCode.js +15 -0
  93. package/dist/bank-system/utils/handleEncryption/decryptData.d.ts +15 -0
  94. package/dist/bank-system/utils/handleEncryption/decryptData.js +78 -0
  95. package/dist/bank-system/utils/handleEncryption/encryptData.d.ts +2 -0
  96. package/dist/bank-system/utils/handleEncryption/encryptData.js +37 -0
  97. package/dist/bank-system/utils/handleEncryption/index.d.ts +4 -0
  98. package/dist/bank-system/utils/handleEncryption/index.js +12 -0
  99. package/dist/bank-system/utils/handleEncryption/key.d.ts +13 -0
  100. package/dist/bank-system/utils/handleEncryption/key.js +40 -0
  101. package/dist/bank-system/utils/index.d.ts +15 -0
  102. package/dist/bank-system/utils/index.js +42 -0
  103. package/dist/bank-system/utils/info.d.ts +8 -0
  104. package/dist/bank-system/utils/info.js +79 -0
  105. package/dist/bank-system/utils/maskingFunction.d.ts +1 -0
  106. package/dist/bank-system/utils/maskingFunction.js +28 -0
  107. package/dist/bank-system/utils/regex.d.ts +106 -0
  108. package/dist/bank-system/utils/regex.js +110 -0
  109. package/dist/bank-system/utils/sortUserInfo.d.ts +1 -0
  110. package/dist/bank-system/utils/sortUserInfo.js +43 -0
  111. package/dist/index.d.ts +8 -0
  112. package/dist/index.js +54 -0
  113. package/dist/keplr-config/chainInfo.d.ts +8 -0
  114. package/dist/keplr-config/chainInfo.js +111 -0
  115. package/package.json +2 -2
@@ -0,0 +1,28 @@
1
+ import { AxiosResponse } from "axios";
2
+ import { LimitedTokenInterface, LoginRequestInterface, LoginDeviceCredentialInterface, LoginWithGoogleInterface } from "../interfaces/signInterface";
3
+ export type HeadersData = {
4
+ header: boolean;
5
+ isUrlEncoded: boolean;
6
+ token: string | null | AxiosResponse<any, any>;
7
+ lang?: string;
8
+ installationId?: string;
9
+ };
10
+ declare const Helper: (userInfo: any) => {
11
+ checkResponse: () => {
12
+ checkUserResponseAuth: (response: any, showMessageSuccess: boolean, funcName: string) => any;
13
+ checkGlobalResponse: (key: string, response: any, funcName: string, keyAction?: string) => {
14
+ newUserInfo: any;
15
+ };
16
+ errorHandler: (error: any, funcName: string, response?: string) => never;
17
+ };
18
+ headerConfig: (headersData: HeadersData) => any;
19
+ convertDataToUrlEncoded: () => {
20
+ dataSignInUrlEncoded: (values: LoginRequestInterface, programId: string) => string;
21
+ dataSignInDeviceEncoded: (values: LoginDeviceCredentialInterface, programId: string) => string;
22
+ dataSignInUrlEncodedWithGoogle: (values: LoginWithGoogleInterface, programId: string) => string;
23
+ dataTokenUrlEncoded: (values: LimitedTokenInterface) => {
24
+ installation_id: string;
25
+ };
26
+ };
27
+ };
28
+ export default Helper;
@@ -0,0 +1,394 @@
1
+ "use strict";
2
+ var __importDefault = (this && this.__importDefault) || function (mod) {
3
+ return (mod && mod.__esModule) ? mod : { "default": mod };
4
+ };
5
+ Object.defineProperty(exports, "__esModule", { value: true });
6
+ const sortUserInfo_1 = require("../utils/sortUserInfo");
7
+ const generateSourceId_1 = require("../utils/generateSourceId");
8
+ const restApi_1 = __importDefault(require("../restApi"));
9
+ //import { fingerPrintHandler } from "../utils/info";
10
+ const qs_1 = __importDefault(require("qs"));
11
+ const enum_1 = require("../constants/enum");
12
+ const fillDeviceDetails_1 = require("../utils/fillDeviceDetails");
13
+ const info_1 = require("../utils/info");
14
+ const Helper = (userInfo) => {
15
+ // error Handler
16
+ const errorHandler = (error, funcName, response) => {
17
+ return {
18
+ response: null,
19
+ newUser: null,
20
+ message: error.message,
21
+ status: "failed",
22
+ };
23
+ };
24
+ // action type
25
+ const newUserInfo = () => {
26
+ let error = null;
27
+ const addInfo = (key, data) => {
28
+ if (Array.isArray(userInfo[`${key}`])) {
29
+ let newData = [...userInfo[`${key}`], data[0]];
30
+ let newUserInfo = Object.assign(Object.assign({}, userInfo), { [key]: (0, sortUserInfo_1.sortUserInfo)(newData) });
31
+ return { newUserInfo: newUserInfo };
32
+ }
33
+ else {
34
+ const newUserInfo = Object.assign(Object.assign({}, userInfo), { [key]: data });
35
+ return { newUserInfo: newUserInfo };
36
+ }
37
+ };
38
+ const updateInfo = (key, data) => {
39
+ let updatedData = Array.isArray(userInfo[`${key}`]) &&
40
+ userInfo[`${key}`].map((el, i) => {
41
+ if (el.id == data[0].id) {
42
+ return data[0];
43
+ }
44
+ else {
45
+ return el;
46
+ }
47
+ });
48
+ let newUserInfo = Object.assign(Object.assign({}, userInfo), { [key]: (0, sortUserInfo_1.sortUserInfo)(updatedData) });
49
+ return { newUserInfo: newUserInfo };
50
+ };
51
+ const removeInfo = (key, data) => {
52
+ let newUserInfo;
53
+ if (Array.isArray(userInfo[`${key}`]) && data != null) {
54
+ let removeData = Array.isArray(userInfo[`${key}`]) &&
55
+ userInfo[`${key}`].filter((el, i) => {
56
+ return el.id !== data[0].id;
57
+ });
58
+ newUserInfo = Object.assign(Object.assign({}, userInfo), { [key]: (0, sortUserInfo_1.sortUserInfo)(removeData) });
59
+ }
60
+ else if (data == null) {
61
+ let userInfoObj = Object.assign({}, userInfo);
62
+ userInfoObj[key] = data;
63
+ newUserInfo = userInfoObj;
64
+ }
65
+ return { newUserInfo: newUserInfo };
66
+ };
67
+ const updatePrimaryInfo = (key, data) => {
68
+ let updateData = Array.isArray(userInfo[`${key}`]) &&
69
+ userInfo[`${key}`].map((el, i) => {
70
+ if (el.id == data[0].id) {
71
+ return Object.assign(Object.assign({}, el), { is_primary: 1 });
72
+ }
73
+ else if (el.is_primary == 1) {
74
+ return Object.assign(Object.assign({}, el), { is_primary: 0 });
75
+ }
76
+ else {
77
+ return el;
78
+ }
79
+ });
80
+ let newUserInfo = Object.assign(Object.assign({}, userInfo), { [key]: (0, sortUserInfo_1.sortUserInfo)(updateData) });
81
+ return { newUserInfo: newUserInfo };
82
+ };
83
+ const updateDocumentInfo = (key, data) => {
84
+ let updateData = Array.isArray(userInfo[`${key}`]) &&
85
+ userInfo[`${key}`].map((el, i) => {
86
+ var _a;
87
+ if (el.id == ((_a = data === null || data === void 0 ? void 0 : data.info) === null || _a === void 0 ? void 0 : _a.entity_id)) {
88
+ return Object.assign(Object.assign({}, el), { verification_status: enum_1.EntityVerificationStatus.Pending });
89
+ }
90
+ else {
91
+ return el;
92
+ }
93
+ });
94
+ let newUserInfo = Object.assign(Object.assign({}, userInfo), { [key]: (0, sortUserInfo_1.sortUserInfo)(updateData) });
95
+ return { newUserInfo: newUserInfo, error: error };
96
+ };
97
+ const updateObjectInfo = (key, data) => {
98
+ let updateData = Object.assign(Object.assign({}, userInfo[`${key}`]), data);
99
+ let newUserInfo = Object.assign(Object.assign({}, userInfo), { [key]: updateData });
100
+ return { newUserInfo: newUserInfo };
101
+ };
102
+ const updateProfilePicture = (key, res) => {
103
+ let data = res.data.attachment[0].file_url;
104
+ let updateData = Object.assign(Object.assign({}, userInfo[`${key}`]), { ["picture"]: data });
105
+ let newUserInfo = Object.assign(Object.assign({}, userInfo), { [`${key}`]: updateData });
106
+ return { newUserInfo: newUserInfo };
107
+ };
108
+ const getUserInfo = (data) => {
109
+ let newUserInfo = Object.assign(Object.assign({}, userInfo), { data });
110
+ return { newUserInfo: newUserInfo };
111
+ };
112
+ const resetSecurity = (key, keyAction) => {
113
+ let security = null;
114
+ if (keyAction == "resetQuestions") {
115
+ security = Object.assign(Object.assign({}, userInfo[`${key}`]), { ["secret_answer_1"]: "____", ["secret_answer_2"]: "____" });
116
+ }
117
+ else if (keyAction == "resetSecurityCode") {
118
+ security = Object.assign(Object.assign({}, userInfo[`${key}`]), { ["security_code"]: "____" });
119
+ }
120
+ let newUserInfo = Object.assign(Object.assign({}, userInfo), { [`${key}`]: security });
121
+ return { newUserInfo: newUserInfo };
122
+ };
123
+ const addOrganizationInfo = (key, data) => {
124
+ if (Array.isArray(userInfo[`${key}`])) {
125
+ let newData = [...userInfo[`${key}`], data];
126
+ let newUserInfo = Object.assign(Object.assign({}, userInfo), { [key]: (0, sortUserInfo_1.sortUserInfo)(newData) });
127
+ return { newUserInfo: newUserInfo };
128
+ }
129
+ else {
130
+ const newUserInfo = Object.assign(Object.assign({}, userInfo), { [key]: [data] });
131
+ return { newUserInfo: newUserInfo };
132
+ }
133
+ };
134
+ const updateOrganizationInfo = (key, data) => {
135
+ let updatedData = Array.isArray(userInfo[`${key}`]) &&
136
+ userInfo[`${key}`].map((el, i) => {
137
+ if (el.info.id == data.info.id) {
138
+ return data;
139
+ }
140
+ else {
141
+ return el;
142
+ }
143
+ });
144
+ let newUserInfo = Object.assign(Object.assign({}, userInfo), { [key]: (0, sortUserInfo_1.sortUserInfo)(updatedData) });
145
+ return { newUserInfo: newUserInfo };
146
+ };
147
+ const removeOrganizationInfo = (key, data) => {
148
+ let newUserInfo;
149
+ if (Array.isArray(userInfo[`${key}`]) && data != null) {
150
+ let removeData = Array.isArray(userInfo[`${key}`]) &&
151
+ userInfo[`${key}`].filter((el, i) => {
152
+ return el.info.id !== data.info.id;
153
+ });
154
+ if (removeData.length <= 0) {
155
+ removeData = null;
156
+ }
157
+ newUserInfo = Object.assign(Object.assign({}, userInfo), { [key]: (0, sortUserInfo_1.sortUserInfo)(removeData) });
158
+ }
159
+ else if (data == null) {
160
+ let userInfoObj = Object.assign({}, userInfo);
161
+ userInfoObj[key] = data;
162
+ newUserInfo = userInfoObj;
163
+ }
164
+ return { newUserInfo: newUserInfo };
165
+ };
166
+ const createDocumentOrganization = (key, data) => {
167
+ let updateData = Array.isArray(userInfo[`${key}`]) &&
168
+ userInfo[`${key}`].map((el, i) => {
169
+ var _a;
170
+ if (el.info.id == ((_a = data === null || data === void 0 ? void 0 : data.info) === null || _a === void 0 ? void 0 : _a.entity_id)) {
171
+ let newInfo = Object.assign(Object.assign({}, el.info), { verification_status: enum_1.EntityVerificationStatus.Pending });
172
+ return Object.assign(Object.assign({}, el), { ["info"]: newInfo });
173
+ }
174
+ else {
175
+ return el;
176
+ }
177
+ });
178
+ let newUserInfo = Object.assign(Object.assign({}, userInfo), { [key]: updateData });
179
+ return { newUserInfo: newUserInfo };
180
+ };
181
+ return {
182
+ addInfo,
183
+ removeInfo,
184
+ updateInfo,
185
+ updatePrimaryInfo,
186
+ updateDocumentInfo,
187
+ updateObjectInfo,
188
+ updateProfilePicture,
189
+ getUserInfo,
190
+ resetSecurity,
191
+ addOrganizationInfo,
192
+ updateOrganizationInfo,
193
+ removeOrganizationInfo,
194
+ createDocumentOrganization,
195
+ };
196
+ };
197
+ const { addInfo, removeInfo, updateInfo, updatePrimaryInfo, updateDocumentInfo, updateObjectInfo, updateProfilePicture, getUserInfo, resetSecurity, addOrganizationInfo, updateOrganizationInfo, removeOrganizationInfo, createDocumentOrganization, } = newUserInfo();
198
+ // convert data json to data url encoded
199
+ const convertDataToUrlEncoded = () => {
200
+ const dataSignInUrlEncoded = (values, programId) => {
201
+ let data = qs_1.default.stringify({
202
+ grant_type: "user_credential",
203
+ user_name: values.email,
204
+ password: values.password,
205
+ program_Id: programId,
206
+ language: "en",
207
+ generate_jwt: true,
208
+ //fingerprint: fingerPrintHandler().fingerPrintCode,
209
+ installation_id: values.installationId,
210
+ device_details: JSON.stringify((0, fillDeviceDetails_1.fillDeviceDetails)()),
211
+ });
212
+ return data;
213
+ };
214
+ const dataSignInUrlEncodedWithGoogle = (values, programId) => {
215
+ let data = qs_1.default.stringify({
216
+ grant_type: "user_credential",
217
+ token: values.token,
218
+ token_id: values.token_id,
219
+ program_Id: programId,
220
+ language: "en",
221
+ token_type: "3",
222
+ generate_jwt: true,
223
+ //fingerprint: fingerPrintHandler().fingerPrintCode,
224
+ installation_id: values.installationId,
225
+ device_details: JSON.stringify((0, fillDeviceDetails_1.fillDeviceDetails)()),
226
+ });
227
+ return data;
228
+ };
229
+ const dataSignInDeviceEncoded = (values, programId) => {
230
+ let data = qs_1.default.stringify({
231
+ grant_type: "device_credential",
232
+ device_security_code: values.device_security_code,
233
+ user_Id: values.user_id,
234
+ device_Id: values.device_id,
235
+ program_Id: programId,
236
+ language: "en",
237
+ token_type: "3",
238
+ generate_jwt: true,
239
+ // fingerprint: fingerPrintHandler().fingerPrintCode,
240
+ device_details: JSON.stringify((0, fillDeviceDetails_1.fillDeviceDetails)()),
241
+ });
242
+ return data;
243
+ };
244
+ const dataTokenUrlEncoded = (values) => {
245
+ const data = {
246
+ installation_id: values.installationId,
247
+ };
248
+ return data;
249
+ };
250
+ return {
251
+ dataSignInUrlEncoded,
252
+ dataSignInDeviceEncoded,
253
+ dataSignInUrlEncodedWithGoogle,
254
+ dataTokenUrlEncoded,
255
+ };
256
+ };
257
+ // header config
258
+ const headerConfig = (headersData) => {
259
+ const { header, isUrlEncoded, token, lang, installationId } = headersData;
260
+ let headers;
261
+ if (!header)
262
+ return undefined;
263
+ if (isUrlEncoded) {
264
+ headers = {
265
+ "Content-Type": "application/x-www-form-urlencoded",
266
+ };
267
+ }
268
+ else {
269
+ headers = {
270
+ Authorization: restApi_1.default.bearer(token),
271
+ "Content-Type": "application/json",
272
+ language: lang ? lang : "en",
273
+ source_id: (0, generateSourceId_1.GenerateSourceID)(),
274
+ time_zone: (0, info_1.getTimezone)().userTimeZone,
275
+ show_sensitive_data: "1",
276
+ show_custom_field: "1",
277
+ show_ticket: "1",
278
+ // finger_print: fingerPrintHandler().fingerPrintCode,
279
+ installation_id: installationId ? installationId : "",
280
+ generate_jwt: true,
281
+ };
282
+ }
283
+ return headers;
284
+ };
285
+ // check response
286
+ const checkResponse = () => {
287
+ const errorHandler = (error, funcName, response) => {
288
+ let errorObj = {
289
+ status: "failed",
290
+ message: error,
291
+ funcName: funcName,
292
+ response: response,
293
+ };
294
+ throw errorObj;
295
+ };
296
+ const actionTypeHandler = (key, response, keyAction) => {
297
+ var _a;
298
+ const data = response === null || response === void 0 ? void 0 : response.data[`${key}`];
299
+ if (keyAction == "create") {
300
+ return addInfo(`${key}`, data);
301
+ }
302
+ else if (keyAction == "update") {
303
+ return updateInfo(`${key}`, data);
304
+ }
305
+ else if (keyAction == "delete") {
306
+ return removeInfo(`${key}`, data);
307
+ }
308
+ else if (keyAction == "updatePrimary") {
309
+ return updatePrimaryInfo(`${key}`, data);
310
+ }
311
+ else if (keyAction == "confirm") {
312
+ let data = (_a = response === null || response === void 0 ? void 0 : response.data) === null || _a === void 0 ? void 0 : _a.verify_data[`${key}`];
313
+ return updateInfo(`${key}`, [data]);
314
+ }
315
+ else if (keyAction == "createDocument") {
316
+ return updateDocumentInfo(`${key}`, response === null || response === void 0 ? void 0 : response.data);
317
+ }
318
+ else if (keyAction == "updateObjectInfo") {
319
+ return updateObjectInfo(`${key}`, data);
320
+ }
321
+ else if (keyAction == "updateProfilePicture") {
322
+ return updateProfilePicture(`${key}`, response);
323
+ }
324
+ else if (keyAction == "userInfo") {
325
+ return getUserInfo(response === null || response === void 0 ? void 0 : response.data);
326
+ }
327
+ else if (keyAction == "resetQuestions" ||
328
+ keyAction == "resetSecurityCode") {
329
+ return resetSecurity(`${key}`, keyAction);
330
+ }
331
+ else if (keyAction == "createOrganization") {
332
+ return addOrganizationInfo(`${key}`, response === null || response === void 0 ? void 0 : response.data);
333
+ }
334
+ else if (keyAction == "updateOrganization") {
335
+ return updateOrganizationInfo(`${key}`, response === null || response === void 0 ? void 0 : response.data);
336
+ }
337
+ else if (keyAction == "deleteOrganization") {
338
+ return removeOrganizationInfo(`${key}`, response === null || response === void 0 ? void 0 : response.data);
339
+ }
340
+ else if (keyAction == "createDocumentOrganization") {
341
+ return createDocumentOrganization(`${key}`, response === null || response === void 0 ? void 0 : response.data);
342
+ }
343
+ else {
344
+ return { newUserInfo: null };
345
+ }
346
+ };
347
+ const checkUserResponseAuth = (response, showMessageSuccess, funcName) => {
348
+ var _a, _b, _c, _d;
349
+ let check = (_b = (_a = response === null || response === void 0 ? void 0 : response.data) === null || _a === void 0 ? void 0 : _a.result) === null || _b === void 0 ? void 0 : _b.code;
350
+ if (check != "0000") {
351
+ errorHandler((_d = (_c = response === null || response === void 0 ? void 0 : response.data) === null || _c === void 0 ? void 0 : _c.result) === null || _d === void 0 ? void 0 : _d.friendly_message, funcName, response);
352
+ }
353
+ else if (!showMessageSuccess) {
354
+ let value = response.data;
355
+ value.email = (0, sortUserInfo_1.sortUserInfo)(value.email);
356
+ value.phone = (0, sortUserInfo_1.sortUserInfo)(value.phone);
357
+ value.identification = (0, sortUserInfo_1.sortUserInfo)(value.identification);
358
+ value.addresses = (0, sortUserInfo_1.sortUserInfo)(value.addresses);
359
+ value.bank_account = (0, sortUserInfo_1.sortUserInfo)(value.bank_account);
360
+ return value;
361
+ }
362
+ else {
363
+ return {
364
+ action: "Success",
365
+ message: "User Created Successfully",
366
+ };
367
+ }
368
+ };
369
+ const checkGlobalResponse = (key, response, funcName, keyAction) => {
370
+ var _a, _b, _c, _d;
371
+ let check = (_b = (_a = response === null || response === void 0 ? void 0 : response.data) === null || _a === void 0 ? void 0 : _a.result) === null || _b === void 0 ? void 0 : _b.code;
372
+ if (check == "0000") {
373
+ return actionTypeHandler(key, response, keyAction);
374
+ }
375
+ else if (check.startsWith("0")) {
376
+ return actionTypeHandler(key, response, keyAction);
377
+ }
378
+ else {
379
+ return errorHandler((_d = (_c = response === null || response === void 0 ? void 0 : response.data) === null || _c === void 0 ? void 0 : _c.result) === null || _d === void 0 ? void 0 : _d.friendly_message, funcName, response);
380
+ }
381
+ };
382
+ return {
383
+ checkUserResponseAuth,
384
+ checkGlobalResponse,
385
+ errorHandler,
386
+ };
387
+ };
388
+ return {
389
+ checkResponse,
390
+ headerConfig,
391
+ convertDataToUrlEncoded,
392
+ };
393
+ };
394
+ exports.default = Helper;
@@ -0,0 +1,26 @@
1
+ import { IGeoCoordinates } from "./interface";
2
+ export interface doTransactionInterface {
3
+ type: number | string;
4
+ amount: string;
5
+ currency: string;
6
+ note: string;
7
+ accountId: number;
8
+ validate: string;
9
+ bankId?: number | string;
10
+ geoCoordinates?: IGeoCoordinates;
11
+ }
12
+ export interface GetTransactionInterface {
13
+ status?: number;
14
+ page_size?: number;
15
+ from_date?: string;
16
+ to_date?: string;
17
+ start_index?: number;
18
+ transaction_type?: number | null;
19
+ account_id?: number;
20
+ classification?: string;
21
+ geoCoordinates?: IGeoCoordinates;
22
+ }
23
+ export interface GetAccountLimit {
24
+ account_id: number;
25
+ geoCoordinates?: IGeoCoordinates;
26
+ }
@@ -0,0 +1,2 @@
1
+ "use strict";
2
+ Object.defineProperty(exports, "__esModule", { value: true });