@cuenca-mx/cuenca-js 1.2.2-dev0 → 2.0.0-dev0

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 (183) hide show
  1. package/CHANGELOG.md +19 -0
  2. package/build/data-91da6d58.mjs +625 -0
  3. package/build/data-ca00ac2d.cjs +669 -0
  4. package/build/dts/client/client.d.ts +86 -0
  5. package/build/dts/client/index.d.ts +1 -0
  6. package/build/dts/errors.d.ts +25 -0
  7. package/build/dts/helpers/case.d.ts +5 -0
  8. package/build/dts/helpers/data.d.ts +3 -0
  9. package/build/dts/helpers/env.d.ts +7 -0
  10. package/build/dts/index.d.ts +52 -0
  11. package/build/dts/jwt.d.ts +8 -0
  12. package/build/dts/models/account.d.ts +12 -0
  13. package/build/dts/models/alert.d.ts +32 -0
  14. package/build/dts/models/apiKey.d.ts +13 -0
  15. package/build/dts/models/arpc.d.ts +10 -0
  16. package/build/dts/models/balanceEntry.d.ts +15 -0
  17. package/build/dts/models/baseUser.d.ts +23 -0
  18. package/build/dts/models/billPayment.d.ts +10 -0
  19. package/build/dts/models/bridgeAccount.d.ts +27 -0
  20. package/build/dts/models/bridgeBankAccount.d.ts +16 -0
  21. package/build/dts/models/bridgeClabe.d.ts +12 -0
  22. package/build/dts/models/bridgeTransaction.d.ts +32 -0
  23. package/build/dts/models/card.d.ts +19 -0
  24. package/build/dts/models/cardActivation.d.ts +12 -0
  25. package/build/dts/models/cardTransaction.d.ts +15 -0
  26. package/build/dts/models/cardValidation.d.ts +19 -0
  27. package/build/dts/models/commission.d.ts +9 -0
  28. package/build/dts/models/deposit.d.ts +11 -0
  29. package/build/dts/models/file.d.ts +10 -0
  30. package/build/dts/models/fraudFundsTransfer.d.ts +9 -0
  31. package/build/dts/models/index.d.ts +38 -0
  32. package/build/dts/models/kycValidations.d.ts +22 -0
  33. package/build/dts/models/loginToken.d.ts +7 -0
  34. package/build/dts/models/partner.d.ts +25 -0
  35. package/build/dts/models/postalCode.d.ts +14 -0
  36. package/build/dts/models/saving.d.ts +11 -0
  37. package/build/dts/models/serviceProvider.d.ts +10 -0
  38. package/build/dts/models/session.d.ts +14 -0
  39. package/build/dts/models/statement.d.ts +10 -0
  40. package/build/dts/models/transaction.d.ts +7 -0
  41. package/build/dts/models/transactionalProfile.d.ts +14 -0
  42. package/build/dts/models/transfer.d.ts +15 -0
  43. package/build/dts/models/user.d.ts +42 -0
  44. package/build/dts/models/userCredential.d.ts +10 -0
  45. package/build/dts/models/userLogin.d.ts +9 -0
  46. package/build/dts/models/userReport.d.ts +48 -0
  47. package/build/dts/models/userTosAgreement.d.ts +13 -0
  48. package/build/dts/models/verification.d.ts +12 -0
  49. package/build/dts/models/wallet.d.ts +8 -0
  50. package/build/dts/models/walletTransaction.d.ts +10 -0
  51. package/build/dts/models/whatsAppTransfer.d.ts +16 -0
  52. package/build/dts/requests/addressUpdateRequest.d.ts +17 -0
  53. package/build/dts/requests/alertRequest.d.ts +31 -0
  54. package/build/dts/requests/apiKeyRequest.d.ts +9 -0
  55. package/build/dts/requests/arpcRequest.d.ts +16 -0
  56. package/build/dts/requests/base.d.ts +2 -0
  57. package/build/dts/requests/cardActivationRequest.d.ts +11 -0
  58. package/build/dts/requests/cardRequest.d.ts +18 -0
  59. package/build/dts/requests/cardValidationRequest.d.ts +15 -0
  60. package/build/dts/requests/fileUploadRequest.d.ts +12 -0
  61. package/build/dts/requests/fraudFundsTransferRequest.d.ts +13 -0
  62. package/build/dts/requests/index.d.ts +24 -0
  63. package/build/dts/requests/kycValidationsRequest.d.ts +10 -0
  64. package/build/dts/requests/partnerUserRequest.d.ts +100 -0
  65. package/build/dts/requests/reportGenerateRequest.d.ts +8 -0
  66. package/build/dts/requests/savingRequest.d.ts +11 -0
  67. package/build/dts/requests/sessionRequest.d.ts +12 -0
  68. package/build/dts/requests/tosUpdateRequest.d.ts +11 -0
  69. package/build/dts/requests/transferRequest.d.ts +12 -0
  70. package/build/dts/requests/transferUpdateRequest.d.ts +8 -0
  71. package/build/dts/requests/userCredentialRequest.d.ts +15 -0
  72. package/build/dts/requests/userLoginRequest.d.ts +8 -0
  73. package/build/dts/requests/userReportCreateRequest.d.ts +9 -0
  74. package/build/dts/requests/userReportUpdateRequest.d.ts +28 -0
  75. package/build/dts/requests/userRequest.d.ts +39 -0
  76. package/build/dts/requests/verificationRequest.d.ts +17 -0
  77. package/build/dts/requests/walletTransactionRequest.d.ts +9 -0
  78. package/build/dts/resources/accounts.d.ts +33 -0
  79. package/build/dts/resources/alerts.d.ts +54 -0
  80. package/build/dts/resources/apiKeys.d.ts +63 -0
  81. package/build/dts/resources/arpc.d.ts +18 -0
  82. package/build/dts/resources/balanceEntries.d.ts +37 -0
  83. package/build/dts/resources/base.d.ts +135 -0
  84. package/build/dts/resources/billPayments.d.ts +34 -0
  85. package/build/dts/resources/bridgeAccounts.d.ts +49 -0
  86. package/build/dts/resources/bridgeBankAccounts.d.ts +33 -0
  87. package/build/dts/resources/bridgeClabes.d.ts +27 -0
  88. package/build/dts/resources/bridgeTransactions.d.ts +36 -0
  89. package/build/dts/resources/cardActivations.d.ts +19 -0
  90. package/build/dts/resources/cardTransactions.d.ts +34 -0
  91. package/build/dts/resources/cardValidations.d.ts +19 -0
  92. package/build/dts/resources/cards.d.ts +63 -0
  93. package/build/dts/resources/commissions.d.ts +34 -0
  94. package/build/dts/resources/deposits.d.ts +34 -0
  95. package/build/dts/resources/files.d.ts +30 -0
  96. package/build/dts/resources/fraudFundsTransfers.d.ts +18 -0
  97. package/build/dts/resources/index.d.ts +36 -0
  98. package/build/dts/resources/kycValidations.d.ts +53 -0
  99. package/build/dts/resources/loginTokens.d.ts +17 -0
  100. package/build/dts/resources/partners.d.ts +54 -0
  101. package/build/dts/resources/postalCodes.d.ts +24 -0
  102. package/build/dts/resources/reports.d.ts +8 -0
  103. package/build/dts/resources/savings.d.ts +62 -0
  104. package/build/dts/resources/serviceProviders.d.ts +32 -0
  105. package/build/dts/resources/sessions.d.ts +43 -0
  106. package/build/dts/resources/statements.d.ts +44 -0
  107. package/build/dts/resources/transfers.d.ts +64 -0
  108. package/build/dts/resources/userCredentials.d.ts +30 -0
  109. package/build/dts/resources/userLogins.d.ts +28 -0
  110. package/build/dts/resources/userReports.d.ts +54 -0
  111. package/build/dts/resources/users.d.ts +56 -0
  112. package/build/dts/resources/usersTosAgreements.d.ts +16 -0
  113. package/build/dts/resources/verifications.d.ts +31 -0
  114. package/build/dts/resources/walletTransactions.d.ts +48 -0
  115. package/build/dts/resources/whatsAppTransfers.d.ts +34 -0
  116. package/build/dts/types/enums.d.ts +579 -0
  117. package/build/dts/types/identities/address.d.ts +25 -0
  118. package/build/dts/types/identities/alertLog.d.ts +11 -0
  119. package/build/dts/types/identities/audit.d.ts +10 -0
  120. package/build/dts/types/identities/businessDetails.d.ts +9 -0
  121. package/build/dts/types/identities/externalAccount.d.ts +8 -0
  122. package/build/dts/types/identities/index.d.ts +17 -0
  123. package/build/dts/types/identities/kycFile.d.ts +14 -0
  124. package/build/dts/types/identities/legalRepresentatives.d.ts +12 -0
  125. package/build/dts/types/identities/license.d.ts +10 -0
  126. package/build/dts/types/identities/moralOperation.d.ts +8 -0
  127. package/build/dts/types/identities/physicalPerson.d.ts +12 -0
  128. package/build/dts/types/identities/shareholderMoral.d.ts +12 -0
  129. package/build/dts/types/identities/shareholderPhysical.d.ts +9 -0
  130. package/build/dts/types/identities/tosAgreements.d.ts +10 -0
  131. package/build/dts/types/identities/transactionalProfileServices.d.ts +10 -0
  132. package/build/dts/types/identities/verificationError.d.ts +10 -0
  133. package/build/dts/types/identities/vulnerableActivity.d.ts +10 -0
  134. package/build/dts/types/index.d.ts +3 -0
  135. package/build/dts/types/queries/accountQuery.d.ts +4 -0
  136. package/build/dts/types/queries/alertQuery.d.ts +12 -0
  137. package/build/dts/types/queries/apiKeyQuery.d.ts +4 -0
  138. package/build/dts/types/queries/balanceEntryQuery.d.ts +5 -0
  139. package/build/dts/types/queries/billPaymentQuery.d.ts +4 -0
  140. package/build/dts/types/queries/bridgeAccountQuery.d.ts +4 -0
  141. package/build/dts/types/queries/bridgeBankAccountQuery.d.ts +4 -0
  142. package/build/dts/types/queries/bridgeQuery.d.ts +7 -0
  143. package/build/dts/types/queries/bridgeTransactionQuery.d.ts +6 -0
  144. package/build/dts/types/queries/cardTransactionQuery.d.ts +4 -0
  145. package/build/dts/types/queries/cardsQuery.d.ts +4 -0
  146. package/build/dts/types/queries/depositQuery.d.ts +5 -0
  147. package/build/dts/types/queries/index.d.ts +26 -0
  148. package/build/dts/types/queries/partnerQuery.d.ts +4 -0
  149. package/build/dts/types/queries/postalCodeQuery.d.ts +4 -0
  150. package/build/dts/types/queries/queryParams.d.ts +15 -0
  151. package/build/dts/types/queries/statementQuery.d.ts +6 -0
  152. package/build/dts/types/queries/transactionQuery.d.ts +4 -0
  153. package/build/dts/types/queries/transferQuery.d.ts +7 -0
  154. package/build/dts/types/queries/userQuery.d.ts +11 -0
  155. package/build/dts/types/queries/userReportQuery.d.ts +4 -0
  156. package/build/dts/types/queries/walletQuery.d.ts +4 -0
  157. package/build/dts/types/queries/walletTransactionQuery.d.ts +4 -0
  158. package/build/errors/index.cjs +10 -0
  159. package/build/errors/index.mjs +10 -1
  160. package/build/index.cjs +1305 -2894
  161. package/build/index.mjs +1307 -2895
  162. package/build/jwt/index.cjs +11 -8
  163. package/build/jwt/index.mjs +11 -8
  164. package/build/requests/index.cjs +4 -22
  165. package/build/requests/index.mjs +2 -26
  166. package/build/types/index.cjs +18 -56
  167. package/build/types/index.mjs +9 -34
  168. package/build/umd/cuenca.umd.js +1 -1
  169. package/build/vulnerableActivity-61dc2846.mjs +278 -0
  170. package/build/vulnerableActivity-d5aed4a7.cjs +299 -0
  171. package/build/walletTransactionRequest-aab46c5e.cjs +461 -0
  172. package/build/walletTransactionRequest-dc11fc69.mjs +433 -0
  173. package/errors/index.d.ts +1 -0
  174. package/jwt/index.d.ts +1 -0
  175. package/package.json +26 -8
  176. package/requests/index.d.ts +1 -0
  177. package/types/index.d.ts +1 -0
  178. package/build/data-1fd00e5c.mjs +0 -1199
  179. package/build/data-72c37b60.cjs +0 -1240
  180. package/build/vulnerableActivity-7cc1734f.cjs +0 -867
  181. package/build/vulnerableActivity-bd344332.mjs +0 -831
  182. package/build/walletTransactionRequest-05d5305a.mjs +0 -1512
  183. package/build/walletTransactionRequest-c6a5c64d.cjs +0 -1539
