cuenca-validations 2.1.16.dev8__py3-none-any.whl → 2.1.16.dev100__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 +6 -6
- cuenca_validations/types/enums.py +5 -3
- cuenca_validations/types/general.py +21 -20
- cuenca_validations/types/requests.py +21 -9
- cuenca_validations/version.py +1 -1
- {cuenca_validations-2.1.16.dev8.dist-info → cuenca_validations-2.1.16.dev100.dist-info}/METADATA +1 -1
- {cuenca_validations-2.1.16.dev8.dist-info → cuenca_validations-2.1.16.dev100.dist-info}/RECORD +12 -12
- tests/test_requests.py +40 -1
- tests/test_types.py +6 -6
- {cuenca_validations-2.1.16.dev8.dist-info → cuenca_validations-2.1.16.dev100.dist-info}/WHEEL +0 -0
- {cuenca_validations-2.1.16.dev8.dist-info → cuenca_validations-2.1.16.dev100.dist-info}/licenses/LICENSE +0 -0
- {cuenca_validations-2.1.16.dev8.dist-info → cuenca_validations-2.1.16.dev100.dist-info}/top_level.txt +0 -0
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
__all__ = [
|
|
2
|
-
'
|
|
2
|
+
'AccountUseType',
|
|
3
3
|
'AccountQuery',
|
|
4
4
|
'Address',
|
|
5
5
|
'ApiKeyQuery',
|
|
@@ -54,8 +54,8 @@ __all__ = [
|
|
|
54
54
|
'KYCValidationSource',
|
|
55
55
|
'Language',
|
|
56
56
|
'LimitedWalletRequest',
|
|
57
|
-
'
|
|
58
|
-
'
|
|
57
|
+
'MonthlyMovementsType',
|
|
58
|
+
'MonthlySpendingType',
|
|
59
59
|
'PartnerRequest',
|
|
60
60
|
'PartnerUpdateRequest',
|
|
61
61
|
'PhoneNumber',
|
|
@@ -122,7 +122,7 @@ __all__ = [
|
|
|
122
122
|
|
|
123
123
|
from .card import StrictPaymentCardNumber
|
|
124
124
|
from .enums import (
|
|
125
|
-
|
|
125
|
+
AccountUseType,
|
|
126
126
|
AuthorizerTransaction,
|
|
127
127
|
BankAccountStatus,
|
|
128
128
|
CardErrorType,
|
|
@@ -147,8 +147,8 @@ from .enums import (
|
|
|
147
147
|
KYCFileType,
|
|
148
148
|
KYCValidationSource,
|
|
149
149
|
Language,
|
|
150
|
-
|
|
151
|
-
|
|
150
|
+
MonthlyMovementsType,
|
|
151
|
+
MonthlySpendingType,
|
|
152
152
|
PlatformType,
|
|
153
153
|
PosCapability,
|
|
154
154
|
Profession,
|
|
@@ -588,6 +588,7 @@ class SessionType(str, Enum):
|
|
|
588
588
|
account_entries = 'session.account_entries'
|
|
589
589
|
download_file = 'session.download_file'
|
|
590
590
|
upload_file = 'session.upload_file'
|
|
591
|
+
metamap_verification = 'session.metamap_verification'
|
|
591
592
|
|
|
592
593
|
|
|
593
594
|
class WebhookObject(str, Enum):
|
|
@@ -704,23 +705,24 @@ class Profession(str, Enum):
|
|
|
704
705
|
sistemas = 'sistemas'
|
|
705
706
|
independiente = 'independiente'
|
|
706
707
|
oficios = 'oficios'
|
|
708
|
+
otros = 'otros'
|
|
707
709
|
|
|
708
710
|
|
|
709
|
-
class
|
|
711
|
+
class AccountUseType(str, Enum):
|
|
710
712
|
personal_expenses = 'personal_expenses'
|
|
711
713
|
business_expenses = 'business_expenses'
|
|
712
714
|
payment_of_goods_or_services = 'payment_of_goods_or_services'
|
|
713
715
|
send_or_receive_transfers = 'send_or_receive_transfers'
|
|
714
716
|
|
|
715
717
|
|
|
716
|
-
class
|
|
718
|
+
class MonthlyMovementsType(str, Enum):
|
|
717
719
|
between_1_and_20 = 'between_1_and_20'
|
|
718
720
|
between_20_and_40 = 'between_20_and_40'
|
|
719
721
|
between_40_and_60 = 'between_40_and_60'
|
|
720
722
|
more_than_60 = 'more_than_60'
|
|
721
723
|
|
|
722
724
|
|
|
723
|
-
class
|
|
725
|
+
class MonthlySpendingType(str, Enum):
|
|
724
726
|
less_than_1k = 'less_than_1k'
|
|
725
727
|
between_1k_and_10k = 'between_1k_and_10k'
|
|
726
728
|
between_10k_and_20k = 'between_10k_and_20k'
|
|
@@ -13,10 +13,10 @@ from pydantic import (
|
|
|
13
13
|
|
|
14
14
|
from ..validators import sanitize_dict, sanitize_item
|
|
15
15
|
from .enums import (
|
|
16
|
-
|
|
16
|
+
AccountUseType,
|
|
17
17
|
IncomeType,
|
|
18
|
-
|
|
19
|
-
|
|
18
|
+
MonthlyMovementsType,
|
|
19
|
+
MonthlySpendingType,
|
|
20
20
|
Profession,
|
|
21
21
|
State,
|
|
22
22
|
)
|
|
@@ -121,6 +121,7 @@ names_professions = {
|
|
|
121
121
|
Profession.sistemas: 'Sistemas y Comunicaciones',
|
|
122
122
|
Profession.independiente: 'Trabajador(a/e) Independiente',
|
|
123
123
|
Profession.oficios: 'Oficios Varios',
|
|
124
|
+
Profession.otros: 'Otros',
|
|
124
125
|
}
|
|
125
126
|
|
|
126
127
|
|
|
@@ -129,47 +130,47 @@ def get_profession_name(profession: Profession) -> str:
|
|
|
129
130
|
|
|
130
131
|
|
|
131
132
|
names_account_use_types = {
|
|
132
|
-
|
|
133
|
-
|
|
133
|
+
AccountUseType.personal_expenses: 'Gastos personales o familiares',
|
|
134
|
+
AccountUseType.business_expenses: (
|
|
134
135
|
'Gastos relacionados con tu actividad económica'
|
|
135
136
|
),
|
|
136
|
-
|
|
137
|
-
|
|
137
|
+
AccountUseType.payment_of_goods_or_services: 'Pago de bienes o servicios',
|
|
138
|
+
AccountUseType.send_or_receive_transfers: (
|
|
138
139
|
'Enviar o recibir transferencias'
|
|
139
140
|
),
|
|
140
141
|
}
|
|
141
142
|
|
|
142
143
|
|
|
143
|
-
def get_account_use_type_name(account_use_type:
|
|
144
|
+
def get_account_use_type_name(account_use_type: AccountUseType) -> str:
|
|
144
145
|
return names_account_use_types[account_use_type]
|
|
145
146
|
|
|
146
147
|
|
|
147
148
|
names_monthly_movements_types = {
|
|
148
|
-
|
|
149
|
-
|
|
150
|
-
|
|
151
|
-
|
|
149
|
+
MonthlyMovementsType.between_1_and_20: 'Entre 1 y 20 movimientos',
|
|
150
|
+
MonthlyMovementsType.between_20_and_40: 'Entre 20 y 40 movimientos',
|
|
151
|
+
MonthlyMovementsType.between_40_and_60: 'Entre 40 y 60 movimientos',
|
|
152
|
+
MonthlyMovementsType.more_than_60: 'Más de 60 movimientos',
|
|
152
153
|
}
|
|
153
154
|
|
|
154
155
|
|
|
155
156
|
def get_monthly_movements_type_name(
|
|
156
|
-
monthly_movements_type:
|
|
157
|
+
monthly_movements_type: MonthlyMovementsType,
|
|
157
158
|
) -> str:
|
|
158
159
|
return names_monthly_movements_types[monthly_movements_type]
|
|
159
160
|
|
|
160
161
|
|
|
161
162
|
names_monthly_spending_types = {
|
|
162
|
-
|
|
163
|
-
|
|
164
|
-
|
|
165
|
-
|
|
166
|
-
|
|
167
|
-
|
|
163
|
+
MonthlySpendingType.less_than_1k: 'Menos de $1,000',
|
|
164
|
+
MonthlySpendingType.between_1k_and_10k: 'Entre $1,000 y $10,000',
|
|
165
|
+
MonthlySpendingType.between_10k_and_20k: 'Entre $10,000 y $20,000',
|
|
166
|
+
MonthlySpendingType.between_20k_and_50k: 'Entre $20,000 y $50,000',
|
|
167
|
+
MonthlySpendingType.between_50k_and_100k: 'Entre $50,000 y $100,000',
|
|
168
|
+
MonthlySpendingType.more_than_100k: 'Más de $100,000',
|
|
168
169
|
}
|
|
169
170
|
|
|
170
171
|
|
|
171
172
|
def get_monthly_spending_type_name(
|
|
172
|
-
monthly_spending_type:
|
|
173
|
+
monthly_spending_type: MonthlySpendingType,
|
|
173
174
|
) -> str:
|
|
174
175
|
return names_monthly_spending_types[monthly_spending_type]
|
|
175
176
|
|
|
@@ -17,7 +17,7 @@ from pydantic_core import core_schema
|
|
|
17
17
|
from pydantic_extra_types.coordinate import Coordinate
|
|
18
18
|
|
|
19
19
|
from ..types.enums import (
|
|
20
|
-
|
|
20
|
+
AccountUseType,
|
|
21
21
|
AuthorizerTransaction,
|
|
22
22
|
CardDesign,
|
|
23
23
|
CardFundingType,
|
|
@@ -34,8 +34,8 @@ from ..types.enums import (
|
|
|
34
34
|
IssuerNetwork,
|
|
35
35
|
KYCFileType,
|
|
36
36
|
KYCValidationSource,
|
|
37
|
-
|
|
38
|
-
|
|
37
|
+
MonthlyMovementsType,
|
|
38
|
+
MonthlySpendingType,
|
|
39
39
|
PlatformType,
|
|
40
40
|
PosCapability,
|
|
41
41
|
Profession,
|
|
@@ -463,9 +463,9 @@ class UserRequest(BaseModel):
|
|
|
463
463
|
...,
|
|
464
464
|
description='ID of previously validated email verification',
|
|
465
465
|
)
|
|
466
|
-
account_use_type: Optional[
|
|
467
|
-
monthly_movements_type: Optional[
|
|
468
|
-
monthly_spending_type: Optional[
|
|
466
|
+
account_use_type: Optional[AccountUseType] = None
|
|
467
|
+
monthly_movements_type: Optional[MonthlyMovementsType] = None
|
|
468
|
+
monthly_spending_type: Optional[MonthlySpendingType] = None
|
|
469
469
|
income_type: Optional[IncomeType] = None
|
|
470
470
|
|
|
471
471
|
model_config = ConfigDict(
|
|
@@ -503,9 +503,9 @@ class UserUpdateRequest(BaseModel):
|
|
|
503
503
|
pronouns: Optional[str] = None
|
|
504
504
|
status: Optional[UserStatus] = None
|
|
505
505
|
required_level: Optional[int] = None
|
|
506
|
-
account_use_type: Optional[
|
|
507
|
-
monthly_movements_type: Optional[
|
|
508
|
-
monthly_spending_type: Optional[
|
|
506
|
+
account_use_type: Optional[AccountUseType] = None
|
|
507
|
+
monthly_movements_type: Optional[MonthlyMovementsType] = None
|
|
508
|
+
monthly_spending_type: Optional[MonthlySpendingType] = None
|
|
509
509
|
income_type: Optional[IncomeType] = None
|
|
510
510
|
|
|
511
511
|
@field_validator('beneficiaries')
|
|
@@ -533,6 +533,17 @@ class SessionRequest(BaseRequest):
|
|
|
533
533
|
type: SessionType
|
|
534
534
|
success_url: Optional[SerializableAnyUrl] = None
|
|
535
535
|
failure_url: Optional[SerializableAnyUrl] = None
|
|
536
|
+
metadata: Optional[dict] = None
|
|
537
|
+
|
|
538
|
+
@model_validator(mode='before')
|
|
539
|
+
@classmethod
|
|
540
|
+
def validate_metadata(cls, values: dict) -> dict:
|
|
541
|
+
if values[
|
|
542
|
+
'type'
|
|
543
|
+
] == SessionType.metamap_verification and not values.get('metadata'):
|
|
544
|
+
raise ValueError('Metadata expected for this session')
|
|
545
|
+
return values
|
|
546
|
+
|
|
536
547
|
model_config = ConfigDict(
|
|
537
548
|
json_schema_extra={
|
|
538
549
|
'example': {
|
|
@@ -540,6 +551,7 @@ class SessionRequest(BaseRequest):
|
|
|
540
551
|
'type': 'session.registration',
|
|
541
552
|
'success_url': 'http://example_success.com',
|
|
542
553
|
'failure_url': 'http://example_failure.com',
|
|
554
|
+
'metadata': {'verification_id': 'some_verification_id'},
|
|
543
555
|
}
|
|
544
556
|
}
|
|
545
557
|
)
|
cuenca_validations/version.py
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
__version__ = '2.1.16.
|
|
1
|
+
__version__ = '2.1.16.dev100'
|
{cuenca_validations-2.1.16.dev8.dist-info → cuenca_validations-2.1.16.dev100.dist-info}/RECORD
RENAMED
|
@@ -4,26 +4,26 @@ 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=mYJDXxJVokl5jZIA4FYn8wkaMUnOxAH54t1Pfg_0kmQ,1190
|
|
7
|
-
cuenca_validations/version.py,sha256
|
|
8
|
-
cuenca_validations/types/__init__.py,sha256=
|
|
7
|
+
cuenca_validations/version.py,sha256=ODlDDVMofzxSOhh3q02wcTtvdAGnEj2DeBz61fUpwPQ,30
|
|
8
|
+
cuenca_validations/types/__init__.py,sha256=CIfqLhBxUMX5YAI-FvX9pnHB233BivGJZj1lFNddx-k,5415
|
|
9
9
|
cuenca_validations/types/card.py,sha256=UGzz8NTFAverUmdUKAK1oGHnOnjSNTpIRUm93vKSSGY,1295
|
|
10
|
-
cuenca_validations/types/enums.py,sha256
|
|
10
|
+
cuenca_validations/types/enums.py,sha256=-2ySq2naYgZd7JhjDLRsM3qTSBwr3NE4XIQPahzJ81Y,20423
|
|
11
11
|
cuenca_validations/types/files.py,sha256=2CszbwF9ytXV9suFFwyDjYG4XxY8UhCjRw3HttVXXNw,269
|
|
12
|
-
cuenca_validations/types/general.py,sha256=
|
|
12
|
+
cuenca_validations/types/general.py,sha256=phXGbEtAfN1Mw26rblYDiFGBwFnhf1tK12ekwhuKFNo,5452
|
|
13
13
|
cuenca_validations/types/helpers.py,sha256=XPiYVTLDtmBB5R1heWUy1c35zZMh7nh-BmS6rtwEltg,1379
|
|
14
14
|
cuenca_validations/types/identities.py,sha256=1wkutHzL9Gpd9oAZdyiikNxWKe5iBVAQT3TabR6YG1o,5451
|
|
15
15
|
cuenca_validations/types/morals.py,sha256=davabh5hAnFVQyM7-yCyDaT5ewXnm0cr1BtqDIwzkX8,1833
|
|
16
16
|
cuenca_validations/types/queries.py,sha256=Pp7BAPk20hzImxb5EIiy3oI8S6AeCruU-NbQpOlrWVo,5146
|
|
17
|
-
cuenca_validations/types/requests.py,sha256=
|
|
18
|
-
cuenca_validations-2.1.16.
|
|
17
|
+
cuenca_validations/types/requests.py,sha256=G0-uTRsLcPNK3vMO8c6xo_i2Q-sNGFk9fclMGyeCDe8,22101
|
|
18
|
+
cuenca_validations-2.1.16.dev100.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
|
-
tests/test_requests.py,sha256=
|
|
23
|
+
tests/test_requests.py,sha256=RKWtt3c-YEMCou1Ya5vH_HtfEE8asc8Z5_RQdRO54LQ,2326
|
|
24
24
|
tests/test_statement.py,sha256=IOE0rRRBgBZSJv_FLaETEyn5NzzXKMNTqgjv99GX-68,1436
|
|
25
|
-
tests/test_types.py,sha256=
|
|
26
|
-
cuenca_validations-2.1.16.
|
|
27
|
-
cuenca_validations-2.1.16.
|
|
28
|
-
cuenca_validations-2.1.16.
|
|
29
|
-
cuenca_validations-2.1.16.
|
|
25
|
+
tests/test_types.py,sha256=2CSwhYn5WDFBHQl2239FD9J7KlB2_Tt7RVqQUlFcwnI,20074
|
|
26
|
+
cuenca_validations-2.1.16.dev100.dist-info/METADATA,sha256=oRdVM62ZEsnpWEjchJb46geHQTVt4e5nSshg80iU7dA,1602
|
|
27
|
+
cuenca_validations-2.1.16.dev100.dist-info/WHEEL,sha256=_zCd3N1l69ArxyTb8rzEoP9TpbYXkqRFSNOD5OuxnTs,91
|
|
28
|
+
cuenca_validations-2.1.16.dev100.dist-info/top_level.txt,sha256=4233xdOs2HtuT-GFRjcDcwK0IwdwvWdczOtk0fPB6Gw,25
|
|
29
|
+
cuenca_validations-2.1.16.dev100.dist-info/RECORD,,
|
tests/test_requests.py
CHANGED
|
@@ -1,7 +1,11 @@
|
|
|
1
1
|
import pytest
|
|
2
2
|
from pydantic import ValidationError
|
|
3
3
|
|
|
4
|
-
from cuenca_validations.types.
|
|
4
|
+
from cuenca_validations.types.enums import SessionType
|
|
5
|
+
from cuenca_validations.types.requests import (
|
|
6
|
+
SessionRequest,
|
|
7
|
+
UserTOSAgreementRequest,
|
|
8
|
+
)
|
|
5
9
|
from cuenca_validations.typing import DictStrAny
|
|
6
10
|
|
|
7
11
|
|
|
@@ -29,3 +33,38 @@ def test_file_cuenca_url_invalid() -> None:
|
|
|
29
33
|
)
|
|
30
34
|
with pytest.raises(ValidationError):
|
|
31
35
|
UserTOSAgreementRequest(**request_data)
|
|
36
|
+
|
|
37
|
+
|
|
38
|
+
def test_session_request_without_metadata():
|
|
39
|
+
request_data = {
|
|
40
|
+
'user_id': 'USWqY5cvkISJOxHyEKjAKf8w',
|
|
41
|
+
'type': 'session.curp_validation',
|
|
42
|
+
}
|
|
43
|
+
request = SessionRequest(**request_data)
|
|
44
|
+
assert request.type == SessionType.curp_validation
|
|
45
|
+
assert request.user_id == 'USWqY5cvkISJOxHyEKjAKf8w'
|
|
46
|
+
|
|
47
|
+
|
|
48
|
+
def test_session_request_with_metadata():
|
|
49
|
+
request_data = {
|
|
50
|
+
'user_id': 'USWqY5cvkISJOxHyEKjAKf8w',
|
|
51
|
+
'type': 'session.metamap_verification',
|
|
52
|
+
'metadata': {'verification_id': 'some_verification'},
|
|
53
|
+
}
|
|
54
|
+
request = SessionRequest(**request_data)
|
|
55
|
+
assert request.type == SessionType.metamap_verification
|
|
56
|
+
assert request.user_id == 'USWqY5cvkISJOxHyEKjAKf8w'
|
|
57
|
+
assert request.metadata
|
|
58
|
+
assert request.metadata['verification_id'] == 'some_verification'
|
|
59
|
+
|
|
60
|
+
|
|
61
|
+
def test_metamap_session_request_without_metadata():
|
|
62
|
+
request_data = {
|
|
63
|
+
'user_id': 'USWqY5cvkISJOxHyEKjAKf8w',
|
|
64
|
+
'type': 'session.metamap_verification',
|
|
65
|
+
}
|
|
66
|
+
|
|
67
|
+
with pytest.raises(ValidationError) as exception:
|
|
68
|
+
SessionRequest(**request_data)
|
|
69
|
+
|
|
70
|
+
assert 'Metadata expected for this session' in str(exception)
|
tests/test_types.py
CHANGED
|
@@ -25,11 +25,11 @@ from cuenca_validations.types import (
|
|
|
25
25
|
get_state_name,
|
|
26
26
|
)
|
|
27
27
|
from cuenca_validations.types.enums import (
|
|
28
|
-
|
|
28
|
+
AccountUseType,
|
|
29
29
|
EcommerceIndicator,
|
|
30
30
|
IncomeType,
|
|
31
|
-
|
|
32
|
-
|
|
31
|
+
MonthlyMovementsType,
|
|
32
|
+
MonthlySpendingType,
|
|
33
33
|
Profession,
|
|
34
34
|
SessionType,
|
|
35
35
|
State,
|
|
@@ -567,21 +567,21 @@ def test_get_income_type_name() -> None:
|
|
|
567
567
|
|
|
568
568
|
def test_get_account_use_type_name() -> None:
|
|
569
569
|
assert (
|
|
570
|
-
get_account_use_type_name(
|
|
570
|
+
get_account_use_type_name(AccountUseType.personal_expenses)
|
|
571
571
|
== 'Gastos personales o familiares'
|
|
572
572
|
)
|
|
573
573
|
|
|
574
574
|
|
|
575
575
|
def test_get_monthly_spending_type_name() -> None:
|
|
576
576
|
assert (
|
|
577
|
-
get_monthly_spending_type_name(
|
|
577
|
+
get_monthly_spending_type_name(MonthlySpendingType.less_than_1k)
|
|
578
578
|
== 'Menos de $1,000'
|
|
579
579
|
)
|
|
580
580
|
|
|
581
581
|
|
|
582
582
|
def test_get_monthly_movements_type_name() -> None:
|
|
583
583
|
assert (
|
|
584
|
-
get_monthly_movements_type_name(
|
|
584
|
+
get_monthly_movements_type_name(MonthlyMovementsType.between_1_and_20)
|
|
585
585
|
== 'Entre 1 y 20 movimientos'
|
|
586
586
|
)
|
|
587
587
|
|
{cuenca_validations-2.1.16.dev8.dist-info → cuenca_validations-2.1.16.dev100.dist-info}/WHEEL
RENAMED
|
File without changes
|
|
File without changes
|
|
File without changes
|