cuenca-validations 2.1.38.dev2__py3-none-any.whl → 2.1.39.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.
- cuenca_validations/types/__init__.py +2 -4
- cuenca_validations/types/enums.py +1 -7
- cuenca_validations/types/general.py +0 -14
- cuenca_validations/types/requests.py +28 -7
- cuenca_validations/version.py +1 -1
- {cuenca_validations-2.1.38.dev2.dist-info → cuenca_validations-2.1.39.dev0.dist-info}/METADATA +1 -1
- {cuenca_validations-2.1.38.dev2.dist-info → cuenca_validations-2.1.39.dev0.dist-info}/RECORD +12 -12
- tests/test_requests.py +24 -0
- tests/test_types.py +10 -64
- {cuenca_validations-2.1.38.dev2.dist-info → cuenca_validations-2.1.39.dev0.dist-info}/WHEEL +0 -0
- {cuenca_validations-2.1.38.dev2.dist-info → cuenca_validations-2.1.39.dev0.dist-info}/licenses/LICENSE +0 -0
- {cuenca_validations-2.1.38.dev2.dist-info → cuenca_validations-2.1.39.dev0.dist-info}/top_level.txt +0 -0
|
@@ -8,7 +8,6 @@ __all__ = [
|
|
|
8
8
|
'BalanceEntryQuery',
|
|
9
9
|
'BankAccountValidationQuery',
|
|
10
10
|
'BankAccountValidationRequest',
|
|
11
|
-
'BankCode',
|
|
12
11
|
'PostalCodeQuery',
|
|
13
12
|
'UsersTOSQuery',
|
|
14
13
|
'TOSQuery',
|
|
@@ -28,6 +27,7 @@ __all__ = [
|
|
|
28
27
|
'CardTransactionType',
|
|
29
28
|
'CardType',
|
|
30
29
|
'Country',
|
|
30
|
+
'CodiNotificationRequest',
|
|
31
31
|
'Curp',
|
|
32
32
|
'CurpValidationRequest',
|
|
33
33
|
'CommissionType',
|
|
@@ -46,7 +46,6 @@ __all__ = [
|
|
|
46
46
|
'FileRequest',
|
|
47
47
|
'FileUploadRequest',
|
|
48
48
|
'FraudFundsTransferRequest',
|
|
49
|
-
'FraudFundsTransferTipoPago',
|
|
50
49
|
'Gender',
|
|
51
50
|
'IncomeType',
|
|
52
51
|
'IssuerNetwork',
|
|
@@ -147,7 +146,6 @@ from .enums import (
|
|
|
147
146
|
EventType,
|
|
148
147
|
FileExtension,
|
|
149
148
|
FileFormat,
|
|
150
|
-
FraudFundsTransferTipoPago,
|
|
151
149
|
Gender,
|
|
152
150
|
IncomeType,
|
|
153
151
|
IssuerNetwork,
|
|
@@ -178,7 +176,6 @@ from .enums import (
|
|
|
178
176
|
)
|
|
179
177
|
from .files import BatchFileMetadata
|
|
180
178
|
from .general import (
|
|
181
|
-
BankCode,
|
|
182
179
|
JSONEncoder,
|
|
183
180
|
LogConfig,
|
|
184
181
|
SantizedDict,
|
|
@@ -230,6 +227,7 @@ from .requests import (
|
|
|
230
227
|
ApiKeyUpdateRequest,
|
|
231
228
|
BankAccountValidationRequest,
|
|
232
229
|
BeneficiaryRequest,
|
|
230
|
+
CodiNotificationRequest,
|
|
233
231
|
CurpValidationRequest,
|
|
234
232
|
EndpointRequest,
|
|
235
233
|
EndpointUpdateRequest,
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
from enum import Enum
|
|
1
|
+
from enum import Enum
|
|
2
2
|
|
|
3
3
|
|
|
4
4
|
class CardNetwork(str, Enum):
|
|
@@ -743,9 +743,3 @@ class RequiredAction(str, Enum):
|
|
|
743
743
|
level_up_required = 'level_up_required'
|
|
744
744
|
level_up_invitation = 'level_up_invitation'
|
|
745
745
|
fix_documents = 'fix_documents'
|
|
746
|
-
|
|
747
|
-
|
|
748
|
-
class FraudFundsTransferTipoPago(IntEnum):
|
|
749
|
-
participante_participante = 7
|
|
750
|
-
devolucion_especial_ordenes_aceptadas_acreditadas = 23
|
|
751
|
-
devolucion_extemporanea_especial_ordenes_acreditadas = 24
|
|
@@ -2,7 +2,6 @@ import json
|
|
|
2
2
|
from dataclasses import dataclass
|
|
3
3
|
from typing import Annotated, Any, Optional
|
|
4
4
|
|
|
5
|
-
from clabe import BANK_NAMES
|
|
6
5
|
from pydantic import (
|
|
7
6
|
AfterValidator,
|
|
8
7
|
AnyUrl,
|
|
@@ -42,19 +41,6 @@ NormalizedName = Annotated[
|
|
|
42
41
|
]
|
|
43
42
|
|
|
44
43
|
|
|
45
|
-
def validate_bank_code(bank_code: str) -> str:
|
|
46
|
-
if bank_code not in BANK_NAMES:
|
|
47
|
-
raise ValueError('Not a valid bank code')
|
|
48
|
-
return bank_code
|
|
49
|
-
|
|
50
|
-
|
|
51
|
-
BankCode = Annotated[
|
|
52
|
-
str,
|
|
53
|
-
StringConstraints(strip_whitespace=True),
|
|
54
|
-
AfterValidator(validate_bank_code),
|
|
55
|
-
]
|
|
56
|
-
|
|
57
|
-
|
|
58
44
|
class SantizedDict(dict):
|
|
59
45
|
def __init__(self, *args, **kwargs):
|
|
60
46
|
super().__init__(*args, **kwargs)
|
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
import datetime as dt
|
|
2
2
|
from typing import Annotated, Any, Optional, Union
|
|
3
3
|
|
|
4
|
-
from clabe import Clabe
|
|
4
|
+
from clabe import BANK_NAMES, Clabe
|
|
5
5
|
from pydantic import (
|
|
6
6
|
BaseModel,
|
|
7
7
|
ConfigDict,
|
|
@@ -29,7 +29,6 @@ from ..types.enums import (
|
|
|
29
29
|
Country,
|
|
30
30
|
EcommerceIndicator,
|
|
31
31
|
FileExtension,
|
|
32
|
-
FraudFundsTransferTipoPago,
|
|
33
32
|
Gender,
|
|
34
33
|
IncomeType,
|
|
35
34
|
IssuerNetwork,
|
|
@@ -67,7 +66,6 @@ from .card import (
|
|
|
67
66
|
StrictPaymentCardNumber,
|
|
68
67
|
)
|
|
69
68
|
from .general import (
|
|
70
|
-
BankCode,
|
|
71
69
|
LogConfig,
|
|
72
70
|
NonEmptyStr,
|
|
73
71
|
SerializableAnyUrl,
|
|
@@ -329,17 +327,21 @@ class WalletTransactionRequest(BaseRequest):
|
|
|
329
327
|
class FraudFundsTransferRequest(BaseRequest):
|
|
330
328
|
user_id: NonEmptyStr
|
|
331
329
|
clabe: Optional[Clabe] = None
|
|
332
|
-
bank_code: Optional[
|
|
333
|
-
tipo_pago: Optional[FraudFundsTransferTipoPago] = None
|
|
330
|
+
bank_code: Optional[str] = None
|
|
334
331
|
amount: Optional[StrictPositiveInt] = None
|
|
335
332
|
concepto: Optional[NonEmptyStr] = None
|
|
336
333
|
|
|
334
|
+
@field_validator('bank_code')
|
|
335
|
+
@classmethod
|
|
336
|
+
def validate_bank_code(cls, bank_code: Optional[str]) -> Optional[str]:
|
|
337
|
+
if bank_code is not None and bank_code not in BANK_NAMES:
|
|
338
|
+
raise ValueError('Not a valid bank code')
|
|
339
|
+
return bank_code
|
|
340
|
+
|
|
337
341
|
@model_validator(mode='after')
|
|
338
342
|
def validate_destination(self) -> 'FraudFundsTransferRequest':
|
|
339
343
|
if self.clabe is None and self.bank_code is None:
|
|
340
344
|
raise ValueError('clabe or bank_code required')
|
|
341
|
-
if self.bank_code is not None and self.tipo_pago is None:
|
|
342
|
-
raise ValueError('tipo_pago required when using bank_code')
|
|
343
345
|
return self
|
|
344
346
|
|
|
345
347
|
|
|
@@ -460,6 +462,25 @@ class CurpValidationRequest(BaseRequest):
|
|
|
460
462
|
return values
|
|
461
463
|
|
|
462
464
|
|
|
465
|
+
class CodiNotificationRequest(BaseRequest):
|
|
466
|
+
clave_rastreo: str
|
|
467
|
+
status: str
|
|
468
|
+
payment_type: Optional[str] = None
|
|
469
|
+
monto: Optional[int] = None
|
|
470
|
+
concepto: Optional[str] = None
|
|
471
|
+
cuenta_ordenante: Optional[str] = None
|
|
472
|
+
cuenta_beneficiario: Optional[str] = None
|
|
473
|
+
nombre_ordenante: Optional[str] = None
|
|
474
|
+
nombre_beneficiario: Optional[str] = None
|
|
475
|
+
referencia_numerica: Optional[str] = None
|
|
476
|
+
alias_celular_ordenante: Optional[str] = None
|
|
477
|
+
digito_verificador_ordenante: Optional[str] = None
|
|
478
|
+
alias_celular_beneficiario: Optional[str] = None
|
|
479
|
+
digito_verificador_beneficiario: Optional[str] = None
|
|
480
|
+
folio_esquema: str
|
|
481
|
+
estampa_tiempo_cobro: Optional[int] = None
|
|
482
|
+
|
|
483
|
+
|
|
463
484
|
class TOSRequest(BaseModel):
|
|
464
485
|
type: TermsOfService
|
|
465
486
|
version: str
|
cuenca_validations/version.py
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
__version__ = '2.1.
|
|
1
|
+
__version__ = '2.1.39.dev0'
|
{cuenca_validations-2.1.38.dev2.dist-info → cuenca_validations-2.1.39.dev0.dist-info}/RECORD
RENAMED
|
@@ -4,27 +4,27 @@ 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=zXSnU5-EMbQZBD-PfFXgP4Z6G7cm7KFDWXB7Nie6WUk,2682
|
|
7
|
-
cuenca_validations/version.py,sha256=
|
|
8
|
-
cuenca_validations/types/__init__.py,sha256=
|
|
7
|
+
cuenca_validations/version.py,sha256=2njsJWkyvrJzxcOIMNAk-kyt0KAROrKAYWtxg5Q3rLE,28
|
|
8
|
+
cuenca_validations/types/__init__.py,sha256=EAIheDQtj_JSaAwMPDsPilm-66lCoPNRZ_oPuIexdbA,5699
|
|
9
9
|
cuenca_validations/types/card.py,sha256=UGzz8NTFAverUmdUKAK1oGHnOnjSNTpIRUm93vKSSGY,1295
|
|
10
|
-
cuenca_validations/types/enums.py,sha256=
|
|
10
|
+
cuenca_validations/types/enums.py,sha256=f-qMUdxLZsAqRvEwh3EcUsB2K-loufvPzdcK0JFQ1JY,20586
|
|
11
11
|
cuenca_validations/types/files.py,sha256=2CszbwF9ytXV9suFFwyDjYG4XxY8UhCjRw3HttVXXNw,269
|
|
12
|
-
cuenca_validations/types/general.py,sha256=
|
|
12
|
+
cuenca_validations/types/general.py,sha256=eYFYwyx_a4_J480GYpqW3DFbZabDFcUjvLRMQbShIUc,5622
|
|
13
13
|
cuenca_validations/types/helpers.py,sha256=4veeLZbugHHqZk0ezSim978VhH6Vq8XTrEhe1eE_r3A,1531
|
|
14
14
|
cuenca_validations/types/identities.py,sha256=j2xxh3UYHJe6IbAwr9yNXJkebTth_-g3SUmHeiPez8M,5513
|
|
15
15
|
cuenca_validations/types/morals.py,sha256=davabh5hAnFVQyM7-yCyDaT5ewXnm0cr1BtqDIwzkX8,1833
|
|
16
16
|
cuenca_validations/types/queries.py,sha256=OonJ6CBDR6OF_kTv49AsE3zLEzQPCF4xpSqzSBpQgEs,5795
|
|
17
|
-
cuenca_validations/types/requests.py,sha256=
|
|
18
|
-
cuenca_validations-2.1.
|
|
17
|
+
cuenca_validations/types/requests.py,sha256=jWUM3v-ehTGbesg-5yFb2XLk3UrG17Ul5ETLBoPjrp0,25918
|
|
18
|
+
cuenca_validations-2.1.39.dev0.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=fx2R7y6oQO8XeQzevJe826NuHkBgvtznZicomchB3Gg,899
|
|
23
|
-
tests/test_requests.py,sha256=
|
|
23
|
+
tests/test_requests.py,sha256=w2Xod9PVfj6SOk2JIIuaXmjhKfY5conlh8KrLJJcb0c,5048
|
|
24
24
|
tests/test_statement.py,sha256=IOE0rRRBgBZSJv_FLaETEyn5NzzXKMNTqgjv99GX-68,1436
|
|
25
|
-
tests/test_types.py,sha256=
|
|
25
|
+
tests/test_types.py,sha256=rPjqPGfPU73MSdbeJpoW_ai5TAO25hWSnQAt_H7ZIeI,23055
|
|
26
26
|
tests/test_validators.py,sha256=Jjr9gWTT4cRntGiKvQK4fncqx3JkEuTWkKm1VqpRHTs,1829
|
|
27
|
-
cuenca_validations-2.1.
|
|
28
|
-
cuenca_validations-2.1.
|
|
29
|
-
cuenca_validations-2.1.
|
|
30
|
-
cuenca_validations-2.1.
|
|
27
|
+
cuenca_validations-2.1.39.dev0.dist-info/METADATA,sha256=-qJZODcGi_Zh4IVEn9lOzy9kRB9v41-sOO4d7OyuM88,1600
|
|
28
|
+
cuenca_validations-2.1.39.dev0.dist-info/WHEEL,sha256=aeYiig01lYGDzBgS8HxWXOg3uV61G9ijOsup-k9o1sk,91
|
|
29
|
+
cuenca_validations-2.1.39.dev0.dist-info/top_level.txt,sha256=4233xdOs2HtuT-GFRjcDcwK0IwdwvWdczOtk0fPB6Gw,25
|
|
30
|
+
cuenca_validations-2.1.39.dev0.dist-info/RECORD,,
|
tests/test_requests.py
CHANGED
|
@@ -4,6 +4,7 @@ from pydantic_extra_types.phone_numbers import PhoneNumber
|
|
|
4
4
|
|
|
5
5
|
from cuenca_validations.types.enums import VerificationType
|
|
6
6
|
from cuenca_validations.types.requests import (
|
|
7
|
+
CodiNotificationRequest,
|
|
7
8
|
PasswordResetRequest,
|
|
8
9
|
UpdateTransferRequest,
|
|
9
10
|
UserTOSAgreementRequest,
|
|
@@ -123,3 +124,26 @@ def test_update_transfer_request_forbids_extra() -> None:
|
|
|
123
124
|
{'status': 'succeeded', 'foo': 'bar'}
|
|
124
125
|
)
|
|
125
126
|
assert 'Extra inputs are not permitted' in str(ex.value)
|
|
127
|
+
|
|
128
|
+
|
|
129
|
+
def test_codi_notification_request_serializes() -> None:
|
|
130
|
+
payload: DictStrAny = {
|
|
131
|
+
'clave_rastreo': 'LT123456789',
|
|
132
|
+
'status': 'succeeded',
|
|
133
|
+
'payment_type': '19',
|
|
134
|
+
'monto': 10000,
|
|
135
|
+
'concepto': 'Pago CoDi test',
|
|
136
|
+
'cuenta_ordenante': '646180157000000001',
|
|
137
|
+
'cuenta_beneficiario': '646180157000000002',
|
|
138
|
+
'nombre_ordenante': 'Juan Perez',
|
|
139
|
+
'nombre_beneficiario': 'Maria Lopez',
|
|
140
|
+
'folio_esquema': '25535dd9e425535dd9ee',
|
|
141
|
+
'estampa_tiempo_cobro': 1704067200000,
|
|
142
|
+
'referencia_numerica': '1234567',
|
|
143
|
+
'alias_celular_ordenante': '2700754676',
|
|
144
|
+
'digito_verificador_ordenante': '34',
|
|
145
|
+
'alias_celular_beneficiario': '0754676270',
|
|
146
|
+
'digito_verificador_beneficiario': '27',
|
|
147
|
+
}
|
|
148
|
+
req = CodiNotificationRequest.model_validate(payload)
|
|
149
|
+
assert req.model_dump() == payload
|
tests/test_types.py
CHANGED
|
@@ -675,73 +675,19 @@ def test_bank_account_validation_clabe_request():
|
|
|
675
675
|
assert BankAccountValidationRequest(account_number='646180157098510917')
|
|
676
676
|
|
|
677
677
|
|
|
678
|
-
|
|
679
|
-
|
|
680
|
-
|
|
681
|
-
|
|
682
|
-
|
|
683
|
-
user_id='US123',
|
|
684
|
-
clabe='646180157098510917',
|
|
685
|
-
amount=10000,
|
|
686
|
-
concepto=' Devolución fraude ',
|
|
687
|
-
),
|
|
688
|
-
dict(
|
|
689
|
-
user_id='US123',
|
|
690
|
-
clabe='646180157098510917',
|
|
691
|
-
amount=10000,
|
|
692
|
-
concepto='Devolución fraude',
|
|
693
|
-
),
|
|
694
|
-
),
|
|
695
|
-
(
|
|
696
|
-
dict(user_id='US123', clabe='646180157098510917'),
|
|
697
|
-
dict(user_id='US123', clabe='646180157098510917'),
|
|
698
|
-
),
|
|
699
|
-
*[
|
|
700
|
-
(
|
|
701
|
-
dict(
|
|
702
|
-
user_id='US123',
|
|
703
|
-
bank_code='40012',
|
|
704
|
-
tipo_pago=tipo_pago,
|
|
705
|
-
amount=5000,
|
|
706
|
-
),
|
|
707
|
-
dict(
|
|
708
|
-
user_id='US123',
|
|
709
|
-
bank_code='40012',
|
|
710
|
-
tipo_pago=tipo_pago,
|
|
711
|
-
amount=5000,
|
|
712
|
-
),
|
|
713
|
-
)
|
|
714
|
-
for tipo_pago in (7, 23, 24)
|
|
715
|
-
],
|
|
716
|
-
],
|
|
717
|
-
)
|
|
718
|
-
def test_fraud_funds_transfer_request(data, expected_dump):
|
|
719
|
-
request = FraudFundsTransferRequest(**data)
|
|
720
|
-
assert request.model_dump() == expected_dump
|
|
678
|
+
def test_fraud_funds_transfer_request():
|
|
679
|
+
assert FraudFundsTransferRequest(
|
|
680
|
+
user_id='US123',
|
|
681
|
+
bank_code='40012',
|
|
682
|
+
).model_dump() == {'user_id': 'US123', 'bank_code': '40012'}
|
|
721
683
|
|
|
684
|
+
with pytest.raises(ValidationError) as exc:
|
|
685
|
+
FraudFundsTransferRequest(user_id='US123')
|
|
686
|
+
assert 'clabe or bank_code required' in str(exc.value)
|
|
722
687
|
|
|
723
|
-
@pytest.mark.parametrize(
|
|
724
|
-
'data, expected_error',
|
|
725
|
-
[
|
|
726
|
-
(dict(user_id='US123'), 'clabe or bank_code required'),
|
|
727
|
-
(
|
|
728
|
-
dict(user_id='US123', bank_code='40012'),
|
|
729
|
-
'tipo_pago required when using bank_code',
|
|
730
|
-
),
|
|
731
|
-
(
|
|
732
|
-
dict(user_id='US123', bank_code='40012', tipo_pago=1),
|
|
733
|
-
'Input should be 7, 23 or 24',
|
|
734
|
-
),
|
|
735
|
-
(
|
|
736
|
-
dict(user_id='US123', bank_code='99999', tipo_pago=7),
|
|
737
|
-
'Not a valid bank code',
|
|
738
|
-
),
|
|
739
|
-
],
|
|
740
|
-
)
|
|
741
|
-
def test_fraud_funds_transfer_request_invalid(data, expected_error):
|
|
742
688
|
with pytest.raises(ValidationError) as exc:
|
|
743
|
-
FraudFundsTransferRequest(
|
|
744
|
-
assert
|
|
689
|
+
FraudFundsTransferRequest(user_id='US123', bank_code='99999')
|
|
690
|
+
assert 'Not a valid bank code' in str(exc.value)
|
|
745
691
|
|
|
746
692
|
|
|
747
693
|
@pytest.mark.parametrize(
|
|
File without changes
|
|
File without changes
|
{cuenca_validations-2.1.38.dev2.dist-info → cuenca_validations-2.1.39.dev0.dist-info}/top_level.txt
RENAMED
|
File without changes
|