cuenca-validations 2.1.7.dev6__py3-none-any.whl → 2.1.8__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.
@@ -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',
@@ -185,6 +186,7 @@ from .queries import (
185
186
  EventQuery,
186
187
  FileQuery,
187
188
  IdentityQuery,
189
+ PostalCodeQuery,
188
190
  QueryParams,
189
191
  SessionQuery,
190
192
  StatementQuery,
@@ -691,16 +691,16 @@ class SATRegimeCode(str, Enum):
691
691
 
692
692
 
693
693
  class Profession(str, Enum):
694
- arts = 'arts'
695
- agriculture = 'agriculture'
696
- commerce = 'commerce'
697
- student = 'student'
698
- employee = 'employee'
699
- entrepreneur = 'entrepreneur'
700
- homemaker = 'homemaker'
701
- teacher = 'teacher'
702
- professional = 'professional'
703
- public_servant = 'public_servant'
704
- it_communications = 'it_communications'
705
- freelancer = 'freelancer'
706
- skilled_trades = 'skilled_trades'
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'
@@ -36,17 +36,24 @@ Rfc = Annotated[
36
36
  ),
37
37
  ]
38
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
+
39
46
 
40
47
  class Address(BaseModel):
41
- street: NonEmptyStr
42
- ext_number: NonEmptyStr
43
- int_number: Optional[NonEmptyStr] = None
44
- colonia: NonEmptyStr
45
- postal_code: NonEmptyStr
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
- country: Country
48
- city: NonEmptyStr
49
-
54
+ country: Optional[Country] = None
55
+ city: Optional[str] = None
56
+ full_name: Optional[str] = None
50
57
  model_config = ConfigDict(
51
58
  json_schema_extra={
52
59
  "example": {
@@ -63,6 +70,25 @@ class Address(BaseModel):
63
70
  )
64
71
 
65
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
+ )
90
+
91
+
66
92
  class Beneficiary(BaseModel):
67
93
  name: str
68
94
  birth_date: dt.date
@@ -3,7 +3,8 @@ from typing import Optional
3
3
 
4
4
  from pydantic import BaseModel, EmailStr
5
5
 
6
- from cuenca_validations.types import Address, Curp, PhoneNumber, Rfc
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: Address
64
+ address: AddressRequest
64
65
 
65
66
 
66
67
  class ShareholderPhysical(PhysicalPerson):
@@ -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
 
@@ -179,3 +180,15 @@ class FileQuery(QueryParams):
179
180
  class BankAccountValidationQuery(QueryParams):
180
181
  account_number: Optional[str] = None
181
182
  status: Optional[BankAccountStatus] = None
183
+
184
+
185
+ class PostalCodeQuery(QueryParams):
186
+ postal_code: Annotated[
187
+ str,
188
+ StringConstraints(
189
+ strip_whitespace=True,
190
+ min_length=5,
191
+ max_length=5,
192
+ pattern=r'^\d+$',
193
+ ),
194
+ ]
@@ -64,7 +64,7 @@ from .general import (
64
64
  StrictPositiveInt,
65
65
  )
66
66
  from .identities import (
67
- Address,
67
+ AddressRequest,
68
68
  Beneficiary,
69
69
  Curp,
70
70
  KYCFile,
@@ -416,7 +416,7 @@ class UserRequest(BaseModel):
416
416
  )
417
417
 
418
418
  profession: Profession = Field(description='User profession or occupation')
419
- address: Address = Field(
419
+ address: AddressRequest = Field(
420
420
  description='User residential address information'
421
421
  )
422
422
  phone_verification_id: str = Field(
@@ -435,7 +435,7 @@ class UserRequest(BaseModel):
435
435
  'phone_number': '+525511223344',
436
436
  'email_address': 'user@example.com',
437
437
  'profession': 'engineer',
438
- 'address': Address.model_json_schema().get('example'),
438
+ 'address': AddressRequest.model_json_schema().get('example'),
439
439
  }
440
440
  },
441
441
  )
