cuenca-validations 2.1.2__tar.gz → 2.1.3__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.2 → cuenca_validations-2.1.3}/PKG-INFO +1 -1
- {cuenca_validations-2.1.2 → cuenca_validations-2.1.3}/cuenca_validations/types/general.py +4 -0
- {cuenca_validations-2.1.2 → cuenca_validations-2.1.3}/cuenca_validations/types/requests.py +27 -7
- cuenca_validations-2.1.3/cuenca_validations/version.py +1 -0
- {cuenca_validations-2.1.2 → cuenca_validations-2.1.3}/cuenca_validations.egg-info/PKG-INFO +1 -1
- {cuenca_validations-2.1.2 → cuenca_validations-2.1.3}/tests/test_types.py +60 -4
- cuenca_validations-2.1.2/cuenca_validations/version.py +0 -1
- {cuenca_validations-2.1.2 → cuenca_validations-2.1.3}/LICENSE +0 -0
- {cuenca_validations-2.1.2 → cuenca_validations-2.1.3}/README.md +0 -0
- {cuenca_validations-2.1.2 → cuenca_validations-2.1.3}/cuenca_validations/__init__.py +0 -0
- {cuenca_validations-2.1.2 → cuenca_validations-2.1.3}/cuenca_validations/card_bins.py +0 -0
- {cuenca_validations-2.1.2 → cuenca_validations-2.1.3}/cuenca_validations/errors.py +0 -0
- {cuenca_validations-2.1.2 → cuenca_validations-2.1.3}/cuenca_validations/py.typed +0 -0
- {cuenca_validations-2.1.2 → cuenca_validations-2.1.3}/cuenca_validations/types/__init__.py +0 -0
- {cuenca_validations-2.1.2 → cuenca_validations-2.1.3}/cuenca_validations/types/card.py +0 -0
- {cuenca_validations-2.1.2 → cuenca_validations-2.1.3}/cuenca_validations/types/enums.py +0 -0
- {cuenca_validations-2.1.2 → cuenca_validations-2.1.3}/cuenca_validations/types/files.py +0 -0
- {cuenca_validations-2.1.2 → cuenca_validations-2.1.3}/cuenca_validations/types/helpers.py +0 -0
- {cuenca_validations-2.1.2 → cuenca_validations-2.1.3}/cuenca_validations/types/identities.py +0 -0
- {cuenca_validations-2.1.2 → cuenca_validations-2.1.3}/cuenca_validations/types/morals.py +0 -0
- {cuenca_validations-2.1.2 → cuenca_validations-2.1.3}/cuenca_validations/types/queries.py +0 -0
- {cuenca_validations-2.1.2 → cuenca_validations-2.1.3}/cuenca_validations/typing.py +0 -0
- {cuenca_validations-2.1.2 → cuenca_validations-2.1.3}/cuenca_validations/validators.py +0 -0
- {cuenca_validations-2.1.2 → cuenca_validations-2.1.3}/cuenca_validations.egg-info/SOURCES.txt +0 -0
- {cuenca_validations-2.1.2 → cuenca_validations-2.1.3}/cuenca_validations.egg-info/dependency_links.txt +0 -0
- {cuenca_validations-2.1.2 → cuenca_validations-2.1.3}/cuenca_validations.egg-info/requires.txt +0 -0
- {cuenca_validations-2.1.2 → cuenca_validations-2.1.3}/cuenca_validations.egg-info/top_level.txt +0 -0
- {cuenca_validations-2.1.2 → cuenca_validations-2.1.3}/setup.cfg +0 -0
- {cuenca_validations-2.1.2 → cuenca_validations-2.1.3}/setup.py +0 -0
- {cuenca_validations-2.1.2 → cuenca_validations-2.1.3}/tests/__init__.py +0 -0
- {cuenca_validations-2.1.2 → cuenca_validations-2.1.3}/tests/test_card.py +0 -0
- {cuenca_validations-2.1.2 → cuenca_validations-2.1.3}/tests/test_errors.py +0 -0
- {cuenca_validations-2.1.2 → cuenca_validations-2.1.3}/tests/test_helpers.py +0 -0
- {cuenca_validations-2.1.2 → cuenca_validations-2.1.3}/tests/test_statement.py +0 -0
|
@@ -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):
|
|
@@ -55,6 +55,7 @@ from .card import (
|
|
|
55
55
|
)
|
|
56
56
|
from .general import (
|
|
57
57
|
LogConfig,
|
|
58
|
+
NonEmptyStr,
|
|
58
59
|
SerializableAnyUrl,
|
|
59
60
|
SerializableHttpUrl,
|
|
60
61
|
SerializableIPvAnyAddress,
|
|
@@ -631,25 +632,43 @@ class BankAccountValidationRequest(BaseModel):
|
|
|
631
632
|
|
|
632
633
|
class UserListsRequest(BaseModel):
|
|
633
634
|
curp: Optional[Curp] = Field(None, description='Curp to review on lists')
|
|
635
|
+
rfc: Optional[Rfc] = Field(None, description='Rfc to review on lists')
|
|
634
636
|
account_number: Optional[Union[Clabe, PaymentCardNumber]] = Field(
|
|
635
637
|
None, description='Account to review on lists'
|
|
636
638
|
)
|
|
637
|
-
names: Optional[
|
|
639
|
+
names: Optional[NonEmptyStr] = Field(
|
|
638
640
|
None, description='Names of the user to review on lists'
|
|
639
641
|
)
|
|
640
|
-
first_surname: Optional[
|
|
641
|
-
None, description='
|
|
642
|
+
first_surname: Optional[NonEmptyStr] = Field(
|
|
643
|
+
None, description='First surname of the user to review on lists'
|
|
642
644
|
)
|
|
643
|
-
second_surname: Optional[
|
|
644
|
-
None, description='
|
|
645
|
+
second_surname: Optional[NonEmptyStr] = Field(
|
|
646
|
+
None, description='Second surname of the user to review on lists'
|
|
645
647
|
)
|
|
646
648
|
|
|
647
649
|
@model_validator(mode='before')
|
|
648
650
|
@classmethod
|
|
649
651
|
def check_request(cls, values):
|
|
652
|
+
if (
|
|
653
|
+
values.get('first_surname') or values.get('second_surname')
|
|
654
|
+
) and not values.get('names'):
|
|
655
|
+
raise ValueError(
|
|
656
|
+
'names is required when first_surname or second_surname '
|
|
657
|
+
'is provided'
|
|
658
|
+
)
|
|
659
|
+
|
|
660
|
+
if values.get('names') and not values.get('first_surname'):
|
|
661
|
+
raise ValueError(
|
|
662
|
+
'first_surname is required when names is provided'
|
|
663
|
+
)
|
|
664
|
+
|
|
650
665
|
has_name = all(values.get(f) for f in ['names', 'first_surname'])
|
|
651
|
-
curp, account =
|
|
652
|
-
|
|
666
|
+
curp, account, rfc = (
|
|
667
|
+
values.get('curp'),
|
|
668
|
+
values.get('account_number'),
|
|
669
|
+
values.get('rfc'),
|
|
670
|
+
)
|
|
671
|
+
if not any([curp, account, rfc, has_name]):
|
|
653
672
|
raise ValueError("At least 1 param is required")
|
|
654
673
|
return values
|
|
655
674
|
|
|
@@ -658,6 +677,7 @@ class UserListsRequest(BaseModel):
|
|
|
658
677
|
json_schema_extra={
|
|
659
678
|
'example': {
|
|
660
679
|
'curp': 'GOCG650418HVZNML08',
|
|
680
|
+
'rfc': 'GOCG650418TJ1',
|
|
661
681
|
'account_number': '9203929392939292392',
|
|
662
682
|
'names': 'Pedrito',
|
|
663
683
|
'first_surname': 'Sola',
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
__version__ = '2.1.3'
|
|
@@ -564,10 +564,66 @@ def test_bank_account_validation_clabe_request():
|
|
|
564
564
|
assert BankAccountValidationRequest(account_number='646180157098510917')
|
|
565
565
|
|
|
566
566
|
|
|
567
|
-
|
|
568
|
-
|
|
569
|
-
|
|
570
|
-
|
|
567
|
+
@pytest.mark.parametrize(
|
|
568
|
+
'input_data',
|
|
569
|
+
[
|
|
570
|
+
{'names': 'Pedro', 'first_surname': 'Paramo'},
|
|
571
|
+
{'curp': 'GOCG650418HVZNML08'},
|
|
572
|
+
{'rfc': 'GOCG650418TJ1'},
|
|
573
|
+
{'account_number': '646180157034181180'},
|
|
574
|
+
{
|
|
575
|
+
'curp': 'GOCG650418HVZNML08',
|
|
576
|
+
'rfc': 'GOCG650418TJ1',
|
|
577
|
+
'names': 'Pedro',
|
|
578
|
+
'first_surname': 'Paramo',
|
|
579
|
+
},
|
|
580
|
+
],
|
|
581
|
+
)
|
|
582
|
+
def test_user_lists_request_valid_params(input_data):
|
|
583
|
+
UserListsRequest(**input_data)
|
|
584
|
+
|
|
585
|
+
|
|
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)
|
|
571
627
|
|
|
572
628
|
|
|
573
629
|
class IntModel(BaseModel):
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
__version__ = '2.1.2'
|
|
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
|
|
File without changes
|
|
File without changes
|
{cuenca_validations-2.1.2 → cuenca_validations-2.1.3}/cuenca_validations/types/identities.py
RENAMED
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
{cuenca_validations-2.1.2 → cuenca_validations-2.1.3}/cuenca_validations.egg-info/SOURCES.txt
RENAMED
|
File without changes
|
|
File without changes
|
{cuenca_validations-2.1.2 → cuenca_validations-2.1.3}/cuenca_validations.egg-info/requires.txt
RENAMED
|
File without changes
|
{cuenca_validations-2.1.2 → cuenca_validations-2.1.3}/cuenca_validations.egg-info/top_level.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
|