cuenca-validations 2.1.41.dev2__py3-none-any.whl → 2.1.42.dev0__py3-none-any.whl
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.
- cuenca_validations/types/__init__.py +3 -30
- cuenca_validations/types/enums.py +1 -22
- cuenca_validations/types/queries.py +0 -10
- cuenca_validations/types/requests.py +3 -146
- cuenca_validations/version.py +1 -1
- {cuenca_validations-2.1.41.dev2.dist-info → cuenca_validations-2.1.42.dev0.dist-info}/METADATA +1 -1
- {cuenca_validations-2.1.41.dev2.dist-info → cuenca_validations-2.1.42.dev0.dist-info}/RECORD +11 -11
- tests/test_requests.py +1 -185
- {cuenca_validations-2.1.41.dev2.dist-info → cuenca_validations-2.1.42.dev0.dist-info}/WHEEL +0 -0
- {cuenca_validations-2.1.41.dev2.dist-info → cuenca_validations-2.1.42.dev0.dist-info}/licenses/LICENSE +0 -0
- {cuenca_validations-2.1.41.dev2.dist-info → cuenca_validations-2.1.42.dev0.dist-info}/top_level.txt +0 -0
|
@@ -1,9 +1,6 @@
|
|
|
1
1
|
__all__ = [
|
|
2
2
|
'AccountUseType',
|
|
3
3
|
'AccountQuery',
|
|
4
|
-
'AccountRequest',
|
|
5
|
-
'AccountUpdateRequest',
|
|
6
|
-
'AccountValidationStatus',
|
|
7
4
|
'Address',
|
|
8
5
|
'AgentQuery',
|
|
9
6
|
'AgentRequest',
|
|
@@ -60,20 +57,11 @@ __all__ = [
|
|
|
60
57
|
'KYCValidationRequest',
|
|
61
58
|
'KYCValidationSource',
|
|
62
59
|
'Language',
|
|
63
|
-
'LegalPersonRequest',
|
|
64
|
-
'LegalPersonUpdateRequest',
|
|
65
60
|
'LimitedWalletRequest',
|
|
66
61
|
'MonthlyMovementsType',
|
|
67
62
|
'MonthlySpendingType',
|
|
68
|
-
'
|
|
69
|
-
'
|
|
70
|
-
'OperatorLoginRequest',
|
|
71
|
-
'OperatorLoginResponse',
|
|
72
|
-
'OperatorQuery',
|
|
73
|
-
'OperatorRequest',
|
|
74
|
-
'OperatorRole',
|
|
75
|
-
'OperatorStatus',
|
|
76
|
-
'OperatorUpdateRequest',
|
|
63
|
+
'LegalPersonRequest',
|
|
64
|
+
'LegalPersonUpdateRequest',
|
|
77
65
|
'PartnerRequest',
|
|
78
66
|
'PartnerUpdateRequest',
|
|
79
67
|
'PasswordResetRequest',
|
|
@@ -83,6 +71,7 @@ __all__ = [
|
|
|
83
71
|
'PosCapability',
|
|
84
72
|
'Profession',
|
|
85
73
|
'QueryParams',
|
|
74
|
+
'LegalRfc',
|
|
86
75
|
'Rfc',
|
|
87
76
|
'QuestionnairesRequest',
|
|
88
77
|
'SantizedDict',
|
|
@@ -91,10 +80,8 @@ __all__ = [
|
|
|
91
80
|
'SavingRequest',
|
|
92
81
|
'SavingUpdateRequest',
|
|
93
82
|
'ServiceProviderCategory',
|
|
94
|
-
'SessionMetadata',
|
|
95
83
|
'SessionQuery',
|
|
96
84
|
'SessionRequest',
|
|
97
|
-
'SessionResponse',
|
|
98
85
|
'SessionType',
|
|
99
86
|
'State',
|
|
100
87
|
'StatementQuery',
|
|
@@ -145,7 +132,6 @@ __all__ = [
|
|
|
145
132
|
from .card import StrictPaymentCardNumber
|
|
146
133
|
from .enums import (
|
|
147
134
|
AccountUseType,
|
|
148
|
-
AccountValidationStatus,
|
|
149
135
|
AuthorizerTransaction,
|
|
150
136
|
BankAccountStatus,
|
|
151
137
|
CardErrorType,
|
|
@@ -172,9 +158,6 @@ from .enums import (
|
|
|
172
158
|
Language,
|
|
173
159
|
MonthlyMovementsType,
|
|
174
160
|
MonthlySpendingType,
|
|
175
|
-
OperationalEventAction,
|
|
176
|
-
OperatorRole,
|
|
177
|
-
OperatorStatus,
|
|
178
161
|
PlatformType,
|
|
179
162
|
PosCapability,
|
|
180
163
|
Profession,
|
|
@@ -233,8 +216,6 @@ from .queries import (
|
|
|
233
216
|
EventQuery,
|
|
234
217
|
FileQuery,
|
|
235
218
|
IdentityQuery,
|
|
236
|
-
OperationalEventQuery,
|
|
237
|
-
OperatorQuery,
|
|
238
219
|
PostalCodeQuery,
|
|
239
220
|
QueryParams,
|
|
240
221
|
SessionQuery,
|
|
@@ -248,8 +229,6 @@ from .queries import (
|
|
|
248
229
|
WalletTransactionQuery,
|
|
249
230
|
)
|
|
250
231
|
from .requests import (
|
|
251
|
-
AccountRequest,
|
|
252
|
-
AccountUpdateRequest,
|
|
253
232
|
AgentRequest,
|
|
254
233
|
ApiKeyUpdateRequest,
|
|
255
234
|
BankAccountValidationRequest,
|
|
@@ -265,10 +244,6 @@ from .requests import (
|
|
|
265
244
|
LegalPersonRequest,
|
|
266
245
|
LegalPersonUpdateRequest,
|
|
267
246
|
LimitedWalletRequest,
|
|
268
|
-
OperatorLoginRequest,
|
|
269
|
-
OperatorLoginResponse,
|
|
270
|
-
OperatorRequest,
|
|
271
|
-
OperatorUpdateRequest,
|
|
272
247
|
PartnerRequest,
|
|
273
248
|
PartnerUpdateRequest,
|
|
274
249
|
PasswordResetRequest,
|
|
@@ -276,9 +251,7 @@ from .requests import (
|
|
|
276
251
|
QuestionnairesRequest,
|
|
277
252
|
SavingRequest,
|
|
278
253
|
SavingUpdateRequest,
|
|
279
|
-
SessionMetadata,
|
|
280
254
|
SessionRequest,
|
|
281
|
-
SessionResponse,
|
|
282
255
|
StrictTransferRequest,
|
|
283
256
|
TOSRequest,
|
|
284
257
|
TransferRequest,
|
|
@@ -624,6 +624,7 @@ class WebhookEvent(str, Enum):
|
|
|
624
624
|
class UserType(str, Enum):
|
|
625
625
|
physical = 'physical'
|
|
626
626
|
moral = 'moral'
|
|
627
|
+
legal_person = 'legal_person'
|
|
627
628
|
|
|
628
629
|
|
|
629
630
|
class VerificationType(str, Enum):
|
|
@@ -744,25 +745,3 @@ class RequiredAction(str, Enum):
|
|
|
744
745
|
level_up_required = 'level_up_required'
|
|
745
746
|
level_up_invitation = 'level_up_invitation'
|
|
746
747
|
fix_documents = 'fix_documents'
|
|
747
|
-
|
|
748
|
-
|
|
749
|
-
class AccountValidationStatus(str, Enum):
|
|
750
|
-
verified = 'verified'
|
|
751
|
-
pending = 'pending'
|
|
752
|
-
|
|
753
|
-
|
|
754
|
-
class OperationalEventAction(str, Enum):
|
|
755
|
-
account_created = 'account_created'
|
|
756
|
-
account_updated = 'account_updated'
|
|
757
|
-
transfer_created = 'transfer_created'
|
|
758
|
-
statement_downloaded = 'statement_downloaded'
|
|
759
|
-
|
|
760
|
-
|
|
761
|
-
class OperatorRole(str, Enum):
|
|
762
|
-
operator = 'operator'
|
|
763
|
-
authorizer = 'authorizer'
|
|
764
|
-
|
|
765
|
-
|
|
766
|
-
class OperatorStatus(str, Enum):
|
|
767
|
-
active = 'active'
|
|
768
|
-
disabled = 'disabled'
|
|
@@ -22,7 +22,6 @@ from .enums import (
|
|
|
22
22
|
CardType,
|
|
23
23
|
EventType,
|
|
24
24
|
KYCFileType,
|
|
25
|
-
OperationalEventAction,
|
|
26
25
|
SessionType,
|
|
27
26
|
TermsOfService,
|
|
28
27
|
TransferNetwork,
|
|
@@ -154,15 +153,6 @@ class AccountQuery(QueryParams):
|
|
|
154
153
|
account_number: Optional[str] = None
|
|
155
154
|
|
|
156
155
|
|
|
157
|
-
class OperationalEventQuery(QueryParams):
|
|
158
|
-
actor_id: Optional[str] = None
|
|
159
|
-
action: Optional[OperationalEventAction] = None
|
|
160
|
-
|
|
161
|
-
|
|
162
|
-
class OperatorQuery(QueryParams):
|
|
163
|
-
email: Optional[EmailStr] = None
|
|
164
|
-
|
|
165
|
-
|
|
166
156
|
class BalanceEntryQuery(QueryParams):
|
|
167
157
|
funding_instrument_uri: Optional[str] = None
|
|
168
158
|
wallet_id: str = 'default'
|
|
@@ -18,7 +18,6 @@ from pydantic_extra_types.coordinate import Coordinate
|
|
|
18
18
|
|
|
19
19
|
from ..types.enums import (
|
|
20
20
|
AccountUseType,
|
|
21
|
-
AccountValidationStatus,
|
|
22
21
|
AuthorizerTransaction,
|
|
23
22
|
CardDesign,
|
|
24
23
|
CardFundingType,
|
|
@@ -37,8 +36,6 @@ from ..types.enums import (
|
|
|
37
36
|
KYCValidationSource,
|
|
38
37
|
MonthlyMovementsType,
|
|
39
38
|
MonthlySpendingType,
|
|
40
|
-
OperatorRole,
|
|
41
|
-
OperatorStatus,
|
|
42
39
|
PlatformType,
|
|
43
40
|
PosCapability,
|
|
44
41
|
Profession,
|
|
@@ -632,29 +629,11 @@ class UserLoginRequest(BaseRequest):
|
|
|
632
629
|
)
|
|
633
630
|
|
|
634
631
|
|
|
635
|
-
class SessionMetadata(BaseModel):
|
|
636
|
-
operator_id: Optional[str] = None
|
|
637
|
-
model_config = ConfigDict(extra='forbid')
|
|
638
|
-
|
|
639
|
-
|
|
640
|
-
class SessionResponse(BaseModel):
|
|
641
|
-
id: str
|
|
642
|
-
created_at: dt.datetime
|
|
643
|
-
user_id: str
|
|
644
|
-
platform_id: str
|
|
645
|
-
expires_at: dt.datetime
|
|
646
|
-
type: SessionType
|
|
647
|
-
success_url: Optional[SerializableAnyUrl] = None
|
|
648
|
-
failure_url: Optional[SerializableAnyUrl] = None
|
|
649
|
-
metadata: Optional[SessionMetadata] = None
|
|
650
|
-
|
|
651
|
-
|
|
652
632
|
class SessionRequest(BaseRequest):
|
|
653
633
|
user_id: str
|
|
654
634
|
type: SessionType
|
|
655
635
|
success_url: Optional[SerializableAnyUrl] = None
|
|
656
636
|
failure_url: Optional[SerializableAnyUrl] = None
|
|
657
|
-
metadata: Optional[SessionMetadata] = None
|
|
658
637
|
model_config = ConfigDict(
|
|
659
638
|
json_schema_extra={
|
|
660
639
|
'example': {
|
|
@@ -756,39 +735,6 @@ class LimitedWalletRequest(BaseRequest):
|
|
|
756
735
|
allowed_rfc: Optional[Rfc] = None
|
|
757
736
|
|
|
758
737
|
|
|
759
|
-
class AccountRequest(BaseRequest):
|
|
760
|
-
name: StrictStr
|
|
761
|
-
account_number: Clabe
|
|
762
|
-
alias: Optional[StrictStr] = None
|
|
763
|
-
curp: Optional[Curp] = None
|
|
764
|
-
rfc: Optional[Rfc] = None
|
|
765
|
-
|
|
766
|
-
model_config = ConfigDict(
|
|
767
|
-
json_schema_extra={
|
|
768
|
-
'example': {
|
|
769
|
-
'name': 'Aceros del Norte SA de CV',
|
|
770
|
-
'account_number': '072691004495711499',
|
|
771
|
-
'alias': 'Proveedor acero',
|
|
772
|
-
}
|
|
773
|
-
},
|
|
774
|
-
)
|
|
775
|
-
|
|
776
|
-
|
|
777
|
-
class AccountUpdateRequest(BaseRequest):
|
|
778
|
-
name: Optional[StrictStr] = None
|
|
779
|
-
alias: Optional[StrictStr] = None
|
|
780
|
-
validation_status: Optional[AccountValidationStatus] = None
|
|
781
|
-
|
|
782
|
-
model_config = ConfigDict(
|
|
783
|
-
json_schema_extra={
|
|
784
|
-
'example': {
|
|
785
|
-
'alias': 'Fletes',
|
|
786
|
-
'validation_status': 'verified',
|
|
787
|
-
}
|
|
788
|
-
},
|
|
789
|
-
)
|
|
790
|
-
|
|
791
|
-
|
|
792
738
|
class PlatformRequest(BaseModel):
|
|
793
739
|
name: str
|
|
794
740
|
rfc: Optional[str] = None
|
|
@@ -920,6 +866,7 @@ class PartnerUpdateRequest(BaseRequest):
|
|
|
920
866
|
class LegalPersonRequest(BaseRequest):
|
|
921
867
|
legal_name: str
|
|
922
868
|
rfc: Rfc
|
|
869
|
+
address: AddressRequest
|
|
923
870
|
legal_representatives: list[LegalRepresentative]
|
|
924
871
|
|
|
925
872
|
model_config = ConfigDict(
|
|
@@ -927,6 +874,7 @@ class LegalPersonRequest(BaseRequest):
|
|
|
927
874
|
'example': {
|
|
928
875
|
'legal_name': 'Aceros del Norte SA de CV',
|
|
929
876
|
'rfc': 'ADN850101ABC',
|
|
877
|
+
'address': AddressRequest.model_json_schema().get('example'),
|
|
930
878
|
'legal_representatives': [
|
|
931
879
|
{
|
|
932
880
|
'names': 'Juan',
|
|
@@ -943,104 +891,13 @@ class LegalPersonRequest(BaseRequest):
|
|
|
943
891
|
},
|
|
944
892
|
)
|
|
945
893
|
|
|
946
|
-
@field_validator('rfc')
|
|
947
|
-
@classmethod
|
|
948
|
-
def validate_legal_rfc(cls, rfc: Rfc) -> Rfc:
|
|
949
|
-
if len(rfc) != 12:
|
|
950
|
-
raise ValueError('RFC must be 12 characters for legal persons')
|
|
951
|
-
return rfc
|
|
952
|
-
|
|
953
894
|
|
|
954
895
|
class LegalPersonUpdateRequest(BaseRequest):
|
|
955
896
|
legal_name: Optional[str] = None
|
|
956
897
|
rfc: Optional[Rfc] = None
|
|
898
|
+
address: Optional[AddressRequest] = None
|
|
957
899
|
legal_representatives: Optional[list[LegalRepresentative]] = None
|
|
958
900
|
|
|
959
|
-
@model_validator(mode="before")
|
|
960
|
-
@classmethod
|
|
961
|
-
def check_at_least_one_param(cls, values: DictStrAny) -> DictStrAny:
|
|
962
|
-
if not values:
|
|
963
|
-
raise ValueError('At least one parameter must be provided')
|
|
964
|
-
return values
|
|
965
|
-
|
|
966
|
-
@field_validator('rfc')
|
|
967
|
-
@classmethod
|
|
968
|
-
def validate_legal_rfc(cls, rfc: Optional[Rfc]) -> Optional[Rfc]:
|
|
969
|
-
if rfc is not None and len(rfc) != 12:
|
|
970
|
-
raise ValueError('RFC must be 12 characters for legal persons')
|
|
971
|
-
return rfc
|
|
972
|
-
|
|
973
|
-
|
|
974
|
-
class OperatorRequest(BaseRequest):
|
|
975
|
-
name: str
|
|
976
|
-
email: EmailStr
|
|
977
|
-
phone: PhoneNumber
|
|
978
|
-
company_user_id: str
|
|
979
|
-
role: OperatorRole
|
|
980
|
-
status: OperatorStatus = OperatorStatus.active
|
|
981
|
-
|
|
982
|
-
model_config = ConfigDict(
|
|
983
|
-
json_schema_extra={
|
|
984
|
-
'example': {
|
|
985
|
-
'name': 'Maria Lopez',
|
|
986
|
-
'email': 'maria.lopez@aceros.com',
|
|
987
|
-
'phone': '+525512345678',
|
|
988
|
-
'company_user_id': 'USWqY5cvkISJOxHyEKjAKf8w',
|
|
989
|
-
'role': 'operator',
|
|
990
|
-
}
|
|
991
|
-
},
|
|
992
|
-
)
|
|
993
|
-
|
|
994
|
-
@field_validator('email', mode='before')
|
|
995
|
-
@classmethod
|
|
996
|
-
def validate_email(cls, email: str) -> str:
|
|
997
|
-
return normalize_email(email)
|
|
998
|
-
|
|
999
|
-
|
|
1000
|
-
class OperatorUpdateRequest(BaseRequest):
|
|
1001
|
-
name: Optional[str] = None
|
|
1002
|
-
phone: Optional[PhoneNumber] = None
|
|
1003
|
-
role: Optional[OperatorRole] = None
|
|
1004
|
-
status: Optional[OperatorStatus] = None
|
|
1005
|
-
|
|
1006
|
-
@model_validator(mode="before")
|
|
1007
|
-
@classmethod
|
|
1008
|
-
def check_at_least_one_param(cls, values: DictStrAny) -> DictStrAny:
|
|
1009
|
-
if not values:
|
|
1010
|
-
raise ValueError('At least one parameter must be provided')
|
|
1011
|
-
return values
|
|
1012
|
-
|
|
1013
|
-
|
|
1014
|
-
class OperatorLoginRequest(BaseRequest):
|
|
1015
|
-
email: EmailStr
|
|
1016
|
-
password: Annotated[Password, LogConfig(masked=True)]
|
|
1017
|
-
|
|
1018
|
-
model_config = ConfigDict(
|
|
1019
|
-
json_schema_extra={
|
|
1020
|
-
'example': {
|
|
1021
|
-
'email': 'maria.lopez@aceros.com',
|
|
1022
|
-
'password': 'supersecret',
|
|
1023
|
-
}
|
|
1024
|
-
},
|
|
1025
|
-
)
|
|
1026
|
-
|
|
1027
|
-
@field_validator('email', mode='before')
|
|
1028
|
-
@classmethod
|
|
1029
|
-
def validate_email(cls, email: str) -> str:
|
|
1030
|
-
return normalize_email(email)
|
|
1031
|
-
|
|
1032
|
-
|
|
1033
|
-
class OperatorLoginResponse(BaseModel):
|
|
1034
|
-
session_token: str
|
|
1035
|
-
|
|
1036
|
-
model_config = ConfigDict(
|
|
1037
|
-
json_schema_extra={
|
|
1038
|
-
'example': {
|
|
1039
|
-
'session_token': 'SEWqY5cvkISJOxHyEKjAKf8w',
|
|
1040
|
-
}
|
|
1041
|
-
},
|
|
1042
|
-
)
|
|
1043
|
-
|
|
1044
901
|
|
|
1045
902
|
class PhoneVerificationAssociationRequest(BaseRequest):
|
|
1046
903
|
verification_id: str
|
cuenca_validations/version.py
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
__version__ = '2.1.
|
|
1
|
+
__version__ = '2.1.42.dev0'
|
{cuenca_validations-2.1.41.dev2.dist-info → cuenca_validations-2.1.42.dev0.dist-info}/RECORD
RENAMED
|
@@ -4,27 +4,27 @@ cuenca_validations/errors.py,sha256=OtM8EgiKqYdz9Hn66AbBO96orL1or7efkyt0vh0Zxbs,
|
|
|
4
4
|
cuenca_validations/py.typed,sha256=47DEQpj8HBSa-_TImW-5JCeuQeRkm5NMpJWZG3hSuFU,0
|
|
5
5
|
cuenca_validations/typing.py,sha256=1QCu81IbVZZpyInjyeAuO-nF36gpT5Gi4o6V9PozuOU,204
|
|
6
6
|
cuenca_validations/validators.py,sha256=zXSnU5-EMbQZBD-PfFXgP4Z6G7cm7KFDWXB7Nie6WUk,2682
|
|
7
|
-
cuenca_validations/version.py,sha256=
|
|
8
|
-
cuenca_validations/types/__init__.py,sha256=
|
|
7
|
+
cuenca_validations/version.py,sha256=KvOmPU0BkfM9RZfPohVJyd20n84CApBrNk5m76pcpTU,28
|
|
8
|
+
cuenca_validations/types/__init__.py,sha256=IRntp9Da2MDkK8qUI1YlZ6cNKRXZa-V2gWI60wTn2A4,5839
|
|
9
9
|
cuenca_validations/types/card.py,sha256=UGzz8NTFAverUmdUKAK1oGHnOnjSNTpIRUm93vKSSGY,1295
|
|
10
|
-
cuenca_validations/types/enums.py,sha256=
|
|
10
|
+
cuenca_validations/types/enums.py,sha256=0aPI091QePFRWDbQir171jjL9cGLBGGjMXGq9-cNnXE,20648
|
|
11
11
|
cuenca_validations/types/files.py,sha256=2CszbwF9ytXV9suFFwyDjYG4XxY8UhCjRw3HttVXXNw,269
|
|
12
12
|
cuenca_validations/types/general.py,sha256=eYFYwyx_a4_J480GYpqW3DFbZabDFcUjvLRMQbShIUc,5622
|
|
13
13
|
cuenca_validations/types/helpers.py,sha256=4veeLZbugHHqZk0ezSim978VhH6Vq8XTrEhe1eE_r3A,1531
|
|
14
14
|
cuenca_validations/types/identities.py,sha256=j2xxh3UYHJe6IbAwr9yNXJkebTth_-g3SUmHeiPez8M,5513
|
|
15
15
|
cuenca_validations/types/morals.py,sha256=davabh5hAnFVQyM7-yCyDaT5ewXnm0cr1BtqDIwzkX8,1833
|
|
16
|
-
cuenca_validations/types/queries.py,sha256=
|
|
17
|
-
cuenca_validations/types/requests.py,sha256=
|
|
18
|
-
cuenca_validations-2.1.
|
|
16
|
+
cuenca_validations/types/queries.py,sha256=KnS_jbuUn5k1dZhliEyFxvttfZ22w0hO5x4qTsZR2g0,5862
|
|
17
|
+
cuenca_validations/types/requests.py,sha256=Lw6IhdeO_ECKVTsMQW0ecQwdQIfmsVHsnn3R49BAyBI,26874
|
|
18
|
+
cuenca_validations-2.1.42.dev0.dist-info/licenses/LICENSE,sha256=wR76FmxBbfnQpwELkkE5iMF8sFIafEMgXLTE4N4WPTc,1063
|
|
19
19
|
tests/__init__.py,sha256=47DEQpj8HBSa-_TImW-5JCeuQeRkm5NMpJWZG3hSuFU,0
|
|
20
20
|
tests/test_card.py,sha256=QAfRz7e11gWICPnFJZ2tiYgUsFV3C9TwzJXrDnDNXFw,1202
|
|
21
21
|
tests/test_errors.py,sha256=ixiIgEuBuzfsL5p4uCFdF32XqFRtTPF6EVhGJ0keOrI,930
|
|
22
22
|
tests/test_helpers.py,sha256=fx2R7y6oQO8XeQzevJe826NuHkBgvtznZicomchB3Gg,899
|
|
23
|
-
tests/test_requests.py,sha256=
|
|
23
|
+
tests/test_requests.py,sha256=9kzuWBikfhrQqH7sJ-HQN9UCJ-Fph0MPL4j6q1RfI4o,4320
|
|
24
24
|
tests/test_statement.py,sha256=IOE0rRRBgBZSJv_FLaETEyn5NzzXKMNTqgjv99GX-68,1436
|
|
25
25
|
tests/test_types.py,sha256=rPjqPGfPU73MSdbeJpoW_ai5TAO25hWSnQAt_H7ZIeI,23055
|
|
26
26
|
tests/test_validators.py,sha256=Jjr9gWTT4cRntGiKvQK4fncqx3JkEuTWkKm1VqpRHTs,1829
|
|
27
|
-
cuenca_validations-2.1.
|
|
28
|
-
cuenca_validations-2.1.
|
|
29
|
-
cuenca_validations-2.1.
|
|
30
|
-
cuenca_validations-2.1.
|
|
27
|
+
cuenca_validations-2.1.42.dev0.dist-info/METADATA,sha256=2-Whs-Ug0XwcIlQ2PA5mLwlEQHLAYUvxfjCEXtmWi2s,1600
|
|
28
|
+
cuenca_validations-2.1.42.dev0.dist-info/WHEEL,sha256=YVMoNqKzERt-wjUZwJ33xBGAwnFl-4cqbYkTtWa4itE,91
|
|
29
|
+
cuenca_validations-2.1.42.dev0.dist-info/top_level.txt,sha256=4233xdOs2HtuT-GFRjcDcwK0IwdwvWdczOtk0fPB6Gw,25
|
|
30
|
+
cuenca_validations-2.1.42.dev0.dist-info/RECORD,,
|
tests/test_requests.py
CHANGED
|
@@ -2,24 +2,9 @@ import pytest
|
|
|
2
2
|
from pydantic import ValidationError
|
|
3
3
|
from pydantic_extra_types.phone_numbers import PhoneNumber
|
|
4
4
|
|
|
5
|
-
from cuenca_validations.types.enums import
|
|
6
|
-
Country,
|
|
7
|
-
OperatorRole,
|
|
8
|
-
OperatorStatus,
|
|
9
|
-
SessionType,
|
|
10
|
-
VerificationType,
|
|
11
|
-
)
|
|
12
|
-
from cuenca_validations.types.queries import OperatorQuery
|
|
5
|
+
from cuenca_validations.types.enums import Country, VerificationType
|
|
13
6
|
from cuenca_validations.types.requests import (
|
|
14
|
-
LegalPersonRequest,
|
|
15
|
-
LegalPersonUpdateRequest,
|
|
16
|
-
OperatorLoginRequest,
|
|
17
|
-
OperatorLoginResponse,
|
|
18
|
-
OperatorRequest,
|
|
19
|
-
OperatorUpdateRequest,
|
|
20
7
|
PasswordResetRequest,
|
|
21
|
-
SessionMetadata,
|
|
22
|
-
SessionRequest,
|
|
23
8
|
UpdateTransferRequest,
|
|
24
9
|
UserTOSAgreementRequest,
|
|
25
10
|
UserUpdateRequest,
|
|
@@ -27,175 +12,6 @@ from cuenca_validations.types.requests import (
|
|
|
27
12
|
)
|
|
28
13
|
from cuenca_validations.typing import DictStrAny
|
|
29
14
|
|
|
30
|
-
LEGAL_REPRESENTATIVE: DictStrAny = {
|
|
31
|
-
'names': 'Juan',
|
|
32
|
-
'first_surname': 'Perez',
|
|
33
|
-
'job': 'Director General',
|
|
34
|
-
'phone_number': '+525512345678',
|
|
35
|
-
'email_address': 'juan.perez@aceros.com',
|
|
36
|
-
'address': {
|
|
37
|
-
'street': 'Reforma',
|
|
38
|
-
'ext_number': '265',
|
|
39
|
-
'postal_code_id': 'PC2ygq9j2bS9-9tsuVawzErA',
|
|
40
|
-
},
|
|
41
|
-
}
|
|
42
|
-
|
|
43
|
-
LEGAL_PERSON_REQUEST: DictStrAny = {
|
|
44
|
-
'legal_name': 'Aceros del Norte SA de CV',
|
|
45
|
-
'rfc': 'ADN850101ABC',
|
|
46
|
-
'legal_representatives': [LEGAL_REPRESENTATIVE],
|
|
47
|
-
}
|
|
48
|
-
|
|
49
|
-
|
|
50
|
-
def test_legal_person_request_valid() -> None:
|
|
51
|
-
req = LegalPersonRequest.model_validate(LEGAL_PERSON_REQUEST)
|
|
52
|
-
assert req.legal_name == 'Aceros del Norte SA de CV'
|
|
53
|
-
assert req.rfc == 'ADN850101ABC'
|
|
54
|
-
|
|
55
|
-
|
|
56
|
-
def test_legal_person_request_rejects_physical_rfc() -> None:
|
|
57
|
-
with pytest.raises(ValidationError) as ex:
|
|
58
|
-
LegalPersonRequest.model_validate(
|
|
59
|
-
{**LEGAL_PERSON_REQUEST, 'rfc': 'GOCG650418TJ1'}
|
|
60
|
-
)
|
|
61
|
-
assert 'RFC must be 12 characters for legal persons' in str(ex.value)
|
|
62
|
-
|
|
63
|
-
|
|
64
|
-
def test_legal_person_request_forbids_extra() -> None:
|
|
65
|
-
with pytest.raises(ValidationError) as ex:
|
|
66
|
-
LegalPersonRequest.model_validate(
|
|
67
|
-
{**LEGAL_PERSON_REQUEST, 'foo': 'bar'}
|
|
68
|
-
)
|
|
69
|
-
assert 'Extra inputs are not permitted' in str(ex.value)
|
|
70
|
-
|
|
71
|
-
|
|
72
|
-
def test_legal_person_update_requires_at_least_one_param() -> None:
|
|
73
|
-
with pytest.raises(ValueError) as ex:
|
|
74
|
-
LegalPersonUpdateRequest()
|
|
75
|
-
assert 'At least one parameter must be provided' in str(ex.value)
|
|
76
|
-
|
|
77
|
-
|
|
78
|
-
def test_legal_person_update_valid() -> None:
|
|
79
|
-
req = LegalPersonUpdateRequest.model_validate({'legal_name': 'New name'})
|
|
80
|
-
assert req.legal_name == 'New name'
|
|
81
|
-
|
|
82
|
-
|
|
83
|
-
def test_legal_person_update_accepts_legal_rfc() -> None:
|
|
84
|
-
req = LegalPersonUpdateRequest.model_validate({'rfc': 'ADN850101ABC'})
|
|
85
|
-
assert req.rfc == 'ADN850101ABC'
|
|
86
|
-
|
|
87
|
-
|
|
88
|
-
def test_legal_person_update_rejects_physical_rfc() -> None:
|
|
89
|
-
with pytest.raises(ValidationError) as ex:
|
|
90
|
-
LegalPersonUpdateRequest.model_validate({'rfc': 'GOCG650418TJ1'})
|
|
91
|
-
assert 'RFC must be 12 characters for legal persons' in str(ex.value)
|
|
92
|
-
|
|
93
|
-
|
|
94
|
-
def test_operator_request_valid() -> None:
|
|
95
|
-
req = OperatorRequest(
|
|
96
|
-
name='Maria Lopez',
|
|
97
|
-
email='Maria+Tag@Aceros.com',
|
|
98
|
-
phone=PhoneNumber('+525512345678'),
|
|
99
|
-
company_user_id='USWqY5cvkISJOxHyEKjAKf8w',
|
|
100
|
-
role=OperatorRole.operator,
|
|
101
|
-
)
|
|
102
|
-
assert req.email == 'maria@aceros.com'
|
|
103
|
-
assert req.status == OperatorStatus.active
|
|
104
|
-
|
|
105
|
-
|
|
106
|
-
def test_operator_request_rejects_invalid_role() -> None:
|
|
107
|
-
with pytest.raises(ValidationError) as ex:
|
|
108
|
-
OperatorRequest.model_validate(
|
|
109
|
-
{
|
|
110
|
-
'name': 'Maria Lopez',
|
|
111
|
-
'email': 'maria@aceros.com',
|
|
112
|
-
'phone': '+525512345678',
|
|
113
|
-
'company_user_id': 'USWqY5cvkISJOxHyEKjAKf8w',
|
|
114
|
-
'role': 'admin',
|
|
115
|
-
}
|
|
116
|
-
)
|
|
117
|
-
assert 'role' in str(ex.value)
|
|
118
|
-
|
|
119
|
-
|
|
120
|
-
def test_operator_update_requires_at_least_one_param() -> None:
|
|
121
|
-
with pytest.raises(ValueError) as ex:
|
|
122
|
-
OperatorUpdateRequest()
|
|
123
|
-
assert 'At least one parameter must be provided' in str(ex.value)
|
|
124
|
-
|
|
125
|
-
|
|
126
|
-
def test_operator_update_valid() -> None:
|
|
127
|
-
req = OperatorUpdateRequest.model_validate({'name': 'New name'})
|
|
128
|
-
assert req.name == 'New name'
|
|
129
|
-
|
|
130
|
-
|
|
131
|
-
def test_operator_login_request_valid() -> None:
|
|
132
|
-
req = OperatorLoginRequest.model_validate(
|
|
133
|
-
{
|
|
134
|
-
'email': 'Operator+Tag@Aceros.com',
|
|
135
|
-
'password': 'supersecret',
|
|
136
|
-
}
|
|
137
|
-
)
|
|
138
|
-
assert req.email == 'operator@aceros.com'
|
|
139
|
-
|
|
140
|
-
|
|
141
|
-
def test_operator_login_request_rejects_short_password() -> None:
|
|
142
|
-
with pytest.raises(ValidationError) as ex:
|
|
143
|
-
OperatorLoginRequest.model_validate(
|
|
144
|
-
{
|
|
145
|
-
'email': 'operator@aceros.com',
|
|
146
|
-
'password': 'short',
|
|
147
|
-
}
|
|
148
|
-
)
|
|
149
|
-
assert 'password' in str(ex.value)
|
|
150
|
-
|
|
151
|
-
|
|
152
|
-
def test_operator_login_request_forbids_extra() -> None:
|
|
153
|
-
with pytest.raises(ValidationError) as ex:
|
|
154
|
-
OperatorLoginRequest.model_validate(
|
|
155
|
-
{
|
|
156
|
-
'email': 'operator@aceros.com',
|
|
157
|
-
'password': 'supersecret',
|
|
158
|
-
'foo': 'bar',
|
|
159
|
-
}
|
|
160
|
-
)
|
|
161
|
-
assert 'Extra inputs are not permitted' in str(ex.value)
|
|
162
|
-
|
|
163
|
-
|
|
164
|
-
def test_operator_login_response_valid() -> None:
|
|
165
|
-
resp = OperatorLoginResponse(session_token='SEWqY5cvkISJOxHyEKjAKf8w')
|
|
166
|
-
assert resp.session_token == 'SEWqY5cvkISJOxHyEKjAKf8w'
|
|
167
|
-
|
|
168
|
-
|
|
169
|
-
def test_operator_query_valid() -> None:
|
|
170
|
-
query = OperatorQuery.model_validate({'email': 'maria.lopez@aceros.com'})
|
|
171
|
-
assert str(query.email) == 'maria.lopez@aceros.com'
|
|
172
|
-
|
|
173
|
-
|
|
174
|
-
def test_operator_query_forbids_extra() -> None:
|
|
175
|
-
with pytest.raises(ValidationError) as ex:
|
|
176
|
-
OperatorQuery.model_validate(
|
|
177
|
-
{'email': 'maria@aceros.com', 'foo': 'bar'}
|
|
178
|
-
)
|
|
179
|
-
assert 'Extra inputs are not permitted' in str(ex.value)
|
|
180
|
-
|
|
181
|
-
|
|
182
|
-
def test_session_request_with_operator_metadata() -> None:
|
|
183
|
-
req = SessionRequest(
|
|
184
|
-
user_id='USWqY5cvkISJOxHyEKjAKf8w',
|
|
185
|
-
type=SessionType.registration,
|
|
186
|
-
metadata=SessionMetadata(operator_id='OPWqY5cvkISJOxHyEKjAKf8w'),
|
|
187
|
-
)
|
|
188
|
-
assert req.metadata is not None
|
|
189
|
-
assert req.metadata.operator_id == 'OPWqY5cvkISJOxHyEKjAKf8w'
|
|
190
|
-
|
|
191
|
-
|
|
192
|
-
def test_session_request_metadata_forbids_extra() -> None:
|
|
193
|
-
with pytest.raises(ValidationError) as ex:
|
|
194
|
-
SessionMetadata.model_validate(
|
|
195
|
-
{'operator_id': 'OPWqY5cvkISJOxHyEKjAKf8w', 'foo': 'bar'}
|
|
196
|
-
)
|
|
197
|
-
assert 'Extra inputs are not permitted' in str(ex.value)
|
|
198
|
-
|
|
199
15
|
|
|
200
16
|
@pytest.mark.parametrize('environment', ['api.stage', 'api.sandbox', 'api'])
|
|
201
17
|
def test_file_cuenca_url(environment: str) -> None:
|
|
File without changes
|
|
File without changes
|
{cuenca_validations-2.1.41.dev2.dist-info → cuenca_validations-2.1.42.dev0.dist-info}/top_level.txt
RENAMED
|
File without changes
|