ggez-banking-sdk 0.1.105 → 0.1.107

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (89) hide show
  1. package/dist/api/clients/account.d.ts +8 -8
  2. package/dist/api/clients/account.js +26 -19
  3. package/dist/api/clients/auth.d.ts +22 -17
  4. package/dist/api/clients/auth.js +57 -42
  5. package/dist/api/clients/blockchain.d.ts +16 -16
  6. package/dist/api/clients/blockchain.js +52 -42
  7. package/dist/api/clients/ipAddressAndLocation.js +15 -13
  8. package/dist/api/clients/limited.d.ts +42 -32
  9. package/dist/api/clients/limited.js +100 -82
  10. package/dist/api/clients/order.d.ts +4 -4
  11. package/dist/api/clients/order.js +16 -12
  12. package/dist/api/clients/organization.d.ts +23 -18
  13. package/dist/api/clients/organization.js +57 -45
  14. package/dist/api/clients/promotion.d.ts +28 -13
  15. package/dist/api/clients/promotion.js +32 -30
  16. package/dist/api/clients/transaction.d.ts +9 -9
  17. package/dist/api/clients/transaction.js +30 -24
  18. package/dist/api/clients/user.d.ts +387 -301
  19. package/dist/api/clients/user.js +886 -735
  20. package/dist/api/data/account.d.ts +3 -0
  21. package/dist/api/data/account.js +8 -0
  22. package/dist/api/data/blockchain.d.ts +2 -1
  23. package/dist/api/data/blockchain.js +11 -1
  24. package/dist/api/data/index.d.ts +2 -0
  25. package/dist/api/data/index.js +2 -0
  26. package/dist/api/data/order.d.ts +2 -1
  27. package/dist/api/data/order.js +15 -1
  28. package/dist/api/data/organization.d.ts +2 -1
  29. package/dist/api/data/organization.js +26 -1
  30. package/dist/api/data/result.d.ts +9 -0
  31. package/dist/api/data/result.js +48 -0
  32. package/dist/api/data/transaction.d.ts +4 -2
  33. package/dist/api/data/transaction.js +24 -1
  34. package/dist/api/data/user/confirmUserSecurity.d.ts +3 -0
  35. package/dist/api/data/user/confirmUserSecurity.js +12 -0
  36. package/dist/api/data/user/forgetSecurityData.d.ts +3 -0
  37. package/dist/api/data/user/forgetSecurityData.js +10 -0
  38. package/dist/api/data/user/index.d.ts +8 -8
  39. package/dist/api/data/user/index.js +8 -161
  40. package/dist/api/data/user/user.d.ts +6 -0
  41. package/dist/api/data/user/user.js +159 -0
  42. package/dist/api/data/user/validateLimitedSecurity.d.ts +3 -0
  43. package/dist/api/data/user/validateLimitedSecurity.js +10 -0
  44. package/dist/api/data/user/validateSecurityData.d.ts +3 -0
  45. package/dist/api/data/user/validateSecurityData.js +11 -0
  46. package/dist/api/data/user/verifyUserSecurity.d.ts +3 -0
  47. package/dist/api/data/user/verifyUserSecurity.js +11 -0
  48. package/dist/api/services/account.js +1 -1
  49. package/dist/api/services/auth.js +4 -5
  50. package/dist/api/services/base.d.ts +1 -1
  51. package/dist/api/services/base.js +1 -0
  52. package/dist/api/services/blockchain.js +5 -9
  53. package/dist/api/services/ipAddressAndLocation.js +10 -10
  54. package/dist/api/services/limited.js +2 -1
  55. package/dist/api/services/order.js +2 -3
  56. package/dist/api/services/organization.d.ts +2 -2
  57. package/dist/api/services/organization.js +7 -10
  58. package/dist/api/services/promotion.js +1 -1
  59. package/dist/api/services/transaction.d.ts +2 -2
  60. package/dist/api/services/transaction.js +3 -5
  61. package/dist/api/services/user.js +65 -127
  62. package/dist/constants/structure.d.ts +1 -0
  63. package/dist/constants/structure.js +1 -0
  64. package/dist/helper/api/axiosHelper.js +71 -71
  65. package/dist/helper/api/responseHelper.d.ts +12 -11
  66. package/dist/helper/api/responseHelper.js +24 -25
  67. package/dist/helper/cipherHelper.js +95 -97
  68. package/dist/helper/clientHelper.js +1 -0
  69. package/dist/helper/cookiesHelper.d.ts +5 -0
  70. package/dist/helper/cookiesHelper.js +169 -126
  71. package/dist/helper/deviceHelper.js +31 -31
  72. package/dist/helper/userHelper.d.ts +12 -2
  73. package/dist/helper/userHelper.js +69 -2
  74. package/dist/index.d.ts +1 -1
  75. package/dist/index.js +1 -1
  76. package/dist/tsconfig.tsbuildinfo +1 -1
  77. package/dist/types/banking/common/ResultSet.d.ts +10 -0
  78. package/dist/types/banking/common/ResultSet.js +1 -0
  79. package/dist/types/banking/common/index.d.ts +1 -0
  80. package/dist/types/banking/entities/address.d.ts +1 -0
  81. package/dist/types/banking/oauth/tokenData.d.ts +3 -1
  82. package/dist/types/banking/transaction/index.d.ts +1 -0
  83. package/dist/types/banking/transaction/transactionResultInquiry.d.ts +9 -0
  84. package/dist/types/banking/transaction/transactionResultInquiry.js +1 -0
  85. package/dist/types/helper/index.d.ts +4 -3
  86. package/dist/types/helper/index.js +1 -3
  87. package/dist/types/helper/userHelper.d.ts +17 -0
  88. package/dist/types/helper/userHelper.js +2 -0
  89. package/package.json +2 -2