@@ -464,7 +464,7 @@ class UserUpdateRequest(BaseModel):
464
464
  verification_id: Optional[str] = None
465
465
  email_verification_id: Optional[str] = None
466
466
  phone_verification_id: Optional[str] = None
467
- address: Optional[Address] = None
467
+ address: Optional[AddressRequest] = None
468
468
  beneficiaries: Optional[list[Beneficiary]] = None
469
469
  govt_id: Optional[KYCFile] = None
470
470
  proof_of_address: Optional[KYCFile] = None
@@ -685,7 +685,7 @@ class PartnerRequest(BaseRequest):
685
685
  web_site: str
686
686
  phone_number: PhoneNumber
687
687
  email_address: EmailStr
688
- address: Address
688
+ address: AddressRequest
689
689
 
690
690
 
691
691
  class PartnerUpdateRequest(BaseRequest):
@@ -699,7 +699,7 @@ class PartnerUpdateRequest(BaseRequest):
699
699
  web_site: Optional[str] = None
700
700
  phone_number: Optional[PhoneNumber] = None
701
701
  email_address: Optional[EmailStr] = None
702
- address: Optional[Address] = None
702
+ address: Optional[AddressRequest] = None
703
703
  business_details: Optional[BusinessDetails] = None
704
704
  transactional_profile: Optional[TransactionalProfile] = None
705
705
  external_account: Optional[Clabe] = None
@@ -1 +1 @@
1
- __version__ = '2.1.7.dev6'
1
+ __version__ = '2.1.8'
@@ -1,6 +1,6 @@
1
1
  Metadata-Version: 2.4
2
2
  Name: cuenca_validations
3
- Version: 2.1.7.dev6
3
+ Version: 2.1.8
4
4
  Summary: Cuenca common validations
5
5
  Home-page: https://github.com/cuenca-mx/cuenca-validations
6
6
  Author: Cuenca
@@ -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=xNYuWD95tiTllFVfWM7FmDp_XLbRZ6ABQ89u9YqAhXw,27
8
- cuenca_validations/types/__init__.py,sha256=1xGfD2tlFsPlhIy-T7BZPs-vvEgDoc6ZW2iXFLbyQpM,4799
7
+ cuenca_validations/version.py,sha256=pYuB8qK-6nufcTu4rxmUsi2yMIYFokx7P2J_Q_IT9sg,22
8
+ cuenca_validations/types/__init__.py,sha256=fPmHzU6mY6l3qK2R8cOhjcrICTOnoHS6VQteX663FRE,4843
9
9
  cuenca_validations/types/card.py,sha256=UGzz8NTFAverUmdUKAK1oGHnOnjSNTpIRUm93vKSSGY,1295
