cuenca-validations 2.1.9.dev1__tar.gz → 2.1.10__tar.gz
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-2.1.9.dev1 → cuenca_validations-2.1.10}/PKG-INFO +1 -1
- {cuenca_validations-2.1.9.dev1 → cuenca_validations-2.1.10}/cuenca_validations/types/__init__.py +4 -0
- {cuenca_validations-2.1.9.dev1 → cuenca_validations-2.1.10}/cuenca_validations/types/enums.py +16 -0
- {cuenca_validations-2.1.9.dev1 → cuenca_validations-2.1.10}/cuenca_validations/types/identities.py +29 -21
- {cuenca_validations-2.1.9.dev1 → cuenca_validations-2.1.10}/cuenca_validations/types/morals.py +3 -2
- {cuenca_validations-2.1.9.dev1 → cuenca_validations-2.1.10}/cuenca_validations/types/queries.py +15 -0
- {cuenca_validations-2.1.9.dev1 → cuenca_validations-2.1.10}/cuenca_validations/types/requests.py +46 -51
- cuenca_validations-2.1.10/cuenca_validations/version.py +1 -0
- {cuenca_validations-2.1.9.dev1 → cuenca_validations-2.1.10}/cuenca_validations.egg-info/PKG-INFO +1 -1
- {cuenca_validations-2.1.9.dev1 → cuenca_validations-2.1.10}/cuenca_validations.egg-info/SOURCES.txt +1 -0
- cuenca_validations-2.1.10/tests/test_requests.py +31 -0
- {cuenca_validations-2.1.9.dev1 → cuenca_validations-2.1.10}/tests/test_types.py +33 -51
- cuenca_validations-2.1.9.dev1/cuenca_validations/version.py +0 -1
- {cuenca_validations-2.1.9.dev1 → cuenca_validations-2.1.10}/LICENSE +0 -0
- {cuenca_validations-2.1.9.dev1 → cuenca_validations-2.1.10}/README.md +0 -0
- {cuenca_validations-2.1.9.dev1 → cuenca_validations-2.1.10}/cuenca_validations/__init__.py +0 -0
- {cuenca_validations-2.1.9.dev1 → cuenca_validations-2.1.10}/cuenca_validations/card_bins.py +0 -0
- {cuenca_validations-2.1.9.dev1 → cuenca_validations-2.1.10}/cuenca_validations/errors.py +0 -0
- {cuenca_validations-2.1.9.dev1 → cuenca_validations-2.1.10}/cuenca_validations/py.typed +0 -0
- {cuenca_validations-2.1.9.dev1 → cuenca_validations-2.1.10}/cuenca_validations/types/card.py +0 -0
- {cuenca_validations-2.1.9.dev1 → cuenca_validations-2.1.10}/cuenca_validations/types/files.py +0 -0
- {cuenca_validations-2.1.9.dev1 → cuenca_validations-2.1.10}/cuenca_validations/types/general.py +0 -0
- {cuenca_validations-2.1.9.dev1 → cuenca_validations-2.1.10}/cuenca_validations/types/helpers.py +0 -0
- {cuenca_validations-2.1.9.dev1 → cuenca_validations-2.1.10}/cuenca_validations/typing.py +0 -0
- {cuenca_validations-2.1.9.dev1 → cuenca_validations-2.1.10}/cuenca_validations/validators.py +0 -0
- {cuenca_validations-2.1.9.dev1 → cuenca_validations-2.1.10}/cuenca_validations.egg-info/dependency_links.txt +0 -0
- {cuenca_validations-2.1.9.dev1 → cuenca_validations-2.1.10}/cuenca_validations.egg-info/requires.txt +0 -0
- {cuenca_validations-2.1.9.dev1 → cuenca_validations-2.1.10}/cuenca_validations.egg-info/top_level.txt +0 -0
- {cuenca_validations-2.1.9.dev1 → cuenca_validations-2.1.10}/setup.cfg +0 -0
- {cuenca_validations-2.1.9.dev1 → cuenca_validations-2.1.10}/setup.py +0 -0
- {cuenca_validations-2.1.9.dev1 → cuenca_validations-2.1.10}/tests/__init__.py +0 -0
- {cuenca_validations-2.1.9.dev1 → cuenca_validations-2.1.10}/tests/test_card.py +0 -0
- {cuenca_validations-2.1.9.dev1 → cuenca_validations-2.1.10}/tests/test_errors.py +0 -0
- {cuenca_validations-2.1.9.dev1 → cuenca_validations-2.1.10}/tests/test_helpers.py +0 -0
- {cuenca_validations-2.1.9.dev1 → cuenca_validations-2.1.10}/tests/test_statement.py +0 -0
{cuenca_validations-2.1.9.dev1 → cuenca_validations-2.1.10}/cuenca_validations/types/__init__.py
RENAMED
|
@@ -7,6 +7,7 @@ __all__ = [
|
|
|
7
7
|
'BalanceEntryQuery',
|
|
8
8
|
'BankAccountValidationQuery',
|
|
9
9
|
'BankAccountValidationRequest',
|
|
10
|
+
'PostalCodeQuery',
|
|
10
11
|
'BankAccountStatus',
|
|
11
12
|
'BatchFileMetadata',
|
|
12
13
|
'Beneficiary',
|
|
@@ -55,6 +56,7 @@ __all__ = [
|
|
|
55
56
|
'PlatformRequest',
|
|
56
57
|
'PlatformType',
|
|
57
58
|
'PosCapability',
|
|
59
|
+
'Profession',
|
|
58
60
|
'QueryParams',
|
|
59
61
|
'Rfc',
|
|
60
62
|
'QuestionnairesRequest',
|
|
@@ -134,6 +136,7 @@ from .enums import (
|
|
|
134
136
|
Language,
|
|
135
137
|
PlatformType,
|
|
136
138
|
PosCapability,
|
|
139
|
+
Profession,
|
|
137
140
|
SATRegimeCode,
|
|
138
141
|
SavingCategory,
|
|
139
142
|
ServiceProviderCategory,
|
|
@@ -183,6 +186,7 @@ from .queries import (
|
|
|
183
186
|
EventQuery,
|
|
184
187
|
FileQuery,
|
|
185
188
|
IdentityQuery,
|
|
189
|
+
PostalCodeQuery,
|
|
186
190
|
QueryParams,
|
|
187
191
|
SessionQuery,
|
|
188
192
|
StatementQuery,
|
{cuenca_validations-2.1.9.dev1 → cuenca_validations-2.1.10}/cuenca_validations/types/enums.py
RENAMED
|
@@ -688,3 +688,19 @@ class SATRegimeCode(str, Enum):
|
|
|
688
688
|
ING_PREM = "615" # Régimen de los ingresos por obtención de premios
|
|
689
689
|
AE_PLAT_TEC = "625" # Régimen de las Actividades Empresariales con ingresos a través de Plataformas Tecnológicas # noqa: E501
|
|
690
690
|
RS_CONF = "626" # Régimen Simplificado de Confianza
|
|
691
|
+
|
|
692
|
+
|
|
693
|
+
class Profession(str, Enum):
|
|
694
|
+
artisticas = 'Actividades Artísticas'
|
|
695
|
+
agropecuario = 'Agricultura, Ganadería o Pesca'
|
|
696
|
+
comercio = 'Comercio'
|
|
697
|
+
estudiante = 'Estudiante'
|
|
698
|
+
empleado = 'Empleado(a/e)'
|
|
699
|
+
emprendimiento = 'Emprendimiento'
|
|
700
|
+
hogar = 'Hogar'
|
|
701
|
+
profesor = 'Profesor(a/e)'
|
|
702
|
+
profesionista = 'Profesionista'
|
|
703
|
+
servidor_publico = 'Servidor(a/e) Público'
|
|
704
|
+
sistemas = 'Sistemas y Comunicaciones'
|
|
705
|
+
independiente = 'Trabajador(a/e) Independiente'
|
|
706
|
+
oficios = 'Oficios Varios'
|
{cuenca_validations-2.1.9.dev1 → cuenca_validations-2.1.10}/cuenca_validations/types/identities.py
RENAMED
|
@@ -1,18 +1,11 @@
|
|
|
1
1
|
import datetime as dt
|
|
2
|
-
from typing import Annotated,
|
|
2
|
+
from typing import Annotated, Optional
|
|
3
3
|
|
|
4
|
-
from pydantic import
|
|
5
|
-
BaseModel,
|
|
6
|
-
ConfigDict,
|
|
7
|
-
Field,
|
|
8
|
-
SecretStr,
|
|
9
|
-
StringConstraints,
|
|
10
|
-
model_validator,
|
|
11
|
-
)
|
|
4
|
+
from pydantic import BaseModel, ConfigDict, Field, SecretStr, StringConstraints
|
|
12
5
|
from pydantic_extra_types.phone_numbers import PhoneNumber
|
|
13
6
|
|
|
14
7
|
from .enums import Country, KYCFileType, State, VerificationStatus
|
|
15
|
-
from .general import SerializableIPvAnyAddress
|
|
8
|
+
from .general import NonEmptyStr, SerializableIPvAnyAddress
|
|
16
9
|
|
|
17
10
|
Password = Annotated[
|
|
18
11
|
SecretStr,
|
|
@@ -43,6 +36,13 @@ Rfc = Annotated[
|
|
|
43
36
|
),
|
|
44
37
|
]
|
|
45
38
|
|
|
39
|
+
# NOTE:
|
|
40
|
+
# The Address model is kept for compatibility with legacy models and data
|
|
41
|
+
# that expect all address fields to be optional. This allows older systems
|
|
42
|
+
# or stored data using Address to continue working without breaking changes.
|
|
43
|
+
# For new request validation, use AddressRequest, which enforces required
|
|
44
|
+
# fields and is intended for validating incoming data.
|
|
45
|
+
|
|
46
46
|
|
|
47
47
|
class Address(BaseModel):
|
|
48
48
|
street: Optional[str] = None
|
|
@@ -69,16 +69,24 @@ class Address(BaseModel):
|
|
|
69
69
|
}
|
|
70
70
|
)
|
|
71
71
|
|
|
72
|
-
|
|
73
|
-
|
|
74
|
-
|
|
75
|
-
|
|
76
|
-
|
|
77
|
-
|
|
78
|
-
|
|
79
|
-
|
|
80
|
-
|
|
81
|
-
|
|
72
|
+
|
|
73
|
+
class AddressRequest(BaseModel):
|
|
74
|
+
# This model is mainly for request validation, enforcing required fields.
|
|
75
|
+
street: NonEmptyStr
|
|
76
|
+
ext_number: NonEmptyStr
|
|
77
|
+
int_number: Optional[NonEmptyStr] = None
|
|
78
|
+
postal_code_id: NonEmptyStr
|
|
79
|
+
|
|
80
|
+
model_config = ConfigDict(
|
|
81
|
+
json_schema_extra={
|
|
82
|
+
"example": {
|
|
83
|
+
"street": "Reforma",
|
|
84
|
+
"ext_number": "265",
|
|
85
|
+
"int_number": "5",
|
|
86
|
+
"postal_code_id": "PC2ygq9j2bS9-9tsuVawzErA",
|
|
87
|
+
}
|
|
88
|
+
}
|
|
89
|
+
)
|
|
82
90
|
|
|
83
91
|
|
|
84
92
|
class Beneficiary(BaseModel):
|
|
@@ -86,7 +94,7 @@ class Beneficiary(BaseModel):
|
|
|
86
94
|
birth_date: dt.date
|
|
87
95
|
phone_number: PhoneNumber
|
|
88
96
|
user_relationship: str
|
|
89
|
-
percentage: int
|
|
97
|
+
percentage: Annotated[int, Field(ge=1, le=100)]
|
|
90
98
|
model_config = ConfigDict(
|
|
91
99
|
json_schema_extra={
|
|
92
100
|
"example": {
|
{cuenca_validations-2.1.9.dev1 → cuenca_validations-2.1.10}/cuenca_validations/types/morals.py
RENAMED
|
@@ -3,7 +3,8 @@ from typing import Optional
|
|
|
3
3
|
|
|
4
4
|
from pydantic import BaseModel, EmailStr
|
|
5
5
|
|
|
6
|
-
from
|
|
6
|
+
from ..types import Curp, PhoneNumber, Rfc
|
|
7
|
+
from .identities import AddressRequest
|
|
7
8
|
|
|
8
9
|
|
|
9
10
|
class BusinessDetails(BaseModel):
|
|
@@ -60,7 +61,7 @@ class LegalRepresentative(PhysicalPerson):
|
|
|
60
61
|
job: str
|
|
61
62
|
phone_number: PhoneNumber
|
|
62
63
|
email_address: EmailStr
|
|
63
|
-
address:
|
|
64
|
+
address: AddressRequest
|
|
64
65
|
|
|
65
66
|
|
|
66
67
|
class ShareholderPhysical(PhysicalPerson):
|
{cuenca_validations-2.1.9.dev1 → cuenca_validations-2.1.10}/cuenca_validations/types/queries.py
RENAMED
|
@@ -7,6 +7,7 @@ from pydantic import (
|
|
|
7
7
|
EmailStr,
|
|
8
8
|
Field,
|
|
9
9
|
PositiveInt,
|
|
10
|
+
StringConstraints,
|
|
10
11
|
field_validator,
|
|
11
12
|
)
|
|
12
13
|
|
|
@@ -174,8 +175,22 @@ class SessionQuery(QueryParams):
|
|
|
174
175
|
|
|
175
176
|
class FileQuery(QueryParams):
|
|
176
177
|
type: Optional[KYCFileType] = None
|
|
178
|
+
id: Optional[str] = None
|
|
179
|
+
user_id: Optional[str] = None
|
|
177
180
|
|
|
178
181
|
|
|
179
182
|
class BankAccountValidationQuery(QueryParams):
|
|
180
183
|
account_number: Optional[str] = None
|
|
181
184
|
status: Optional[BankAccountStatus] = None
|
|
185
|
+
|
|
186
|
+
|
|
187
|
+
class PostalCodeQuery(QueryParams):
|
|
188
|
+
postal_code: Annotated[
|
|
189
|
+
str,
|
|
190
|
+
StringConstraints(
|
|
191
|
+
strip_whitespace=True,
|
|
192
|
+
min_length=5,
|
|
193
|
+
max_length=5,
|
|
194
|
+
pattern=r'^\d+$',
|
|
195
|
+
),
|
|
196
|
+
]
|
{cuenca_validations-2.1.9.dev1 → cuenca_validations-2.1.10}/cuenca_validations/types/requests.py
RENAMED
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
import datetime as dt
|
|
2
|
-
from typing import Annotated, Optional, Union
|
|
2
|
+
from typing import Annotated, Any, Optional, Union
|
|
3
3
|
|
|
4
4
|
from clabe import Clabe
|
|
5
5
|
from pydantic import (
|
|
@@ -7,11 +7,13 @@ from pydantic import (
|
|
|
7
7
|
ConfigDict,
|
|
8
8
|
EmailStr,
|
|
9
9
|
Field,
|
|
10
|
+
GetCoreSchemaHandler,
|
|
10
11
|
StrictStr,
|
|
11
12
|
StringConstraints,
|
|
12
13
|
field_validator,
|
|
13
14
|
model_validator,
|
|
14
15
|
)
|
|
16
|
+
from pydantic_core import core_schema
|
|
15
17
|
from pydantic_extra_types.coordinate import Coordinate
|
|
16
18
|
|
|
17
19
|
from ..types.enums import (
|
|
@@ -32,6 +34,7 @@ from ..types.enums import (
|
|
|
32
34
|
KYCValidationSource,
|
|
33
35
|
PlatformType,
|
|
34
36
|
PosCapability,
|
|
37
|
+
Profession,
|
|
35
38
|
SavingCategory,
|
|
36
39
|
SessionType,
|
|
37
40
|
State,
|
|
@@ -39,7 +42,6 @@ from ..types.enums import (
|
|
|
39
42
|
TrackDataMethod,
|
|
40
43
|
TransactionTokenValidationStatus,
|
|
41
44
|
UserCardNotification,
|
|
42
|
-
UserStatus,
|
|
43
45
|
VerificationType,
|
|
44
46
|
WalletTransactionType,
|
|
45
47
|
WebhookEvent,
|
|
@@ -64,14 +66,13 @@ from .general import (
|
|
|
64
66
|
StrictPositiveInt,
|
|
65
67
|
)
|
|
66
68
|
from .identities import (
|
|
67
|
-
|
|
69
|
+
AddressRequest,
|
|
68
70
|
Beneficiary,
|
|
69
71
|
Curp,
|
|
70
72
|
KYCFile,
|
|
71
73
|
Password,
|
|
72
74
|
PhoneNumber,
|
|
73
75
|
Rfc,
|
|
74
|
-
TOSAgreement,
|
|
75
76
|
)
|
|
76
77
|
from .morals import (
|
|
77
78
|
AuditDetails,
|
|
@@ -83,6 +84,10 @@ from .morals import (
|
|
|
83
84
|
VulnerableActivityDetails,
|
|
84
85
|
)
|
|
85
86
|
|
|
87
|
+
CUENCA_FILE_URL = (
|
|
88
|
+
r'^https:\/\/(?:stage|sandbox|api)\.cuenca\.com\/files\/([a-zA-Z0-9\-]+)$'
|
|
89
|
+
)
|
|
90
|
+
|
|
86
91
|
|
|
87
92
|
class BaseRequest(BaseModel):
|
|
88
93
|
model_config = ConfigDict(extra="forbid")
|
|
@@ -404,50 +409,47 @@ class TOSRequest(BaseModel):
|
|
|
404
409
|
ip: Optional[SerializableIPvAnyAddress] = None
|
|
405
410
|
|
|
406
411
|
|
|
412
|
+
class FileCuencaUrl(str):
|
|
413
|
+
|
|
414
|
+
@property
|
|
415
|
+
def file_id(self) -> str:
|
|
416
|
+
return self.split('/')[-1]
|
|
417
|
+
|
|
418
|
+
@classmethod
|
|
419
|
+
def __get_pydantic_core_schema__(
|
|
420
|
+
cls, _source_type: Any, _handler: GetCoreSchemaHandler
|
|
421
|
+
) -> core_schema.CoreSchema:
|
|
422
|
+
return core_schema.no_info_after_validator_function(
|
|
423
|
+
cls, core_schema.str_schema(pattern=CUENCA_FILE_URL)
|
|
424
|
+
)
|
|
425
|
+
|
|
426
|
+
|
|
407
427
|
class UserTOSAgreementRequest(BaseModel):
|
|
408
428
|
tos_id: str
|
|
409
429
|
location: Coordinate
|
|
410
|
-
|
|
430
|
+
signature_image_url: Optional[FileCuencaUrl] = None
|
|
411
431
|
|
|
412
432
|
|
|
413
433
|
class UserRequest(BaseModel):
|
|
414
|
-
id: Optional[str] = Field(
|
|
415
|
-
None, description='if you want to create with specific `id`'
|
|
416
|
-
)
|
|
417
434
|
curp: Curp = Field(
|
|
418
|
-
description=
|
|
419
|
-
|
|
420
|
-
|
|
421
|
-
None, description='Only if you validated previously on your side'
|
|
422
|
-
)
|
|
423
|
-
email_address: Optional[EmailStr] = Field(
|
|
424
|
-
None, description='Only if you validated previously on your side'
|
|
435
|
+
description=(
|
|
436
|
+
'Mexican government ID (18 characters). ' 'Must be pre-validated.'
|
|
437
|
+
)
|
|
425
438
|
)
|
|
426
|
-
|
|
427
|
-
|
|
428
|
-
|
|
429
|
-
|
|
430
|
-
description='Status that the user will have when created. '
|
|
431
|
-
'Defined by platform',
|
|
439
|
+
|
|
440
|
+
profession: Profession = Field(description='User profession or occupation')
|
|
441
|
+
address: AddressRequest = Field(
|
|
442
|
+
description='User residential address information'
|
|
432
443
|
)
|
|
433
|
-
|
|
434
|
-
|
|
435
|
-
|
|
436
|
-
le=3,
|
|
437
|
-
description='Maximum level a User can reach. Defined by platform',
|
|
444
|
+
phone_verification_id: str = Field(
|
|
445
|
+
...,
|
|
446
|
+
description='ID of previously validated phone verification',
|
|
438
447
|
)
|
|
439
|
-
|
|
440
|
-
|
|
441
|
-
description='
|
|
442
|
-
'resource `verifications`',
|
|
448
|
+
email_verification_id: str = Field(
|
|
449
|
+
...,
|
|
450
|
+
description='ID of previously validated email verification',
|
|
443
451
|
)
|
|
444
|
-
|
|
445
|
-
None,
|
|
446
|
-
description='Only if you validated it previously with the '
|
|
447
|
-
'resource `verifications`',
|
|
448
|
-
)
|
|
449
|
-
terms_of_service: Optional[TOSRequest] = None
|
|
450
|
-
signature: Optional[KYCFile] = None
|
|
452
|
+
|
|
451
453
|
model_config = ConfigDict(
|
|
452
454
|
json_schema_extra={
|
|
453
455
|
'example': {
|
|
@@ -455,7 +457,7 @@ class UserRequest(BaseModel):
|
|
|
455
457
|
'phone_number': '+525511223344',
|
|
456
458
|
'email_address': 'user@example.com',
|
|
457
459
|
'profession': 'engineer',
|
|
458
|
-
'address':
|
|
460
|
+
'address': AddressRequest.model_json_schema().get('example'),
|
|
459
461
|
}
|
|
460
462
|
},
|
|
461
463
|
)
|
|
@@ -480,21 +482,16 @@ class UserRequest(BaseModel):
|
|
|
480
482
|
|
|
481
483
|
|
|
482
484
|
class UserUpdateRequest(BaseModel):
|
|
483
|
-
|
|
484
|
-
email_address: Optional[EmailStr] = None
|
|
485
|
-
profession: Optional[str] = None
|
|
485
|
+
profession: Optional[Profession] = None
|
|
486
486
|
verification_id: Optional[str] = None
|
|
487
487
|
email_verification_id: Optional[str] = None
|
|
488
488
|
phone_verification_id: Optional[str] = None
|
|
489
|
-
address: Optional[
|
|
489
|
+
address: Optional[AddressRequest] = None
|
|
490
490
|
beneficiaries: Optional[list[Beneficiary]] = None
|
|
491
491
|
govt_id: Optional[KYCFile] = None
|
|
492
492
|
proof_of_address: Optional[KYCFile] = None
|
|
493
493
|
proof_of_life: Optional[KYCFile] = None
|
|
494
494
|
signature: Optional[KYCFile] = None
|
|
495
|
-
status: Optional[UserStatus] = None
|
|
496
|
-
terms_of_service: Optional[TOSRequest] = None
|
|
497
|
-
platform_terms_of_service: Optional[TOSAgreement] = None
|
|
498
495
|
curp_document_uri: Optional[SerializableHttpUrl] = None
|
|
499
496
|
|
|
500
497
|
@field_validator('beneficiaries')
|
|
@@ -502,8 +499,8 @@ class UserUpdateRequest(BaseModel):
|
|
|
502
499
|
def beneficiary_percentage(
|
|
503
500
|
cls, beneficiaries: Optional[list[Beneficiary]] = None
|
|
504
501
|
):
|
|
505
|
-
if beneficiaries and sum(b.percentage for b in beneficiaries)
|
|
506
|
-
raise ValueError('The total percentage
|
|
502
|
+
if beneficiaries and sum(b.percentage for b in beneficiaries) != 100:
|
|
503
|
+
raise ValueError('The total percentage should be 100%')
|
|
507
504
|
return beneficiaries
|
|
508
505
|
|
|
509
506
|
|
|
@@ -570,14 +567,12 @@ class VerificationRequest(BaseModel):
|
|
|
570
567
|
recipient: Union[EmailStr, PhoneNumber] = Field(
|
|
571
568
|
description='Phone or email to validate'
|
|
572
569
|
)
|
|
573
|
-
platform_id: str
|
|
574
570
|
model_config = ConfigDict(
|
|
575
571
|
str_strip_whitespace=True,
|
|
576
572
|
json_schema_extra={
|
|
577
573
|
'example': {
|
|
578
574
|
'type': 'email',
|
|
579
575
|
'recipient': 'user@example.com',
|
|
580
|
-
'platform_id': 'PT8UEv02zBTcymd4Kd3MO6pg',
|
|
581
576
|
}
|
|
582
577
|
},
|
|
583
578
|
)
|
|
@@ -710,7 +705,7 @@ class PartnerRequest(BaseRequest):
|
|
|
710
705
|
web_site: str
|
|
711
706
|
phone_number: PhoneNumber
|
|
712
707
|
email_address: EmailStr
|
|
713
|
-
address:
|
|
708
|
+
address: AddressRequest
|
|
714
709
|
|
|
715
710
|
|
|
716
711
|
class PartnerUpdateRequest(BaseRequest):
|
|
@@ -724,7 +719,7 @@ class PartnerUpdateRequest(BaseRequest):
|
|
|
724
719
|
web_site: Optional[str] = None
|
|
725
720
|
phone_number: Optional[PhoneNumber] = None
|
|
726
721
|
email_address: Optional[EmailStr] = None
|
|
727
|
-
address: Optional[
|
|
722
|
+
address: Optional[AddressRequest] = None
|
|
728
723
|
business_details: Optional[BusinessDetails] = None
|
|
729
724
|
transactional_profile: Optional[TransactionalProfile] = None
|
|
730
725
|
external_account: Optional[Clabe] = None
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
__version__ = '2.1.10'
|
|
@@ -0,0 +1,31 @@
|
|
|
1
|
+
import pytest
|
|
2
|
+
from pydantic import ValidationError
|
|
3
|
+
|
|
4
|
+
from cuenca_validations.types.requests import UserTOSAgreementRequest
|
|
5
|
+
from cuenca_validations.typing import DictStrAny
|
|
6
|
+
|
|
7
|
+
|
|
8
|
+
@pytest.mark.parametrize('environment', ['stage', 'sandbox', 'api'])
|
|
9
|
+
def test_file_cuenca_url(environment: str) -> None:
|
|
10
|
+
request_data: DictStrAny = dict(
|
|
11
|
+
tos_id='TS67dcae8e74e81bba5a77bf47',
|
|
12
|
+
location=(19.432607, -99.133209),
|
|
13
|
+
signature_image_url=(
|
|
14
|
+
f'https://{environment}.cuenca.com/files/EFQL87ohvoRp-PkOTYgvQYFA'
|
|
15
|
+
),
|
|
16
|
+
)
|
|
17
|
+
utos = UserTOSAgreementRequest(**request_data)
|
|
18
|
+
assert utos.signature_image_url is not None
|
|
19
|
+
assert utos.signature_image_url.file_id == 'EFQL87ohvoRp-PkOTYgvQYFA'
|
|
20
|
+
|
|
21
|
+
|
|
22
|
+
def test_file_cuenca_url_invalid() -> None:
|
|
23
|
+
request_data: DictStrAny = dict(
|
|
24
|
+
tos_id='TS67dcae8e74e81bba5a77bf47',
|
|
25
|
+
location=(19.432607, -99.133209),
|
|
26
|
+
signature_image_url=(
|
|
27
|
+
'https://cuenca.com/files/EFQL87ohvoRp-PkOTYgvQYFA/invalid'
|
|
28
|
+
),
|
|
29
|
+
)
|
|
30
|
+
with pytest.raises(ValidationError):
|
|
31
|
+
UserTOSAgreementRequest(**request_data)
|
|
@@ -10,7 +10,6 @@ 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,
|
|
14
13
|
CardQuery,
|
|
15
14
|
JSONEncoder,
|
|
16
15
|
QueryParams,
|
|
@@ -21,8 +20,8 @@ from cuenca_validations.types import (
|
|
|
21
20
|
get_state_name,
|
|
22
21
|
)
|
|
23
22
|
from cuenca_validations.types.enums import (
|
|
24
|
-
Country,
|
|
25
23
|
EcommerceIndicator,
|
|
24
|
+
Profession,
|
|
26
25
|
SessionType,
|
|
27
26
|
State,
|
|
28
27
|
)
|
|
@@ -303,60 +302,42 @@ def test_saving_update_request():
|
|
|
303
302
|
SavingUpdateRequest(**data)
|
|
304
303
|
|
|
305
304
|
|
|
306
|
-
|
|
307
|
-
|
|
308
|
-
|
|
309
|
-
|
|
310
|
-
|
|
311
|
-
|
|
312
|
-
|
|
313
|
-
|
|
314
|
-
|
|
315
|
-
|
|
316
|
-
|
|
317
|
-
|
|
318
|
-
|
|
319
|
-
street='varsovia',
|
|
320
|
-
ext_number='36',
|
|
321
|
-
state=State.DF,
|
|
322
|
-
country=Country.MX,
|
|
305
|
+
@freeze_time('2022-01-01')
|
|
306
|
+
def test_user_request():
|
|
307
|
+
request = dict(
|
|
308
|
+
curp='ABCD920604HDFSRN03',
|
|
309
|
+
profession=Profession.empleado,
|
|
310
|
+
address=dict(
|
|
311
|
+
street='calle 1',
|
|
312
|
+
ext_number='2',
|
|
313
|
+
int_number='3',
|
|
314
|
+
postal_code_id='PC2ygq9j2bS9-9tsuVawzErA',
|
|
315
|
+
),
|
|
316
|
+
phone_verification_id='VE12345678',
|
|
317
|
+
email_verification_id='VE0987654321',
|
|
323
318
|
)
|
|
324
|
-
assert
|
|
319
|
+
assert UserRequest(**request).model_dump() == request
|
|
325
320
|
|
|
326
321
|
|
|
327
322
|
@freeze_time('2022-01-01')
|
|
328
|
-
def
|
|
323
|
+
def test_user_request_underage():
|
|
329
324
|
request = dict(
|
|
330
|
-
|
|
331
|
-
curp='ABCD920604HDFSRN03',
|
|
332
|
-
phone_number='+525555555555',
|
|
333
|
-
email_address='email@email.com',
|
|
325
|
+
curp='ABCD060604HDFSRN03', # underage CURP
|
|
334
326
|
profession='worker',
|
|
335
|
-
status='active',
|
|
336
327
|
address=dict(
|
|
337
328
|
street='calle 1',
|
|
338
329
|
ext_number='2',
|
|
339
330
|
int_number='3',
|
|
340
|
-
|
|
341
|
-
postal_code='09900',
|
|
342
|
-
state=State.DF.value,
|
|
343
|
-
country=Country.MX,
|
|
344
|
-
city='Obrera',
|
|
345
|
-
full_name=None,
|
|
331
|
+
postal_code_id='PC2ygq9j2bS9-9tsuVawzErA',
|
|
346
332
|
),
|
|
347
333
|
phone_verification_id='VE12345678',
|
|
348
334
|
email_verification_id='VE0987654321',
|
|
349
|
-
required_level=3,
|
|
350
|
-
terms_of_service=None,
|
|
351
|
-
signature=None,
|
|
352
335
|
)
|
|
353
|
-
assert UserRequest(**request).model_dump() == request
|
|
354
336
|
|
|
355
|
-
# changing curp so user is underage
|
|
356
|
-
request['curp'] = 'ABCD060604HDFSRN03'
|
|
357
337
|
with pytest.raises(ValueError) as v:
|
|
358
338
|
UserRequest(**request)
|
|
359
|
-
|
|
339
|
+
|
|
340
|
+
assert 'User does not meet age requirement.' in str(v)
|
|
360
341
|
|
|
361
342
|
|
|
362
343
|
@freeze_time('2022-01-01')
|
|
@@ -438,7 +419,7 @@ def test_user_update_request():
|
|
|
438
419
|
birth_date=dt.date(2020, 1, 1).isoformat(),
|
|
439
420
|
phone_number='+525555555555',
|
|
440
421
|
user_relationship='brother',
|
|
441
|
-
percentage=
|
|
422
|
+
percentage=100,
|
|
442
423
|
),
|
|
443
424
|
]
|
|
444
425
|
assert UserUpdateRequest(**request)
|
|
@@ -449,12 +430,21 @@ def test_user_update_request():
|
|
|
449
430
|
birth_date=dt.date(2020, 1, 1).isoformat(),
|
|
450
431
|
phone_number='+525555555555',
|
|
451
432
|
user_relationship='brother',
|
|
452
|
-
percentage=
|
|
433
|
+
percentage=50,
|
|
434
|
+
),
|
|
435
|
+
dict(
|
|
436
|
+
name='José Pérez',
|
|
437
|
+
birth_date=dt.date(2020, 1, 2).isoformat(),
|
|
438
|
+
phone_number='+525544444444',
|
|
439
|
+
user_relationship='brother',
|
|
440
|
+
percentage=51,
|
|
453
441
|
),
|
|
454
442
|
]
|
|
455
|
-
with pytest.raises(
|
|
443
|
+
with pytest.raises(ValidationError) as v:
|
|
456
444
|
UserUpdateRequest(**request)
|
|
457
|
-
|
|
445
|
+
|
|
446
|
+
assert 'The total percentage should be 100%' in str(v)
|
|
447
|
+
request.pop('beneficiaries')
|
|
458
448
|
|
|
459
449
|
tos_request = dict(
|
|
460
450
|
terms_of_service=dict(
|
|
@@ -485,12 +475,6 @@ def test_user_update_request():
|
|
|
485
475
|
)
|
|
486
476
|
UserUpdateRequest(**kyc_request)
|
|
487
477
|
|
|
488
|
-
# chagning to invalid request
|
|
489
|
-
tos_request['terms_of_service']['ip'] = 'not valid ip'
|
|
490
|
-
with pytest.raises(ValueError) as v:
|
|
491
|
-
UserUpdateRequest(**tos_request)
|
|
492
|
-
assert 'not valid ip' in str(v.value)
|
|
493
|
-
|
|
494
478
|
|
|
495
479
|
def test_session_request():
|
|
496
480
|
data = dict(
|
|
@@ -522,7 +506,6 @@ def test_email_verification_request():
|
|
|
522
506
|
data = dict(
|
|
523
507
|
recipient='mail@cuenca.com',
|
|
524
508
|
type='email_verification',
|
|
525
|
-
platform_id='PL01',
|
|
526
509
|
)
|
|
527
510
|
with pytest.raises(ValidationError):
|
|
528
511
|
VerificationRequest(**data)
|
|
@@ -534,7 +517,6 @@ def test_phone_verification_request():
|
|
|
534
517
|
data = dict(
|
|
535
518
|
recipient='+525555555555',
|
|
536
519
|
type='phone_verification',
|
|
537
|
-
platform_id='PL01',
|
|
538
520
|
)
|
|
539
521
|
with pytest.raises(ValidationError):
|
|
540
522
|
VerificationRequest(**data)
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
__version__ = '2.1.9.dev1'
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
{cuenca_validations-2.1.9.dev1 → cuenca_validations-2.1.10}/cuenca_validations/types/card.py
RENAMED
|
File without changes
|
{cuenca_validations-2.1.9.dev1 → cuenca_validations-2.1.10}/cuenca_validations/types/files.py
RENAMED
|
File without changes
|
{cuenca_validations-2.1.9.dev1 → cuenca_validations-2.1.10}/cuenca_validations/types/general.py
RENAMED
|
File without changes
|
{cuenca_validations-2.1.9.dev1 → cuenca_validations-2.1.10}/cuenca_validations/types/helpers.py
RENAMED
|
File without changes
|
|
File without changes
|
{cuenca_validations-2.1.9.dev1 → cuenca_validations-2.1.10}/cuenca_validations/validators.py
RENAMED
|
File without changes
|
|
File without changes
|
{cuenca_validations-2.1.9.dev1 → cuenca_validations-2.1.10}/cuenca_validations.egg-info/requires.txt
RENAMED
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|