@cuenca-mx/cuenca-js 0.0.5-dev0 → 0.0.6-dev.0

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.
@@ -1,3 +1,17 @@
1
+ class BridgeAccountStatus {
2
+ static Succeeded = new BridgeAccountStatus('succeeded');
3
+
4
+ static NotValidated = new BridgeAccountStatus('not_validated');
5
+
6
+ static Failed = new BridgeAccountStatus('failed');
7
+
8
+ static OnWaitList = new BridgeAccountStatus('on_wait_list');
9
+
10
+ constructor(value) {
11
+ this.value = value;
12
+ }
13
+ }
14
+
1
15
  class CardErrorType {
2
16
  static Blocked = new CardErrorType('blocked');
3
17
 
@@ -46,6 +60,16 @@ class CardIssuer {
46
60
  }
47
61
  }
48
62
 
63
+ class BridgeTransactionType {
64
+ static Buy = new BridgeTransactionType('buy');
65
+
66
+ static Sell = new BridgeTransactionType('sell');
67
+
68
+ constructor(value) {
69
+ this.value = value;
70
+ }
71
+ }
72
+
49
73
  class CardStatus {
50
74
  static Active = new CardStatus('active');
51
75
 
@@ -80,6 +104,18 @@ class CardTransactionType {
80
104
  }
81
105
  }
82
106
 