@@ -0,0 +1,3 @@
1
+ import { AccountData } from "../../types";
2
+ declare const FillAccountData: <K extends keyof AccountData>(key: K, value: AccountData[K]) => AccountData;
3
+ export { FillAccountData };
@@ -0,0 +1,8 @@
1
+ const FillAccountData = (key, value) => {
2
+ const accountData = {
3
+ result: null,
4
+ };
5
+ accountData[key] = value;
6
+ return accountData;
7
+ };
8
+ export { FillAccountData };
@@ -1,7 +1,8 @@
1
1
  import type { IBlockchainDelegateRequestData, IBlockchainMultiSendRequestData, IBlockchainSendRequestData, IBlockchainUndelegateRequestData } from "../../types";
2
2
  import type { BlockchainData } from "../../types";
3
+ declare const FillBlockchainData: <K extends keyof BlockchainData>(key: K, value: BlockchainData[K]) => BlockchainData;
3
4
  declare const FillBlockchainSendData: (data: IBlockchainSendRequestData) => BlockchainData;
4
5
  declare const FillBlockchainMultiSendData: (data: IBlockchainMultiSendRequestData) => BlockchainData;
5
6
  declare const FillBlockchainDelegateData: (data: IBlockchainDelegateRequestData) => BlockchainData;
6
7
  declare const FillBlockchainUndelegateData: (data: IBlockchainUndelegateRequestData) => BlockchainData;
