@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.
@@ -1,5 +1,5 @@
1
1
  import { ValidationError } from './errors/index.mjs';
2
- import { d as dateToUTC, e as enumValueFromString, s as VerificationType } from './data-7e8b28c6.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,12 +15,27 @@ 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,
25
40
  changeLog,
26
41
  committeeMeetingDate,
@@ -46,7 +61,7 @@ class AlertUpdateRequest extends BaseRequest {
46
61
  this.accountNumber = accountNumber;
47
62
  this.actualPeriodCount = actualPeriodCount;
48
63
  this.actualPeriodSum = actualPeriodSum;
49
- this.aggent = aggent;
64
+ this.agent = agent;
50
65
  this.aggregationType = aggregationType;
51
66
  this.changeLog = changeLog;
52
67
  this.committeeMeetingDate = committeeMeetingDate;
@@ -71,7 +86,7 @@ class AlertUpdateRequest extends BaseRequest {
71
86
 
72
87
  toObject() {
73
88
  return {
74
- aggent: this.aggent,
89
+ agent: this.agent,
75
90
  change_log: this.changeLog,
76
91
  comments: this.comments,
77
92
  description: this.description,
@@ -99,21 +114,6 @@ class AlertUpdateRequest extends BaseRequest {
99
114
  }
100
115
  }
101
116
 
102
- class ApiKeyUpdateRequest extends BaseRequest {
103
- constructor(userId, metadata) {
104
- super();
105
- this.userId = userId;
106
- this.metadata = metadata;
107
- }
108
-
109
- toObject() {
110
- return {
111
- user_id: this.userId,
112
- metadata: this.metadata,
113
- };
114
- }
115
- }
116
-
117
117
  class ArpcRequest extends BaseRequest {
118
118
  constructor({
119
119
  arpcMethod,
@@ -407,184 +407,6 @@ class KYCValidationsRequest extends BaseRequest {
407
407
  }
408
408
  }
409
409
 
410
- class SavingRequest extends BaseRequest {
411
- constructor(category, goalAmount, goalDate, name) {
412
- super();
413
- this.category = category;
414
- this.name = name;
415
- this.goalAmount = goalAmount;
416
- this.validDate = goalDate;
417
- }
418
-
419
- get goalDate() {
420
- return this._goalDate;
421
- }
422
-
423
- set validDate(value) {
424
- if (!value) return;
425
- if (dateToUTC(value).getTime() <= dateToUTC(Date.now()).getTime()) {
426
- throw new ValidationError(
427
- 'The goal_date always need to be higher than now',
428
- );
429
- }
430
- this._goalDate = value;
431
- }
432
-
433
- toObject() {
434
- return {
435
- category: this.category,
436
- goal_amount: this.goalAmount,
437
- goal_date: this.goalDate,
438
- name: this.name,
439
- };
440
- }
441
- }
442
-
443
- class SessionRequest extends BaseRequest {
444
- constructor({ failureUrl, successUrl, type, userId, isBridge = false }) {
445
- super();
446
- this.failureUrl = failureUrl;
447
- this.successUrl = successUrl;
448
- this.type = type;
449
- this.userId = userId;
450
- this.isBridge = isBridge;
451
- }
452
-
453
- toObject() {
454
- return {
455
- failure_url: this.failureUrl,
456
- success_url: this.successUrl,
457
- type: this.type,
458
- [this.isBridge ? 'account_id' : 'user_id']: this.userId,
459
- };
460
- }
461
- }
462
-
463
- class TransferRequest extends BaseRequest {
464
- constructor(
465
- accountNumber,
466
- amount,
467
- descriptor,
468
- idempotencyKey,
469
- recipientName,
470
- ) {
471
- super();
472
- this.accountNumber = accountNumber;
473
- this.amount = amount;
474
- this.descriptor = descriptor;
475
- this.idempotencyKey = idempotencyKey;
476
- this.recipientName = recipientName;
477
- }
478
-
479
- toObject() {
480
- return {
481
- account_number: this.accountNumber,
482
- amount: this.amount,
483
- descriptor: this.descriptor,
484
- idempotency_key: this.idempotencyKey,
485
- recipient_name: this.recipientName,
486
- };
487
- }
488
- }
489
-
490
- class UserCredentialRequest extends BaseRequest {
491
- constructor(password) {
492
- super();
493
- this.pwd = password;
494
- }
495
-
496
- get password() {
497
- return this._password;
498
- }
499
-
500
- set pwd(value) {
501
- const validations = [!!value, value.length >= 6];
502
- if (validations.some((x) => !x)) {
503
- throw new ValidationError('Invalid password');
504
- }
505
- this._password = value;
506
- }
507
-
508
- toObject() {
509
- return {
510
- password: this.password,
511
- };
512
- }
513
- }
514
-
515
- class UserCredentialUpdateRequest extends BaseRequest {
516
- constructor(password, isActive) {
517
- super();
518
- this.pwd = password;
519
- this.isActive = isActive;
520
- this.req = {
521
- password: this.password,
522
- isActive: this.isActive,
523
- };
524
- }
525
-
526
- get password() {
527
- return this._password;
528
- }
529
-
530
- get request() {
531
- return this._request;
532
- }
533
-
534
- set pwd(value) {
535
- if (!value) {
536
- this._password = value;
537
- return;
538
- }
539
- const validations = [value.length >= 6];
540
- if (validations.some((x) => !x)) {
541
- throw new ValidationError('Invalid password');
542
- }
543
- this._password = value;
544
- }
545
-
546
- set req(value) {
547
- if (value.password && value.isActive != null) {
548
- throw new ValidationError('Only one property can be updated at a time');
549
- }
550
- this._request = value;
551
- }
552
-
553
- toObject() {
554
- return {
555
- password: this.request.password,
556
- is_active: this.request.isActive,
557
- };
558
- }
559
- }
560
-
561
- class UserLoginRequest extends BaseRequest {
562
- constructor(password, userId = 'me') {
563
- super();
564
- this.pwd = password;
565
- this.userId = userId;
566
- }
567
-
568
- get password() {
569
- return this._password;
570
- }
571
-
572
- set pwd(value) {
573
- const validations = [!!value, value.length === 6, /^\d{6}$/.test(value)];
574
- if (validations.some((x) => !x)) {
575
- throw new ValidationError('Invalid password');
576
- }
577
- this._password = value;
578
- }
579
-
580
- toObject() {
581
- return {
582
- password: this.password,
583
- user_id: this.userId,
584
- };
585
- }
586
- }
587
-
588
410
  class TosUpdateRequest extends BaseRequest {
589
411
  constructor({ ip, location, type, version }) {
590
412
  super();
@@ -688,22 +510,30 @@ class UserUpdateRequest extends BaseRequest {
688
510
  address,
689
511
  curpDocumentUri,
690
512
  govtId,
513
+ emailAddress,
691
514
  profession,
692
515
  proofOfAddress,
693
516
  proofOfLife,
694
517
  requiredLevel,
695
518
  termsOfService,
519
+ phoneNumber,
520
+ rfc,
521
+ userType,
696
522
  verificationId,
697
523
  }) {
698
524
  super();
525
+ this.addressProofs = proofOfAddress;
699
526
  this.adrs = address;
700
527
  this.curpDocumentUri = curpDocumentUri;
528
+ this.emailAddress = emailAddress;
701
529
  this.govstIds = govtId;
702
- this.profession = profession;
703
- this.addressProofs = proofOfAddress;
704
530
  this.lifeProofs = proofOfLife;
531
+ this.profession = profession;
532
+ this.phoneNumber = phoneNumber;
705
533
  this.requiredLevel = requiredLevel;
706
- this.terms = termsOfService;
534
+ this.termsOfService = termsOfService;
535
+ this.rfc = rfc;
536
+ this.userType = userType;
707
537
  this.verificationId = verificationId;
708
538
  }
709
539
 
@@ -711,7 +541,7 @@ class UserUpdateRequest extends BaseRequest {
711
541
  return this._termsOfService;
712
542
  }
713
543
 
714
- set terms(value) {
544
+ set termsOfService(value) {
715
545
  if (!value) return;
716
546
  this._termsOfService = new TosUpdateRequest(value).toObject();
717
547
  }
@@ -756,13 +586,658 @@ class UserUpdateRequest extends BaseRequest {
756
586
  return {
757
587
  address: this.address,
758
588
  curp_document_uri: this.curpDocumentUri,
589
+ email_address: this.emailAddress,
590
+ govt_id: this.govtId,
591
+ phone_number: this.phoneNumber,
759
592
  profession: this.profession,
593
+ proof_of_life: this.proofOfLife,
594
+ proof_of_address: this.proofOfAddress,
760
595
  requiredLevel: this.requiredLevel,
596
+ rfc: this.rfc,
761
597
  terms_of_service: this.termsOfService,
762
598
  verification_id: this.verificationId,
763
- proof_of_life: this.proofOfLife,
764
- proof_of_address: this.proofOfAddress,
765
- 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,
766
1241
  };
767
1242
  }
768
1243
  }
@@ -847,4 +1322,4 @@ class WalletTransactionRequest extends BaseRequest {
847
1322
  }
848
1323
  }
849
1324
 
850
- 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 };