cuenca-validations 2.1.3.dev1__py3-none-any.whl → 2.1.4.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.
@@ -249,6 +249,9 @@ class KYCFileType(str, Enum):
249
249
  curp = 'curp'
250
250
  signature = 'signature'
251
251
 
252
+ class KYCValidationType(str, Enum):
253
+ client_side = 'client_side'
254
+ background = 'background'
252
255
 
253
256
  class Gender(str, Enum):
254
257
  female = 'female'
@@ -22,6 +22,10 @@ SerializableIPvAnyAddress = Annotated[
22
22
  IPvAnyAddress, PlainSerializer(str, return_type=str)
23
23
  ]
24
24
 
25
+ NonEmptyStr = Annotated[
26
+ str, StringConstraints(strip_whitespace=True, min_length=1)
27
+ ]
28
+
25
29
 
26
30
  class SantizedDict(dict):
27
31
  def __init__(self, *args, **kwargs):
@@ -28,6 +28,7 @@ from ..types.enums import (
28
28
  Gender,
29
29
  IssuerNetwork,
30
30
  KYCFileType,
31
+ KYCValidationType,
31
32
  PlatformType,
32
33
  PosCapability,
33
34
  SavingCategory,
@@ -55,6 +56,7 @@ from .card import (
55
56
  )
56
57
  from .general import (
57
58
  LogConfig,
59
+ NonEmptyStr,
58
60
  SerializableAnyUrl,
59
61
  SerializableHttpUrl,
60
62
  SerializableIPvAnyAddress,
@@ -421,7 +423,7 @@ class UserRequest(BaseModel):
421
423
  description='Status that the user will have when created. '
422
424
  'Defined by platform',
423
425
  )
424
- required_level: Optional[Annotated[int, Field(ge=-1, le=4)]] = Field(
426
+ required_level: Optional[Annotated[int, Field(ge=-1, le=3)]] = Field(
425
427
  None,
426
428
  description='Maximum level a User can reach. ' 'Defined by platform',
427
429
  )
@@ -596,9 +598,6 @@ class LimitedWalletRequest(BaseRequest):
596
598
  allowed_rfc: Optional[Rfc] = None
597
599
 
598
600
 
599
- class KYCVerificationUpdateRequest(BaseRequest):
600
- curp: Curp
601
-
602
601
 
603
602
  class PlatformRequest(BaseModel):
604
603
  name: str
@@ -621,6 +620,7 @@ class WebhookRequest(BaseModel):
621
620
 
622
621
  class KYCValidationRequest(BaseRequest):
623
622
  user_id: str
623
+ validation_type: KYCValidationType
624
624
  force: bool = False
625
625
  documents: list[KYCFile] = []
626
626
 
@@ -635,19 +635,32 @@ class UserListsRequest(BaseModel):
635
635
  account_number: Optional[Union[Clabe, PaymentCardNumber]] = Field(
636
636
  None, description='Account to review on lists'
637
637
  )
638
- names: Optional[str] = Field(
638
+ names: Optional[NonEmptyStr] = Field(
639
639
  None, description='Names of the user to review on lists'
640
640
  )
641
- first_surname: Optional[str] = Field(
642
- None, description='first_surname of the user to review on lists'
641
+ first_surname: Optional[NonEmptyStr] = Field(
642
+ None, description='First surname of the user to review on lists'
643
643
  )
644
- second_surname: Optional[str] = Field(
645
- None, description='second_surname of the user to review on lists'
644
+ second_surname: Optional[NonEmptyStr] = Field(
645
+ None, description='Second surname of the user to review on lists'
646
646
  )
647
647
 
648
648
  @model_validator(mode='before')
649
649
  @classmethod
650
650
  def check_request(cls, values):
651
+ if (
652
+ values.get('first_surname') or values.get('second_surname')
653
+ ) and not values.get('names'):
654
+ raise ValueError(
655
+ 'names is required when first_surname or second_surname '
656
+ 'is provided'
657
+ )
658
+
659
+ if values.get('names') and not values.get('first_surname'):
660
+ raise ValueError(
661
+ 'first_surname is required when names is provided'
662
+ )
663
+
651
664
  has_name = all(values.get(f) for f in ['names', 'first_surname'])
652
665
  curp, account, rfc = (
653
666
  values.get('curp'),
@@ -1 +1 @@
1
- __version__ = '2.1.3.dev1'
1
+ __version__ = '2.1.4.dev0'
@@ -1,6 +1,6 @@
1
1
  Metadata-Version: 2.2
2
2
  Name: cuenca_validations
3
- Version: 2.1.3.dev1
3
+ Version: 2.1.4.dev0
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=P6qbWxLdSiR-eupsaovRuiklkIe1NAytqw3aOUNRFEQ,27
7
+ cuenca_validations/version.py,sha256=cLHYXQmN28dRLuLXRArXaHB_E4t3K1AvmSjEv_vWrN0,27
8
8
  cuenca_validations/types/__init__.py,sha256=8fiuz26oYQT2DriQ7sbD740yFJergVhB1OYoUGETB5A,4783
9
9
  cuenca_validations/types/card.py,sha256=UGzz8NTFAverUmdUKAK1oGHnOnjSNTpIRUm93vKSSGY,1295
10
- cuenca_validations/types/enums.py,sha256=sK9ayp8wuu4D5-hjkFTV_-h9xdeVHFj_cZkGjLAzPGI,18853
10
+ cuenca_validations/types/enums.py,sha256=M0tx5vQTOqe9UVVX8Yw9i15k4kVYdfDveHVGuCqE_3o,18951
11
11
  cuenca_validations/types/files.py,sha256=2CszbwF9ytXV9suFFwyDjYG4XxY8UhCjRw3HttVXXNw,269
12
- cuenca_validations/types/general.py,sha256=I1sFlVL61_-Z9n0SQC7ziL9SDEAEgZP4aq_Sem99NOw,2529
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
14
  cuenca_validations/types/identities.py,sha256=-TWRDRpmIaCI4nE4hVy1FQtQtlxuErtmEtzJW1FBzec,4956
15
15
  cuenca_validations/types/morals.py,sha256=m8kAedevmwfSPTA9GYe03l7pkgipynwYgKfejyVtnuI,1813
16
16
  cuenca_validations/types/queries.py,sha256=KCRx0sPzWDtDDbZysmFGVgANgfqil17EITWaG7tGQ-A,4700
17
- cuenca_validations/types/requests.py,sha256=cvdW0gPhgkwoOI_dHonncQgSZwjvVWxfc4MHISxJEb4,20748
17
+ cuenca_validations/types/requests.py,sha256=D1WOpUOOP7jC4bH2ITxTw42BtVtwA6HJ9RXk_neAZpY,21239
18
18
  tests/__init__.py,sha256=47DEQpj8HBSa-_TImW-5JCeuQeRkm5NMpJWZG3hSuFU,0
19
19
  tests/test_card.py,sha256=QAfRz7e11gWICPnFJZ2tiYgUsFV3C9TwzJXrDnDNXFw,1202
20
20
  tests/test_errors.py,sha256=ixiIgEuBuzfsL5p4uCFdF32XqFRtTPF6EVhGJ0keOrI,930
21
21
  tests/test_helpers.py,sha256=ubzpi1UXCryLQdgsT_Zm2IX-XE_4L0dnHnhLwH06xK8,748
22
22
  tests/test_statement.py,sha256=IOE0rRRBgBZSJv_FLaETEyn5NzzXKMNTqgjv99GX-68,1436
23
- tests/test_types.py,sha256=sMcDFd_Ho4yAafPHpYAcS1YNmfiIyWxt0hoJZrc0N6Q,18260
24
- cuenca_validations-2.1.3.dev1.dist-info/LICENSE,sha256=wR76FmxBbfnQpwELkkE5iMF8sFIafEMgXLTE4N4WPTc,1063
25
- cuenca_validations-2.1.3.dev1.dist-info/METADATA,sha256=qaREo_8G8n1kR5maDW7bhAXUryC55Do5QAfN_W7QTYk,1577
26
- cuenca_validations-2.1.3.dev1.dist-info/WHEEL,sha256=nn6H5-ilmfVryoAQl3ZQ2l8SH5imPWFpm1A5FgEuFV4,91
27
- cuenca_validations-2.1.3.dev1.dist-info/top_level.txt,sha256=4233xdOs2HtuT-GFRjcDcwK0IwdwvWdczOtk0fPB6Gw,25
28
- cuenca_validations-2.1.3.dev1.dist-info/RECORD,,
23
+ tests/test_types.py,sha256=K_YNFz0Kac3k8fJNeXuYGkL1hjXDQu084jCX6xEMEE4,19348
24
+ cuenca_validations-2.1.4.dev0.dist-info/LICENSE,sha256=wR76FmxBbfnQpwELkkE5iMF8sFIafEMgXLTE4N4WPTc,1063
25
+ cuenca_validations-2.1.4.dev0.dist-info/METADATA,sha256=C3NadpW8rxS3SSAwTiJ_o3MpfrK1dr6eklD3szZOZe8,1577
26
+ cuenca_validations-2.1.4.dev0.dist-info/WHEEL,sha256=52BFRY2Up02UkjOa29eZOS2VxUrpPORXg1pkohGGUS8,91
27
+ cuenca_validations-2.1.4.dev0.dist-info/top_level.txt,sha256=4233xdOs2HtuT-GFRjcDcwK0IwdwvWdczOtk0fPB6Gw,25
28
+ cuenca_validations-2.1.4.dev0.dist-info/RECORD,,
@@ -1,5 +1,5 @@
1
1
  Wheel-Version: 1.0
2
- Generator: setuptools (75.8.1)
2
+ Generator: setuptools (76.0.0)
3
3
  Root-Is-Purelib: true
4
4
  Tag: py3-none-any
5
5
 
tests/test_types.py CHANGED
@@ -583,9 +583,47 @@ def test_user_lists_request_valid_params(input_data):
583
583
  UserListsRequest(**input_data)
584
584
 
585
585
 
586
- def test_user_lists_request_invalid_params():
587
- with pytest.raises(ValueError):
588
- UserListsRequest(first_surname='Paramo', second_surname='Paramo')
586
+ @pytest.mark.parametrize(
587
+ 'input_data,expected_error',
588
+ [
589
+ (
590
+ {'first_surname': 'Paramo'},
591
+ (
592
+ 'names is required when first_surname or second_surname '
593
+ 'is provided'
594
+ ),
595
+ ),
596
+ (
597
+ {'second_surname': 'Paramo'},
598
+ (
599
+ 'names is required when first_surname or second_surname '
600
+ 'is provided'
601
+ ),
602
+ ),
603
+ (
604
+ {'first_surname': 'Paramo', 'second_surname': 'Paramo'},
605
+ (
606
+ 'names is required when first_surname or second_surname '
607
+ 'is provided'
608
+ ),
609
+ ),
610
+ (
611
+ {'names': 'Juan'},
612
+ 'first_surname is required when names is provided',
613
+ ),
614
+ (
615
+ {'first_surname': 'Paramo', 'curp': 'GOCG650418HVZNML08'},
616
+ (
617
+ 'names is required when first_surname or second_surname '
618
+ 'is provided'
619
+ ),
620
+ ),
621
+ ({}, 'At least 1 param is required'),
622
+ ],
623
+ )
624
+ def test_user_lists_request_invalid_params(input_data, expected_error):
625
+ with pytest.raises(ValueError, match=expected_error):
626
+ UserListsRequest(**input_data)
589
627
 
590
628
 
591
629
  class IntModel(BaseModel):