@cuenca-mx/cuenca-js 0.0.14-dev2 → 0.0.14-dev20

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