cuenca-validations 2.1.48.dev1__tar.gz → 2.1.49__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.48.dev1 → cuenca_validations-2.1.49}/PKG-INFO +1 -1
- {cuenca_validations-2.1.48.dev1 → cuenca_validations-2.1.49}/cuenca_validations/types/__init__.py +4 -2
- {cuenca_validations-2.1.48.dev1 → cuenca_validations-2.1.49}/cuenca_validations/types/enums.py +5 -0
- {cuenca_validations-2.1.48.dev1 → cuenca_validations-2.1.49}/cuenca_validations/types/requests.py +37 -45
- cuenca_validations-2.1.49/cuenca_validations/version.py +1 -0
- {cuenca_validations-2.1.48.dev1 → cuenca_validations-2.1.49}/cuenca_validations.egg-info/PKG-INFO +1 -1
- {cuenca_validations-2.1.48.dev1 → cuenca_validations-2.1.49}/tests/test_requests.py +51 -15
- cuenca_validations-2.1.48.dev1/cuenca_validations/version.py +0 -1
- {cuenca_validations-2.1.48.dev1 → cuenca_validations-2.1.49}/LICENSE +0 -0
- {cuenca_validations-2.1.48.dev1 → cuenca_validations-2.1.49}/README.md +0 -0
- {cuenca_validations-2.1.48.dev1 → cuenca_validations-2.1.49}/cuenca_validations/__init__.py +0 -0
- {cuenca_validations-2.1.48.dev1 → cuenca_validations-2.1.49}/cuenca_validations/card_bins.py +0 -0
- {cuenca_validations-2.1.48.dev1 → cuenca_validations-2.1.49}/cuenca_validations/errors.py +0 -0
- {cuenca_validations-2.1.48.dev1 → cuenca_validations-2.1.49}/cuenca_validations/py.typed +0 -0
- {cuenca_validations-2.1.48.dev1 → cuenca_validations-2.1.49}/cuenca_validations/types/card.py +0 -0
- {cuenca_validations-2.1.48.dev1 → cuenca_validations-2.1.49}/cuenca_validations/types/files.py +0 -0
- {cuenca_validations-2.1.48.dev1 → cuenca_validations-2.1.49}/cuenca_validations/types/general.py +0 -0
- {cuenca_validations-2.1.48.dev1 → cuenca_validations-2.1.49}/cuenca_validations/types/helpers.py +0 -0
- {cuenca_validations-2.1.48.dev1 → cuenca_validations-2.1.49}/cuenca_validations/types/identities.py +0 -0
- {cuenca_validations-2.1.48.dev1 → cuenca_validations-2.1.49}/cuenca_validations/types/morals.py +0 -0
- {cuenca_validations-2.1.48.dev1 → cuenca_validations-2.1.49}/cuenca_validations/types/queries.py +0 -0
- {cuenca_validations-2.1.48.dev1 → cuenca_validations-2.1.49}/cuenca_validations/typing.py +0 -0
- {cuenca_validations-2.1.48.dev1 → cuenca_validations-2.1.49}/cuenca_validations/validators.py +0 -0
- {cuenca_validations-2.1.48.dev1 → cuenca_validations-2.1.49}/cuenca_validations.egg-info/SOURCES.txt +0 -0
- {cuenca_validations-2.1.48.dev1 → cuenca_validations-2.1.49}/cuenca_validations.egg-info/dependency_links.txt +0 -0
- {cuenca_validations-2.1.48.dev1 → cuenca_validations-2.1.49}/cuenca_validations.egg-info/requires.txt +0 -0
- {cuenca_validations-2.1.48.dev1 → cuenca_validations-2.1.49}/cuenca_validations.egg-info/top_level.txt +0 -0
- {cuenca_validations-2.1.48.dev1 → cuenca_validations-2.1.49}/setup.cfg +0 -0
- {cuenca_validations-2.1.48.dev1 → cuenca_validations-2.1.49}/setup.py +0 -0
- {cuenca_validations-2.1.48.dev1 → cuenca_validations-2.1.49}/tests/__init__.py +0 -0
- {cuenca_validations-2.1.48.dev1 → cuenca_validations-2.1.49}/tests/test_card.py +0 -0
- {cuenca_validations-2.1.48.dev1 → cuenca_validations-2.1.49}/tests/test_errors.py +0 -0
- {cuenca_validations-2.1.48.dev1 → cuenca_validations-2.1.49}/tests/test_helpers.py +0 -0
- {cuenca_validations-2.1.48.dev1 → cuenca_validations-2.1.49}/tests/test_statement.py +0 -0
- {cuenca_validations-2.1.48.dev1 → cuenca_validations-2.1.49}/tests/test_types.py +0 -0
- {cuenca_validations-2.1.48.dev1 → cuenca_validations-2.1.49}/tests/test_validators.py +0 -0
{cuenca_validations-2.1.48.dev1 → cuenca_validations-2.1.49}/cuenca_validations/types/__init__.py
RENAMED
|
@@ -83,7 +83,6 @@ __all__ = [
|
|
|
83
83
|
'Profession',
|
|
84
84
|
'QueryParams',
|
|
85
85
|
'ReferencedClabeRequest',
|
|
86
|
-
'RejectTransferOrderRequest',
|
|
87
86
|
'LegalRfc',
|
|
88
87
|
'Rfc',
|
|
89
88
|
'QuestionnairesRequest',
|
|
@@ -114,6 +113,8 @@ __all__ = [
|
|
|
114
113
|
'TransferOrderStatus',
|
|
115
114
|
'TransferQuery',
|
|
116
115
|
'TransferRequest',
|
|
116
|
+
'UpdateTransferOrderRequest',
|
|
117
|
+
'UpdateTransferOrderStatus',
|
|
117
118
|
'UpdateTransferRequest',
|
|
118
119
|
'UserCardNotification',
|
|
119
120
|
'UserCredentialRequest',
|
|
@@ -191,6 +192,7 @@ from .enums import (
|
|
|
191
192
|
TransactionStatus,
|
|
192
193
|
TransferNetwork,
|
|
193
194
|
TransferOrderStatus,
|
|
195
|
+
UpdateTransferOrderStatus,
|
|
194
196
|
UserCardNotification,
|
|
195
197
|
UserStatus,
|
|
196
198
|
UserType,
|
|
@@ -280,7 +282,6 @@ from .requests import (
|
|
|
280
282
|
PlatformRequest,
|
|
281
283
|
QuestionnairesRequest,
|
|
282
284
|
ReferencedClabeRequest,
|
|
283
|
-
RejectTransferOrderRequest,
|
|
284
285
|
SavingRequest,
|
|
285
286
|
SavingUpdateRequest,
|
|
286
287
|
SessionRequest,
|
|
@@ -289,6 +290,7 @@ from .requests import (
|
|
|
289
290
|
TransferOrderLineRequest,
|
|
290
291
|
TransferOrderRequest,
|
|
291
292
|
TransferRequest,
|
|
293
|
+
UpdateTransferOrderRequest,
|
|
292
294
|
UpdateTransferRequest,
|
|
293
295
|
UserCredentialRequest,
|
|
294
296
|
UserCredentialUpdateRequest,
|
{cuenca_validations-2.1.48.dev1 → cuenca_validations-2.1.49}/cuenca_validations/types/requests.py
RENAMED
|
@@ -50,6 +50,7 @@ from ..types.enums import (
|
|
|
50
50
|
TrackDataMethod,
|
|
51
51
|
TransactionStatus,
|
|
52
52
|
TransactionTokenValidationStatus,
|
|
53
|
+
UpdateTransferOrderStatus,
|
|
53
54
|
UserCardNotification,
|
|
54
55
|
UserStatus,
|
|
55
56
|
VerificationStatus,
|
|
@@ -1021,10 +1022,6 @@ class PhoneVerificationAssociationRequest(BaseRequest):
|
|
|
1021
1022
|
verification_id: str
|
|
1022
1023
|
|
|
1023
1024
|
|
|
1024
|
-
MAX_TRANSFER_ORDER_BATCH_LINES = 5000
|
|
1025
|
-
MAX_TRANSFER_ORDER_EXPIRATION_HOURS = 24 * 7
|
|
1026
|
-
|
|
1027
|
-
|
|
1028
1025
|
class TransferOrderLineRequest(BaseRequest):
|
|
1029
1026
|
account_number: str
|
|
1030
1027
|
recipient_name: str
|
|
@@ -1044,65 +1041,60 @@ class TransferOrderLineRequest(BaseRequest):
|
|
|
1044
1041
|
|
|
1045
1042
|
|
|
1046
1043
|
class TransferOrderRequest(BaseRequest):
|
|
1047
|
-
account_number: Optional[str] = None
|
|
1048
|
-
recipient_name: Optional[str] = None
|
|
1049
|
-
amount: Optional[int] = None
|
|
1050
|
-
descriptor: Optional[str] = None
|
|
1051
1044
|
idempotency_key: str
|
|
1052
1045
|
legal_person_id: Optional[str] = None
|
|
1053
|
-
items:
|
|
1054
|
-
expires_in_hours: Optional[int] = Field(
|
|
1055
|
-
default=None,
|
|
1056
|
-
gt=0,
|
|
1057
|
-
le=MAX_TRANSFER_ORDER_EXPIRATION_HOURS,
|
|
1058
|
-
)
|
|
1046
|
+
items: list[TransferOrderLineRequest]
|
|
1059
1047
|
|
|
1060
1048
|
model_config = ConfigDict(
|
|
1061
1049
|
json_schema_extra={
|
|
1062
1050
|
'example': {
|
|
1063
|
-
'account_number': '646180157034181180',
|
|
1064
|
-
'recipient_name': 'Doroteo Arango',
|
|
1065
|
-
'amount': 100_00,
|
|
1066
|
-
'descriptor': 'Mezcal, pulque y tequila',
|
|
1067
1051
|
'idempotency_key': 'UNIQUE-KEY-003',
|
|
1068
1052
|
'legal_person_id': 'USWqY5cvkISJOxHyEKjAKf8w',
|
|
1053
|
+
'items': [
|
|
1054
|
+
{
|
|
1055
|
+
'account_number': '646180157034181180',
|
|
1056
|
+
'recipient_name': 'Doroteo Arango',
|
|
1057
|
+
'amount': 100_00,
|
|
1058
|
+
'descriptor': 'Mezcal, pulque y tequila',
|
|
1059
|
+
}
|
|
1060
|
+
],
|
|
1069
1061
|
}
|
|
1070
1062
|
},
|
|
1071
1063
|
)
|
|
1072
1064
|
|
|
1073
1065
|
@model_validator(mode='after')
|
|
1074
|
-
def
|
|
1075
|
-
|
|
1076
|
-
|
|
1077
|
-
(
|
|
1078
|
-
self.account_number is not None,
|
|
1079
|
-
self.recipient_name is not None,
|
|
1080
|
-
self.amount is not None,
|
|
1081
|
-
self.descriptor is not None,
|
|
1082
|
-
)
|
|
1083
|
-
)
|
|
1084
|
-
if has_items == has_flat:
|
|
1085
|
-
raise ValueError(
|
|
1086
|
-
'Provide either a single transfer (account_number, '
|
|
1087
|
-
'recipient_name, amount, descriptor) or items[] for a batch, '
|
|
1088
|
-
'not both'
|
|
1089
|
-
)
|
|
1090
|
-
if self.items is not None:
|
|
1091
|
-
if len(self.items) > MAX_TRANSFER_ORDER_BATCH_LINES:
|
|
1092
|
-
raise ValueError(
|
|
1093
|
-
'Batch exceeds maximum of '
|
|
1094
|
-
f'{MAX_TRANSFER_ORDER_BATCH_LINES} lines'
|
|
1095
|
-
)
|
|
1096
|
-
if len(self.items) == 0:
|
|
1097
|
-
raise ValueError('items must not be empty')
|
|
1066
|
+
def validate_items(self) -> 'TransferOrderRequest':
|
|
1067
|
+
if len(self.items) == 0:
|
|
1068
|
+
raise ValueError('items must not be empty')
|
|
1098
1069
|
return self
|
|
1099
1070
|
|
|
1100
1071
|
|
|
1101
|
-
class
|
|
1102
|
-
|
|
1072
|
+
class UpdateTransferOrderRequest(BaseRequest):
|
|
1073
|
+
status: UpdateTransferOrderStatus
|
|
1074
|
+
rejection_reason: Optional[str] = None
|
|
1103
1075
|
|
|
1104
1076
|
model_config = ConfigDict(
|
|
1105
1077
|
json_schema_extra={
|
|
1106
|
-
'
|
|
1078
|
+
'examples': [
|
|
1079
|
+
{'status': 'authorized'},
|
|
1080
|
+
{
|
|
1081
|
+
'status': 'rejected',
|
|
1082
|
+
'rejection_reason': 'Monto incorrecto',
|
|
1083
|
+
},
|
|
1084
|
+
]
|
|
1107
1085
|
},
|
|
1108
1086
|
)
|
|
1087
|
+
|
|
1088
|
+
@model_validator(mode='after')
|
|
1089
|
+
def validate_rejection_reason(self) -> 'UpdateTransferOrderRequest':
|
|
1090
|
+
if self.status is UpdateTransferOrderStatus.rejected:
|
|
1091
|
+
if (
|
|
1092
|
+
self.rejection_reason is None
|
|
1093
|
+
or not self.rejection_reason.strip()
|
|
1094
|
+
):
|
|
1095
|
+
raise ValueError('rejection_reason is required')
|
|
1096
|
+
elif self.rejection_reason is not None:
|
|
1097
|
+
raise ValueError(
|
|
1098
|
+
'rejection_reason is only allowed when status is rejected'
|
|
1099
|
+
)
|
|
1100
|
+
return self
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
__version__ = '2.1.49'
|
|
@@ -5,17 +5,18 @@ from pydantic_extra_types.phone_numbers import PhoneNumber
|
|
|
5
5
|
from cuenca_validations.types.enums import (
|
|
6
6
|
Country,
|
|
7
7
|
OperatorRole,
|
|
8
|
+
UpdateTransferOrderStatus,
|
|
8
9
|
VerificationType,
|
|
9
10
|
)
|
|
10
11
|
from cuenca_validations.types.queries import OperatorQuery
|
|
11
12
|
from cuenca_validations.types.requests import (
|
|
12
|
-
MAX_TRANSFER_ORDER_BATCH_LINES,
|
|
13
13
|
OperatorLoginRequest,
|
|
14
14
|
OperatorLoginUpdateRequest,
|
|
15
15
|
OperatorRequest,
|
|
16
16
|
OperatorUpdateRequest,
|
|
17
17
|
PasswordResetRequest,
|
|
18
18
|
TransferOrderRequest,
|
|
19
|
+
UpdateTransferOrderRequest,
|
|
19
20
|
UpdateTransferRequest,
|
|
20
21
|
UserTOSAgreementRequest,
|
|
21
22
|
UserUpdateRequest,
|
|
@@ -244,26 +245,61 @@ def test_transfer_order_request_shape() -> None:
|
|
|
244
245
|
'descriptor': 'Mezcal',
|
|
245
246
|
}
|
|
246
247
|
single = TransferOrderRequest.model_validate(
|
|
247
|
-
{
|
|
248
|
+
{'idempotency_key': 'single', 'items': [line]}
|
|
248
249
|
)
|
|
249
|
-
assert single.items is None
|
|
250
|
+
assert single.items is not None
|
|
251
|
+
assert len(single.items) == 1
|
|
250
252
|
batch = TransferOrderRequest.model_validate(
|
|
251
|
-
{'idempotency_key': 'batch', 'items': [line]}
|
|
253
|
+
{'idempotency_key': 'batch', 'items': [line, line]}
|
|
252
254
|
)
|
|
253
255
|
assert batch.items is not None
|
|
256
|
+
assert len(batch.items) == 2
|
|
254
257
|
|
|
255
|
-
with pytest.raises(ValidationError, match='not both'):
|
|
256
|
-
TransferOrderRequest.model_validate(
|
|
257
|
-
{**line, 'idempotency_key': 'both', 'items': [line]}
|
|
258
|
-
)
|
|
259
258
|
with pytest.raises(ValidationError, match='items must not be empty'):
|
|
260
259
|
TransferOrderRequest.model_validate(
|
|
261
|
-
{
|
|
260
|
+
{'idempotency_key': 'empty', 'items': []}
|
|
262
261
|
)
|
|
263
|
-
with pytest.raises(ValidationError
|
|
264
|
-
TransferOrderRequest.model_validate(
|
|
265
|
-
|
|
266
|
-
|
|
267
|
-
|
|
268
|
-
|
|
262
|
+
with pytest.raises(ValidationError):
|
|
263
|
+
TransferOrderRequest.model_validate({'idempotency_key': 'missing'})
|
|
264
|
+
|
|
265
|
+
|
|
266
|
+
@pytest.mark.parametrize(
|
|
267
|
+
'payload',
|
|
268
|
+
[
|
|
269
|
+
{'status': 'rejected'},
|
|
270
|
+
{'status': 'rejected', 'rejection_reason': ''},
|
|
271
|
+
{'status': 'rejected', 'rejection_reason': ' '},
|
|
272
|
+
],
|
|
273
|
+
)
|
|
274
|
+
def test_update_transfer_order_request_rejected_requires_reason(
|
|
275
|
+
payload: dict,
|
|
276
|
+
) -> None:
|
|
277
|
+
with pytest.raises(ValidationError, match='rejection_reason is required'):
|
|
278
|
+
UpdateTransferOrderRequest.model_validate(payload)
|
|
279
|
+
|
|
280
|
+
|
|
281
|
+
def test_update_transfer_order_request_authorized_forbids_reason() -> None:
|
|
282
|
+
with pytest.raises(
|
|
283
|
+
ValidationError,
|
|
284
|
+
match='rejection_reason is only allowed when status is rejected',
|
|
285
|
+
):
|
|
286
|
+
UpdateTransferOrderRequest.model_validate(
|
|
287
|
+
{'status': 'authorized', 'rejection_reason': 'no'}
|
|
269
288
|
)
|
|
289
|
+
|
|
290
|
+
|
|
291
|
+
@pytest.mark.parametrize(
|
|
292
|
+
'payload, status',
|
|
293
|
+
[
|
|
294
|
+
({'status': 'authorized'}, UpdateTransferOrderStatus.authorized),
|
|
295
|
+
(
|
|
296
|
+
{'status': 'rejected', 'rejection_reason': 'Monto incorrecto'},
|
|
297
|
+
UpdateTransferOrderStatus.rejected,
|
|
298
|
+
),
|
|
299
|
+
],
|
|
300
|
+
)
|
|
301
|
+
def test_update_transfer_order_request_valid(
|
|
302
|
+
payload: dict, status: UpdateTransferOrderStatus
|
|
303
|
+
) -> None:
|
|
304
|
+
req = UpdateTransferOrderRequest.model_validate(payload)
|
|
305
|
+
assert req.status is status
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
__version__ = '2.1.48.dev1'
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
{cuenca_validations-2.1.48.dev1 → cuenca_validations-2.1.49}/cuenca_validations/card_bins.py
RENAMED
|
File without changes
|
|
File without changes
|
|
File without changes
|
{cuenca_validations-2.1.48.dev1 → cuenca_validations-2.1.49}/cuenca_validations/types/card.py
RENAMED
|
File without changes
|
{cuenca_validations-2.1.48.dev1 → cuenca_validations-2.1.49}/cuenca_validations/types/files.py
RENAMED
|
File without changes
|
{cuenca_validations-2.1.48.dev1 → cuenca_validations-2.1.49}/cuenca_validations/types/general.py
RENAMED
|
File without changes
|
{cuenca_validations-2.1.48.dev1 → cuenca_validations-2.1.49}/cuenca_validations/types/helpers.py
RENAMED
|
File without changes
|
{cuenca_validations-2.1.48.dev1 → cuenca_validations-2.1.49}/cuenca_validations/types/identities.py
RENAMED
|
File without changes
|
{cuenca_validations-2.1.48.dev1 → cuenca_validations-2.1.49}/cuenca_validations/types/morals.py
RENAMED
|
File without changes
|
{cuenca_validations-2.1.48.dev1 → cuenca_validations-2.1.49}/cuenca_validations/types/queries.py
RENAMED
|
File without changes
|
|
File without changes
|
{cuenca_validations-2.1.48.dev1 → cuenca_validations-2.1.49}/cuenca_validations/validators.py
RENAMED
|
File without changes
|
{cuenca_validations-2.1.48.dev1 → cuenca_validations-2.1.49}/cuenca_validations.egg-info/SOURCES.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
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|