@@ -1,1512 +0,0 @@
1
- import { ValidationError } from './errors/index.mjs';
2
- import { d as dateToUTC, e as enumValueFromString, w as VerificationType } from './data-1fd00e5c.mjs';
3
-
4
- class BaseRequest {
5
- toObject() {
6
- return {};
7
- }
8
-
9
- toCleanObject() {
10
- const obj = this.toObject();
11
- Object.keys(obj).forEach((k) => {
12
- if (obj[k] == null) delete obj[k];
13
- });
14
- return obj;
15
- }
16
- }
17
-
18
- class ApiKeyUpdateRequest extends BaseRequest {
19
- constructor(userId, metadata) {
20
- super();
21
- this.userId = userId;
22
- this.metadata = metadata;
23
- }
24
-
25
- toObject() {
26
- return {
27
- user_id: this.userId,
28
- metadata: this.metadata,
29
- };
30
- }
31
- }
32
-
33
- class AlertUpdateRequest extends BaseRequest {
34
- constructor({
35
- accountNumber,
36
- actualPeriodCount,
37
- actualPeriodSum,
38
- agent,
39
- aggregationType,
40
- changeLog,
41
- committeeMeetingDate,
42
- comments,
43
- createdAt,
44
- description,
45
- id,
46
- institutionName,
47
- level,
48
- manualScenario,
49
- name,
50
- period,
51
- periodNumber,
52
- status,
53
- sourceType,
54
- transactionDate,
55
- type,
56
- typeOfFilter,
57
- updatedAt,
58
- userId,
59
- } = {}) {
60
- super();
61
- this.accountNumber = accountNumber;
62
- this.actualPeriodCount = actualPeriodCount;
63
- this.actualPeriodSum = actualPeriodSum;
64
- this.agent = agent;
65
- this.aggregationType = aggregationType;
66
- this.changeLog = changeLog;
67
- this.committeeMeetingDate = committeeMeetingDate;
68
- this.createdAt = createdAt;
69
- this.comments = comments;
70
- this.description = description;
71
- this.id = id;
72
- this.institutionName = institutionName;
73
- this.level = level;
74
- this.name = name;
75
- this.manualScenario = manualScenario;
76
- this.period = period;
77
- this.periodNumber = periodNumber;
78
- this.status = status;
79
- this.sourceType = sourceType;
80
- this.transactionDate = transactionDate;
81
- this.type = type;
82
- this.typeOfFilter = typeOfFilter;
83
- this.updatedAt = updatedAt;
84
- this.userId = userId;
85
- }
86
-
87
- toObject() {
88
- return {
89
- agent: this.agent,
90
- change_log: this.changeLog,
91
- comments: this.comments,
92
- description: this.description,
93
- id: this.id,
94
- level: this.level,
95
- name: this.name,
96
- period: this.period,
97
- status: this.status,
98
- type: this.type,
99
- account_number: this.accountNumber,
100
- actual_period_count: this.actualPeriodCount,
101
- actual_period_sum: this.actualPeriodSum,
102
- aggregation_type: this.aggregationType,
103
- committee_meeting_date: this.committeeMeetingDate,
104
- created_at: this.createdAt,
105
- institution_name: this.institutionName,
106
- manual_scenario: this.manualScenario,
107
- period_number: this.periodNumber,
108
- transaction_date: this.transactionDate,
109
- source_type: this.sourceType,
110
- type_of_filter: this.typeOfFilter,
111
- updated_at: this.updatedAt,
112
- user_id: this.userId,
113
- };
114
- }
115
- }
116
-
117
- class ArpcRequest extends BaseRequest {
118
- constructor({
119
- arpcMethod,
120
- arqc,
121
- number,
122
- panSequence,
123
- responseCode,
124
- transactionCounter,
125
- transactionData,
126
- trackDataMethod,
127
- uniqueNumber,
128
- }) {
129
- super();
130
- this.arpcM = arpcMethod;
131
- this.arqc = arqc;
132
- this.num = number;
133
- this.panSequence = panSequence;
134
- this.responseCode = responseCode;
135
- this.transactionCounter = transactionCounter;
136
- this.transactionData = transactionData;
137
- this.trackDataMethod = trackDataMethod;
138
- this.uniqueNumber = uniqueNumber;
139
- }
140
-
141
- get number() {
142
- return this._number;
143
- }
144
-
145
- set num(value) {
146
- if (!value) return;
147
- const validations = [!!value, value.length === 16, /^\d{16}/.test(value)];
148
- if (validations.some((x) => !x)) {
149
- throw new ValidationError('Invalid number');
150
- }
151
- this._number = value;
152
- }
153
-
154
- get arpcMethod() {
155
- return this._arpcMethod;
156
- }
157
-
158
- set arpcM(value) {
159
- if (!value) return;
160
- const validations = [value.length === 1];
161
- if (validations.some((x) => !x)) {
162
- throw new ValidationError('Invalid method');
163
- }
164
- this._arpcMethod = value;
165
- }
166
-
167
- toObject() {
168
- return {
169
- arpc_method: this.arpcMethod,
170
- arqc: this.arqc,
171
- number: this.number,
172
- pan_sequence: this.panSequence,
173
- response_code: this.responseCode,
174
- transaction_counter: this.transactionCounter,
175
- transaction_data: this.transactionData,
176
- track_data_method: this.trackDataMethod,
177
- unique_number: this.uniqueNumber,
178
- };
179
- }
180
- }
181
-
182
- class CardRequest extends BaseRequest {
183
- constructor(userId, issuer, fundingType) {
184
- super();
185
- this.userId = userId;
186
- this.issuer = issuer;
187
- this.fundingType = fundingType;
188
- }
189
-
190
- toObject() {
191
- return {
192
- user_id: this.userId,
193
- issuer: this.issuer,
194
- funding_type: this.fundingType,
195
- };
196
- }
197
- }
198
-
199
- class CardUpdateRequest extends BaseRequest {
200
- constructor(status, pinBlock) {
201
- super();
202
- this.status = status;
203
- this.pinBlock = pinBlock;
204
- }
205
-
206
- toObject() {
207
- return {
208
- status: this.status,
209
- pin_block: this.pinBlock,
210
- };
211
- }
212
- }
213
-
214
- class CardActivationRequest extends BaseRequest {
215
- constructor(number, expMonth, expYear, cvv2) {
216
- super();
217
- this.n = number;
218
- this.eM = expMonth;
219
- this.eY = expYear;
220
- this.c2 = cvv2;
221
- }
222
-
223
- get number() {
224
- return this._number;
225
- }
226
-
227
- set n(value) {
228
- const validations = [!!value, value.length === 16, /^\d{16}/.test(value)];
229
- if (validations.some((x) => !x)) {
230
- throw new ValidationError('Invalid number');
231
- }
232
- this._number = value.trim();
233
- }
234
-
235
- get expMonth() {
236
- return this._expMonth;
237
- }
238
-
239
- set eM(value) {
240
- const validations = [!!value, value >= 1, value <= 12];
241
- if (validations.some((x) => !x)) {
242
- throw new ValidationError('Invalid expiration month');
243
- }
244
- this._expMonth = value;
245
- }
246
-
247
- get expYear() {
248
- return this._expYear;
249
- }
250
-
251
- set eY(value) {
252
- const validations = [!!value, value >= 18, value <= 99];
253
- if (validations.some((x) => !x)) {
254
- throw new ValidationError('Invalid expiration year');
255
- }
256
- this._expYear = value;
257
- }
258
-
259
- get cvv2() {
260
- return this._cvv2;
261
- }
262
-
263
- set c2(value) {
264
- const validations = [!!value, value.length === 3, /^\d{3}/.test(value)];
265
- if (validations.some((x) => !x)) {
266
- throw new ValidationError('Invalid cvv2');
267
- }
268
- this._cvv2 = value;
269
- }
270
-
271
- toObject() {
272
- return {
273
- number: this.number,
274
- exp_month: this.expMonth,
275
- exp_year: this.expYear,
276
- cvv2: this.cvv2,
277
- };
278
- }
279
- }
280
-
281
- class CardValidationRequest extends BaseRequest {
282
- constructor({
283
- cvv,
284
- cvv2,
285
- expMonth,
286
- expYear,
287
- icvv,
288
- number,
289
- pinBlock,
290
- pinAttemptsExceeded,
291
- }) {
292
- super();
293
- this.c = cvv;
294
- this.c2 = cvv2;
295
- this.em = expMonth;
296
- this.ey = expYear;
297
- this.ic = icvv;
298
- this.n = number;
299
- this.pinBloc = pinBlock;
300
- this.pinAttemptsExceeded = pinAttemptsExceeded;
301
- }
302
-
303
- get cvv() {
304
- return this._cvv;
305
- }
306
-
307
- set c(value) {
308
- if (!value) return;
309
- const validations = [value.length === 3];
310
- if (validations.some((x) => !x)) {
311
- throw new ValidationError('Invalid cvv');
312
- }
313
- this._cvv = value;
314
- }
315
-
316
- get cvv2() {
317
- return this._cvv2;
318
- }
319
-
320
- set c2(value) {
321
- if (!value) return;
322
- const validations = [value.length === 3];
323
- if (validations.some((x) => !x)) {
324
- throw new ValidationError('Invalid cvv2');
325
- }
326
- this._cvv2 = value;
327
- }
328
-
329
- get expMonth() {
330
- return this._expMonth;
331
- }
332
-
333
- set em(value) {
334
- if (!value) return;
335
- const validations = [value >= 1, value <= 12];
336
- if (validations.some((x) => !x)) {
337
- throw new ValidationError('Invalid expiration month');
338
- }
339
- this._expMonth = value;
340
- }
341
-
342
- get expYear() {
343
- return this._expYear;
344
- }
345
-
346
- set ey(value) {
347
- if (!value) return;
348
- const validations = [value >= 18, value <= 99];
349
- if (validations.some((x) => !x)) {
350
- throw new ValidationError('Invalid expiration year');
351
- }
352
- this._expYear = value;
353
- }
354
-
355
- get icvv() {
356
- return this._icvv;
357
- }
358
-
359
- set ic(value) {
360
- if (!value) return;
361
- const validations = [value.length === 3];
362
- if (validations.some((x) => !x)) {
363
- throw new ValidationError('Invalid icvv');
364
- }
365
- this._icvv = value;
366
- }
367
-
368
- get number() {
369
- return this._number;
370
- }
371
-
372
- set n(value) {
373
- const validations = [!!value, value.length === 16, /^\d{16}/.test(value)];
374
- if (validations.some((x) => !x)) {
375
- throw new ValidationError('Invalid number');
376
- }
377
- this._number = value;
378
- }
379
-
380
- toObject() {
381
- return {
382
- cvv: this.cvv,
383
- cvv2: this.cvv2,
384
- exp_month: this.expMonth,
385
- exp_year: this.expYear,
386
- icvv: this.icvv,
387
- number: this.number,
388
- pin_block: this.pinBloc,
389
- pin_attempts_exceeded: this.pinAttemptsExceeded,
390
- };
391
- }
392
- }
393
-
394
- class KYCValidationsRequest extends BaseRequest {
395
- constructor({ userId, force, isBridge = false }) {
396
- super();
397
- this.force = force;
398
- this.userId = userId;
399
- this.isBridge = isBridge;
400
- }
401
-
402
- toObject() {
403
- return {
404
- force: this.force,
405
- [this.isBridge ? 'account_id' : 'user_id']: this.userId,
406
- };
407
- }
408
- }
409
-
410
- class AddressUpdateRequest extends BaseRequest {
411
- constructor({
412
- city,
413
- colonia,
414
- country,
415
- extNumber,
416
- fullName,
417
- intNumber,
418
- postalCode,
419
- postalCodeId,
420
- state,
421
- street,
422
- } = {}) {
423
- super();
424
- this.city = city;
425
- this.colonia = colonia;
426
- this.country = country;
427
- this.extNumber = extNumber;
428
- this.fullName = fullName;
429
- this.intNumber = intNumber;
430
- this.postalCode = postalCode;
431
- this.postalCodeId = postalCodeId;
432
- this.state = state;
433
- this.street = street;
434
- }
435
-
436
- toObject() {
437
- return {
438
- city: this.city,
439
- colonia: this.colonia,
440
- country: this.country,
441
- ext_number: this.extNumber,
442
- full_name: this.fullName,
443
- int_number: this.intNumber,
444
- postal_code: this.postalCode,
445
- postal_code_id: this.postalCodeId,
446
- state: this.state,
447
- street: this.street,
448
- };
449
- }
450
- }
451
-
452
- class TransactionalProfileServicesRequest extends BaseRequest {
453
- constructor({
454
- speiTransfersNum,
455
- speiTransfersAmount,
456
- internalTransfersNum,
457
- internalTransfersAmount,
458
- }) {
459
- super();
460
- this.speiTransfersNum = speiTransfersNum;
461
- this.speiTransfersAmount = speiTransfersAmount;
462
- this.internalTransfersNum = internalTransfersNum;
463
- this.internalTransfersAmount = internalTransfersAmount;
464
- }
465
-
466
- toObject() {
467
- return {
468
- spei_transfers_num: this.speiTransfersNum,
469
- spei_transfers_amount: this.speiTransfersAmount,
470
- internal_transfers_num: this.internalTransfersNum,
471
- internal_transfers_amount: this.internalTransfersAmount,
472
- };
473
- }
474
- }
475
-
476
- class TransactionalProfileRequest {
477
- constructor({
478
- currency,
479
- monthlyAmount,
480
- recipientsNum,
481
- payersNum,
482
- deposits,
483
- withdrawal,
484
- }) {
485
- this.currency = currency;
486
- this.monthlyAmount = monthlyAmount;
487
-
488
- this.recipientsNum = recipientsNum;
489
- this.payersNum = payersNum;
490
-
491
- this.deposits = deposits;
492
- this.withdrawal = withdrawal;
493
- }
494
-
495
- get deposits() {
496
- return this._deposits;
497
- }
498
-
499
- set deposits(value) {
500
- if (!value) return;
501
- this._deposits = new TransactionalProfileServicesRequest(value).toObject();
502
- }
503
-
504
- get withdrawal() {
505
- return this._withdrawal;
506
- }
507
-
508
- set withdrawal(value) {
509
- if (!value) return;
510
- this._withdrawal = new TransactionalProfileServicesRequest(
511
- value,
512
- ).toObject();
513
- }
514
-
515
- toObject() {
516
- return {
517
- currency: this.currency,
518
- monthly_amount: this.monthlyAmount,
519
- recipients_num: this.recipientsNum,
520
- payers_num: this.payersNum,
521
- deposits: this.deposits,
522
- withdrawal: this.withdrawal,
523
- };
524
- }
525
- }
526
-
527
- class BusinessDetailsRequest extends BaseRequest {
528
- constructor({ accountUsageDescription, businessDescription }) {
529
- super();
530
- this.accountUsageDescription = accountUsageDescription;
531
- this.businessDescription = businessDescription;
532
- }
533
-
534
- toObject() {
535
- return {
536
- account_usage_description: this.accountUsageDescription,
537
- business_description: this.businessDescription,
538
- };
539
- }
540
- }
541
-
542
- class ShareholderPhysicalRequest extends BaseRequest {
543
- constructor({
544
- names,
545
- curp,
546
- rfc,
547
- firstSurname,
548
- percentage,
549
- secondSurname,
550
- shareCapital,
551
- }) {
552
- super();
553
- this.names = names;
554
- this.curp = curp;
555
- this.percentage = percentage;
556
- this.rfc = rfc;
557
- this.shareCapital = shareCapital;
558
- this.firstSurname = firstSurname;
559
- this.secondSurname = secondSurname;
560
- }
561
-
562
- toObject() {
563
- return {
564
- curp: this.curp,
565
- names: this.names,
566
- percentage: this.percentage,
567
- rfc: this.rfc,
568
- share_capital: this.shareCapital,
569
- first_surname: this.firstSurname,
570
- second_surname: this.secondSurname,
571
- };
572
- }
573
- }
574
-
575
- class LegalRepresentativesRequest extends ShareholderPhysicalRequest {
576
- constructor({
577
- address,
578
- curp,
579
- emailAddress,
580
- firstSurname,
581
- job,
582
- names,
583
- percentage,
584
- phoneNumber,
585
- rfc,
586
- secondSurname,
587
- }) {
588
- super({ curp, firstSurname, names, percentage, rfc, secondSurname });
589
- this.job = job;
590
- this.phoneNumber = phoneNumber;
591
- this.emailAddress = emailAddress;
592
- this.address = address;
593
- }
594
-
595
- get address() {
596
- return this._address;
597
- }
598
-
599
- set address(value) {
600
- if (!value) return;
601
- this._address = new AddressUpdateRequest(value).toCleanObject();
602
- }
603
-
604
- toObject() {
605
- return {
606
- ...super.toObject(),
607
- job: this.job,
608
- phone_number: this.phoneNumber,
609
- email_address: this.emailAddress,
610
- address: this.address,
611
- };
612
- }
613
- }
614
-
615
- class ShareholderMoralRequest extends BaseRequest {
616
- constructor({ name, percentage, shareholders, legalRepresentatives }) {
617
- super();
618
- this.name = name;
619
- this.percentage = percentage;
620
- this.shareholders = shareholders;
621
- this.legalRepresentatives = legalRepresentatives;
622
- }
623
-
624
- get shareholders() {
625
- return this._shareholders;
626
- }
627
-
628
- set shareholders(value) {
629
- if (!value) return;
630
- this._shareholders = value.map((sh) =>
631
- new ShareholderPhysicalRequest(sh).toObject(),
632
- );
633
- }
634
-
635
- get legalRepresentatives() {
636
- return this._legalRepresentatives;
637
- }
638
-
639
- set legalRepresentatives(value) {
640
- if (!value) return;
641
- this._legalRepresentatives = value.map((lr) =>
642
- new LegalRepresentativesRequest(lr).toObject(),
643
- );
644
- }
645
-
646
- toObject() {
647
- return {
648
- name: this.name,
649
- percentage: this.percentage,
650
- shareholders: this.shareholders,
651
- legal_representatives: this.legalRepresentatives,
652
- };
653
- }
654
- }
655
-
656
- class VulnerableActivityRequest extends BaseRequest {
657
- constructor({
658
- isVulnerableActivity,
659
- hasSatRegister,
660
- satRegisteredDate,
661
- isInCompliance,
662
- }) {
663
- super();
664
- this.isVulnerableActivity = isVulnerableActivity;
665
- this.hasSatRegister = hasSatRegister;
666
- this.satRegisteredDate = satRegisteredDate;
667
- this.isInCompliance = isInCompliance;
668
- }
669
-
670
- toObject() {
671
- return {
672
- is_vulnerable_activity: this.isVulnerableActivity,
673
- has_sat_register: this.hasSatRegister,
674
- sat_registered_date: this.satRegisteredDate,
675
- is_in_compliance: this.isInCompliance,
676
- };
677
- }
678
- }
679
-
680
- class LicenseRequest extends BaseRequest {
681
- constructor({
682
- licenseRequired,
683
- supervisoryEntity,
684
- licenseType,
685
- licenseDate,
686
- }) {
687
- super();
688
- this.licenseRequired = licenseRequired;
689
- this.supervisoryEntity = supervisoryEntity;
690
- this.licenseType = licenseType;
691
- this.licenseDate = licenseDate;
692
- }
693
-
694
- toObject() {
695
- return {
696
- license_required: this.licenseRequired,
697
- supervisory_entity: this.supervisoryEntity,
698
- license_type: this.licenseType,
699
- license_date: this.licenseDate,
700
- };
701
- }
702
- }
703
-
704
- class AuditRequest extends BaseRequest {
705
- constructor({ hasAudit, auditProvider, auditDate, auditComments }) {
706
- super();
707
- this.hasAudit = hasAudit;
708
- this.auditProvider = auditProvider;
709
- this.auditDate = auditDate;
710
- this.auditComments = auditComments;
711
- }
712
-
713
- toObject() {
714
- return {
715
- has_audit: this.hasAudit,
716
- audit_provider: this.auditProvider,
717
- audit_date: this.auditDate,
718
- audit_comments: this.auditComments,
719
- };
720
- }
721
- }
722
-
723
- class PartnerUserRequest extends BaseRequest {
724
- constructor({
725
- address,
726
- audit,
727
- businessDetails,
728
- businessName,
729
- clabe,
730
- createdAt,
731
- documentationUrl,
732
- emailAddress,
733
- externalAccount,
734
- folio,
735
- id,
736
- incorporationDate,
737
- legalName,
738
- legalRepresentatives,
739
- level,
740
- license,
741
- meta,
742
- nationality,
743
- phoneNumber,
744
- platformId,
745
- requiredLevel,
746
- rfc,
747
- shareholders,
748
- status,
749
- transactionalProfile,
750
- updatedAt,
751
- userId,
752
- userType,
753
- vulnerableActivity,
754
- webSite,
755
- } = {}) {
756
- super();
757
- this.addressRequest = address;
758
- this.auditRequest = audit;
759
- this.businessDetailsRequest = businessDetails;
760
- this.businessName = businessName;
761
- this.clabe = clabe;
762
- this.createdAt = createdAt;
763
- this.documentationUrl = documentationUrl;
764
- this.emailAddress = emailAddress;
765
- this.externalAccountRequest = externalAccount;
766
- this.folio = folio;
767
- this.id = id;
768
- this.incorporationDate = incorporationDate;
769
- this.legalName = legalName;
770
- this.legalRepresentativesRequest = legalRepresentatives;
771
- this.level = level;
772
- this.licenseRequest = license;
773
- this.meta = meta;
774
- this.nationality = nationality;
775
- this.phoneNumber = phoneNumber;
776
- this.platformId = platformId;
777
- this.requiredLevel = requiredLevel;
778
- this.rfc = rfc;
779
- this.shareholdersRequest = shareholders;
780
- this.status = status;
781
- this.transactionalProfileRequest = transactionalProfile;
782
- this.updatedAt = updatedAt;
783
- this.userId = userId;
784
- this.userType = userType;
785
- this.vulnerableActivityRequest = vulnerableActivity;
786
- this.webSite = webSite;
787
- }
788
-
789
- get address() {
790
- return this._address;
791
- }
792
-
793
- set addressRequest(value) {
794
- if (!value) return;
795
- this._address = new AddressUpdateRequest(value).toCleanObject();
796
- }
797
-
798
- get audit() {
799
- return this._audit;
800
- }
801
-
802
- set auditRequest(value) {
803
- if (!value) return;
804
- this._audit = new AuditRequest(value).toObject();
805
- }
806
-
807
- get businessDetails() {
808
- return this._businessDetails;
809
- }
810
-
811
- set businessDetailsRequest(value) {
812
- if (!value) return;
813
- this._businessDetails = new BusinessDetailsRequest(value).toObject();
814
- }
815
-
816
- get legalRepresentatives() {
817
- return this._legalRepresentatives;
818
- }
819
-
820
- set legalRepresentativesRequest(value) {
821
- if (!value) return;
822
- this._legalRepresentatives = value.map((lr) =>
823
- new LegalRepresentativesRequest(lr).toObject(),
824
- );
825
- }
826
-
827
- get license() {
828
- return this._license;
829
- }
830
-
831
- set licenseRequest(value) {
832
- if (!value) return;
833
- this._license = new LicenseRequest(value).toObject();
834
- }
835
-
836
- get shareholders() {
837
- return this._shareholders;
838
- }
839
-
840
- set shareholdersRequest(value) {
841
- if (!value) return;
842
- this._shareholders = value.map((sh) =>
843
- new ShareholderMoralRequest(sh).toObject(),
844
- );
845
- }
846
-
847
- get transactionalProfile() {
848
- return this._transactionalProfile;
849
- }
850
-
851
- set transactionalProfileRequest(value) {
852
- if (!value) return;
853
- this._transactionalProfile = new TransactionalProfileRequest(
854
- value,
855
- ).toObject();
856
- }
857
-
858
- get vulnerableActivity() {
859
- return this._vulnerableActivity;
860
- }
861
-
862
- set vulnerableActivityRequest(value) {
863
- if (!value) return;
864
- this._vulnerableActivity = new VulnerableActivityRequest(value).toObject();
865
- }
866
-
867
- get externalAccount() {
868
- return this._externalAccount;
869
- }
870
-
871
- set externalAccountRequest(value) {
872
- if (!value) return;
873
- this._externalAccount = {
874
- account: value.account,
875
- bank: value.bank,
876
- };
877
- }
878
-
879
- toObject() {
880
- return {
881
- address: this.address,
882
- audit: this.audit,
883
- business_details: this.businessDetails,
884
- business_name: this.businessName,
885
- clabe: this.clabe,
886
- created_at: this.createdAt,
887
- documentation_url: this.documentationUrl,
888
- email_address: this.emailAddress,
889
- external_account: this.externalAccount,
890
- folio: this.folio,
891
- id: this.id,
892
- incorporation_date: this.incorporationDate,
893
- legal_name: this.legalName,
894
- legal_representatives: this.legalRepresentatives,
895
- level: this.level,
896
- license: this.license,
897
- meta: this.meta,
898
- nationality: this.nationality,
899
- phone_number: this.phoneNumber,
900
- platform_id: this.platformId,
901
- required_level: this.requiredLevel,
902
- rfc: this.rfc,
903
- shareholders: this.shareholders,
904
- status: this.status,
905
- transactional_profile: this.transactionalProfile,
906
- updated_at: this.updatedAt,
907
- user_id: this.userId,
908
- user_type: this.userType,
909
- vulnerable_activity: this.vulnerableActivity,
910
- web_site: this.webSite,
911
- };
912
- }
913
- }
914
-
915
- class ReportGenerateRequest extends BaseRequest {
916
- constructor({ committeeMeetingDate } = {}) {
917
- super();
918
- this.committeeMeetingDate = committeeMeetingDate;
919
- }
920
-
921
- toObject() {
922
- return {
923
- committee_meeting_date: this.committeeMeetingDate,
924
- };
925
- }
926
- }
927
-
928
- class SavingRequest extends BaseRequest {
929
- constructor(category, goalAmount, goalDate, name) {
930
- super();
931
- this.category = category;
932
- this.name = name;
933
- this.goalAmount = goalAmount;
934
- this.validDate = goalDate;
935
- }
936
-
937
- get goalDate() {
938
- return this._goalDate;
939
- }
940
-
941
- set validDate(value) {
942
- if (!value) return;
943
- if (dateToUTC(value).getTime() <= dateToUTC(Date.now()).getTime()) {
944
- throw new ValidationError(
945
- 'The goal_date always need to be higher than now',
946
- );
947
- }
948
- this._goalDate = value;
949
- }
950
-
951
- toObject() {
952
- return {
953
- category: this.category,
954
- goal_amount: this.goalAmount,
955
- goal_date: this.goalDate,
956
- name: this.name,
957
- };
958
- }
959
- }
960
-
961
- class SessionRequest extends BaseRequest {
962
- constructor({ failureUrl, successUrl, type, userId, isBridge = false }) {
963
- super();
964
- this.failureUrl = failureUrl;
965
- this.successUrl = successUrl;
966
- this.type = type;
967
- this.userId = userId;
968
- this.isBridge = isBridge;
969
- }
970
-
971
- toObject() {
972
- return {
973
- failure_url: this.failureUrl,
974
- success_url: this.successUrl,
975
- type: this.type,
976
- [this.isBridge ? 'account_id' : 'user_id']: this.userId,
977
- };
978
- }
979
- }
980
-
981
- class FraudFundsTransferRequest extends BaseRequest {
982
- constructor({ userId, amount, concepto, clabe, reason, bankCode }) {
983
- super();
984
- this.userId = userId;
985
- this.amount = amount;
986
- this.concepto = concepto;
987
- this.clabe = clabe;
988
- this.reason = reason;
989
- this.bankCode = bankCode;
990
- }
991
-
992
- toObject() {
993
- return {
994
- user_id: this.userId,
995
- amount: this.amount,
996
- concepto: this.concepto,
997
- clabe: this.clabe,
998
- reason: this.reason,
999
- bank_code: this.bankCode,
1000
- };
1001
- }
1002
- }
1003
-
1004
- class TransferRequest extends BaseRequest {
1005
- constructor(
1006
- accountNumber,
1007
- amount,
1008
- descriptor,
1009
- idempotencyKey,
1010
- recipientName,
1011
- ) {
1012
- super();
1013
- this.accountNumber = accountNumber;
1014
- this.amount = amount;
1015
- this.descriptor = descriptor;
1016
- this.idempotencyKey = idempotencyKey;
1017
- this.recipientName = recipientName;
1018
- }
1019
-
1020
- toObject() {
1021
- return {
1022
- account_number: this.accountNumber,
1023
- amount: this.amount,
1024
- descriptor: this.descriptor,
1025
- idempotency_key: this.idempotencyKey,
1026
- recipient_name: this.recipientName,
1027
- };
1028
- }
1029
- }
1030
-
1031
- const VALID_STATUSES = ['succeeded', 'failed'];
1032
-
1033
- class TransferUpdateRequest extends BaseRequest {
1034
- constructor({ status } = {}) {
1035
- super();
1036
- if (!status || !VALID_STATUSES.includes(status)) {
1037
- throw new Error(
1038
- `Invalid status: "${status}". Must be one of: ${VALID_STATUSES.join(
1039
- ', ',
1040
- )}`,
1041
- );
1042
- }
1043
- this.status = status;
1044
- }
1045
-
1046
- toObject() {
1047
- return {
1048
- status: this.status,
1049
- };
1050
- }
1051
- }
1052
-
1053
- class UserCredentialRequest extends BaseRequest {
1054
- constructor(password) {
1055
- super();
1056
- this.pwd = password;
1057
- }
1058
-
1059
- get password() {
1060
- return this._password;
1061
- }
1062
-
1063
- set pwd(value) {
1064
- const validations = [!!value, value.length >= 6];
1065
- if (validations.some((x) => !x)) {
1066
- throw new ValidationError('Invalid password');
1067
- }
1068
- this._password = value;
1069
- }
1070
-
1071
- toObject() {
1072
- return {
1073
- password: this.password,
1074
- };
1075
- }
1076
- }
1077
-
1078
- class UserCredentialUpdateRequest extends BaseRequest {
1079
- constructor(password, isActive) {
1080
- super();
1081
- this.pwd = password;
1082
- this.isActive = isActive;
1083
- this.req = {
1084
- password: this.password,
1085
- isActive: this.isActive,
1086
- };
1087
- }
1088
-
1089
- get password() {
1090
- return this._password;
1091
- }
1092
-
1093
- get request() {
1094
- return this._request;
1095
- }
1096
-
1097
- set pwd(value) {
1098
- if (!value) {
1099
- this._password = value;
1100
- return;
1101
- }
1102
- const validations = [value.length >= 6];
1103
- if (validations.some((x) => !x)) {
1104
- throw new ValidationError('Invalid password');
1105
- }
1106
- this._password = value;
1107
- }
1108
-
1109
- set req(value) {
1110
- if (value.password && value.isActive != null) {
1111
- throw new ValidationError('Only one property can be updated at a time');
1112
- }
1113
- this._request = value;
1114
- }
1115
-
1116
- toObject() {
1117
- return {
1118
- password: this.request.password,
1119
- is_active: this.request.isActive,
1120
- };
1121
- }
1122
-
1123
- toCleanObject() {
1124
- const obj = this.toObject();
1125
- Object.keys(obj).forEach((k) => {
1126
- if (k === 'password' && obj[k] === null) {
1127
- return;
1128
- }
1129
- if (obj[k] == null) {
1130
- delete obj[k];
1131
- }
1132
- });
1133
- return obj;
1134
- }
1135
- }
1136
-
1137
- class UserLoginRequest extends BaseRequest {
1138
- constructor(password, userId = 'me') {
1139
- super();
1140
- this.pwd = password;
1141
- this.userId = userId;
1142
- }
1143
-
1144
- get password() {
1145
- return this._password;
1146
- }
1147
-
1148
- set pwd(value) {
1149
- const validations = [!!value, value.length === 6, /^\d{6}$/.test(value)];
1150
- if (validations.some((x) => !x)) {
1151
- throw new ValidationError('Invalid password');
1152
- }
1153
- this._password = value;
1154
- }
1155
-
1156
- toObject() {
1157
- return {
1158
- password: this.password,
1159
- user_id: this.userId,
1160
- };
1161
- }
1162
- }
1163
-
1164
- class UserReportCreateRequest extends BaseRequest {
1165
- constructor({ committeeMeetingDate, userId } = {}) {
1166
- super();
1167
- this.committeeMeetingDate = committeeMeetingDate;
1168
- this.userId = userId;
1169
- }
1170
-
1171
- toObject() {
1172
- return {
1173
- committee_meeting_date: this.committeeMeetingDate,
1174
- user_id: this.userId,
1175
- };
1176
- }
1177
- }
1178
-
1179
- class UserReportUpdateRequest extends BaseRequest {
1180
- constructor({
1181
- actividadEconomica,
1182
- apellidoMaternoContraparte,
1183
- apellidoPaternoContraparte,
1184
- ciudadPoblacion,
1185
- colonia,
1186
- cuentaClabeContraparte,
1187
- descripcionOperacion,
1188
- entidadFederativaDomicilio,
1189
- institucionFinancieraContraparte,
1190
- instrumentoMonetario,
1191
- mainAlertId,
1192
- nacionalidadCuentaContraparte,
1193
- nivelCuenta,
1194
- nombreContraparte,
1195
- paisNacionalidad,
1196
- prioridadReporte,
1197
- razonDenominacionContraparte,
1198
- razonInusual,
1199
- tipoOperacionItf,
1200
- tipoOperacionPerfil,
1201
- tipoPersonaContraparte,
1202
- } = {}) {
1203
- super();
1204
- this.actividadEconomica = actividadEconomica;
1205
- this.apellidoMaternoContraparte = apellidoMaternoContraparte;
1206
- this.apellidoPaternoContraparte = apellidoPaternoContraparte;
1207
- this.ciudadPoblacion = ciudadPoblacion;
1208
- this.colonia = colonia;
1209
- this.cuentaClabeContraparte = cuentaClabeContraparte;
1210
- this.descripcionOperacion = descripcionOperacion;
1211
- this.entidadFederativaDomicilio = entidadFederativaDomicilio;
1212
- this.institucionFinancieraContraparte = institucionFinancieraContraparte;
1213
- this.instrumentoMonetario = instrumentoMonetario;
1214
- this.mainAlertId = mainAlertId;
1215
- this.nacionalidadCuentaContraparte = nacionalidadCuentaContraparte;
1216
- this.nivelCuenta = nivelCuenta;
1217
- this.nombreContraparte = nombreContraparte;
1218
- this.paisNacionalidad = paisNacionalidad;
1219
- this.prioridadReporte = prioridadReporte;
1220
- this.razonDenominacionContraparte = razonDenominacionContraparte;
1221
- this.razonInusual = razonInusual;
1222
- this.tipoOperacionItf = tipoOperacionItf;
1223
- this.tipoOperacionPerfil = tipoOperacionPerfil;
1224
- this.tipoPersonaContraparte = tipoPersonaContraparte;
1225
- }
1226
-
1227
- toObject() {
1228
- return {
1229
- actividad_economica: this.actividadEconomica,
1230
- apellido_materno_contraparte: this.apellidoMaternoContraparte,
1231
- apellido_paterno_contraparte: this.apellidoPaternoContraparte,
1232
- ciudad_poblacion: this.ciudadPoblacion,
1233
- colonia: this.colonia,
1234
- cuenta_clabe_contraparte: this.cuentaClabeContraparte,
1235
- descripcion_operacion: this.descripcionOperacion,
1236
- entidad_federativa_domicilio: this.entidadFederativaDomicilio,
1237
- institucion_financiera_contraparte: this.institucionFinancieraContraparte,
1238
- instrumento_monetario: this.instrumentoMonetario,
1239
- main_alert_id: this.mainAlertId,
1240
- nacionalidad_cuenta_contraparte: this.nacionalidadCuentaContraparte,
1241
- nivel_cuenta: this.nivelCuenta,
1242
- nombre_contraparte: this.nombreContraparte,
1243
- pais_nacionalidad: this.paisNacionalidad,
1244
- prioridad_reporte: this.prioridadReporte,
1245
- razon_denominacion_contraparte: this.razonDenominacionContraparte,
1246
- razon_inusual: this.razonInusual,
1247
- tipo_operacion_itf: this.tipoOperacionItf,
1248
- tipo_operacion_perfil: this.tipoOperacionPerfil,
1249
- tipo_persona_contraparte: this.tipoPersonaContraparte,
1250
- };
1251
- }
1252
- }
1253
-
1254
- class TosUpdateRequest extends BaseRequest {
1255
- constructor({ ip, location, type, version }) {
1256
- super();
1257
- this.ipAddress = ip;
1258
- this.location = location;
1259
- this.type = type;
1260
- this.version = version;
1261
- }
1262
-
1263
- get ip() {
1264
- return this._ip;
1265
- }
1266
-
1267
- set ipAddress(value) {
1268
- if (!value) throw new ValidationError('missing ip address');
1269
- const ipBlocks = value.split('.');
1270
- const blocks = ipBlocks.every((block) => {
1271
- return block >= 0 && block <= 255;
1272
- });
1273
- if (blocks) {
1274
- this._ip = value;
1275
- } else {
1276
- throw new ValidationError('Invalid ip address');
1277
- }
1278
- }
1279
-
1280
- toObject() {
1281
- return {
1282
- ip: this.ip,
1283
- location: this.location,
1284
- type: this.type,
1285
- version: this.version,
1286
- };
1287
- }
1288
- }
1289
-
1290
- class KycFileRequest extends BaseRequest {
1291
- constructor({ data, isMx, status, type, uriBack, uriFront }) {
1292
- super();
1293
- this.data = data;
1294
- this.isMx = isMx;
1295
- this.status = status;
1296
- this.type = type;
1297
- this.uriBack = uriBack;
1298
- this.uriFront = uriFront;
1299
- }
1300
-
1301
- toObject() {
1302
- return {
1303
- data: this.data,
1304
- is_mx: this.isMx,
1305
- status: this.status,
1306
- type: this.type,
1307
- uri_back: this.uriBack,
1308
- uri_front: this.uriFront,
1309
- };
1310
- }
1311
- }
1312
- class UserUpdateRequest extends BaseRequest {
1313
- constructor({
1314
- address,
1315
- blacklistValidationStatus,
1316
- countryOfBirth,
1317
- curpDocumentUri,
1318
- fiscalRegimeCode,
1319
- govtId,
1320
- emailAddress,
1321
- isDormant,
1322
- isFraud,
1323
- isPldBlocked,
1324
- isSecurityMode,
1325
- profession,
1326
- proofOfAddress,
1327
- proofOfLife,
1328
- requiredLevel,
1329
- termsOfService,
1330
- phoneNumber,
1331
- rfc,
1332
- status,
1333
- userType,
1334
- verificationId,
1335
- }) {
1336
- super();
1337
- this.addressProofs = proofOfAddress;
1338
- this.adrs = address;
1339
- this.blacklistValidationStatus = blacklistValidationStatus;
1340
- this.countryOfBirth = countryOfBirth;
1341
- this.curpDocumentUri = curpDocumentUri;
1342
- this.emailAddress = emailAddress;
1343
- this.fiscalRegimeCode = fiscalRegimeCode;
1344
- this.govstIds = govtId;
1345
- this.isDormant = isDormant;
1346
- this.isFraud = isFraud;
1347
- this.isPldBlocked = isPldBlocked;
1348
- this.isSecurityMode = isSecurityMode;
1349
- this.lifeProofs = proofOfLife;
1350
- this.profession = profession;
1351
- this.phoneNumber = phoneNumber;
1352
- this.requiredLevel = requiredLevel;
1353
- this.termsOfService = termsOfService;
1354
- this.rfc = rfc;
1355
- this.status = status;
1356
- this.userType = userType;
1357
- this.verificationId = verificationId;
1358
- }
1359
-
1360
- get termsOfService() {
1361
- return this._termsOfService;
1362
- }
1363
-
1364
- set termsOfService(value) {
1365
- if (!value) return;
1366
- this._termsOfService = new TosUpdateRequest(value).toObject();
1367
- }
1368
-
1369
- get address() {
1370
- return this._address;
1371
- }
1372
-
1373
- set adrs(value) {
1374
- if (!value) return;
1375
- this._address = new AddressUpdateRequest(value).toCleanObject();
1376
- }
1377
-
1378
- get proofOfLife() {
1379
- return this._proofOfLife;
1380
- }
1381
-
1382
- set lifeProofs(value) {
1383
- if (!value) return;
1384
- this._proofOfLife = new KycFileRequest(value).toCleanObject();
1385
- }
1386
-
1387
- get proofOfAddress() {
1388
- return this._proofOfAddress;
1389
- }
1390
-
1391
- set addressProofs(value) {
1392
- if (!value) return;
1393
- this._proofOfAddress = new KycFileRequest(value).toCleanObject();
1394
- }
1395
-
1396
- get govtId() {
1397
- return this._govtId;
1398
- }
1399
-
1400
- set govstIds(value) {
1401
- if (!value) return;
1402
- this._govtId = new KycFileRequest(value).toCleanObject();
1403
- }
1404
-
1405
- toObject() {
1406
- return {
1407
- address: this.address,
1408
- blacklist_validation_status: this.blacklistValidationStatus,
1409
- country_of_birth: this.countryOfBirth,
1410
- curp_document_uri: this.curpDocumentUri,
1411
- email_address: this.emailAddress,
1412
- fiscal_regime_code: this.fiscalRegimeCode,
1413
- govt_id: this.govtId,
1414
- is_dormant: this.isDormant,
1415
- is_fraud: this.isFraud,
1416
- is_pld_blocked: this.isPldBlocked,
1417
- is_security_mode: this.isSecurityMode,
1418
- phone_number: this.phoneNumber,
1419
- profession: this.profession,
1420
- proof_of_life: this.proofOfLife,
1421
- proof_of_address: this.proofOfAddress,
1422
- requiredLevel: this.requiredLevel,
1423
- rfc: this.rfc,
1424
- status: this.status,
1425
- terms_of_service: this.termsOfService,
1426
- verification_id: this.verificationId,
1427
- user_type: this.userType,
1428
- };
1429
- }
1430
- }
1431
-
1432
- class VerificationRequest extends BaseRequest {
1433
- constructor({ platformId, recipient, type }) {
1434
- super();
1435
- this.platformId = platformId;
1436
- this.type = type;
1437
- this.recipients = recipient;
1438
- }
1439
-
1440
- get recipient() {
1441
- return this._recipient;
1442
- }
1443
-
1444
- set recipients(value) {
1445
- function validateEmail(email) {
1446
- return email.match(
1447
- /^(([^<>()[\]\\.,;:\s@"]+(\.[^<>()[\]\\.,;:\s@"]+)*)|(".+"))@((\[[0-9]{1,3}\.[0-9]{1,3}\.[0-9]{1,3}\.[0-9]{1,3}\])|(([a-zA-Z\-0-9]+\.)+[a-zA-Z]{2,}))$/,
1448
- );
1449
- }
1450
-
1451
- function validatePhone(phone) {
1452
- return phone.match(/^\+?[0-9]{10,15}$/);
1453
- }
1454
-
1455
- switch (enumValueFromString(VerificationType, this.type)) {
1456
- case VerificationType.Email:
1457
- if (validateEmail(value)) {
1458
- this._recipient = value;
1459
- } else {
1460
- throw new ValidationError('Invalid email address');
1461
- }
1462
- break;
1463
- case VerificationType.Phone:
1464
- if (validatePhone(value)) {
1465
- this._recipient = value;
1466
- } else {
1467
- throw new ValidationError('Invalid Phone Number');
1468
- }
1469
- break;
1470
- }
1471
- }
1472
-
1473
- toObject() {
1474
- return {
1475
- platform_id: this.platformId,
1476
- recipient: this.recipient,
1477
- type: this.type,
1478
- };
1479
- }
1480
- }
1481
-
1482
- class VerificationAttemptRequest extends BaseRequest {
1483
- constructor({ code }) {
1484
- super();
1485
- this.code = code;
1486
- }
1487
-
1488
- toObject() {
1489
- return {
1490
- code: this.code,
1491
- };
1492
- }
1493
- }
1494
-
1495
- class WalletTransactionRequest extends BaseRequest {
1496
- constructor(amount, transactionType, walletUri) {
1497
- super();
1498
- this.amount = amount;
1499
- this.transactionType = transactionType;
1500
- this.walletUri = walletUri;
1501
- }
1502
-
1503
- toObject() {
1504
- return {
1505
- amount: this.amount,
1506
- transaction_type: this.transactionType,
1507
- wallet_uri: this.walletUri,
1508
- };
1509
- }
1510
- }
1511
-
1512
- export { AlertUpdateRequest as A, BaseRequest as B, CardActivationRequest as C, FraudFundsTransferRequest as F, KYCValidationsRequest as K, PartnerUserRequest as P, ReportGenerateRequest as R, SavingRequest as S, TransferRequest as T, UserUpdateRequest as U, VerificationRequest as V, WalletTransactionRequest as W, ApiKeyUpdateRequest as a, ArpcRequest as b, CardRequest as c, CardUpdateRequest as d, CardValidationRequest as e, SessionRequest as f, TransferUpdateRequest as g, UserCredentialRequest as h, UserCredentialUpdateRequest as i, UserLoginRequest as j, UserReportCreateRequest as k, UserReportUpdateRequest as l, VerificationAttemptRequest as m, AddressUpdateRequest as n };