cuenca-validations 2.1.8.dev3__py3-none-any.whl → 2.1.9.dev1__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 +0 -2
- cuenca_validations/types/identities.py +36 -10
- cuenca_validations/types/queries.py +0 -4
- cuenca_validations/types/requests.py +2 -1
- cuenca_validations/version.py +1 -1
- {cuenca_validations-2.1.8.dev3.dist-info → cuenca_validations-2.1.9.dev1.dist-info}/METADATA +1 -1
- {cuenca_validations-2.1.8.dev3.dist-info → cuenca_validations-2.1.9.dev1.dist-info}/RECORD +11 -11
- tests/test_types.py +29 -1
- {cuenca_validations-2.1.8.dev3.dist-info → cuenca_validations-2.1.9.dev1.dist-info}/WHEEL +0 -0
- {cuenca_validations-2.1.8.dev3.dist-info → cuenca_validations-2.1.9.dev1.dist-info}/licenses/LICENSE +0 -0
- {cuenca_validations-2.1.8.dev3.dist-info → cuenca_validations-2.1.9.dev1.dist-info}/top_level.txt +0 -0
|
@@ -7,7 +7,6 @@ __all__ = [
|
|
|
7
7
|
'BalanceEntryQuery',
|
|
8
8
|
'BankAccountValidationQuery',
|
|
9
9
|
'BankAccountValidationRequest',
|
|
10
|
-
'PostalCodeQuery',
|
|
11
10
|
'BankAccountStatus',
|
|
12
11
|
'BatchFileMetadata',
|
|
13
12
|
'Beneficiary',
|
|
@@ -184,7 +183,6 @@ from .queries import (
|
|
|
184
183
|
EventQuery,
|
|
185
184
|
FileQuery,
|
|
186
185
|
IdentityQuery,
|
|
187
|
-
PostalCodeQuery,
|
|
188
186
|
QueryParams,
|
|
189
187
|
SessionQuery,
|
|
190
188
|
StatementQuery,
|
|
@@ -1,11 +1,18 @@
|
|
|
1
1
|
import datetime as dt
|
|
2
|
-
from typing import Annotated, Optional
|
|
2
|
+
from typing import Annotated, Any, Optional
|
|
3
3
|
|
|
4
|
-
from pydantic import
|
|
4
|
+
from pydantic import (
|
|
5
|
+
BaseModel,
|
|
6
|
+
ConfigDict,
|
|
7
|
+
Field,
|
|
8
|
+
SecretStr,
|
|
9
|
+
StringConstraints,
|
|
10
|
+
model_validator,
|
|
11
|
+
)
|
|
5
12
|
from pydantic_extra_types.phone_numbers import PhoneNumber
|
|
6
13
|
|
|
7
|
-
from .enums import KYCFileType, VerificationStatus
|
|
8
|
-
from .general import
|
|
14
|
+
from .enums import Country, KYCFileType, State, VerificationStatus
|
|
15
|
+
from .general import SerializableIPvAnyAddress
|
|
9
16
|
|
|
10
17
|
Password = Annotated[
|
|
11
18
|
SecretStr,
|
|
@@ -38,22 +45,41 @@ Rfc = Annotated[
|
|
|
38
45
|
|
|
39
46
|
|
|
40
47
|
class Address(BaseModel):
|
|
41
|
-
street:
|
|
42
|
-
ext_number:
|
|
43
|
-
int_number: Optional[
|
|
44
|
-
|
|
45
|
-
|
|
48
|
+
street: Optional[str] = None
|
|
49
|
+
ext_number: Optional[str] = None
|
|
50
|
+
int_number: Optional[str] = None
|
|
51
|
+
colonia: Optional[str] = None
|
|
52
|
+
postal_code: Optional[str] = None
|
|
53
|
+
state: Optional[State] = None
|
|
54
|
+
country: Optional[Country] = None
|
|
55
|
+
city: Optional[str] = None
|
|
56
|
+
full_name: Optional[str] = None
|
|
46
57
|
model_config = ConfigDict(
|
|
47
58
|
json_schema_extra={
|
|
48
59
|
"example": {
|
|
49
60
|
"street": "Reforma",
|
|
50
61
|
"ext_number": "265",
|
|
51
62
|
"int_number": "5",
|
|
52
|
-
"
|
|
63
|
+
"colonia": "Cuauhtémoc",
|
|
64
|
+
"postal_code": "06500",
|
|
65
|
+
"state": "DF",
|
|
66
|
+
"country": "MX",
|
|
67
|
+
"city": "Cuauhtémoc",
|
|
53
68
|
}
|
|
54
69
|
}
|
|
55
70
|
)
|
|
56
71
|
|
|
72
|
+
@model_validator(mode='before')
|
|
73
|
+
@classmethod
|
|
74
|
+
def full_name_complete(cls, values: dict[str, Any]) -> dict[str, Any]:
|
|
75
|
+
if values.get('full_name'):
|
|
76
|
+
return values
|
|
77
|
+
if not values.get('street'):
|
|
78
|
+
raise ValueError('required street')
|
|
79
|
+
if not values.get('ext_number'):
|
|
80
|
+
raise ValueError('required ext_number')
|
|
81
|
+
return values
|
|
82
|
+
|
|
57
83
|
|
|
58
84
|
class Beneficiary(BaseModel):
|
|
59
85
|
name: str
|
|
@@ -407,6 +407,7 @@ class TOSRequest(BaseModel):
|
|
|
407
407
|
class UserTOSAgreementRequest(BaseModel):
|
|
408
408
|
tos_id: str
|
|
409
409
|
location: Coordinate
|
|
410
|
+
signature: SerializableHttpUrl | None = None
|
|
410
411
|
|
|
411
412
|
|
|
412
413
|
class UserRequest(BaseModel):
|
|
@@ -423,7 +424,7 @@ class UserRequest(BaseModel):
|
|
|
423
424
|
None, description='Only if you validated previously on your side'
|
|
424
425
|
)
|
|
425
426
|
profession: Optional[str] = None
|
|
426
|
-
address: Address
|
|
427
|
+
address: Optional[Address] = None
|
|
427
428
|
status: Optional[UserStatus] = Field(
|
|
428
429
|
None,
|
|
429
430
|
description='Status that the user will have when created. '
|
cuenca_validations/version.py
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
__version__ = '2.1.
|
|
1
|
+
__version__ = '2.1.9.dev1'
|
|
@@ -4,25 +4,25 @@ 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=wzwLnJ4wHggZvqp3mearbFkzvDERGeTNvJkuofQnuMc,1484
|
|
7
|
-
cuenca_validations/version.py,sha256=
|
|
8
|
-
cuenca_validations/types/__init__.py,sha256=
|
|
7
|
+
cuenca_validations/version.py,sha256=K0tGeUKZQpqxelTLpDhoi_2JCO1-4RT69FepccoTGao,27
|
|
8
|
+
cuenca_validations/types/__init__.py,sha256=UNb7auBcD0qp-x9TX7TNNj8IKo7uaI7xHaf9PYmaziY,4765
|
|
9
9
|
cuenca_validations/types/card.py,sha256=UGzz8NTFAverUmdUKAK1oGHnOnjSNTpIRUm93vKSSGY,1295
|
|
10
10
|
cuenca_validations/types/enums.py,sha256=Vm9HGf83jPkEp8iZ-KGtKGWQGx5q-cIUuQj32y_QcvU,18997
|
|
11
11
|
cuenca_validations/types/files.py,sha256=2CszbwF9ytXV9suFFwyDjYG4XxY8UhCjRw3HttVXXNw,269
|
|
12
12
|
cuenca_validations/types/general.py,sha256=vJmQBD_Iv_hsxD8x3_Bip-NlYAiE2rmXSPQKj4kTtto,2621
|
|
13
13
|
cuenca_validations/types/helpers.py,sha256=6rHUhwoQ7jJZtGcW3LX-W5ZDl42PWE1RoBpGme7KCkk,610
|
|
14
|
-
cuenca_validations/types/identities.py,sha256
|
|
14
|
+
cuenca_validations/types/identities.py,sha256=-TWRDRpmIaCI4nE4hVy1FQtQtlxuErtmEtzJW1FBzec,4956
|
|
15
15
|
cuenca_validations/types/morals.py,sha256=m8kAedevmwfSPTA9GYe03l7pkgipynwYgKfejyVtnuI,1813
|
|
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=KCRx0sPzWDtDDbZysmFGVgANgfqil17EITWaG7tGQ-A,4700
|
|
17
|
+
cuenca_validations/types/requests.py,sha256=zGlKCy5o2FbPvU49znxspCA8fIihG0rRwWA-mvPOw6c,21387
|
|
18
|
+
cuenca_validations-2.1.9.dev1.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=ubzpi1UXCryLQdgsT_Zm2IX-XE_4L0dnHnhLwH06xK8,748
|
|
23
23
|
tests/test_statement.py,sha256=IOE0rRRBgBZSJv_FLaETEyn5NzzXKMNTqgjv99GX-68,1436
|
|
24
|
-
tests/test_types.py,sha256=
|
|
25
|
-
cuenca_validations-2.1.
|
|
26
|
-
cuenca_validations-2.1.
|
|
27
|
-
cuenca_validations-2.1.
|
|
28
|
-
cuenca_validations-2.1.
|
|
24
|
+
tests/test_types.py,sha256=K_YNFz0Kac3k8fJNeXuYGkL1hjXDQu084jCX6xEMEE4,19348
|
|
25
|
+
cuenca_validations-2.1.9.dev1.dist-info/METADATA,sha256=LObUZJhrJ7mM1z8eUTy8Wl7-iHDOSIj5RgPUrlNBBfc,1599
|
|
26
|
+
cuenca_validations-2.1.9.dev1.dist-info/WHEEL,sha256=_zCd3N1l69ArxyTb8rzEoP9TpbYXkqRFSNOD5OuxnTs,91
|
|
27
|
+
cuenca_validations-2.1.9.dev1.dist-info/top_level.txt,sha256=4233xdOs2HtuT-GFRjcDcwK0IwdwvWdczOtk0fPB6Gw,25
|
|
28
|
+
cuenca_validations-2.1.9.dev1.dist-info/RECORD,,
|
tests/test_types.py
CHANGED
|
@@ -10,6 +10,7 @@ from pydantic import AfterValidator, BaseModel, SecretStr, ValidationError
|
|
|
10
10
|
from pydantic.fields import FieldInfo
|
|
11
11
|
|
|
12
12
|
from cuenca_validations.types import (
|
|
13
|
+
Address,
|
|
13
14
|
CardQuery,
|
|
14
15
|
JSONEncoder,
|
|
15
16
|
QueryParams,
|
|
@@ -20,6 +21,7 @@ from cuenca_validations.types import (
|
|
|
20
21
|
get_state_name,
|
|
21
22
|
)
|
|
22
23
|
from cuenca_validations.types.enums import (
|
|
24
|
+
Country,
|
|
23
25
|
EcommerceIndicator,
|
|
24
26
|
SessionType,
|
|
25
27
|
State,
|
|
@@ -301,6 +303,27 @@ def test_saving_update_request():
|
|
|
301
303
|
SavingUpdateRequest(**data)
|
|
302
304
|
|
|
303
305
|
|
|
306
|
+
def test_address_validation():
|
|
307
|
+
data = dict(
|
|
308
|
+
full_name='Varsovia 36, Col Cuahutemoc',
|
|
309
|
+
)
|
|
310
|
+
assert Address(**data)
|
|
311
|
+
with pytest.raises(ValueError) as v:
|
|
312
|
+
Address(**dict())
|
|
313
|
+
assert 'required street' in str(v)
|
|
314
|
+
data = dict(street='somestreet')
|
|
315
|
+
with pytest.raises(ValueError) as v:
|
|
316
|
+
Address(**data)
|
|
317
|
+
assert 'required ext_number' in str(v)
|
|
318
|
+
data = dict(
|
|
319
|
+
street='varsovia',
|
|
320
|
+
ext_number='36',
|
|
321
|
+
state=State.DF,
|
|
322
|
+
country=Country.MX,
|
|
323
|
+
)
|
|
324
|
+
assert Address(**data)
|
|
325
|
+
|
|
326
|
+
|
|
304
327
|
@freeze_time('2022-01-01')
|
|
305
328
|
def test_user_request():
|
|
306
329
|
request = dict(
|
|
@@ -314,7 +337,12 @@ def test_user_request():
|
|
|
314
337
|
street='calle 1',
|
|
315
338
|
ext_number='2',
|
|
316
339
|
int_number='3',
|
|
317
|
-
|
|
340
|
+
colonia='Juarez',
|
|
341
|
+
postal_code='09900',
|
|
342
|
+
state=State.DF.value,
|
|
343
|
+
country=Country.MX,
|
|
344
|
+
city='Obrera',
|
|
345
|
+
full_name=None,
|
|
318
346
|
),
|
|
319
347
|
phone_verification_id='VE12345678',
|
|
320
348
|
email_verification_id='VE0987654321',
|
|
File without changes
|
{cuenca_validations-2.1.8.dev3.dist-info → cuenca_validations-2.1.9.dev1.dist-info}/licenses/LICENSE
RENAMED
|
File without changes
|
{cuenca_validations-2.1.8.dev3.dist-info → cuenca_validations-2.1.9.dev1.dist-info}/top_level.txt
RENAMED
|
File without changes
|