cuenca-validations 2.1.41.dev1__py3-none-any.whl → 2.1.41.dev3__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 +10 -4
- cuenca_validations/types/enums.py +1 -0
- cuenca_validations/types/queries.py +4 -0
- cuenca_validations/types/requests.py +24 -6
- cuenca_validations/version.py +1 -1
- {cuenca_validations-2.1.41.dev1.dist-info → cuenca_validations-2.1.41.dev3.dist-info}/METADATA +1 -1
- {cuenca_validations-2.1.41.dev1.dist-info → cuenca_validations-2.1.41.dev3.dist-info}/RECORD +11 -11
- tests/test_requests.py +56 -21
- {cuenca_validations-2.1.41.dev1.dist-info → cuenca_validations-2.1.41.dev3.dist-info}/WHEEL +0 -0
- {cuenca_validations-2.1.41.dev1.dist-info → cuenca_validations-2.1.41.dev3.dist-info}/licenses/LICENSE +0 -0
- {cuenca_validations-2.1.41.dev1.dist-info → cuenca_validations-2.1.41.dev3.dist-info}/top_level.txt +0 -0
|
@@ -60,15 +60,16 @@ __all__ = [
|
|
|
60
60
|
'KYCValidationRequest',
|
|
61
61
|
'KYCValidationSource',
|
|
62
62
|
'Language',
|
|
63
|
+
'LegalPersonRequest',
|
|
64
|
+
'LegalPersonUpdateRequest',
|
|
63
65
|
'LimitedWalletRequest',
|
|
64
66
|
'MonthlyMovementsType',
|
|
65
67
|
'MonthlySpendingType',
|
|
66
|
-
'MoralPersonRequest',
|
|
67
|
-
'MoralPersonUpdateRequest',
|
|
68
68
|
'OperationalEventAction',
|
|
69
69
|
'OperationalEventQuery',
|
|
70
70
|
'OperatorLoginRequest',
|
|
71
71
|
'OperatorLoginResponse',
|
|
72
|
+
'OperatorQuery',
|
|
72
73
|
'OperatorRequest',
|
|
73
74
|
'OperatorRole',
|
|
74
75
|
'OperatorStatus',
|
|
@@ -90,8 +91,10 @@ __all__ = [
|
|
|
90
91
|
'SavingRequest',
|
|
91
92
|
'SavingUpdateRequest',
|
|
92
93
|
'ServiceProviderCategory',
|
|
94
|
+
'SessionMetadata',
|
|
93
95
|
'SessionQuery',
|
|
94
96
|
'SessionRequest',
|
|
97
|
+
'SessionResponse',
|
|
95
98
|
'SessionType',
|
|
96
99
|
'State',
|
|
97
100
|
'StatementQuery',
|
|
@@ -231,6 +234,7 @@ from .queries import (
|
|
|
231
234
|
FileQuery,
|
|
232
235
|
IdentityQuery,
|
|
233
236
|
OperationalEventQuery,
|
|
237
|
+
OperatorQuery,
|
|
234
238
|
PostalCodeQuery,
|
|
235
239
|
QueryParams,
|
|
236
240
|
SessionQuery,
|
|
@@ -258,9 +262,9 @@ from .requests import (
|
|
|
258
262
|
FileUploadRequest,
|
|
259
263
|
FraudFundsTransferRequest,
|
|
260
264
|
KYCValidationRequest,
|
|
265
|
+
LegalPersonRequest,
|
|
266
|
+
LegalPersonUpdateRequest,
|
|
261
267
|
LimitedWalletRequest,
|
|
262
|
-
MoralPersonRequest,
|
|
263
|
-
MoralPersonUpdateRequest,
|
|
264
268
|
OperatorLoginRequest,
|
|
265
269
|
OperatorLoginResponse,
|
|
266
270
|
OperatorRequest,
|
|
@@ -272,7 +276,9 @@ from .requests import (
|
|
|
272
276
|
QuestionnairesRequest,
|
|
273
277
|
SavingRequest,
|
|
274
278
|
SavingUpdateRequest,
|
|
279
|
+
SessionMetadata,
|
|
275
280
|
SessionRequest,
|
|
281
|
+
SessionResponse,
|
|
276
282
|
StrictTransferRequest,
|
|
277
283
|
TOSRequest,
|
|
278
284
|
TransferRequest,
|
|
@@ -159,6 +159,10 @@ class OperationalEventQuery(QueryParams):
|
|
|
159
159
|
action: Optional[OperationalEventAction] = None
|
|
160
160
|
|
|
161
161
|
|
|
162
|
+
class OperatorQuery(QueryParams):
|
|
163
|
+
email: Optional[EmailStr] = None
|
|
164
|
+
|
|
165
|
+
|
|
162
166
|
class BalanceEntryQuery(QueryParams):
|
|
163
167
|
funding_instrument_uri: Optional[str] = None
|
|
164
168
|
wallet_id: str = 'default'
|
|
@@ -632,11 +632,29 @@ class UserLoginRequest(BaseRequest):
|
|
|
632
632
|
)
|
|
633
633
|
|
|
634
634
|
|
|
635
|
+
class SessionMetadata(BaseModel):
|
|
636
|
+
operator_id: Optional[str] = None
|
|
637
|
+
model_config = ConfigDict(extra='forbid')
|
|
638
|
+
|
|
639
|
+
|
|
640
|
+
class SessionResponse(BaseModel):
|
|
641
|
+
id: str
|
|
642
|
+
created_at: dt.datetime
|
|
643
|
+
user_id: str
|
|
644
|
+
platform_id: str
|
|
645
|
+
expires_at: dt.datetime
|
|
646
|
+
type: SessionType
|
|
647
|
+
success_url: Optional[SerializableAnyUrl] = None
|
|
648
|
+
failure_url: Optional[SerializableAnyUrl] = None
|
|
649
|
+
metadata: Optional[SessionMetadata] = None
|
|
650
|
+
|
|
651
|
+
|
|
635
652
|
class SessionRequest(BaseRequest):
|
|
636
653
|
user_id: str
|
|
637
654
|
type: SessionType
|
|
638
655
|
success_url: Optional[SerializableAnyUrl] = None
|
|
639
656
|
failure_url: Optional[SerializableAnyUrl] = None
|
|
657
|
+
metadata: Optional[SessionMetadata] = None
|
|
640
658
|
model_config = ConfigDict(
|
|
641
659
|
json_schema_extra={
|
|
642
660
|
'example': {
|
|
@@ -899,7 +917,7 @@ class PartnerUpdateRequest(BaseRequest):
|
|
|
899
917
|
shareholders: Optional[list[Shareholder]] = None
|
|
900
918
|
|
|
901
919
|
|
|
902
|
-
class
|
|
920
|
+
class LegalPersonRequest(BaseRequest):
|
|
903
921
|
legal_name: str
|
|
904
922
|
rfc: Rfc
|
|
905
923
|
legal_representatives: list[LegalRepresentative]
|
|
@@ -927,13 +945,13 @@ class MoralPersonRequest(BaseRequest):
|
|
|
927
945
|
|
|
928
946
|
@field_validator('rfc')
|
|
929
947
|
@classmethod
|
|
930
|
-
def
|
|
948
|
+
def validate_legal_rfc(cls, rfc: Rfc) -> Rfc:
|
|
931
949
|
if len(rfc) != 12:
|
|
932
|
-
raise ValueError('RFC must be 12 characters for
|
|
950
|
+
raise ValueError('RFC must be 12 characters for legal persons')
|
|
933
951
|
return rfc
|
|
934
952
|
|
|
935
953
|
|
|
936
|
-
class
|
|
954
|
+
class LegalPersonUpdateRequest(BaseRequest):
|
|
937
955
|
legal_name: Optional[str] = None
|
|
938
956
|
rfc: Optional[Rfc] = None
|
|
939
957
|
legal_representatives: Optional[list[LegalRepresentative]] = None
|
|
@@ -947,9 +965,9 @@ class MoralPersonUpdateRequest(BaseRequest):
|
|
|
947
965
|
|
|
948
966
|
@field_validator('rfc')
|
|
949
967
|
@classmethod
|
|
950
|
-
def
|
|
968
|
+
def validate_legal_rfc(cls, rfc: Optional[Rfc]) -> Optional[Rfc]:
|
|
951
969
|
if rfc is not None and len(rfc) != 12:
|
|
952
|
-
raise ValueError('RFC must be 12 characters for
|
|
970
|
+
raise ValueError('RFC must be 12 characters for legal persons')
|
|
953
971
|
return rfc
|
|
954
972
|
|
|
955
973
|
|
cuenca_validations/version.py
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
__version__ = '2.1.41.
|
|
1
|
+
__version__ = '2.1.41.dev3'
|
{cuenca_validations-2.1.41.dev1.dist-info → cuenca_validations-2.1.41.dev3.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=7rZF6eOzQFUXn6Pbgu0bw7KT8TJkVbGcuHLpQ9WYpSA,28
|
|
8
|
+
cuenca_validations/types/__init__.py,sha256=iBrQYsV3gnlA1HRdMZlkNcz1c1JI8OEfql7vf5-oHbQ,6511
|
|
9
9
|
cuenca_validations/types/card.py,sha256=UGzz8NTFAverUmdUKAK1oGHnOnjSNTpIRUm93vKSSGY,1295
|
|
10
|
-
cuenca_validations/types/enums.py,sha256=
|
|
10
|
+
cuenca_validations/types/enums.py,sha256=c891k16TSvEYP05LX_4eh-upySsqPc6QSigEKjc5qAY,21129
|
|
11
11
|
cuenca_validations/types/files.py,sha256=2CszbwF9ytXV9suFFwyDjYG4XxY8UhCjRw3HttVXXNw,269
|
|
12
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
|
-
cuenca_validations/types/queries.py,sha256=
|
|
17
|
-
cuenca_validations/types/requests.py,sha256=
|
|
18
|
-
cuenca_validations-2.1.41.
|
|
16
|
+
cuenca_validations/types/queries.py,sha256=ZakPAM9kiABA2qL-Z2z46GbFqaGXG4JKtqLn0ZTlW3Y,6094
|
|
17
|
+
cuenca_validations/types/requests.py,sha256=MnONAIHdVitz_Hxv5xC4bhaTV7_UcA9o1xzR-_IEj5c,30683
|
|
18
|
+
cuenca_validations-2.1.41.dev3.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=TNLQSATFzqLSnAdcoyoR7I8hLF2hE5sNw9ccNT0PCj8,10124
|
|
24
24
|
tests/test_statement.py,sha256=IOE0rRRBgBZSJv_FLaETEyn5NzzXKMNTqgjv99GX-68,1436
|
|
25
25
|
tests/test_types.py,sha256=rPjqPGfPU73MSdbeJpoW_ai5TAO25hWSnQAt_H7ZIeI,23055
|
|
26
26
|
tests/test_validators.py,sha256=Jjr9gWTT4cRntGiKvQK4fncqx3JkEuTWkKm1VqpRHTs,1829
|
|
27
|
-
cuenca_validations-2.1.41.
|
|
28
|
-
cuenca_validations-2.1.41.
|
|
29
|
-
cuenca_validations-2.1.41.
|
|
30
|
-
cuenca_validations-2.1.41.
|
|
27
|
+
cuenca_validations-2.1.41.dev3.dist-info/METADATA,sha256=wxqSUinxW4YpyI0DHplzWP0EXLNkXiITT-FxUyxouhw,1600
|
|
28
|
+
cuenca_validations-2.1.41.dev3.dist-info/WHEEL,sha256=YVMoNqKzERt-wjUZwJ33xBGAwnFl-4cqbYkTtWa4itE,91
|
|
29
|
+
cuenca_validations-2.1.41.dev3.dist-info/top_level.txt,sha256=4233xdOs2HtuT-GFRjcDcwK0IwdwvWdczOtk0fPB6Gw,25
|
|
30
|
+
cuenca_validations-2.1.41.dev3.dist-info/RECORD,,
|
tests/test_requests.py
CHANGED
|
@@ -6,16 +6,20 @@ from cuenca_validations.types.enums import (
|
|
|
6
6
|
Country,
|
|
7
7
|
OperatorRole,
|
|
8
8
|
OperatorStatus,
|
|
9
|
+
SessionType,
|
|
9
10
|
VerificationType,
|
|
10
11
|
)
|
|
12
|
+
from cuenca_validations.types.queries import OperatorQuery
|
|
11
13
|
from cuenca_validations.types.requests import (
|
|
12
|
-
|
|
13
|
-
|
|
14
|
+
LegalPersonRequest,
|
|
15
|
+
LegalPersonUpdateRequest,
|
|
14
16
|
OperatorLoginRequest,
|
|
15
17
|
OperatorLoginResponse,
|
|
16
18
|
OperatorRequest,
|
|
17
19
|
OperatorUpdateRequest,
|
|
18
20
|
PasswordResetRequest,
|
|
21
|
+
SessionMetadata,
|
|
22
|
+
SessionRequest,
|
|
19
23
|
UpdateTransferRequest,
|
|
20
24
|
UserTOSAgreementRequest,
|
|
21
25
|
UserUpdateRequest,
|
|
@@ -36,55 +40,55 @@ LEGAL_REPRESENTATIVE: DictStrAny = {
|
|
|
36
40
|
},
|
|
37
41
|
}
|
|
38
42
|
|
|
39
|
-
|
|
43
|
+
LEGAL_PERSON_REQUEST: DictStrAny = {
|
|
40
44
|
'legal_name': 'Aceros del Norte SA de CV',
|
|
41
45
|
'rfc': 'ADN850101ABC',
|
|
42
46
|
'legal_representatives': [LEGAL_REPRESENTATIVE],
|
|
43
47
|
}
|
|
44
48
|
|
|
45
49
|
|
|
46
|
-
def
|
|
47
|
-
req =
|
|
50
|
+
def test_legal_person_request_valid() -> None:
|
|
51
|
+
req = LegalPersonRequest.model_validate(LEGAL_PERSON_REQUEST)
|
|
48
52
|
assert req.legal_name == 'Aceros del Norte SA de CV'
|
|
49
53
|
assert req.rfc == 'ADN850101ABC'
|
|
50
54
|
|
|
51
55
|
|
|
52
|
-
def
|
|
56
|
+
def test_legal_person_request_rejects_physical_rfc() -> None:
|
|
53
57
|
with pytest.raises(ValidationError) as ex:
|
|
54
|
-
|
|
55
|
-
{**
|
|
58
|
+
LegalPersonRequest.model_validate(
|
|
59
|
+
{**LEGAL_PERSON_REQUEST, 'rfc': 'GOCG650418TJ1'}
|
|
56
60
|
)
|
|
57
|
-
assert 'RFC must be 12 characters for
|
|
61
|
+
assert 'RFC must be 12 characters for legal persons' in str(ex.value)
|
|
58
62
|
|
|
59
63
|
|
|
60
|
-
def
|
|
64
|
+
def test_legal_person_request_forbids_extra() -> None:
|
|
61
65
|
with pytest.raises(ValidationError) as ex:
|
|
62
|
-
|
|
63
|
-
{**
|
|
66
|
+
LegalPersonRequest.model_validate(
|
|
67
|
+
{**LEGAL_PERSON_REQUEST, 'foo': 'bar'}
|
|
64
68
|
)
|
|
65
69
|
assert 'Extra inputs are not permitted' in str(ex.value)
|
|
66
70
|
|
|
67
71
|
|
|
68
|
-
def
|
|
72
|
+
def test_legal_person_update_requires_at_least_one_param() -> None:
|
|
69
73
|
with pytest.raises(ValueError) as ex:
|
|
70
|
-
|
|
74
|
+
LegalPersonUpdateRequest()
|
|
71
75
|
assert 'At least one parameter must be provided' in str(ex.value)
|
|
72
76
|
|
|
73
77
|
|
|
74
|
-
def
|
|
75
|
-
req =
|
|
78
|
+
def test_legal_person_update_valid() -> None:
|
|
79
|
+
req = LegalPersonUpdateRequest.model_validate({'legal_name': 'New name'})
|
|
76
80
|
assert req.legal_name == 'New name'
|
|
77
81
|
|
|
78
82
|
|
|
79
|
-
def
|
|
80
|
-
req =
|
|
83
|
+
def test_legal_person_update_accepts_legal_rfc() -> None:
|
|
84
|
+
req = LegalPersonUpdateRequest.model_validate({'rfc': 'ADN850101ABC'})
|
|
81
85
|
assert req.rfc == 'ADN850101ABC'
|
|
82
86
|
|
|
83
87
|
|
|
84
|
-
def
|
|
88
|
+
def test_legal_person_update_rejects_physical_rfc() -> None:
|
|
85
89
|
with pytest.raises(ValidationError) as ex:
|
|
86
|
-
|
|
87
|
-
assert 'RFC must be 12 characters for
|
|
90
|
+
LegalPersonUpdateRequest.model_validate({'rfc': 'GOCG650418TJ1'})
|
|
91
|
+
assert 'RFC must be 12 characters for legal persons' in str(ex.value)
|
|
88
92
|
|
|
89
93
|
|
|
90
94
|
def test_operator_request_valid() -> None:
|
|
@@ -162,6 +166,37 @@ def test_operator_login_response_valid() -> None:
|
|
|
162
166
|
assert resp.session_token == 'SEWqY5cvkISJOxHyEKjAKf8w'
|
|
163
167
|
|
|
164
168
|
|
|
169
|
+
def test_operator_query_valid() -> None:
|
|
170
|
+
query = OperatorQuery.model_validate({'email': 'maria.lopez@aceros.com'})
|
|
171
|
+
assert str(query.email) == 'maria.lopez@aceros.com'
|
|
172
|
+
|
|
173
|
+
|
|
174
|
+
def test_operator_query_forbids_extra() -> None:
|
|
175
|
+
with pytest.raises(ValidationError) as ex:
|
|
176
|
+
OperatorQuery.model_validate(
|
|
177
|
+
{'email': 'maria@aceros.com', 'foo': 'bar'}
|
|
178
|
+
)
|
|
179
|
+
assert 'Extra inputs are not permitted' in str(ex.value)
|
|
180
|
+
|
|
181
|
+
|
|
182
|
+
def test_session_request_with_operator_metadata() -> None:
|
|
183
|
+
req = SessionRequest(
|
|
184
|
+
user_id='USWqY5cvkISJOxHyEKjAKf8w',
|
|
185
|
+
type=SessionType.registration,
|
|
186
|
+
metadata=SessionMetadata(operator_id='OPWqY5cvkISJOxHyEKjAKf8w'),
|
|
187
|
+
)
|
|
188
|
+
assert req.metadata is not None
|
|
189
|
+
assert req.metadata.operator_id == 'OPWqY5cvkISJOxHyEKjAKf8w'
|
|
190
|
+
|
|
191
|
+
|
|
192
|
+
def test_session_request_metadata_forbids_extra() -> None:
|
|
193
|
+
with pytest.raises(ValidationError) as ex:
|
|
194
|
+
SessionMetadata.model_validate(
|
|
195
|
+
{'operator_id': 'OPWqY5cvkISJOxHyEKjAKf8w', 'foo': 'bar'}
|
|
196
|
+
)
|
|
197
|
+
assert 'Extra inputs are not permitted' in str(ex.value)
|
|
198
|
+
|
|
199
|
+
|
|
165
200
|
@pytest.mark.parametrize('environment', ['api.stage', 'api.sandbox', 'api'])
|
|
166
201
|
def test_file_cuenca_url(environment: str) -> None:
|
|
167
202
|
request_data: DictStrAny = dict(
|
|
File without changes
|
|
File without changes
|
{cuenca_validations-2.1.41.dev1.dist-info → cuenca_validations-2.1.41.dev3.dist-info}/top_level.txt
RENAMED
|
File without changes
|