cuenca-validations 2.1.8.dev5__py3-none-any.whl → 2.1.10.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 +28 -9
- cuenca_validations/types/queries.py +0 -4
- cuenca_validations/types/requests.py +6 -25
- cuenca_validations/version.py +1 -1
- {cuenca_validations-2.1.8.dev5.dist-info → cuenca_validations-2.1.10.dev1.dist-info}/METADATA +1 -1
- {cuenca_validations-2.1.8.dev5.dist-info → cuenca_validations-2.1.10.dev1.dist-info}/RECORD +11 -11
- tests/test_types.py +29 -3
- {cuenca_validations-2.1.8.dev5.dist-info → cuenca_validations-2.1.10.dev1.dist-info}/WHEEL +0 -0
- {cuenca_validations-2.1.8.dev5.dist-info → cuenca_validations-2.1.10.dev1.dist-info}/licenses/LICENSE +0 -0
- {cuenca_validations-2.1.8.dev5.dist-info → cuenca_validations-2.1.10.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
14
|
from .enums import Country, KYCFileType, State, VerificationStatus
|
|
8
|
-
from .general import
|
|
15
|
+
from .general import SerializableIPvAnyAddress
|
|
9
16
|
|
|
10
17
|
Password = Annotated[
|
|
11
18
|
SecretStr,
|
|
@@ -38,14 +45,15 @@ Rfc = Annotated[
|
|
|
38
45
|
|
|
39
46
|
|
|
40
47
|
class Address(BaseModel):
|
|
41
|
-
street:
|
|
42
|
-
ext_number:
|
|
43
|
-
int_number: Optional[
|
|
44
|
-
colonia: Optional[
|
|
45
|
-
postal_code: Optional[
|
|
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
|
|
46
53
|
state: Optional[State] = None
|
|
47
54
|
country: Optional[Country] = None
|
|
48
|
-
city: Optional[
|
|
55
|
+
city: Optional[str] = None
|
|
56
|
+
full_name: Optional[str] = None
|
|
49
57
|
model_config = ConfigDict(
|
|
50
58
|
json_schema_extra={
|
|
51
59
|
"example": {
|
|
@@ -61,6 +69,17 @@ class Address(BaseModel):
|
|
|
61
69
|
}
|
|
62
70
|
)
|
|
63
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
|
+
|
|
64
83
|
|
|
65
84
|
class Beneficiary(BaseModel):
|
|
66
85
|
name: str
|
|
@@ -64,6 +64,7 @@ from .general import (
|
|
|
64
64
|
StrictPositiveInt,
|
|
65
65
|
)
|
|
66
66
|
from .identities import (
|
|
67
|
+
Address,
|
|
67
68
|
Beneficiary,
|
|
68
69
|
Curp,
|
|
69
70
|
KYCFile,
|
|
@@ -83,24 +84,6 @@ from .morals import (
|
|
|
83
84
|
)
|
|
84
85
|
|
|
85
86
|
|
|
86
|
-
class AddressRequest(BaseModel):
|
|
87
|
-
street: NonEmptyStr
|
|
88
|
-
ext_number: NonEmptyStr
|
|
89
|
-
int_number: Optional[NonEmptyStr] = None
|
|
90
|
-
postal_code_id: NonEmptyStr
|
|
91
|
-
|
|
92
|
-
model_config = ConfigDict(
|
|
93
|
-
json_schema_extra={
|
|
94
|
-
"example": {
|
|
95
|
-
"street": "Reforma",
|
|
96
|
-
"ext_number": "265",
|
|
97
|
-
"int_number": "5",
|
|
98
|
-
"postal_code_id": "PC2ygq9j2bS9-9tsuVawzErA",
|
|
99
|
-
}
|
|
100
|
-
}
|
|
101
|
-
)
|
|
102
|
-
|
|
103
|
-
|
|
104
87
|
class BaseRequest(BaseModel):
|
|
105
88
|
model_config = ConfigDict(extra="forbid")
|
|
106
89
|
|
|
@@ -440,7 +423,7 @@ class UserRequest(BaseModel):
|
|
|
440
423
|
None, description='Only if you validated previously on your side'
|
|
441
424
|
)
|
|
442
425
|
profession: Optional[str] = None
|
|
443
|
-
address:
|
|
426
|
+
address: Optional[Address] = None
|
|
444
427
|
status: Optional[UserStatus] = Field(
|
|
445
428
|
None,
|
|
446
429
|
description='Status that the user will have when created. '
|
|
@@ -471,7 +454,7 @@ class UserRequest(BaseModel):
|
|
|
471
454
|
'phone_number': '+525511223344',
|
|
472
455
|
'email_address': 'user@example.com',
|
|
473
456
|
'profession': 'engineer',
|
|
474
|
-
'address':
|
|
457
|
+
'address': Address.schema().get('example'),
|
|
475
458
|
}
|
|
476
459
|
},
|
|
477
460
|
)
|
|
@@ -502,7 +485,7 @@ class UserUpdateRequest(BaseModel):
|
|
|
502
485
|
verification_id: Optional[str] = None
|
|
503
486
|
email_verification_id: Optional[str] = None
|
|
504
487
|
phone_verification_id: Optional[str] = None
|
|
505
|
-
address: Optional[
|
|
488
|
+
address: Optional[Address] = None
|
|
506
489
|
beneficiaries: Optional[list[Beneficiary]] = None
|
|
507
490
|
govt_id: Optional[KYCFile] = None
|
|
508
491
|
proof_of_address: Optional[KYCFile] = None
|
|
@@ -586,14 +569,12 @@ class VerificationRequest(BaseModel):
|
|
|
586
569
|
recipient: Union[EmailStr, PhoneNumber] = Field(
|
|
587
570
|
description='Phone or email to validate'
|
|
588
571
|
)
|
|
589
|
-
platform_id: str
|
|
590
572
|
model_config = ConfigDict(
|
|
591
573
|
str_strip_whitespace=True,
|
|
592
574
|
json_schema_extra={
|
|
593
575
|
'example': {
|
|
594
576
|
'type': 'email',
|
|
595
577
|
'recipient': 'user@example.com',
|
|
596
|
-
'platform_id': 'PT8UEv02zBTcymd4Kd3MO6pg',
|
|
597
578
|
}
|
|
598
579
|
},
|
|
599
580
|
)
|
|
@@ -726,7 +707,7 @@ class PartnerRequest(BaseRequest):
|
|
|
726
707
|
web_site: str
|
|
727
708
|
phone_number: PhoneNumber
|
|
728
709
|
email_address: EmailStr
|
|
729
|
-
address:
|
|
710
|
+
address: Address
|
|
730
711
|
|
|
731
712
|
|
|
732
713
|
class PartnerUpdateRequest(BaseRequest):
|
|
@@ -740,7 +721,7 @@ class PartnerUpdateRequest(BaseRequest):
|
|
|
740
721
|
web_site: Optional[str] = None
|
|
741
722
|
phone_number: Optional[PhoneNumber] = None
|
|
742
723
|
email_address: Optional[EmailStr] = None
|
|
743
|
-
address: Optional[
|
|
724
|
+
address: Optional[Address] = None
|
|
744
725
|
business_details: Optional[BusinessDetails] = None
|
|
745
726
|
transactional_profile: Optional[TransactionalProfile] = None
|
|
746
727
|
external_account: Optional[Clabe] = None
|
cuenca_validations/version.py
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
__version__ = '2.1.
|
|
1
|
+
__version__ = '2.1.10.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=5eGaTFo3hIdPpcREMMuwCh8KXJ9UUCnbGEI5w4pINq4,28
|
|
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=h8RgEO6_lMvDHC0yoq8W6qWBq8s6u-Ktr_rW7zFj8LQ,21258
|
|
18
|
+
cuenca_validations-2.1.10.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=PQ_tffbKOhugC_VhlxXqMimx2iRDUUVH7E6zXJLdrac,19292
|
|
25
|
+
cuenca_validations-2.1.10.dev1.dist-info/METADATA,sha256=9hwqqrcY1ICd0mpTjA7WtIYnnw_oJcRiRLg5SHudSc0,1600
|
|
26
|
+
cuenca_validations-2.1.10.dev1.dist-info/WHEEL,sha256=_zCd3N1l69ArxyTb8rzEoP9TpbYXkqRFSNOD5OuxnTs,91
|
|
27
|
+
cuenca_validations-2.1.10.dev1.dist-info/top_level.txt,sha256=4233xdOs2HtuT-GFRjcDcwK0IwdwvWdczOtk0fPB6Gw,25
|
|
28
|
+
cuenca_validations-2.1.10.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',
|
|
@@ -494,7 +522,6 @@ def test_email_verification_request():
|
|
|
494
522
|
data = dict(
|
|
495
523
|
recipient='mail@cuenca.com',
|
|
496
524
|
type='email_verification',
|
|
497
|
-
platform_id='PL01',
|
|
498
525
|
)
|
|
499
526
|
with pytest.raises(ValidationError):
|
|
500
527
|
VerificationRequest(**data)
|
|
@@ -506,7 +533,6 @@ def test_phone_verification_request():
|
|
|
506
533
|
data = dict(
|
|
507
534
|
recipient='+525555555555',
|
|
508
535
|
type='phone_verification',
|
|
509
|
-
platform_id='PL01',
|
|
510
536
|
)
|
|
511
537
|
with pytest.raises(ValidationError):
|
|
512
538
|
VerificationRequest(**data)
|
|
File without changes
|
|
File without changes
|
{cuenca_validations-2.1.8.dev5.dist-info → cuenca_validations-2.1.10.dev1.dist-info}/top_level.txt
RENAMED
|
File without changes
|