@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,7 +1,7 @@
1
1
  'use strict';
2
2
 
3
3
  var errors_index = require('./errors/index.cjs');
4
- var data = require('./data-665e0ec5.cjs');
4
+ var data = require('./data-6c2897da.cjs');
5
5
 
6
6
  class BaseRequest {
7
7
  toObject() {
@@ -17,25 +17,42 @@ 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
- aggent,
40
+ agent,
26
41
  aggregationType,
42
+ changeLog,
27
43
  committeeMeetingDate,
28
44
  comments,
29
45
  createdAt,
30
46
  description,
31
- hasQuestionnaire,
32
47
  id,
33
48
  institutionName,
34
49
  level,
50
+ manualScenario,
35
51
  name,
36
52
  period,
37
53
  periodNumber,
38
54
  status,
55
+ sourceType,
39
56
  transactionDate,
40
57
  type,
41
58
  typeOfFilter,
@@ -46,20 +63,22 @@ class AlertUpdateRequest extends BaseRequest {
46
63
  this.accountNumber = accountNumber;
47
64
  this.actualPeriodCount = actualPeriodCount;
48
65
  this.actualPeriodSum = actualPeriodSum;
49
- this.aggent = aggent;
66
+ this.agent = agent;
50
67
  this.aggregationType = aggregationType;
68
+ this.changeLog = changeLog;
51
69
  this.committeeMeetingDate = committeeMeetingDate;
52
70
  this.createdAt = createdAt;
53
71
  this.comments = comments;
54
72
  this.description = description;
55
- this.hasQuestionnaire = hasQuestionnaire;
56
73
  this.id = id;
57
74
  this.institutionName = institutionName;
58
75
  this.level = level;
59
76
  this.name = name;
77
+ this.manualScenario = manualScenario;
60
78
  this.period = period;
61
79
  this.periodNumber = periodNumber;
62
80
  this.status = status;
81
+ this.sourceType = sourceType;
63
82
  this.transactionDate = transactionDate;
64
83
  this.type = type;
65
84
  this.typeOfFilter = typeOfFilter;
@@ -69,7 +88,8 @@ class AlertUpdateRequest extends BaseRequest {
69
88
 
70
89
  toObject() {
71
90
  return {
72
- aggent: this.aggent,
91
+ agent: this.agent,
92
+ change_log: this.changeLog,
73
93
  comments: this.comments,
74
94
  description: this.description,
75
95
  id: this.id,
@@ -78,34 +98,20 @@ class AlertUpdateRequest extends BaseRequest {
78
98
  period: this.period,
79
99
  status: this.status,
80
100
  type: this.type,
81
- accountNumber: this.accountNumber,
82
- actualPeriodCount: this.actualPeriodCount,
83
- actualPeriodSum: this.actualPeriodSum,
84
- aggregationType: this.aggregationType,
85
- committeeMeetingDate: this.committeeMeetingDate,
86
- createdAt: this.createdAt,
87
- hasQuestionnaire: this.hasQuestionnaire,
88
- institutionName: this.institutionName,
89
- periodNumber: this.periodNumber,
90
- transactionDate: this.transactionDate,
91
- typeOfFilter: this.typeOfFilter,
92
- updatedAt: this.updatedAt,
93
- userId: this.userId,
94
- };
95
- }
96
- }
97
-
98
- class ApiKeyUpdateRequest extends BaseRequest {
99
- constructor(userId, metadata) {
100
- super();
101
- this.userId = userId;
102
- this.metadata = metadata;
103
- }
104
-
105
- toObject() {
106
- return {
101
+ account_number: this.accountNumber,
102
+ actual_period_count: this.actualPeriodCount,
103
+ actual_period_sum: this.actualPeriodSum,
104
+ aggregation_type: this.aggregationType,
105
+ committee_meeting_date: this.committeeMeetingDate,
106
+ created_at: this.createdAt,
107
+ institution_name: this.institutionName,
108
+ manual_scenario: this.manualScenario,
109
+ period_number: this.periodNumber,
110
+ transaction_date: this.transactionDate,
111
+ source_type: this.sourceType,
112
+ type_of_filter: this.typeOfFilter,
113
+ updated_at: this.updatedAt,
107
114
  user_id: this.userId,
108
- metadata: this.metadata,
109
115
  };
110
116
  }
111
117
  }
@@ -403,184 +409,6 @@ class KYCValidationsRequest extends BaseRequest {
403
409
  }
404
410
  }
405
411
 
406
- class SavingRequest extends BaseRequest {
407
- constructor(category, goalAmount, goalDate, name) {
408
- super();
409
- this.category = category;
410
- this.name = name;
411
- this.goalAmount = goalAmount;
412
- this.validDate = goalDate;
413
- }
414
-
415
- get goalDate() {
416
- return this._goalDate;
417
- }
418
-
419
- set validDate(value) {
420
- if (!value) return;
421
- if (data.dateToUTC(value).getTime() <= data.dateToUTC(Date.now()).getTime()) {
422
- throw new errors_index.ValidationError(
423
- 'The goal_date always need to be higher than now',
424
- );
425
- }
426
- this._goalDate = value;
427
- }
428
-
429
- toObject() {
430
- return {
431
- category: this.category,
432
- goal_amount: this.goalAmount,
433
- goal_date: this.goalDate,
434
- name: this.name,
435
- };
436
- }
437
- }
438
-
439
- class SessionRequest extends BaseRequest {
440
- constructor({ failureUrl, successUrl, type, userId, isBridge = false }) {
441
- super();
442
- this.failureUrl = failureUrl;
443
- this.successUrl = successUrl;
444
- this.type = type;
445
- this.userId = userId;
446
- this.isBridge = isBridge;
447
- }
448
-
449
- toObject() {
450
- return {
451
- failure_url: this.failureUrl,
452
- success_url: this.successUrl,
453
- type: this.type,
454
- [this.isBridge ? 'account_id' : 'user_id']: this.userId,
455
- };
456
- }
457
- }
458
-
459
- class TransferRequest extends BaseRequest {
460
- constructor(
461
- accountNumber,
462
- amount,
463
- descriptor,
464
- idempotencyKey,
465
- recipientName,
466
- ) {
467
- super();
468
- this.accountNumber = accountNumber;
469
- this.amount = amount;
470
- this.descriptor = descriptor;
471
- this.idempotencyKey = idempotencyKey;
472
- this.recipientName = recipientName;
473
- }
474
-
475
- toObject() {
476
- return {
477
- account_number: this.accountNumber,
478
- amount: this.amount,
479
- descriptor: this.descriptor,
480
- idempotency_key: this.idempotencyKey,
481
- recipient_name: this.recipientName,
482
- };
483
- }
484
- }
485
-
486
- class UserCredentialRequest extends BaseRequest {
487
- constructor(password) {
488
- super();
489
- this.pwd = password;
490
- }
491
-
492
- get password() {
493
- return this._password;
494
- }
495
-
496
- set pwd(value) {
497
- const validations = [!!value, value.length >= 6];
498
- if (validations.some((x) => !x)) {
499
- throw new errors_index.ValidationError('Invalid password');
500
- }
501
- this._password = value;
502
- }
503
-
504
- toObject() {
505
- return {
506
- password: this.password,
507
- };
508
- }
509
- }
510
-
511
- class UserCredentialUpdateRequest extends BaseRequest {
512
- constructor(password, isActive) {
513
- super();
514
- this.pwd = password;
515
- this.isActive = isActive;
516
- this.req = {
517
- password: this.password,
518
- isActive: this.isActive,
519
- };
520
- }
521
-
522
- get password() {
523
- return this._password;
524
- }
525
-
526
- get request() {
527
- return this._request;
528
- }
529
-
530
- set pwd(value) {
531
- if (!value) {
532
- this._password = value;
533
- return;
534
- }
535
- const validations = [value.length >= 6];
536
- if (validations.some((x) => !x)) {
537
- throw new errors_index.ValidationError('Invalid password');
538
- }
539
- this._password = value;
540
- }
541
-
542
- set req(value) {
543
- if (value.password && value.isActive != null) {
544
- throw new errors_index.ValidationError('Only one property can be updated at a time');
545
- }
546
- this._request = value;
547
- }
548
-
549
- toObject() {
550
- return {
551
- password: this.request.password,
552
- is_active: this.request.isActive,
553
- };
554
- }
555
- }
556
-
557
- class UserLoginRequest extends BaseRequest {
558
- constructor(password, userId = 'me') {
559
- super();
560
- this.pwd = password;
561
- this.userId = userId;
562
- }
563
-
564
- get password() {
565
- return this._password;
566
- }
567
-
568
- set pwd(value) {
569
- const validations = [!!value, value.length === 6, /^\d{6}$/.test(value)];
570
- if (validations.some((x) => !x)) {
571
- throw new errors_index.ValidationError('Invalid password');
572
- }
573
- this._password = value;
574
- }
575
-
576
- toObject() {
577
- return {
578
- password: this.password,
579
- user_id: this.userId,
580
- };
581
- }
582
- }
583
-
584
412
  class TosUpdateRequest extends BaseRequest {
585
413
  constructor({ ip, location, type, version }) {
586
414
  super();
@@ -684,22 +512,30 @@ class UserUpdateRequest extends BaseRequest {
684
512
  address,
685
513
  curpDocumentUri,
686
514
  govtId,
515
+ emailAddress,
687
516
  profession,
688
517
  proofOfAddress,
689
518
  proofOfLife,
690
519
  requiredLevel,
691
520
  termsOfService,
521
+ phoneNumber,
522
+ rfc,
523
+ userType,
692
524
  verificationId,
693
525
  }) {
694
526
  super();
527
+ this.addressProofs = proofOfAddress;
695
528
  this.adrs = address;
696
529
  this.curpDocumentUri = curpDocumentUri;
530
+ this.emailAddress = emailAddress;
697
531
  this.govstIds = govtId;
698
- this.profession = profession;
699
- this.addressProofs = proofOfAddress;
700
532
  this.lifeProofs = proofOfLife;
533
+ this.profession = profession;
534
+ this.phoneNumber = phoneNumber;
701
535
  this.requiredLevel = requiredLevel;
702
- this.terms = termsOfService;
536
+ this.termsOfService = termsOfService;
537
+ this.rfc = rfc;
538
+ this.userType = userType;
703
539
  this.verificationId = verificationId;
704
540
  }
705
541
 
@@ -707,7 +543,7 @@ class UserUpdateRequest extends BaseRequest {
707
543
  return this._termsOfService;
708
544
  }
709
545
 
710
- set terms(value) {
546
+ set termsOfService(value) {
711
547
  if (!value) return;
712
548
  this._termsOfService = new TosUpdateRequest(value).toObject();
713
549
  }
@@ -752,13 +588,658 @@ class UserUpdateRequest extends BaseRequest {
752
588
  return {
753
589
  address: this.address,
754
590
  curp_document_uri: this.curpDocumentUri,
591
+ email_address: this.emailAddress,
592
+ govt_id: this.govtId,
593
+ phone_number: this.phoneNumber,
755
594
  profession: this.profession,
595
+ proof_of_life: this.proofOfLife,
596
+ proof_of_address: this.proofOfAddress,
756
597
  requiredLevel: this.requiredLevel,
598
+ rfc: this.rfc,
757
599
  terms_of_service: this.termsOfService,
758
600
  verification_id: this.verificationId,
759
- proof_of_life: this.proofOfLife,
760
- proof_of_address: this.proofOfAddress,
761
- govt_id: this.govtId,
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,
762
1243
  };
763
1244
  }
764
1245
  }
@@ -852,6 +1333,7 @@ exports.CardRequest = CardRequest;
852
1333
  exports.CardUpdateRequest = CardUpdateRequest;
853
1334
  exports.CardValidationRequest = CardValidationRequest;
854
1335
  exports.KYCValidationsRequest = KYCValidationsRequest;
1336
+ exports.PartnerUserRequest = PartnerUserRequest;
855
1337
  exports.SavingRequest = SavingRequest;
856
1338
  exports.SessionRequest = SessionRequest;
857
1339
  exports.TransferRequest = TransferRequest;