107
+ class Currency {
108
+ static Mxn = new Currency('mxn');
109
+
110
+ static Usdc = new Currency('usdc');
111
+
112
+ static Sol = new Currency('sol');
113
+
114
+ constructor(value) {
115
+ this.value = value;
116
+ }
117
+ }
118
+
83
119
  class CardType {
84
120
  static Physical = new CardType('physical');
85
121
 
@@ -125,11 +161,13 @@ class EntryType {
125
161
  }
126
162
 
127
163
  class FileFormat {
128
- static Pdf = new FileFormat('pdf');
164
+ static Pdf = new FileFormat('application/pdf');
165
+
166
+ static Xml = new FileFormat('application/xml');
129
167
 
130
- static Xml = new FileFormat('xml');
168
+ static Json = new FileFormat('application/json');
131
169
 
132
- static Json = new FileFormat('json');
170
+ static Any = new FileFormat('*/*');
133
171
 
134
172
  constructor(value) {
135
173
  this.value = value;
@@ -154,24 +192,10 @@ class KYCFileType {
154
192
  }
155
193
  }
156
194
 
157
- class KYCStatus {
158
- static UploadAgain = new KYCStatus('upload_again');
159
-
160
- static ReviewNeeded = new KYCStatus('review_needed');
161
-
162
- static Submitted = new KYCStatus('submitted');
163
-
164
- static Succeeded = new KYCStatus('succeeded');
165
-
166
- constructor(value) {
167
- this.value = value;
168
- }
169
- }
170
-
171
195
  class Phase {
172
- static Sandbox = new Phase('sandbox');
196
+ static Sandbox = new Phase('sandbox-api');
173
197
 
174
- static Stage = new Phase('stage');
198
+ static Stage = new Phase('stage-api');
175
199
 
176
200
  static Api = new Phase('api');
177
201
 
@@ -258,6 +282,16 @@ class TrackDataMethod {
258
282
  }
259
283
  }
260
284
 
285
+ class Network {
286
+ static Polygon = new Network('polygon');
287
+
288
+ static Solana = new Network('solana');
289
+
290
+ constructor(value) {
291
+ this.value = value;
292
+ }
293
+ }
294
+
261
295
  class TransactionStatus {
262
296
  static Created = new TransactionStatus('created');
263
297
 
@@ -307,12 +341,12 @@ class VerificationStatus {
307
341
 
308
342
  static ReviewNeeded = new VerificationStatus('review_needed');
309
343
 
310
- static UploadAgain = new VerificationStatus('upload_again');
311
-
312
344
  static Submitted = new VerificationStatus('submitted');
313
345
 
314
346
  static Succeeded = new VerificationStatus('succeeded');
315
347
 
348
+ static UploadAgain = new VerificationStatus('upload_again');
349
+
316
350
  constructor(value) {
317
351
  this.value = value;
318
352
  }
@@ -347,4 +381,4 @@ const dateToUTC = (date) => {
347
381
  const enumValueFromString = (enumValue, value) =>
348
382
  Object.values(enumValue).find((enumV) => enumV.value === value);
349
383
 
350
- export { CardFundingType as C, DepositNetwork as D, EntryType as E, FileFormat as F, KYCFileType as K, Phase as P, SavingCategory as S, TransactionStatus as T, UserStatus as U, VerificationStatus as V, WalletTransactionType as W, CardIssuer as a, CardStatus as b, CardType as c, dateToUTC as d, enumValueFromString as e, CardErrorType as f, CardTransactionType as g, CommissionType as h, ServiceProviderCategory as i, TransferNetwork as j, VerificationType as k, KYCStatus as l, TrackDataMethod as m };
384
+ export { BridgeAccountStatus as B, Currency as C, DepositNetwork as D, EntryType as E, FileFormat as F, KYCFileType as K, Network as N, Phase as P, SavingCategory as S, TransactionStatus as T, UserStatus as U, VerificationStatus as V, WalletTransactionType as W, BridgeTransactionType as a, CardFundingType as b, CardIssuer as c, dateToUTC as d, enumValueFromString as e, CardStatus as f, CardType as g, CardErrorType as h, CardTransactionType as i, CommissionType as j, ServiceProviderCategory as k, TransferNetwork as l, VerificationType as m, TrackDataMethod as n };
@@ -1,5 +1,19 @@
1
1
  'use strict';
2
2
 
3
+ class BridgeAccountStatus {
4
+ static Succeeded = new BridgeAccountStatus('succeeded');
5
+
6
+ static NotValidated = new BridgeAccountStatus('not_validated');
7
+
8
+ static Failed = new BridgeAccountStatus('failed');
9
+
10
+ static OnWaitList = new BridgeAccountStatus('on_wait_list');
11
+
12
+ constructor(value) {
13
+ this.value = value;
14
+ }
15
+ }
16
+
3
17
  class CardErrorType {
4
18
  static Blocked = new CardErrorType('blocked');
5
19
 
@@ -48,6 +62,16 @@ class CardIssuer {
48
62
  }
49
63
  }
50
64
 
65
+ class BridgeTransactionType {
66
+ static Buy = new BridgeTransactionType('buy');
67
+
68
+ static Sell = new BridgeTransactionType('sell');
69
+
70
+ constructor(value) {
71
+ this.value = value;
72
+ }
73
+ }
74
+
51
75
  class CardStatus {
52
76
  static Active = new CardStatus('active');
53
77
 
@@ -82,6 +106,18 @@ class CardTransactionType {
82
106
  }
83
107
  }
84
108
 
109
+ class Currency {
110
+ static Mxn = new Currency('mxn');
111
+
112
+ static Usdc = new Currency('usdc');
113
+
114
+ static Sol = new Currency('sol');
115
+
116
+ constructor(value) {
117
+ this.value = value;
118
+ }
119
+ }
120
+
85
121
  class CardType {
86
122
  static Physical = new CardType('physical');
87
123
 
@@ -127,11 +163,13 @@ class EntryType {
127
163
  }
128
164
 
129
165
  class FileFormat {
130
- static Pdf = new FileFormat('pdf');
166
+ static Pdf = new FileFormat('application/pdf');
167
+
168
+ static Xml = new FileFormat('application/xml');
131
169
 
132
- static Xml = new FileFormat('xml');
170
+ static Json = new FileFormat('application/json');
133
171
 
134
- static Json = new FileFormat('json');
172
+ static Any = new FileFormat('*/*');
135
173
 
136
174
  constructor(value) {
137
175
  this.value = value;
@@ -156,24 +194,10 @@ class KYCFileType {
156
194
  }
157
195
  }
158
196
 
159
- class KYCStatus {
160
- static UploadAgain = new KYCStatus('upload_again');
161
-
162
- static ReviewNeeded = new KYCStatus('review_needed');
163
-
164
- static Submitted = new KYCStatus('submitted');
165
-
166
- static Succeeded = new KYCStatus('succeeded');
167
-
168
- constructor(value) {
169
- this.value = value;
170
- }
171
- }
172
-
173
197
  class Phase {
174
- static Sandbox = new Phase('sandbox');
198
+ static Sandbox = new Phase('sandbox-api');
175
199
 
176
- static Stage = new Phase('stage');
200
+ static Stage = new Phase('stage-api');
177
201
 
178
202
  static Api = new Phase('api');
179
203
 
@@ -260,6 +284,16 @@ class TrackDataMethod {
260
284
  }
261
285
  }
262
286
 
287
+ class Network {
288
+ static Polygon = new Network('polygon');
289
+
290
+ static Solana = new Network('solana');
291
+
292
+ constructor(value) {
293
+ this.value = value;
294
+ }
295
+ }
296
+
263
297
  class TransactionStatus {
264
298
  static Created = new TransactionStatus('created');
265
299
 
@@ -309,12 +343,12 @@ class VerificationStatus {
309
343
 
310
344
  static ReviewNeeded = new VerificationStatus('review_needed');
311
345
 
312
- static UploadAgain = new VerificationStatus('upload_again');
313
-
314
346
  static Submitted = new VerificationStatus('submitted');
315
347
 
316
348
  static Succeeded = new VerificationStatus('succeeded');
317
349
 
350
+ static UploadAgain = new VerificationStatus('upload_again');
351
+
318
352
  constructor(value) {
319
353
  this.value = value;
320
354
  }
@@ -349,6 +383,8 @@ const dateToUTC = (date) => {
349
383
  const enumValueFromString = (enumValue, value) =>
350
384
  Object.values(enumValue).find((enumV) => enumV.value === value);
351
385
 
386
+ exports.BridgeAccountStatus = BridgeAccountStatus;
387
+ exports.BridgeTransactionType = BridgeTransactionType;
352
388
  exports.CardErrorType = CardErrorType;
353
389
  exports.CardFundingType = CardFundingType;
354
390
  exports.CardIssuer = CardIssuer;
@@ -356,11 +392,12 @@ exports.CardStatus = CardStatus;
356
392
  exports.CardTransactionType = CardTransactionType;
357
393
  exports.CardType = CardType;
358
394
  exports.CommissionType = CommissionType;
395
+ exports.Currency = Currency;
359
396
  exports.DepositNetwork = DepositNetwork;
360
397
  exports.EntryType = EntryType;
361
398
  exports.FileFormat = FileFormat;
362
399
  exports.KYCFileType = KYCFileType;
363
- exports.KYCStatus = KYCStatus;
400
+ exports.Network = Network;
364
401
  exports.Phase = Phase;
365
402
  exports.SavingCategory = SavingCategory;
366
403
  exports.ServiceProviderCategory = ServiceProviderCategory;
@@ -1,5 +1,5 @@
1
1
  import { ValidationError } from './errors/index.mjs';
2
- import { d as dateToUTC, e as enumValueFromString, K as KYCFileType, l as KYCStatus } from './data-38bfc8ad.mjs';
2
+ import { d as dateToUTC, e as enumValueFromString, V as VerificationStatus, K as KYCFileType } from './data-8710a060.mjs';
3
3
 
4
4
  class PageSize {
5
5
  constructor(size) {
@@ -296,6 +296,36 @@ class StatementQuery extends QueryParams {
296
296
  }
297
297
  }
298
298
 
299
+ class BridgeAccountQuery extends QueryParams {
300
+ constructor({ emailAddress, ...args }) {
301
+ super(args);
302
+ this.emailAddress = emailAddress;
303
+ }
304
+
305
+ toObject() {
306
+ return Object.assign(super.toObject(), {
307
+ email_address: this.emailAddress,
308
+ });
309
+ }
310
+ }
311
+
312
+ class BridgeTransactionQuery extends QueryParams {
313
+ constructor({ accountId, status, type, ...args }) {
314
+ super(args);
315
+ this.accountId = accountId;
316
+ this.status = status;
317
+ this.type = type;
318
+ }
319
+
320
+ toObject() {
321
+ return Object.assign(super.toObject(), {
322
+ account: this.accountId,
323
+ status: this.status,
324
+ type: this.type,
325
+ });
326
+ }
327
+ }
328
+
299
329
  class TOSAgreements {
300
330
  constructor({ ip, location, type, version }) {
301
331
  this.ip = ip;
@@ -313,19 +343,41 @@ class TOSAgreements {
313
343
  });
314
344
  }
315
345
 
346
+ class VerificationError {
347
+ constructor({ code, error, identifier, message }) {
348
+ this.code = code;
349
+ this.error = error;
350
+ this.identifier = identifier;
351
+ this.message = message;
352
+ }
353
+
354
+ static fromObject = ({ code, error, identifier, message }) =>
355
+ new VerificationError({
356
+ code,
357
+ error,
358
+ identifier,
359
+ message,
360
+ });
361
+ }
362
+
316
363
  class KYCFile {
317
- constructor({ data, isMx, status, type, uriBack, uriFront }) {
364
+ constructor({ data, errors, isMx, status, type, uriBack, uriFront }) {
318
365
  this.data = data;
319
366
  this.isMx = isMx;
320
- this.status = enumValueFromString(KYCStatus, status);
367
+ this.status = enumValueFromString(VerificationStatus, status);
321
368
  this.type = enumValueFromString(KYCFileType, type);
322
369
  this.uriBack = uriBack;
323
370
  this.uriFront = uriFront;
371
+
372
+ if (errors && errors.length > 0) {
373
+ this.errors = errors.map((e) => VerificationError.fromObject(e));
374
+ }
324
375
  }
325
376
 
326
- static fromObject = ({ data, status, type, ...obj }) =>
377
+ static fromObject = ({ data, errors, status, type, ...obj }) =>
327
378
  new KYCFile({
328
379
  data,
380
+ errors,
329
381
  status,
330
382
  type,
331
383
  isMx: obj.is_mx,
@@ -371,4 +423,4 @@ class Address {
371
423
  });
372
424
  }
373
425
 
374
- export { Address as A, BalanceEntryQuery as B, CardsQuery as C, DepositQuery as D, KYCFile as K, PageSize as P, QueryParams as Q, StatementQuery as S, TOSAgreements as T, UserQuery as U, WalletQuery as W, AccountQuery as a, ApiKeyQuery as b, BillPaymentQuery as c, CardTransactionQuery as d, TransferQuery as e, WalletTransactionQuery as f };
426
+ export { Address as A, BalanceEntryQuery as B, CardsQuery as C, DepositQuery as D, KYCFile as K, PageSize as P, QueryParams as Q, StatementQuery as S, TOSAgreements as T, UserQuery as U, WalletQuery as W, AccountQuery as a, ApiKeyQuery as b, BillPaymentQuery as c, BridgeAccountQuery as d, BridgeTransactionQuery as e, CardTransactionQuery as f, TransferQuery as g, WalletTransactionQuery as h, TransactionQuery as i };
@@ -1,7 +1,7 @@
1
1
  'use strict';
2
2
 
3
3
  var errors_index = require('./errors/index.cjs');
4
- var data = require('./data-6451748e.cjs');
4
+ var data = require('./data-e5d6baf4.cjs');
5
5
 
6
6
  class PageSize {
7
7
  constructor(size) {
@@ -298,6 +298,36 @@ class StatementQuery extends QueryParams {
298
298
  }
299
299
  }
300
300
 
301
+ class BridgeAccountQuery extends QueryParams {
302
+ constructor({ emailAddress, ...args }) {
303
+ super(args);
304
+ this.emailAddress = emailAddress;
305
+ }
306
+
307
+ toObject() {
308
+ return Object.assign(super.toObject(), {
309
+ email_address: this.emailAddress,
310
+ });
311
+ }
312
+ }
313
+
314
+ class BridgeTransactionQuery extends QueryParams {
315
+ constructor({ accountId, status, type, ...args }) {
316
+ super(args);
317
+ this.accountId = accountId;
318
+ this.status = status;
319
+ this.type = type;
320
+ }
321
+
322
+ toObject() {
323
+ return Object.assign(super.toObject(), {
324
+ account: this.accountId,
325
+ status: this.status,
326
+ type: this.type,
327
+ });
328
+ }
329
+ }
330
+
301
331
  class TOSAgreements {
302
332
  constructor({ ip, location, type, version }) {
303
333
  this.ip = ip;
@@ -315,19 +345,41 @@ class TOSAgreements {
315
345
  });
316
346
  }
317
347
 
348
+ class VerificationError {
349
+ constructor({ code, error, identifier, message }) {
350
+ this.code = code;
351
+ this.error = error;
352
+ this.identifier = identifier;
353
+ this.message = message;
354
+ }
355
+
356
+ static fromObject = ({ code, error, identifier, message }) =>
357
+ new VerificationError({
358
+ code,
359
+ error,
360
+ identifier,
361
+ message,
362
+ });
363
+ }
364
+
318
365
  class KYCFile {
319
- constructor({ data: data$1, isMx, status, type, uriBack, uriFront }) {
366
+ constructor({ data: data$1, errors, isMx, status, type, uriBack, uriFront }) {
320
367
  this.data = data$1;
321
368
  this.isMx = isMx;
322
- this.status = data.enumValueFromString(data.KYCStatus, status);
369
+ this.status = data.enumValueFromString(data.VerificationStatus, status);
323
370
  this.type = data.enumValueFromString(data.KYCFileType, type);
324
371
  this.uriBack = uriBack;
325
372
  this.uriFront = uriFront;
373
+
374
+ if (errors && errors.length > 0) {
375
+ this.errors = errors.map((e) => VerificationError.fromObject(e));
376
+ }
326
377
  }
327
378
 
328
- static fromObject = ({ data, status, type, ...obj }) =>
379
+ static fromObject = ({ data, errors, status, type, ...obj }) =>
329
380
  new KYCFile({
330
381
  data,
382
+ errors,
331
383
  status,
332
384
  type,
333
385
  isMx: obj.is_mx,
@@ -378,6 +430,8 @@ exports.Address = Address;
378
430
  exports.ApiKeyQuery = ApiKeyQuery;
379
431
  exports.BalanceEntryQuery = BalanceEntryQuery;
380
432
  exports.BillPaymentQuery = BillPaymentQuery;
433
+ exports.BridgeAccountQuery = BridgeAccountQuery;
434
+ exports.BridgeTransactionQuery = BridgeTransactionQuery;
381
435
  exports.CardTransactionQuery = CardTransactionQuery;
382
436
  exports.CardsQuery = CardsQuery;
383
437
  exports.DepositQuery = DepositQuery;
@@ -386,6 +440,7 @@ exports.PageSize = PageSize;
386
440
  exports.QueryParams = QueryParams;
387
441
  exports.StatementQuery = StatementQuery;
388
442
  exports.TOSAgreements = TOSAgreements;
443
+ exports.TransactionQuery = TransactionQuery;
389
444
  exports.TransferQuery = TransferQuery;
390
445
  exports.UserQuery = UserQuery;
391
446
  exports.WalletQuery = WalletQuery;