@cuenca-mx/cuenca-js 0.0.14-dev8 → 1.0.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.
- package/README.md +3 -1
- package/build/{data-7e8b28c6.mjs → data-27fc844b.mjs} +18 -6
- package/build/{data-92aab1cc.cjs → data-6c2897da.cjs} +19 -6
- package/build/index.cjs +409 -68
- package/build/index.mjs +379 -38
- package/build/requests/index.cjs +3 -2
- package/build/requests/index.mjs +3 -3
- package/build/types/index.cjs +69 -27
- package/build/types/index.mjs +36 -2
- package/build/umd/cuenca.umd.js +1 -1
- package/build/{identities-1d8c28b7.mjs → vulnerableActivity-70ff062e.mjs} +472 -205
- package/build/{identities-fd7aee67.cjs → vulnerableActivity-88488ee4.cjs} +481 -205
- package/build/{walletTransactionRequest-da986c71.cjs → walletTransactionRequest-534ea750.cjs} +680 -204
- package/build/{walletTransactionRequest-d05a25a9.mjs → walletTransactionRequest-80f0424d.mjs} +680 -205
- package/package.json +4 -2
package/build/{walletTransactionRequest-da986c71.cjs → walletTransactionRequest-534ea750.cjs}
RENAMED
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
'use strict';
|
|
2
2
|
|
|
3
3
|
var errors_index = require('./errors/index.cjs');
|
|
4
|
-
var data = require('./data-
|
|
4
|
+
var data = require('./data-6c2897da.cjs');
|
|
5
5
|
|
|
6
6
|
class BaseRequest {
|
|
7
7
|
toObject() {
|
|
@@ -17,12 +17,27 @@ class BaseRequest {
|
|
|
17
17
|
}
|
|
18
18
|
}
|
|
19
19
|
|
|
20
|
+
class ApiKeyUpdateRequest extends BaseRequest {
|
|
21
|
+
constructor(userId, metadata) {
|
|
22
|
+
super();
|
|
23
|
+
this.userId = userId;
|
|
24
|
+
this.metadata = metadata;
|
|
25
|
+
}
|
|
26
|
+
|
|
27
|
+
toObject() {
|
|
28
|
+
return {
|
|
29
|
+
user_id: this.userId,
|
|
30
|
+
metadata: this.metadata,
|
|
31
|
+
};
|
|
32
|
+
}
|
|
33
|
+
}
|
|
34
|
+
|
|
20
35
|
class AlertUpdateRequest extends BaseRequest {
|
|
21
36
|
constructor({
|
|
22
37
|
accountNumber,
|
|
23
38
|
actualPeriodCount,
|
|
24
39
|
actualPeriodSum,
|
|
25
|
-
|
|
40
|
+
agent,
|
|
26
41
|
aggregationType,
|
|
27
42
|
changeLog,
|
|
28
43
|
committeeMeetingDate,
|
|
@@ -48,7 +63,7 @@ class AlertUpdateRequest extends BaseRequest {
|
|
|
48
63
|
this.accountNumber = accountNumber;
|
|
49
64
|
this.actualPeriodCount = actualPeriodCount;
|
|
50
65
|
this.actualPeriodSum = actualPeriodSum;
|
|
51
|
-
this.
|
|
66
|
+
this.agent = agent;
|
|
52
67
|
this.aggregationType = aggregationType;
|
|
53
68
|
this.changeLog = changeLog;
|
|
54
69
|
this.committeeMeetingDate = committeeMeetingDate;
|
|
@@ -73,7 +88,7 @@ class AlertUpdateRequest extends BaseRequest {
|
|
|
73
88
|
|
|
74
89
|
toObject() {
|
|
75
90
|
return {
|
|
76
|
-
|
|
91
|
+
agent: this.agent,
|
|
77
92
|
change_log: this.changeLog,
|
|
78
93
|
comments: this.comments,
|
|
79
94
|
description: this.description,
|
|
@@ -101,21 +116,6 @@ class AlertUpdateRequest extends BaseRequest {
|
|
|
101
116
|
}
|
|
102
117
|
}
|
|
103
118
|
|
|
104
|
-
class ApiKeyUpdateRequest extends BaseRequest {
|
|
105
|
-
constructor(userId, metadata) {
|
|
106
|
-
super();
|
|
107
|
-
this.userId = userId;
|
|
108
|
-
this.metadata = metadata;
|
|
109
|
-
}
|
|
110
|
-
|
|
111
|
-
toObject() {
|
|
112
|
-
return {
|
|
113
|
-
user_id: this.userId,
|
|
114
|
-
metadata: this.metadata,
|
|
115
|
-
};
|
|
116
|
-
}
|
|
117
|
-
}
|
|
118
|
-
|
|
119
119
|
class ArpcRequest extends BaseRequest {
|
|
120
120
|
constructor({
|
|
121
121
|
arpcMethod,
|
|
@@ -409,184 +409,6 @@ class KYCValidationsRequest extends BaseRequest {
|
|
|
409
409
|
}
|
|
410
410
|
}
|
|
411
411
|
|
|
412
|
-
class SavingRequest extends BaseRequest {
|
|
413
|
-
constructor(category, goalAmount, goalDate, name) {
|
|
414
|
-
super();
|
|
415
|
-
this.category = category;
|
|
416
|
-
this.name = name;
|
|
417
|
-
this.goalAmount = goalAmount;
|
|
418
|
-
this.validDate = goalDate;
|
|
419
|
-
}
|
|
420
|
-
|
|
421
|
-
get goalDate() {
|
|
422
|
-
return this._goalDate;
|
|
423
|
-
}
|
|
424
|
-
|
|
425
|
-
set validDate(value) {
|
|
426
|
-
if (!value) return;
|
|
427
|
-
if (data.dateToUTC(value).getTime() <= data.dateToUTC(Date.now()).getTime()) {
|
|
428
|
-
throw new errors_index.ValidationError(
|
|
429
|
-
'The goal_date always need to be higher than now',
|
|
430
|
-
);
|
|
431
|
-
}
|
|
432
|
-
this._goalDate = value;
|
|
433
|
-
}
|
|
434
|
-
|
|
435
|
-
toObject() {
|
|
436
|
-
return {
|
|
437
|
-
category: this.category,
|
|
438
|
-
goal_amount: this.goalAmount,
|
|
439
|
-
goal_date: this.goalDate,
|
|
440
|
-
name: this.name,
|
|
441
|
-
};
|
|
442
|
-
}
|
|
443
|
-
}
|
|
444
|
-
|
|
445
|
-
class SessionRequest extends BaseRequest {
|
|
446
|
-
constructor({ failureUrl, successUrl, type, userId, isBridge = false }) {
|
|
447
|
-
super();
|
|
448
|
-
this.failureUrl = failureUrl;
|
|
449
|
-
this.successUrl = successUrl;
|
|
450
|
-
this.type = type;
|
|
451
|
-
this.userId = userId;
|
|
452
|
-
this.isBridge = isBridge;
|
|
453
|
-
}
|
|
454
|
-
|
|
455
|
-
toObject() {
|
|
456
|
-
return {
|
|
457
|
-
failure_url: this.failureUrl,
|
|
458
|
-
success_url: this.successUrl,
|
|
459
|
-
type: this.type,
|
|
460
|
-
[this.isBridge ? 'account_id' : 'user_id']: this.userId,
|
|
461
|
-
};
|
|
462
|
-
}
|
|
463
|
-
}
|
|
464
|
-
|
|
465
|
-
class TransferRequest extends BaseRequest {
|
|
466
|
-
constructor(
|
|
467
|
-
accountNumber,
|
|
468
|
-
amount,
|
|
469
|
-
descriptor,
|
|
470
|
-
idempotencyKey,
|
|
471
|
-
recipientName,
|
|
472
|
-
) {
|
|
473
|
-
super();
|
|
474
|
-
this.accountNumber = accountNumber;
|
|
475
|
-
this.amount = amount;
|
|
476
|
-
this.descriptor = descriptor;
|
|
477
|
-
this.idempotencyKey = idempotencyKey;
|
|
478
|
-
this.recipientName = recipientName;
|
|
479
|
-
}
|
|
480
|
-
|
|
481
|
-
toObject() {
|
|
482
|
-
return {
|
|
483
|
-
account_number: this.accountNumber,
|
|
484
|
-
amount: this.amount,
|
|
485
|
-
descriptor: this.descriptor,
|
|
486
|
-
idempotency_key: this.idempotencyKey,
|
|
487
|
-
recipient_name: this.recipientName,
|
|
488
|
-
};
|
|
489
|
-
}
|
|
490
|
-
}
|
|
491
|
-
|
|
492
|
-
class UserCredentialRequest extends BaseRequest {
|
|
493
|
-
constructor(password) {
|
|
494
|
-
super();
|
|
495
|
-
this.pwd = password;
|
|
496
|
-
}
|
|
497
|
-
|
|
498
|
-
get password() {
|
|
499
|
-
return this._password;
|
|
500
|
-
}
|
|
501
|
-
|
|
502
|
-
set pwd(value) {
|
|
503
|
-
const validations = [!!value, value.length >= 6];
|
|
504
|
-
if (validations.some((x) => !x)) {
|
|
505
|
-
throw new errors_index.ValidationError('Invalid password');
|
|
506
|
-
}
|
|
507
|
-
this._password = value;
|
|
508
|
-
}
|
|
509
|
-
|
|
510
|
-
toObject() {
|
|
511
|
-
return {
|
|
512
|
-
password: this.password,
|
|
513
|
-
};
|
|
514
|
-
}
|
|
515
|
-
}
|
|
516
|
-
|
|
517
|
-
class UserCredentialUpdateRequest extends BaseRequest {
|
|
518
|
-
constructor(password, isActive) {
|
|
519
|
-
super();
|
|
520
|
-
this.pwd = password;
|
|
521
|
-
this.isActive = isActive;
|
|
522
|
-
this.req = {
|
|
523
|
-
password: this.password,
|
|
524
|
-
isActive: this.isActive,
|
|
525
|
-
};
|
|
526
|
-
}
|
|
527
|
-
|
|
528
|
-
get password() {
|
|
529
|
-
return this._password;
|
|
530
|
-
}
|
|
531
|
-
|
|
532
|
-
get request() {
|
|
533
|
-
return this._request;
|
|
534
|
-
}
|
|
535
|
-
|
|
536
|
-
set pwd(value) {
|
|
537
|
-
if (!value) {
|
|
538
|
-
this._password = value;
|
|
539
|
-
return;
|
|
540
|
-
}
|
|
541
|
-
const validations = [value.length >= 6];
|
|
542
|
-
if (validations.some((x) => !x)) {
|
|
543
|
-
throw new errors_index.ValidationError('Invalid password');
|
|
544
|
-
}
|
|
545
|
-
this._password = value;
|
|
546
|
-
}
|
|
547
|
-
|
|
548
|
-
set req(value) {
|
|
549
|
-
if (value.password && value.isActive != null) {
|
|
550
|
-
throw new errors_index.ValidationError('Only one property can be updated at a time');
|
|
551
|
-
}
|
|
552
|
-
this._request = value;
|
|
553
|
-
}
|
|
554
|
-
|
|
555
|
-
toObject() {
|
|
556
|
-
return {
|
|
557
|
-
password: this.request.password,
|
|
558
|
-
is_active: this.request.isActive,
|
|
559
|
-
};
|
|
560
|
-
}
|
|
561
|
-
}
|
|
562
|
-
|
|
563
|
-
class UserLoginRequest extends BaseRequest {
|
|
564
|
-
constructor(password, userId = 'me') {
|
|
565
|
-
super();
|
|
566
|
-
this.pwd = password;
|
|
567
|
-
this.userId = userId;
|
|
568
|
-
}
|
|
569
|
-
|
|
570
|
-
get password() {
|
|
571
|
-
return this._password;
|
|
572
|
-
}
|
|
573
|
-
|
|
574
|
-
set pwd(value) {
|
|
575
|
-
const validations = [!!value, value.length === 6, /^\d{6}$/.test(value)];
|
|
576
|
-
if (validations.some((x) => !x)) {
|
|
577
|
-
throw new errors_index.ValidationError('Invalid password');
|
|
578
|
-
}
|
|
579
|
-
this._password = value;
|
|
580
|
-
}
|
|
581
|
-
|
|
582
|
-
toObject() {
|
|
583
|
-
return {
|
|
584
|
-
password: this.password,
|
|
585
|
-
user_id: this.userId,
|
|
586
|
-
};
|
|
587
|
-
}
|
|
588
|
-
}
|
|
589
|
-
|
|
590
412
|
class TosUpdateRequest extends BaseRequest {
|
|
591
413
|
constructor({ ip, location, type, version }) {
|
|
592
414
|
super();
|
|
@@ -690,22 +512,30 @@ class UserUpdateRequest extends BaseRequest {
|
|
|
690
512
|
address,
|
|
691
513
|
curpDocumentUri,
|
|
692
514
|
govtId,
|
|
515
|
+
emailAddress,
|
|
693
516
|
profession,
|
|
694
517
|
proofOfAddress,
|
|
695
518
|
proofOfLife,
|
|
696
519
|
requiredLevel,
|
|
697
520
|
termsOfService,
|
|
521
|
+
phoneNumber,
|
|
522
|
+
rfc,
|
|
523
|
+
userType,
|
|
698
524
|
verificationId,
|
|
699
525
|
}) {
|
|
700
526
|
super();
|
|
527
|
+
this.addressProofs = proofOfAddress;
|
|
701
528
|
this.adrs = address;
|
|
702
529
|
this.curpDocumentUri = curpDocumentUri;
|
|
530
|
+
this.emailAddress = emailAddress;
|
|
703
531
|
this.govstIds = govtId;
|
|
704
|
-
this.profession = profession;
|
|
705
|
-
this.addressProofs = proofOfAddress;
|
|
706
532
|
this.lifeProofs = proofOfLife;
|
|
533
|
+
this.profession = profession;
|
|
534
|
+
this.phoneNumber = phoneNumber;
|
|
707
535
|
this.requiredLevel = requiredLevel;
|
|
708
|
-
this.
|
|
536
|
+
this.termsOfService = termsOfService;
|
|
537
|
+
this.rfc = rfc;
|
|
538
|
+
this.userType = userType;
|
|
709
539
|
this.verificationId = verificationId;
|
|
710
540
|
}
|
|
711
541
|
|
|
@@ -713,7 +543,7 @@ class UserUpdateRequest extends BaseRequest {
|
|
|
713
543
|
return this._termsOfService;
|
|
714
544
|
}
|
|
715
545
|
|
|
716
|
-
set
|
|
546
|
+
set termsOfService(value) {
|
|
717
547
|
if (!value) return;
|
|
718
548
|
this._termsOfService = new TosUpdateRequest(value).toObject();
|
|
719
549
|
}
|
|
@@ -758,13 +588,658 @@ class UserUpdateRequest extends BaseRequest {
|
|
|
758
588
|
return {
|
|
759
589
|
address: this.address,
|
|
760
590
|
curp_document_uri: this.curpDocumentUri,
|
|
591
|
+
email_address: this.emailAddress,
|
|
592
|
+
govt_id: this.govtId,
|
|
593
|
+
phone_number: this.phoneNumber,
|
|
761
594
|
profession: this.profession,
|
|
595
|
+
proof_of_life: this.proofOfLife,
|
|
596
|
+
proof_of_address: this.proofOfAddress,
|
|
762
597
|
requiredLevel: this.requiredLevel,
|
|
598
|
+
rfc: this.rfc,
|
|
763
599
|
terms_of_service: this.termsOfService,
|
|
764
600
|
verification_id: this.verificationId,
|
|
765
|
-
|
|
766
|
-
|
|
767
|
-
|
|
601
|
+
user_type: this.userType,
|
|
602
|
+
};
|
|
603
|
+
}
|
|
604
|
+
}
|
|
605
|
+
|
|
606
|
+
class TransactionalProfileServicesRequest extends BaseRequest {
|
|
607
|
+
constructor({
|
|
608
|
+
speiTransfersNum,
|
|
609
|
+
speiTransfersAmount,
|
|
610
|
+
internalTransfersNum,
|
|
611
|
+
internalTransfersAmount,
|
|
612
|
+
}) {
|
|
613
|
+
super();
|
|
614
|
+
this.speiTransfersNum = speiTransfersNum;
|
|
615
|
+
this.speiTransfersAmount = speiTransfersAmount;
|
|
616
|
+
this.internalTransfersNum = internalTransfersNum;
|
|
617
|
+
this.internalTransfersAmount = internalTransfersAmount;
|
|
618
|
+
}
|
|
619
|
+
|
|
620
|
+
toObject() {
|
|
621
|
+
return {
|
|
622
|
+
spei_transfers_num: this.speiTransfersNum,
|
|
623
|
+
spei_transfers_amount: this.speiTransfersAmount,
|
|
624
|
+
internal_transfers_num: this.internalTransfersNum,
|
|
625
|
+
internal_transfers_amount: this.internalTransfersAmount,
|
|
626
|
+
};
|
|
627
|
+
}
|
|
628
|
+
}
|
|
629
|
+
|
|
630
|
+
class TransactionalProfileRequest {
|
|
631
|
+
constructor({
|
|
632
|
+
currency,
|
|
633
|
+
monthlyAmount,
|
|
634
|
+
recipientsNum,
|
|
635
|
+
payersNum,
|
|
636
|
+
deposits,
|
|
637
|
+
withdrawal,
|
|
638
|
+
}) {
|
|
639
|
+
this.currency = currency;
|
|
640
|
+
this.monthlyAmount = monthlyAmount;
|
|
641
|
+
|
|
642
|
+
this.recipientsNum = recipientsNum;
|
|
643
|
+
this.payersNum = payersNum;
|
|
644
|
+
|
|
645
|
+
this.deposits = deposits;
|
|
646
|
+
this.withdrawal = withdrawal;
|
|
647
|
+
}
|
|
648
|
+
|
|
649
|
+
get deposits() {
|
|
650
|
+
return this._deposits;
|
|
651
|
+
}
|
|
652
|
+
|
|
653
|
+
set deposits(value) {
|
|
654
|
+
if (!value) return;
|
|
655
|
+
this._deposits = new TransactionalProfileServicesRequest(value).toObject();
|
|
656
|
+
}
|
|
657
|
+
|
|
658
|
+
get withdrawal() {
|
|
659
|
+
return this._withdrawal;
|
|
660
|
+
}
|
|
661
|
+
|
|
662
|
+
set withdrawal(value) {
|
|
663
|
+
if (!value) return;
|
|
664
|
+
this._withdrawal = new TransactionalProfileServicesRequest(
|
|
665
|
+
value,
|
|
666
|
+
).toObject();
|
|
667
|
+
}
|
|
668
|
+
|
|
669
|
+
toObject() {
|
|
670
|
+
return {
|
|
671
|
+
currency: this.currency,
|
|
672
|
+
monthly_amount: this.monthlyAmount,
|
|
673
|
+
recipients_num: this.recipientsNum,
|
|
674
|
+
payers_num: this.payersNum,
|
|
675
|
+
deposits: this.deposits,
|
|
676
|
+
withdrawal: this.withdrawal,
|
|
677
|
+
};
|
|
678
|
+
}
|
|
679
|
+
}
|
|
680
|
+
|
|
681
|
+
class BusinessDetailsRequest extends BaseRequest {
|
|
682
|
+
constructor({ accountUsageDescription, businessDescription }) {
|
|
683
|
+
super();
|
|
684
|
+
this.accountUsageDescription = accountUsageDescription;
|
|
685
|
+
this.businessDescription = businessDescription;
|
|
686
|
+
}
|
|
687
|
+
|
|
688
|
+
toObject() {
|
|
689
|
+
return {
|
|
690
|
+
account_usage_description: this.accountUsageDescription,
|
|
691
|
+
business_description: this.businessDescription,
|
|
692
|
+
};
|
|
693
|
+
}
|
|
694
|
+
}
|
|
695
|
+
|
|
696
|
+
class ShareholderPhysicalRequest extends BaseRequest {
|
|
697
|
+
constructor({
|
|
698
|
+
names,
|
|
699
|
+
curp,
|
|
700
|
+
rfc,
|
|
701
|
+
firstSurname,
|
|
702
|
+
percentage,
|
|
703
|
+
secondSurname,
|
|
704
|
+
shareCapital,
|
|
705
|
+
}) {
|
|
706
|
+
super();
|
|
707
|
+
this.names = names;
|
|
708
|
+
this.curp = curp;
|
|
709
|
+
this.percentage = percentage;
|
|
710
|
+
this.rfc = rfc;
|
|
711
|
+
this.shareCapital = shareCapital;
|
|
712
|
+
this.firstSurname = firstSurname;
|
|
713
|
+
this.secondSurname = secondSurname;
|
|
714
|
+
}
|
|
715
|
+
|
|
716
|
+
toObject() {
|
|
717
|
+
return {
|
|
718
|
+
curp: this.curp,
|
|
719
|
+
names: this.names,
|
|
720
|
+
percentage: this.percentage,
|
|
721
|
+
rfc: this.rfc,
|
|
722
|
+
share_capital: this.shareCapital,
|
|
723
|
+
first_surname: this.firstSurname,
|
|
724
|
+
second_surname: this.secondSurname,
|
|
725
|
+
};
|
|
726
|
+
}
|
|
727
|
+
}
|
|
728
|
+
|
|
729
|
+
class LegalRepresentativesRequest extends ShareholderPhysicalRequest {
|
|
730
|
+
constructor({
|
|
731
|
+
address,
|
|
732
|
+
curp,
|
|
733
|
+
emailAddress,
|
|
734
|
+
firstSurname,
|
|
735
|
+
job,
|
|
736
|
+
names,
|
|
737
|
+
percentage,
|
|
738
|
+
phoneNumber,
|
|
739
|
+
rfc,
|
|
740
|
+
secondSurname,
|
|
741
|
+
}) {
|
|
742
|
+
super({ curp, firstSurname, names, percentage, rfc, secondSurname });
|
|
743
|
+
this.job = job;
|
|
744
|
+
this.phoneNumber = phoneNumber;
|
|
745
|
+
this.emailAddress = emailAddress;
|
|
746
|
+
this.address = address;
|
|
747
|
+
}
|
|
748
|
+
|
|
749
|
+
get address() {
|
|
750
|
+
return this._address;
|
|
751
|
+
}
|
|
752
|
+
|
|
753
|
+
set address(value) {
|
|
754
|
+
if (!value) return;
|
|
755
|
+
this._address = new AddressUpdateRequest(value).toCleanObject();
|
|
756
|
+
}
|
|
757
|
+
|
|
758
|
+
toObject() {
|
|
759
|
+
return {
|
|
760
|
+
...super.toObject(),
|
|
761
|
+
job: this.job,
|
|
762
|
+
phone_number: this.phoneNumber,
|
|
763
|
+
email_address: this.emailAddress,
|
|
764
|
+
address: this.address,
|
|
765
|
+
};
|
|
766
|
+
}
|
|
767
|
+
}
|
|
768
|
+
|
|
769
|
+
class ShareholderMoralRequest extends BaseRequest {
|
|
770
|
+
constructor({ name, percentage, shareholders, legalRepresentatives }) {
|
|
771
|
+
super();
|
|
772
|
+
this.name = name;
|
|
773
|
+
this.percentage = percentage;
|
|
774
|
+
this.shareholders = shareholders;
|
|
775
|
+
this.legalRepresentatives = legalRepresentatives;
|
|
776
|
+
}
|
|
777
|
+
|
|
778
|
+
get shareholders() {
|
|
779
|
+
return this._shareholders;
|
|
780
|
+
}
|
|
781
|
+
|
|
782
|
+
set shareholders(value) {
|
|
783
|
+
if (!value) return;
|
|
784
|
+
this._shareholders = value.map((sh) =>
|
|
785
|
+
new ShareholderPhysicalRequest(sh).toObject(),
|
|
786
|
+
);
|
|
787
|
+
}
|
|
788
|
+
|
|
789
|
+
get legalRepresentatives() {
|
|
790
|
+
return this._legalRepresentatives;
|
|
791
|
+
}
|
|
792
|
+
|
|
793
|
+
set legalRepresentatives(value) {
|
|
794
|
+
if (!value) return;
|
|
795
|
+
this._legalRepresentatives = value.map((lr) =>
|
|
796
|
+
new LegalRepresentativesRequest(lr).toObject(),
|
|
797
|
+
);
|
|
798
|
+
}
|
|
799
|
+
|
|
800
|
+
toObject() {
|
|
801
|
+
return {
|
|
802
|
+
name: this.name,
|
|
803
|
+
percentage: this.percentage,
|
|
804
|
+
shareholders: this.shareholders,
|
|
805
|
+
legal_representatives: this.legalRepresentatives,
|
|
806
|
+
};
|
|
807
|
+
}
|
|
808
|
+
}
|
|
809
|
+
|
|
810
|
+
class VulnerableActivityRequest extends BaseRequest {
|
|
811
|
+
constructor({
|
|
812
|
+
isVulnerableActivity,
|
|
813
|
+
hasSatRegister,
|
|
814
|
+
satRegisteredDate,
|
|
815
|
+
isInCompliance,
|
|
816
|
+
}) {
|
|
817
|
+
super();
|
|
818
|
+
this.isVulnerableActivity = isVulnerableActivity;
|
|
819
|
+
this.hasSatRegister = hasSatRegister;
|
|
820
|
+
this.satRegisteredDate = satRegisteredDate;
|
|
821
|
+
this.isInCompliance = isInCompliance;
|
|
822
|
+
}
|
|
823
|
+
|
|
824
|
+
toObject() {
|
|
825
|
+
return {
|
|
826
|
+
is_vulnerable_activity: this.isVulnerableActivity,
|
|
827
|
+
has_sat_register: this.hasSatRegister,
|
|
828
|
+
sat_registered_date: this.satRegisteredDate,
|
|
829
|
+
is_in_compliance: this.isInCompliance,
|
|
830
|
+
};
|
|
831
|
+
}
|
|
832
|
+
}
|
|
833
|
+
|
|
834
|
+
class LicenseRequest extends BaseRequest {
|
|
835
|
+
constructor({
|
|
836
|
+
licenseRequired,
|
|
837
|
+
supervisoryEntity,
|
|
838
|
+
licenseType,
|
|
839
|
+
licenseDate,
|
|
840
|
+
}) {
|
|
841
|
+
super();
|
|
842
|
+
this.licenseRequired = licenseRequired;
|
|
843
|
+
this.supervisoryEntity = supervisoryEntity;
|
|
844
|
+
this.licenseType = licenseType;
|
|
845
|
+
this.licenseDate = licenseDate;
|
|
846
|
+
}
|
|
847
|
+
|
|
848
|
+
toObject() {
|
|
849
|
+
return {
|
|
850
|
+
license_required: this.licenseRequired,
|
|
851
|
+
supervisory_entity: this.supervisoryEntity,
|
|
852
|
+
license_type: this.licenseType,
|
|
853
|
+
license_date: this.licenseDate,
|
|
854
|
+
};
|
|
855
|
+
}
|
|
856
|
+
}
|
|
857
|
+
|
|
858
|
+
class AuditRequest extends BaseRequest {
|
|
859
|
+
constructor({ hasAudit, auditProvider, auditDate, auditComments }) {
|
|
860
|
+
super();
|
|
861
|
+
this.hasAudit = hasAudit;
|
|
862
|
+
this.auditProvider = auditProvider;
|
|
863
|
+
this.auditDate = auditDate;
|
|
864
|
+
this.auditComments = auditComments;
|
|
865
|
+
}
|
|
866
|
+
|
|
867
|
+
toObject() {
|
|
868
|
+
return {
|
|
869
|
+
has_audit: this.hasAudit,
|
|
870
|
+
audit_provider: this.auditProvider,
|
|
871
|
+
audit_date: this.auditDate,
|
|
872
|
+
audit_comments: this.auditComments,
|
|
873
|
+
};
|
|
874
|
+
}
|
|
875
|
+
}
|
|
876
|
+
|
|
877
|
+
class PartnerUserRequest extends BaseRequest {
|
|
878
|
+
constructor({
|
|
879
|
+
address,
|
|
880
|
+
audit,
|
|
881
|
+
businessDetails,
|
|
882
|
+
businessName,
|
|
883
|
+
clabe,
|
|
884
|
+
createdAt,
|
|
885
|
+
documentationUrl,
|
|
886
|
+
emailAddress,
|
|
887
|
+
externalAccount,
|
|
888
|
+
folio,
|
|
889
|
+
id,
|
|
890
|
+
incorporationDate,
|
|
891
|
+
legalName,
|
|
892
|
+
legalRepresentatives,
|
|
893
|
+
level,
|
|
894
|
+
license,
|
|
895
|
+
meta,
|
|
896
|
+
nationality,
|
|
897
|
+
phoneNumber,
|
|
898
|
+
platformId,
|
|
899
|
+
requiredLevel,
|
|
900
|
+
rfc,
|
|
901
|
+
shareholders,
|
|
902
|
+
status,
|
|
903
|
+
transactionalProfile,
|
|
904
|
+
updatedAt,
|
|
905
|
+
userId,
|
|
906
|
+
userType,
|
|
907
|
+
vulnerableActivity,
|
|
908
|
+
webSite,
|
|
909
|
+
} = {}) {
|
|
910
|
+
super();
|
|
911
|
+
this.addressRequest = address;
|
|
912
|
+
this.auditRequest = audit;
|
|
913
|
+
this.businessDetailsRequest = businessDetails;
|
|
914
|
+
this.businessName = businessName;
|
|
915
|
+
this.clabe = clabe;
|
|
916
|
+
this.createdAt = createdAt;
|
|
917
|
+
this.documentationUrl = documentationUrl;
|
|
918
|
+
this.emailAddress = emailAddress;
|
|
919
|
+
this.externalAccountRequest = externalAccount;
|
|
920
|
+
this.folio = folio;
|
|
921
|
+
this.id = id;
|
|
922
|
+
this.incorporationDate = incorporationDate;
|
|
923
|
+
this.legalName = legalName;
|
|
924
|
+
this.legalRepresentativesRequest = legalRepresentatives;
|
|
925
|
+
this.level = level;
|
|
926
|
+
this.licenseRequest = license;
|
|
927
|
+
this.meta = meta;
|
|
928
|
+
this.nationality = nationality;
|
|
929
|
+
this.phoneNumber = phoneNumber;
|
|
930
|
+
this.platformId = platformId;
|
|
931
|
+
this.requiredLevel = requiredLevel;
|
|
932
|
+
this.rfc = rfc;
|
|
933
|
+
this.shareholdersRequest = shareholders;
|
|
934
|
+
this.status = status;
|
|
935
|
+
this.transactionalProfileRequest = transactionalProfile;
|
|
936
|
+
this.updatedAt = updatedAt;
|
|
937
|
+
this.userId = userId;
|
|
938
|
+
this.userType = userType;
|
|
939
|
+
this.vulnerableActivityRequest = vulnerableActivity;
|
|
940
|
+
this.webSite = webSite;
|
|
941
|
+
}
|
|
942
|
+
|
|
943
|
+
get address() {
|
|
944
|
+
return this._address;
|
|
945
|
+
}
|
|
946
|
+
|
|
947
|
+
set addressRequest(value) {
|
|
948
|
+
if (!value) return;
|
|
949
|
+
this._address = new AddressUpdateRequest(value).toCleanObject();
|
|
950
|
+
}
|
|
951
|
+
|
|
952
|
+
get audit() {
|
|
953
|
+
return this._audit;
|
|
954
|
+
}
|
|
955
|
+
|
|
956
|
+
set auditRequest(value) {
|
|
957
|
+
if (!value) return;
|
|
958
|
+
this._audit = new AuditRequest(value).toObject();
|
|
959
|
+
}
|
|
960
|
+
|
|
961
|
+
get businessDetails() {
|
|
962
|
+
return this._businessDetails;
|
|
963
|
+
}
|
|
964
|
+
|
|
965
|
+
set businessDetailsRequest(value) {
|
|
966
|
+
if (!value) return;
|
|
967
|
+
this._businessDetails = new BusinessDetailsRequest(value).toObject();
|
|
968
|
+
}
|
|
969
|
+
|
|
970
|
+
get legalRepresentatives() {
|
|
971
|
+
return this._legalRepresentatives;
|
|
972
|
+
}
|
|
973
|
+
|
|
974
|
+
set legalRepresentativesRequest(value) {
|
|
975
|
+
if (!value) return;
|
|
976
|
+
this._legalRepresentatives = value.map((lr) =>
|
|
977
|
+
new LegalRepresentativesRequest(lr).toObject(),
|
|
978
|
+
);
|
|
979
|
+
}
|
|
980
|
+
|
|
981
|
+
get license() {
|
|
982
|
+
return this._license;
|
|
983
|
+
}
|
|
984
|
+
|
|
985
|
+
set licenseRequest(value) {
|
|
986
|
+
if (!value) return;
|
|
987
|
+
this._license = new LicenseRequest(value).toObject();
|
|
988
|
+
}
|
|
989
|
+
|
|
990
|
+
get shareholders() {
|
|
991
|
+
return this._shareholders;
|
|
992
|
+
}
|
|
993
|
+
|
|
994
|
+
set shareholdersRequest(value) {
|
|
995
|
+
if (!value) return;
|
|
996
|
+
this._shareholders = value.map((sh) =>
|
|
997
|
+
new ShareholderMoralRequest(sh).toObject(),
|
|
998
|
+
);
|
|
999
|
+
}
|
|
1000
|
+
|
|
1001
|
+
get transactionalProfile() {
|
|
1002
|
+
return this._transactionalProfile;
|
|
1003
|
+
}
|
|
1004
|
+
|
|
1005
|
+
set transactionalProfileRequest(value) {
|
|
1006
|
+
if (!value) return;
|
|
1007
|
+
this._transactionalProfile = new TransactionalProfileRequest(
|
|
1008
|
+
value,
|
|
1009
|
+
).toObject();
|
|
1010
|
+
}
|
|
1011
|
+
|
|
1012
|
+
get vulnerableActivity() {
|
|
1013
|
+
return this._vulnerableActivity;
|
|
1014
|
+
}
|
|
1015
|
+
|
|
1016
|
+
set vulnerableActivityRequest(value) {
|
|
1017
|
+
if (!value) return;
|
|
1018
|
+
this._vulnerableActivity = new VulnerableActivityRequest(value).toObject();
|
|
1019
|
+
}
|
|
1020
|
+
|
|
1021
|
+
get externalAccount() {
|
|
1022
|
+
return this._externalAccount;
|
|
1023
|
+
}
|
|
1024
|
+
|
|
1025
|
+
set externalAccountRequest(value) {
|
|
1026
|
+
if (!value) return;
|
|
1027
|
+
this._externalAccount = {
|
|
1028
|
+
account: value.account,
|
|
1029
|
+
bank: value.bank,
|
|
1030
|
+
};
|
|
1031
|
+
}
|
|
1032
|
+
|
|
1033
|
+
toObject() {
|
|
1034
|
+
return {
|
|
1035
|
+
address: this.address,
|
|
1036
|
+
audit: this.audit,
|
|
1037
|
+
business_details: this.businessDetails,
|
|
1038
|
+
business_name: this.businessName,
|
|
1039
|
+
clabe: this.clabe,
|
|
1040
|
+
created_at: this.createdAt,
|
|
1041
|
+
documentation_url: this.documentationUrl,
|
|
1042
|
+
email_address: this.emailAddress,
|
|
1043
|
+
external_account: this.externalAccount,
|
|
1044
|
+
folio: this.folio,
|
|
1045
|
+
id: this.id,
|
|
1046
|
+
incorporation_date: this.incorporationDate,
|
|
1047
|
+
legal_name: this.legalName,
|
|
1048
|
+
legal_representatives: this.legalRepresentatives,
|
|
1049
|
+
level: this.level,
|
|
1050
|
+
license: this.license,
|
|
1051
|
+
meta: this.meta,
|
|
1052
|
+
nationality: this.nationality,
|
|
1053
|
+
phone_number: this.phoneNumber,
|
|
1054
|
+
platform_id: this.platformId,
|
|
1055
|
+
required_level: this.requiredLevel,
|
|
1056
|
+
rfc: this.rfc,
|
|
1057
|
+
shareholders: this.shareholders,
|
|
1058
|
+
status: this.status,
|
|
1059
|
+
transactional_profile: this.transactionalProfile,
|
|
1060
|
+
updated_at: this.updatedAt,
|
|
1061
|
+
user_id: this.userId,
|
|
1062
|
+
user_type: this.userType,
|
|
1063
|
+
vulnerable_activity: this.vulnerableActivity,
|
|
1064
|
+
web_site: this.webSite,
|
|
1065
|
+
};
|
|
1066
|
+
}
|
|
1067
|
+
}
|
|
1068
|
+
|
|
1069
|
+
class SavingRequest extends BaseRequest {
|
|
1070
|
+
constructor(category, goalAmount, goalDate, name) {
|
|
1071
|
+
super();
|
|
1072
|
+
this.category = category;
|
|
1073
|
+
this.name = name;
|
|
1074
|
+
this.goalAmount = goalAmount;
|
|
1075
|
+
this.validDate = goalDate;
|
|
1076
|
+
}
|
|
1077
|
+
|
|
1078
|
+
get goalDate() {
|
|
1079
|
+
return this._goalDate;
|
|
1080
|
+
}
|
|
1081
|
+
|
|
1082
|
+
set validDate(value) {
|
|
1083
|
+
if (!value) return;
|
|
1084
|
+
if (data.dateToUTC(value).getTime() <= data.dateToUTC(Date.now()).getTime()) {
|
|
1085
|
+
throw new errors_index.ValidationError(
|
|
1086
|
+
'The goal_date always need to be higher than now',
|
|
1087
|
+
);
|
|
1088
|
+
}
|
|
1089
|
+
this._goalDate = value;
|
|
1090
|
+
}
|
|
1091
|
+
|
|
1092
|
+
toObject() {
|
|
1093
|
+
return {
|
|
1094
|
+
category: this.category,
|
|
1095
|
+
goal_amount: this.goalAmount,
|
|
1096
|
+
goal_date: this.goalDate,
|
|
1097
|
+
name: this.name,
|
|
1098
|
+
};
|
|
1099
|
+
}
|
|
1100
|
+
}
|
|
1101
|
+
|
|
1102
|
+
class SessionRequest extends BaseRequest {
|
|
1103
|
+
constructor({ failureUrl, successUrl, type, userId, isBridge = false }) {
|
|
1104
|
+
super();
|
|
1105
|
+
this.failureUrl = failureUrl;
|
|
1106
|
+
this.successUrl = successUrl;
|
|
1107
|
+
this.type = type;
|
|
1108
|
+
this.userId = userId;
|
|
1109
|
+
this.isBridge = isBridge;
|
|
1110
|
+
}
|
|
1111
|
+
|
|
1112
|
+
toObject() {
|
|
1113
|
+
return {
|
|
1114
|
+
failure_url: this.failureUrl,
|
|
1115
|
+
success_url: this.successUrl,
|
|
1116
|
+
type: this.type,
|
|
1117
|
+
[this.isBridge ? 'account_id' : 'user_id']: this.userId,
|
|
1118
|
+
};
|
|
1119
|
+
}
|
|
1120
|
+
}
|
|
1121
|
+
|
|
1122
|
+
class TransferRequest extends BaseRequest {
|
|
1123
|
+
constructor(
|
|
1124
|
+
accountNumber,
|
|
1125
|
+
amount,
|
|
1126
|
+
descriptor,
|
|
1127
|
+
idempotencyKey,
|
|
1128
|
+
recipientName,
|
|
1129
|
+
) {
|
|
1130
|
+
super();
|
|
1131
|
+
this.accountNumber = accountNumber;
|
|
1132
|
+
this.amount = amount;
|
|
1133
|
+
this.descriptor = descriptor;
|
|
1134
|
+
this.idempotencyKey = idempotencyKey;
|
|
1135
|
+
this.recipientName = recipientName;
|
|
1136
|
+
}
|
|
1137
|
+
|
|
1138
|
+
toObject() {
|
|
1139
|
+
return {
|
|
1140
|
+
account_number: this.accountNumber,
|
|
1141
|
+
amount: this.amount,
|
|
1142
|
+
descriptor: this.descriptor,
|
|
1143
|
+
idempotency_key: this.idempotencyKey,
|
|
1144
|
+
recipient_name: this.recipientName,
|
|
1145
|
+
};
|
|
1146
|
+
}
|
|
1147
|
+
}
|
|
1148
|
+
|
|
1149
|
+
class UserCredentialRequest extends BaseRequest {
|
|
1150
|
+
constructor(password) {
|
|
1151
|
+
super();
|
|
1152
|
+
this.pwd = password;
|
|
1153
|
+
}
|
|
1154
|
+
|
|
1155
|
+
get password() {
|
|
1156
|
+
return this._password;
|
|
1157
|
+
}
|
|
1158
|
+
|
|
1159
|
+
set pwd(value) {
|
|
1160
|
+
const validations = [!!value, value.length >= 6];
|
|
1161
|
+
if (validations.some((x) => !x)) {
|
|
1162
|
+
throw new errors_index.ValidationError('Invalid password');
|
|
1163
|
+
}
|
|
1164
|
+
this._password = value;
|
|
1165
|
+
}
|
|
1166
|
+
|
|
1167
|
+
toObject() {
|
|
1168
|
+
return {
|
|
1169
|
+
password: this.password,
|
|
1170
|
+
};
|
|
1171
|
+
}
|
|
1172
|
+
}
|
|
1173
|
+
|
|
1174
|
+
class UserCredentialUpdateRequest extends BaseRequest {
|
|
1175
|
+
constructor(password, isActive) {
|
|
1176
|
+
super();
|
|
1177
|
+
this.pwd = password;
|
|
1178
|
+
this.isActive = isActive;
|
|
1179
|
+
this.req = {
|
|
1180
|
+
password: this.password,
|
|
1181
|
+
isActive: this.isActive,
|
|
1182
|
+
};
|
|
1183
|
+
}
|
|
1184
|
+
|
|
1185
|
+
get password() {
|
|
1186
|
+
return this._password;
|
|
1187
|
+
}
|
|
1188
|
+
|
|
1189
|
+
get request() {
|
|
1190
|
+
return this._request;
|
|
1191
|
+
}
|
|
1192
|
+
|
|
1193
|
+
set pwd(value) {
|
|
1194
|
+
if (!value) {
|
|
1195
|
+
this._password = value;
|
|
1196
|
+
return;
|
|
1197
|
+
}
|
|
1198
|
+
const validations = [value.length >= 6];
|
|
1199
|
+
if (validations.some((x) => !x)) {
|
|
1200
|
+
throw new errors_index.ValidationError('Invalid password');
|
|
1201
|
+
}
|
|
1202
|
+
this._password = value;
|
|
1203
|
+
}
|
|
1204
|
+
|
|
1205
|
+
set req(value) {
|
|
1206
|
+
if (value.password && value.isActive != null) {
|
|
1207
|
+
throw new errors_index.ValidationError('Only one property can be updated at a time');
|
|
1208
|
+
}
|
|
1209
|
+
this._request = value;
|
|
1210
|
+
}
|
|
1211
|
+
|
|
1212
|
+
toObject() {
|
|
1213
|
+
return {
|
|
1214
|
+
password: this.request.password,
|
|
1215
|
+
is_active: this.request.isActive,
|
|
1216
|
+
};
|
|
1217
|
+
}
|
|
1218
|
+
}
|
|
1219
|
+
|
|
1220
|
+
class UserLoginRequest extends BaseRequest {
|
|
1221
|
+
constructor(password, userId = 'me') {
|
|
1222
|
+
super();
|
|
1223
|
+
this.pwd = password;
|
|
1224
|
+
this.userId = userId;
|
|
1225
|
+
}
|
|
1226
|
+
|
|
1227
|
+
get password() {
|
|
1228
|
+
return this._password;
|
|
1229
|
+
}
|
|
1230
|
+
|
|
1231
|
+
set pwd(value) {
|
|
1232
|
+
const validations = [!!value, value.length === 6, /^\d{6}$/.test(value)];
|
|
1233
|
+
if (validations.some((x) => !x)) {
|
|
1234
|
+
throw new errors_index.ValidationError('Invalid password');
|
|
1235
|
+
}
|
|
1236
|
+
this._password = value;
|
|
1237
|
+
}
|
|
1238
|
+
|
|
1239
|
+
toObject() {
|
|
1240
|
+
return {
|
|
1241
|
+
password: this.password,
|
|
1242
|
+
user_id: this.userId,
|
|
768
1243
|
};
|
|
769
1244
|
}
|
|
770
1245
|
}
|
|
@@ -858,6 +1333,7 @@ exports.CardRequest = CardRequest;
|
|
|
858
1333
|
exports.CardUpdateRequest = CardUpdateRequest;
|
|
859
1334
|
exports.CardValidationRequest = CardValidationRequest;
|
|
860
1335
|
exports.KYCValidationsRequest = KYCValidationsRequest;
|
|
1336
|
+
exports.PartnerUserRequest = PartnerUserRequest;
|
|
861
1337
|
exports.SavingRequest = SavingRequest;
|
|
862
1338
|
exports.SessionRequest = SessionRequest;
|
|
863
1339
|
exports.TransferRequest = TransferRequest;
|