7
- export { FillBlockchainSendData, FillBlockchainMultiSendData, FillBlockchainDelegateData, FillBlockchainUndelegateData, };
8
+ export { FillBlockchainData, FillBlockchainSendData, FillBlockchainMultiSendData, FillBlockchainDelegateData, FillBlockchainUndelegateData, };
@@ -1,3 +1,13 @@
1
+ const FillBlockchainData = (key, value) => {
2
+ const blockchainData = {
3
+ result: null,
4
+ info: null,
5
+ transaction_data: null,
6
+ authentication: null,
7
+ };
8
+ blockchainData[key] = value;
9
+ return blockchainData;
10
+ };
1
11
  const FillBlockchainSendData = (data) => {
2
12
  const blockchainSendData = {
3
13
  info: data.info,
@@ -34,4 +44,4 @@ const FillBlockchainUndelegateData = (data) => {
34
44
  };
35
45
  return blockchainUndelegateData;
36
46
  };
37
- export { FillBlockchainSendData, FillBlockchainMultiSendData, FillBlockchainDelegateData, FillBlockchainUndelegateData, };
47
+ export { FillBlockchainData, FillBlockchainSendData, FillBlockchainMultiSendData, FillBlockchainDelegateData, FillBlockchainUndelegateData, };
@@ -1,7 +1,9 @@
1
+ export * from "./account";
1
2
  export * from "./auth";
2
3
  export * from "./blockchain";
3
4
  export * from "./limited";
4
5
  export * from "./order";
5
6
  export * from "./organization";
7
+ export * from "./result";
6
8
  export * from "./transaction";
7
9
  export * from "./user";
@@ -1,7 +1,9 @@
1
+ export * from "./account";
1
2
  export * from "./auth";
2
3
  export * from "./blockchain";
3
4
  export * from "./limited";
4
5
  export * from "./order";
5
6
  export * from "./organization";
7
+ export * from "./result";
6
8
  export * from "./transaction";
7
9
  export * from "./user";
@@ -1,4 +1,5 @@
1
1
  import type { ICreateOrderData } from "../../types";
2
2
  import type { OrderData } from "../../types";
3
+ declare const FillOrderData: <K extends keyof OrderData>(key: K, value: OrderData[K]) => OrderData;
3
4
  declare const FillCreateOrderData: (data: ICreateOrderData) => OrderData;
4
- export { FillCreateOrderData };
5
+ export { FillOrderData, FillCreateOrderData };
@@ -1,4 +1,18 @@
1
1
  import { CommerceProductSourceType, OrderType, TransactionType, ValidateType, } from "../../constants";
2
+ const FillOrderData = (key, value) => {
3
+ const orderData = {
4
+ result: null,
5
+ authentication: null,
6
+ info: null,
7
+ items: [],
8
+ payment_method: null,
9
+ transaction: null,
10
+ notes: null,
11
+ validate: null,
12
+ };
13
+ orderData[key] = value;
14
+ return orderData;
15
+ };
2
16
  const FillCreateOrderData = (data) => {
3
17
  const orderData = {
4
18
  info: {
@@ -40,4 +54,4 @@ const FillCreateOrderData = (data) => {
40
54
  };
41
55
  return orderData;
42
56
  };
43
- export { FillCreateOrderData };
57
+ export { FillOrderData, FillCreateOrderData };
@@ -1,6 +1,7 @@
1
1
  import type { ICreateOrganizationDocumentData, ICreateOrganizationData, IUpdateOrganizationData } from "../../types";
2
2
  import type { DocumentData, OrganizationData } from "../../types";
3
+ declare const FillOrganizationData: <K extends keyof OrganizationData>(key: K, value: OrganizationData[K]) => OrganizationData;
3
4
  declare const FillCreateOrganizationData: (data: ICreateOrganizationData, userId: number) => OrganizationData;
4
5
  declare const FillCreateOrganizationDocumentData: (data: ICreateOrganizationDocumentData) => DocumentData;
5
6
  declare const FillUpdateOrganizationData: (data: IUpdateOrganizationData, userId: number) => OrganizationData;
6
- export { FillCreateOrganizationData, FillCreateOrganizationDocumentData, FillUpdateOrganizationData, };
7
+ export { FillOrganizationData, FillCreateOrganizationData, FillCreateOrganizationDocumentData, FillUpdateOrganizationData, };
@@ -1,4 +1,29 @@
1
1
  import { AddressType, Entity, DocumentType, EntityStatus, EntityVerificationStatus, } from "../../constants";
2
+ const FillOrganizationData = (key, value) => {
3
+ const organizationData = {
4
+ result: null,
5
+ info: null,
6
+ details: null,
7
+ address: [],
8
+ email: [],
9
+ phone: [],
10
+ social_media: [],
11
+ ownership_json: "",
12
+ classification: null,
13
+ working_hours: null,
14
+ json: "",
15
+ geo_coordinates: null,
16
+ history: [],
17
+ relationship: [],
18
+ documents: [],
19
+ users: [],
20
+ accounts: [],
21
+ picture: [],
22
+ ticket: [],
23
+ };
24
+ organizationData[key] = value;
25
+ return organizationData;
26
+ };
2
27
  const FillCreateOrganizationData = (data, userId) => {
3
28
  const organizationData = {
4
29
  info: {
@@ -80,4 +105,4 @@ const FillUpdateOrganizationData = (data, userId) => {
80
105
  };
81
106
  return organizationData;
82
107
  };
83
- export { FillCreateOrganizationData, FillCreateOrganizationDocumentData, FillUpdateOrganizationData, };
108
+ export { FillOrganizationData, FillCreateOrganizationData, FillCreateOrganizationDocumentData, FillUpdateOrganizationData, };
@@ -0,0 +1,9 @@
1
+ import { HttpStatusCode } from "axios";
2
+ import { BaseResult, Result } from "../../types";
3
+ declare const FillBaseResult: <K extends keyof BaseResult>(key: K, value: BaseResult[K]) => BaseResult;
4
+ declare const FillResult: <K extends BaseResult & {
5
+ error: string;
6
+ }>(responseData: K) => Result;
7
+ declare const FillResultByError: (error: any) => Result;
8
+ declare const FillResultByHttpCode: (code: HttpStatusCode, message?: string) => Result;
9
+ export { FillBaseResult, FillResult, FillResultByError, FillResultByHttpCode };
@@ -0,0 +1,48 @@
1
+ import { HttpStatusCode } from "axios";
2
+ import { SystemResponses } from "../../constants";
3
+ const FillBaseResult = (key, value) => {
4
+ const baseResult = {
5
+ result: null,
6
+ notes: null,
7
+ authentication: null,
8
+ last_activity: null,
9
+ validate: null,
10
+ function_code: null,
11
+ response_time: null,
12
+ time_zone: null,
13
+ time_zone_name: null,
14
+ };
15
+ baseResult[key] = value;
16
+ return baseResult;
17
+ };
18
+ const FillResult = (responseData) => {
19
+ if (responseData.error) {
20
+ const result = FillResultByError(responseData.error);
21
+ responseData.result = result;
22
+ }
23
+ return {
24
+ code: SystemResponses.Approved,
25
+ message: "",
26
+ friendly_message: "",
27
+ description: "",
28
+ };
29
+ };
30
+ const FillResultByError = (error) => {
31
+ const result = {
32
+ code: HttpStatusCode.BadRequest.toString(),
33
+ message: error.message || error,
34
+ friendly_message: error.message || error,
35
+ description: error.message || error,
36
+ };
37
+ return result;
38
+ };
39
+ const FillResultByHttpCode = (code, message) => {
40
+ const result = {
41
+ code: code.toString(),
42
+ message: message,
43
+ friendly_message: message,
44
+ description: message,
45
+ };
46
+ return result;
47
+ };
48
+ export { FillBaseResult, FillResult, FillResultByError, FillResultByHttpCode };
@@ -1,5 +1,7 @@
1
- import type { ICreateTransactionData, IInquiryTransactionData } from "../../types";
1
+ import type { ICreateTransactionData, IInquiryTransactionData, TransactionResultInquiry } from "../../types";
2
2
  import type { TransactionData, TransactionInquiry } from "../../types";
3
+ declare const FillTransactionData: <K extends keyof TransactionData>(key: K, value: TransactionData[K]) => TransactionData;
4
+ declare const FillTransactionInquiryResultData: <K extends keyof TransactionResultInquiry>(key: K, value: TransactionResultInquiry[K]) => TransactionResultInquiry;
3
5
  declare const FillTransactionInquiryData: (data: IInquiryTransactionData) => TransactionInquiry;
4
6
  declare const FillCreateTransactionData: (data: ICreateTransactionData) => TransactionData;
5
- export { FillTransactionInquiryData, FillCreateTransactionData };
7
+ export { FillTransactionData, FillTransactionInquiryResultData, FillTransactionInquiryData, FillCreateTransactionData, };
@@ -1,3 +1,26 @@
1
+ const FillTransactionData = (key, value) => {
2
+ const transactionData = {
3
+ result: null,
4
+ info: null,
5
+ account: null,
6
+ bank_account: null,
7
+ validate: null,
8
+ history: [],
9
+ };
10
+ transactionData[key] = value;
11
+ return transactionData;
12
+ };
13
+ const FillTransactionInquiryResultData = (key, value) => {
14
+ const transactionResultInquiryData = {
15
+ result_set: null,
16
+ transaction_inquiry: null,
17
+ end_point_url: null,
18
+ transactions: null,
19
+ archive: null,
20
+ };
21
+ transactionResultInquiryData[key] = value;
22
+ return transactionResultInquiryData;
23
+ };
1
24
  const FillTransactionInquiryData = (data) => {
2
25
  const transactionInquiryData = {
3
26
  status: data.status,
@@ -32,4 +55,4 @@ const FillCreateTransactionData = (data) => {
32
55
  };
33
56
  return transactionData;
34
57
  };
35
- export { FillTransactionInquiryData, FillCreateTransactionData };
58
+ export { FillTransactionData, FillTransactionInquiryResultData, FillTransactionInquiryData, FillCreateTransactionData, };
@@ -0,0 +1,3 @@
1
+ import { ConfirmUserSecurity } from "../../../types";
2
+ declare const FillConfirmUserSecurityData: <K extends keyof ConfirmUserSecurity>(key: K, value: ConfirmUserSecurity[K]) => ConfirmUserSecurity;
3
+ export { FillConfirmUserSecurityData };
@@ -0,0 +1,12 @@
1
+ const FillConfirmUserSecurityData = (key, value) => {
2
+ const confirmUserSecurity = {
3
+ result: null,
4
+ info: null,
5
+ verify_data: null,
6
+ confirm_data: null,
7
+ geo_coordinates: null,
8
+ };
9
+ confirmUserSecurity[key] = value;
10
+ return confirmUserSecurity;
11
+ };
12
+ export { FillConfirmUserSecurityData };
@@ -0,0 +1,3 @@
1
+ import { ForgetSecurityData } from "../../../types";
2
+ declare const FillForgetSecurityData: <K extends keyof ForgetSecurityData>(key: K, value: ForgetSecurityData[K]) => ForgetSecurityData;
3
+ export { FillForgetSecurityData };
@@ -0,0 +1,10 @@
1
+ const FillForgetSecurityData = (key, value) => {
2
+ const forgetSecurityData = {
3
+ result: null,
4
+ info: null,
5
+ security: null,
6
+ };
7
+ forgetSecurityData[key] = value;
8
+ return forgetSecurityData;
9
+ };
10
+ export { FillForgetSecurityData };
@@ -1,18 +1,18 @@
1
- import type { ICreateUserData, ICreateUserWithGoogleData } from "../../../types";
2
- import type { UserData } from "../../../types";
3
- declare const FillUserData: <K extends keyof UserData>(key: K, value: UserData[K]) => UserData;
4
- declare const FillCreateUserData: (data: ICreateUserData) => UserData;
5
- declare const FillCreateUserWithGoogleData: (data: ICreateUserWithGoogleData) => UserData;
6
- export { FillUserData, FillCreateUserData, FillCreateUserWithGoogleData };
7
1
  export * from "./address";
2
+ export * from "./auth";
8
3
  export * from "./bankAccount";
4
+ export * from "./confirmUserSecurity";
9
5
  export * from "./device";
10
6
  export * from "./document";
11
7
  export * from "./email";
8
+ export * from "./forgetSecurityData";
12
9
  export * from "./identification";
10
+ export * from "./personalInfo";
13
11
  export * from "./phone";
14
12
  export * from "./preferences";
15
- export * from "./personalInfo";
16
13
  export * from "./security";
17
- export * from "./auth";
18
14
  export * from "./ticket";
15
+ export * from "./user";
16
+ export * from "./validateLimitedSecurity";
17
+ export * from "./validateSecurityData";
18
+ export * from "./verifyUserSecurity";
@@ -1,171 +1,18 @@
1
- import { DeviceType, EntityStatus, EntityVerificationStatus, Gender, PhoneNumberTypes, SecurityAuthenticationTypes, SecurityLoginType, Titles, } from "../../../constants";
2
- import { ClientHelper, DateTimeHelper } from "../../../helper";
3
- const FillUserData = (key, value) => {
4
- const userData = {
5
- result: null,
6
- info: null,
7
- personal_info: null,
8
- address: null,
9
- addresses: null,
10
- email: null,
11
- phone: null,
12
- security: null,
13
- preferences: null,
14
- identification: null,
15
- bank_account: null,
16
- credit_card: null,
17
- notification: null,
18
- documents: null,
19
- currency: null,
20
- credit_limit: null,
21
- account: null,
22
- group: null,
23
- terms_conditions: null,
24
- device_info: null,
25
- device: null,
26
- device_history: null,
27
- commerce: null,
28
- external_auth: null,
29
- validation_data: null,
30
- relationship: null,
31
- custom_field: null,
32
- history: null,
33
- access_rule: null,
34
- ticket: null,
35
- general_requirements: null,
36
- organization: null,
37
- authentication_data: null,
38
- crypto_address: null,
39
- activity: null,
40
- notes: null,
41
- last_activity: null,
42
- authentication: null,
43
- validate: null,
44
- function_code: null,
45
- response_time: null,
46
- geo_coordinates: null,
47
- time_zone: null,
48
- time_zone_name: null,
49
- };
50
- userData[key] = value;
51
- return userData;
52
- };
53
- const FillCreateUserData = (data) => {
54
- const clientHelper = new ClientHelper();
55
- const userData = {
56
- info: {
57
- type: data.userType,
58
- },
59
- personal_info: {
60
- title: data.gender == Gender.Male ? Titles.Mr : Titles.Miss,
61
- first_name: data.firstName,
62
- last_name: data.lastName,
63
- date_of_birth: data.dateOfBirth,
64
- gender: data.gender,
65
- verification_status: EntityVerificationStatus.Verified,
66
- },
67
- address: {
68
- country_code: data.country,
69
- state_region: data.state,
70
- verification_status: EntityVerificationStatus.Not_Verified,
71
- },
72
- email: [
73
- {
74
- id: 0,
75
- address: data.email,
76
- is_primary: 1,
77
- verification_status: EntityVerificationStatus.Verified,
78
- },
79
- ],
80
- phone: [
81
- {
82
- id: 0,
83
- type: PhoneNumberTypes.Mobile,
84
- country_code: data.mobileNumberCountry,
85
- number: data.mobileNumber,
86
- is_primary: 1,
87
- verification_status: data.isMobileConfirmed
88
- ? EntityVerificationStatus.Verified
89
- : EntityVerificationStatus.Not_Verified,
90
- },
91
- ],
92
- authentication: [
93
- {
94
- type: SecurityAuthenticationTypes.Email_Code,
95
- code: data.emailAuthenticationCode,
96
- },
97
- data.isMobileConfirmed &&
98
- !!data.mobileAuthenticationCode && {
99
- type: SecurityAuthenticationTypes.SMS_Code,
100
- code: data.mobileAuthenticationCode,
101
- },
102
- ],
103
- security: {
104
- password: data.password,
105
- security_code: data.securityCode,
106
- },
107
- preferences: {
108
- preferred_language_code: data.preferredLanguageCode,
109
- enable_promotion_notification: "1",
110
- enable_email_notification: "1",
111
- enable_sms_notification: "1",
112
- enable_push_notification: "1",
113
- enable_device_authentication: "1",
114
- time_zone: DateTimeHelper.GetClientTimeZone(),
115
- },
116
- currency: [
117
- {
118
- id: 0,
119
- code: data.currency,
120
- is_primary: 0,
121
- },
122
- ],
123
- terms_conditions: {
124
- id: 0,
125
- acceptance: "1",
126
- },
127
- device: [
128
- {
129
- type: DeviceType.Browser,
130
- brand: `${clientHelper.getBrowser()}-${clientHelper.getBrowserVersion()}`,
131
- os: clientHelper.getOS(),
132
- status: EntityStatus.Active,
133
- verification_status: data.deviceVerificationStatus,
134
- installation_id: data.installationID,
135
- extended_info: {
136
- cpu: clientHelper.getCPU(),
137
- system_language: clientHelper.getSystemLanguage(),
138
- user_agent: clientHelper.getUserAgent(),
139
- },
140
- },
141
- ],
142
- custom_field: data.customField,
143
- };
144
- return userData;
145
- };
146
- const FillCreateUserWithGoogleData = (data) => {
147
- const userData = FillCreateUserData(data);
148
- const externalAuth = {
149
- id: 0,
150
- login_id: data.loginId,
151
- token: data.token,
152
- status: EntityStatus.Active,
153
- type: SecurityLoginType.Google,
154
- verification_status: EntityVerificationStatus.Verified,
155
- };
156
- userData.external_auth = [externalAuth];
157
- return userData;
158
- };
159
- export { FillUserData, FillCreateUserData, FillCreateUserWithGoogleData };
160
1
  export * from "./address";
2
+ export * from "./auth";
161
3
  export * from "./bankAccount";
4
+ export * from "./confirmUserSecurity";
162
5
  export * from "./device";
163
6
  export * from "./document";
164
7
  export * from "./email";
8
+ export * from "./forgetSecurityData";
165
9
  export * from "./identification";
10
+ export * from "./personalInfo";
166
11
  export * from "./phone";
167
12
  export * from "./preferences";
168
- export * from "./personalInfo";
169
13
  export * from "./security";
170
- export * from "./auth";
171
14
  export * from "./ticket";
15
+ export * from "./user";
16
+ export * from "./validateLimitedSecurity";
17
+ export * from "./validateSecurityData";
18
+ export * from "./verifyUserSecurity";
@@ -0,0 +1,6 @@
1
+ import type { ICreateUserData, ICreateUserWithGoogleData } from "../../../types";
2
+ import type { UserData } from "../../../types";
3
+ export { FillUserData, FillCreateUserData, FillCreateUserWithGoogleData };
4
+ declare const FillUserData: <K extends keyof UserData>(key: K, value: UserData[K]) => UserData;
5
+ declare const FillCreateUserData: (data: ICreateUserData) => UserData;
6
+ declare const FillCreateUserWithGoogleData: (data: ICreateUserWithGoogleData) => UserData;
@@ -0,0 +1,159 @@
1
+ import { DeviceType, EntityStatus, EntityVerificationStatus, Gender, PhoneNumberTypes, SecurityAuthenticationTypes, SecurityLoginType, Titles, } from "../../../constants";
2
+ import { ClientHelper, DateTimeHelper } from "../../../helper";
3
+ export { FillUserData, FillCreateUserData, FillCreateUserWithGoogleData };
4
+ const FillUserData = (key, value) => {
5
+ const userData = {
6
+ result: null,
7
+ info: null,
8
+ personal_info: null,
9
+ address: null,
10
+ addresses: [],
11
+ email: [],
12
+ phone: [],
13
+ security: null,
14
+ preferences: null,
15
+ identification: [],
16
+ bank_account: [],
17
+ credit_card: null,
18
+ notification: null,
19
+ documents: [],
20
+ currency: [],
21
+ credit_limit: null,
22
+ account: [],
23
+ group: null,
24
+ terms_conditions: null,
25
+ device_info: null,
26
+ device: [],
27
+ device_history: [],
28
+ commerce: null,
29
+ external_auth: null,
30
+ validation_data: null,
31
+ relationship: null,
32
+ custom_field: null,
33
+ history: null,
34
+ access_rule: null,
35
+ ticket: null,
36
+ general_requirements: null,
37
+ organization: [],
38
+ authentication_data: [],
39
+ crypto_address: null,
40
+ activity: null,
41
+ notes: null,
42
+ last_activity: null,
43
+ authentication: null,
44
+ validate: null,
45
+ function_code: null,
46
+ response_time: null,
47
+ geo_coordinates: null,
48
+ time_zone: null,
49
+ time_zone_name: null,
50
+ };
51
+ userData[key] = value;
52
+ return userData;
53
+ };
54
+ const FillCreateUserData = (data) => {
55
+ const clientHelper = new ClientHelper();
56
+ const userData = {
57
+ info: {
58
+ type: data.userType,
59
+ },
60
+ personal_info: {
61
+ title: data.gender == Gender.Male ? Titles.Mr : Titles.Miss,
62
+ first_name: data.firstName,
63
+ last_name: data.lastName,
64
+ date_of_birth: data.dateOfBirth,
65
+ gender: data.gender,
66
+ verification_status: EntityVerificationStatus.Verified,
67
+ },
68
+ address: {
69
+ country_code: data.country,
70
+ state_region: data.state,
71
+ verification_status: EntityVerificationStatus.Not_Verified,
72
+ },
73
+ email: [
74
+ {
75
+ id: 0,
76
+ address: data.email,
77
+ is_primary: 1,
78
+ verification_status: EntityVerificationStatus.Verified,
79
+ },
80
+ ],
81
+ phone: [
82
+ {
83
+ id: 0,
84
+ type: PhoneNumberTypes.Mobile,
85
+ country_code: data.mobileNumberCountry,
86
+ number: data.mobileNumber,
87
+ is_primary: 1,
88
+ verification_status: data.isMobileConfirmed
89
+ ? EntityVerificationStatus.Verified
90
+ : EntityVerificationStatus.Not_Verified,
91
+ },
92
+ ],
93
+ authentication: [
94
+ {
95
+ type: SecurityAuthenticationTypes.Email_Code,
96
+ code: data.emailAuthenticationCode,
97
+ },
98
+ data.isMobileConfirmed &&
99
+ !!data.mobileAuthenticationCode && {
100
+ type: SecurityAuthenticationTypes.SMS_Code,
101
+ code: data.mobileAuthenticationCode,
102
+ },
103
+ ],
104
+ security: {
105
+ password: data.password,
106
+ security_code: data.securityCode,
107
+ },
108
+ preferences: {
109
+ preferred_language_code: data.preferredLanguageCode,
110
+ enable_promotion_notification: "1",
111
+ enable_email_notification: "1",
112
+ enable_sms_notification: "1",
113
+ enable_push_notification: "1",
114
+ enable_device_authentication: "1",
115
+ time_zone: DateTimeHelper.GetClientTimeZone(),
116
+ },
117
+ currency: [
118
+ {
119
+ id: 0,
120
+ code: data.currency,
121
+ is_primary: 0,
122
+ },
123
+ ],
124
+ terms_conditions: {
125
+ id: 0,
126
+ acceptance: "1",
127
+ },
128
+ device: [
129
+ {
130
+ type: DeviceType.Browser,
131
+ brand: `${clientHelper.getBrowser()}-${clientHelper.getBrowserVersion()}`,
132
+ os: clientHelper.getOS(),
133
+ status: EntityStatus.Active,
134
+ verification_status: data.deviceVerificationStatus,
135
+ installation_id: data.installationID,
136
+ extended_info: {
137
+ cpu: clientHelper.getCPU(),
138
+ system_language: clientHelper.getSystemLanguage(),
139
+ user_agent: clientHelper.getUserAgent(),
140
+ },
141
+ },
142
+ ],
143
+ custom_field: data.customField,
144
+ };
145
+ return userData;
146
+ };
147
+ const FillCreateUserWithGoogleData = (data) => {
148
+ const userData = FillCreateUserData(data);
149
+ const externalAuth = {
150
+ id: 0,
151
+ login_id: data.loginId,
152
+ token: data.token,
153
+ status: EntityStatus.Active,
154
+ type: SecurityLoginType.Google,
155
+ verification_status: EntityVerificationStatus.Verified,
156
+ };
157
+ userData.external_auth = [externalAuth];
158
+ return userData;
159
+ };
@@ -0,0 +1,3 @@
1
+ import { ValidateLimitedSecurity } from "../../../types";
2
+ declare const FillValidateLimitedSecurityData: <K extends keyof ValidateLimitedSecurity>(key: K, value: ValidateLimitedSecurity[K]) => ValidateLimitedSecurity;
3
+ export { FillValidateLimitedSecurityData };
@@ -0,0 +1,10 @@
1
+ const FillValidateLimitedSecurityData = (key, value) => {
2
+ const forgetSecurityData = {
3
+ result: null,
4
+ info: null,
5
+ security: null,
6
+ };
7
+ forgetSecurityData[key] = value;
8
+ return forgetSecurityData;
9
+ };
10
+ export { FillValidateLimitedSecurityData };