10
- cuenca_validations/types/enums.py,sha256=o2XmufNIBhx88KDVARnpoXqLkyXVP89XMW0DDPDH9NI,19424
10
+ cuenca_validations/types/enums.py,sha256=533fUCip5CXMD7m4Ww8VAcB5Yr4A0EmT5GBRt2mF4b0,19510
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=FBpWUwRfy99jBr2Zhuv9gArnnUe12o3A2kbs25i9nwo,4470
15
- cuenca_validations/types/morals.py,sha256=m8kAedevmwfSPTA9GYe03l7pkgipynwYgKfejyVtnuI,1813
16
- cuenca_validations/types/queries.py,sha256=KCRx0sPzWDtDDbZysmFGVgANgfqil17EITWaG7tGQ-A,4700
17
- cuenca_validations/types/requests.py,sha256=SdLE0N-3bRNVUQRQ2IWtShjR8Iok_Ev818o9UbcraTU,20370
18
- cuenca_validations-2.1.7.dev6.dist-info/licenses/LICENSE,sha256=wR76FmxBbfnQpwELkkE5iMF8sFIafEMgXLTE4N4WPTc,1063
14
+ cuenca_validations/types/identities.py,sha256=1wkutHzL9Gpd9oAZdyiikNxWKe5iBVAQT3TabR6YG1o,5451
15
+ cuenca_validations/types/morals.py,sha256=davabh5hAnFVQyM7-yCyDaT5ewXnm0cr1BtqDIwzkX8,1833
16
+ cuenca_validations/types/queries.py,sha256=5VHVyTcN9lELcCNXL_b7kWXWw5-6e7G3NTVPF8FT11Y,4963
17
+ cuenca_validations/types/requests.py,sha256=u2lUkeIQu2KqSo1PU0XNb1mFczBXZZoLy1p7vivQwiU,20412
18
+ cuenca_validations-2.1.8.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=TimSUqe0YX83qIzo7p6XUy8YYuf19a7M3iPkVKw0iMg,19203
25
- cuenca_validations-2.1.7.dev6.dist-info/METADATA,sha256=bN1iprUBHlSHDDvjNOOo9I-l8_fZN207JIm9Jkwvp-w,1599
26
- cuenca_validations-2.1.7.dev6.dist-info/WHEEL,sha256=_zCd3N1l69ArxyTb8rzEoP9TpbYXkqRFSNOD5OuxnTs,91
27
- cuenca_validations-2.1.7.dev6.dist-info/top_level.txt,sha256=4233xdOs2HtuT-GFRjcDcwK0IwdwvWdczOtk0fPB6Gw,25
28
- cuenca_validations-2.1.7.dev6.dist-info/RECORD,,
24
+ tests/test_types.py,sha256=EJwZ0a0L7085aISg-mZFwxWpeE0RDQupp-YxZUyZNgc,18867
25
+ cuenca_validations-2.1.8.dist-info/METADATA,sha256=bL7fyLJrhANl7DDAcT66KTJK9rHrzlvSfGN8PuyzQrI,1594
26
+ cuenca_validations-2.1.8.dist-info/WHEEL,sha256=_zCd3N1l69ArxyTb8rzEoP9TpbYXkqRFSNOD5OuxnTs,91
27
+ cuenca_validations-2.1.8.dist-info/top_level.txt,sha256=4233xdOs2HtuT-GFRjcDcwK0IwdwvWdczOtk0fPB6Gw,25
28
+ cuenca_validations-2.1.8.dist-info/RECORD,,
tests/test_types.py CHANGED
@@ -20,7 +20,6 @@ from cuenca_validations.types import (
20
20
  get_state_name,
21
21
  )
22
22
  from cuenca_validations.types.enums import (
23
- Country,
24
23
  EcommerceIndicator,
25
24
  Profession,
26
25
  SessionType,
@@ -307,23 +306,15 @@ def test_saving_update_request():
307
306
  def test_user_request():
308
307
  request = dict(
309
308
  curp='ABCD920604HDFSRN03',
310
- profession=Profession.employee,
309
+ profession=Profession.empleado,
311
310
  address=dict(
312
311
  street='calle 1',
313
312
  ext_number='2',
314
313
  int_number='3',
315
- colonia='Juarez',
316
- postal_code='09900',
317
- state=State.DF,
318
- country=Country.MX,
319
- city='Obrera',
314
+ postal_code_id='PC2ygq9j2bS9-9tsuVawzErA',
320
315
  ),
321
316
  phone_verification_id='VE12345678',
322
317
  email_verification_id='VE0987654321',
323
- tos_agreement=dict(
324
- tos_id='TOS123',
325
- location=dict(latitude=19.4326, longitude=-99.1332),
326
- ),
327
318
  )
328
319
  assert UserRequest(**request).model_dump() == request
329
320
 
@@ -337,11 +328,7 @@ def test_user_request_underage():
337
328
  street='calle 1',
338
329
  ext_number='2',
339
330
  int_number='3',
340
- colonia='Juarez',
341
- postal_code='09900',
342
- state=State.DF,
343
- country=Country.MX,
344
- city='Obrera',
331
+ postal_code_id='PC2ygq9j2bS9-9tsuVawzErA',
345
332
  ),
346
333
  phone_verification_id='VE12345678',
347
334
  email_verification_id='VE0987654321',