cuenca-validations 2.1.48.dev0__py3-none-any.whl → 2.1.48.dev2__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 +0 -2
- cuenca_validations/types/enums.py +0 -7
- cuenca_validations/types/requests.py +14 -44
- cuenca_validations/version.py +1 -1
- {cuenca_validations-2.1.48.dev0.dist-info → cuenca_validations-2.1.48.dev2.dist-info}/METADATA +1 -1
- {cuenca_validations-2.1.48.dev0.dist-info → cuenca_validations-2.1.48.dev2.dist-info}/RECORD +10 -10
- tests/test_requests.py +8 -16
- {cuenca_validations-2.1.48.dev0.dist-info → cuenca_validations-2.1.48.dev2.dist-info}/WHEEL +0 -0
- {cuenca_validations-2.1.48.dev0.dist-info → cuenca_validations-2.1.48.dev2.dist-info}/licenses/LICENSE +0 -0
- {cuenca_validations-2.1.48.dev0.dist-info → cuenca_validations-2.1.48.dev2.dist-info}/top_level.txt +0 -0
|
@@ -109,7 +109,6 @@ __all__ = [
|
|
|
109
109
|
'TransactionStatus',
|
|
110
110
|
'TransferNetwork',
|
|
111
111
|
'TransferOrderLineRequest',
|
|
112
|
-
'TransferOrderLineStatus',
|
|
113
112
|
'TransferOrderQuery',
|
|
114
113
|
'TransferOrderRequest',
|
|
115
114
|
'TransferOrderStatus',
|
|
@@ -191,7 +190,6 @@ from .enums import (
|
|
|
191
190
|
TrackDataMethod,
|
|
192
191
|
TransactionStatus,
|
|
193
192
|
TransferNetwork,
|
|
194
|
-
TransferOrderLineStatus,
|
|
195
193
|
TransferOrderStatus,
|
|
196
194
|
UserCardNotification,
|
|
197
195
|
UserStatus,
|
|
@@ -765,13 +765,6 @@ class OperatorStatus(str, Enum):
|
|
|
765
765
|
|
|
766
766
|
class TransferOrderStatus(str, Enum):
|
|
767
767
|
created = 'created'
|
|
768
|
-
authorizing = 'authorizing'
|
|
769
768
|
authorized = 'authorized'
|
|
770
769
|
rejected = 'rejected'
|
|
771
770
|
expired = 'expired'
|
|
772
|
-
|
|
773
|
-
|
|
774
|
-
class TransferOrderLineStatus(str, Enum):
|
|
775
|
-
pending = 'pending'
|
|
776
|
-
invalid = 'invalid'
|
|
777
|
-
submitted = 'submitted'
|
|
@@ -1021,10 +1021,6 @@ class PhoneVerificationAssociationRequest(BaseRequest):
|
|
|
1021
1021
|
verification_id: str
|
|
1022
1022
|
|
|
1023
1023
|
|
|
1024
|
-
MAX_TRANSFER_ORDER_BATCH_LINES = 5000
|
|
1025
|
-
MAX_TRANSFER_ORDER_EXPIRATION_HOURS = 24 * 7
|
|
1026
|
-
|
|
1027
|
-
|
|
1028
1024
|
class TransferOrderLineRequest(BaseRequest):
|
|
1029
1025
|
account_number: str
|
|
1030
1026
|
recipient_name: str
|
|
@@ -1044,57 +1040,31 @@ class TransferOrderLineRequest(BaseRequest):
|
|
|
1044
1040
|
|
|
1045
1041
|
|
|
1046
1042
|
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
1043
|
idempotency_key: str
|
|
1052
|
-
|
|
1053
|
-
items:
|
|
1054
|
-
expires_in_hours: Optional[int] = Field(
|
|
1055
|
-
default=None,
|
|
1056
|
-
gt=0,
|
|
1057
|
-
le=MAX_TRANSFER_ORDER_EXPIRATION_HOURS,
|
|
1058
|
-
)
|
|
1044
|
+
legal_person_id: Optional[str] = None
|
|
1045
|
+
items: list[TransferOrderLineRequest]
|
|
1059
1046
|
|
|
1060
1047
|
model_config = ConfigDict(
|
|
1061
1048
|
json_schema_extra={
|
|
1062
1049
|
'example': {
|
|
1063
|
-
'account_number': '646180157034181180',
|
|
1064
|
-
'recipient_name': 'Doroteo Arango',
|
|
1065
|
-
'amount': 100_00,
|
|
1066
|
-
'descriptor': 'Mezcal, pulque y tequila',
|
|
1067
1050
|
'idempotency_key': 'UNIQUE-KEY-003',
|
|
1068
|
-
'
|
|
1051
|
+
'legal_person_id': 'USWqY5cvkISJOxHyEKjAKf8w',
|
|
1052
|
+
'items': [
|
|
1053
|
+
{
|
|
1054
|
+
'account_number': '646180157034181180',
|
|
1055
|
+
'recipient_name': 'Doroteo Arango',
|
|
1056
|
+
'amount': 100_00,
|
|
1057
|
+
'descriptor': 'Mezcal, pulque y tequila',
|
|
1058
|
+
}
|
|
1059
|
+
],
|
|
1069
1060
|
}
|
|
1070
1061
|
},
|
|
1071
1062
|
)
|
|
1072
1063
|
|
|
1073
1064
|
@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')
|
|
1065
|
+
def validate_items(self) -> 'TransferOrderRequest':
|
|
1066
|
+
if len(self.items) == 0:
|
|
1067
|
+
raise ValueError('items must not be empty')
|
|
1098
1068
|
return self
|
|
1099
1069
|
|
|
1100
1070
|
|
cuenca_validations/version.py
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
__version__ = '2.1.48.
|
|
1
|
+
__version__ = '2.1.48.dev2'
|
{cuenca_validations-2.1.48.dev0.dist-info → cuenca_validations-2.1.48.dev2.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=WiG1nA9P-LOoeeac7LvTU5c6xyEwI2zmIZJ7cJBZ67U,28
|
|
8
|
+
cuenca_validations/types/__init__.py,sha256=VZu01odevifIR7SR9-lpJC2Ysee8QLwVnIOj7cjEUTU,6711
|
|
9
9
|
cuenca_validations/types/card.py,sha256=UGzz8NTFAverUmdUKAK1oGHnOnjSNTpIRUm93vKSSGY,1295
|
|
10
|
-
cuenca_validations/types/enums.py,sha256=
|
|
10
|
+
cuenca_validations/types/enums.py,sha256=If8N4-AbM9daHmnH6txmBb9AqN0Ey7gi3jmkOZOIDAU,21104
|
|
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
16
|
cuenca_validations/types/queries.py,sha256=yJZGW3p6uWGaBm6mjDp7KBgg7oLh0CUlAJeeVLRzowk,6134
|
|
17
|
-
cuenca_validations/types/requests.py,sha256
|
|
18
|
-
cuenca_validations-2.1.48.
|
|
17
|
+
cuenca_validations/types/requests.py,sha256=Ud4sxo-B5dRAbTtYB6lcFJzSknT2yMms1WVjGZ7YlDo,31485
|
|
18
|
+
cuenca_validations-2.1.48.dev2.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=hS7uqo3pdi5lO-miDBNxO7S0lpI6tzAimBpBnx02e3E,8377
|
|
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.48.
|
|
28
|
-
cuenca_validations-2.1.48.
|
|
29
|
-
cuenca_validations-2.1.48.
|
|
30
|
-
cuenca_validations-2.1.48.
|
|
27
|
+
cuenca_validations-2.1.48.dev2.dist-info/METADATA,sha256=XgN9tibEGrut9ztzILQMoq4bAwxpRGvocKzsBAroG5g,1600
|
|
28
|
+
cuenca_validations-2.1.48.dev2.dist-info/WHEEL,sha256=YVMoNqKzERt-wjUZwJ33xBGAwnFl-4cqbYkTtWa4itE,91
|
|
29
|
+
cuenca_validations-2.1.48.dev2.dist-info/top_level.txt,sha256=4233xdOs2HtuT-GFRjcDcwK0IwdwvWdczOtk0fPB6Gw,25
|
|
30
|
+
cuenca_validations-2.1.48.dev2.dist-info/RECORD,,
|
tests/test_requests.py
CHANGED
|
@@ -9,7 +9,6 @@ from cuenca_validations.types.enums import (
|
|
|
9
9
|
)
|
|
10
10
|
from cuenca_validations.types.queries import OperatorQuery
|
|
11
11
|
from cuenca_validations.types.requests import (
|
|
12
|
-
MAX_TRANSFER_ORDER_BATCH_LINES,
|
|
13
12
|
OperatorLoginRequest,
|
|
14
13
|
OperatorLoginUpdateRequest,
|
|
15
14
|
OperatorRequest,
|
|
@@ -244,26 +243,19 @@ def test_transfer_order_request_shape() -> None:
|
|
|
244
243
|
'descriptor': 'Mezcal',
|
|
245
244
|
}
|
|
246
245
|
single = TransferOrderRequest.model_validate(
|
|
247
|
-
{
|
|
246
|
+
{'idempotency_key': 'single', 'items': [line]}
|
|
248
247
|
)
|
|
249
|
-
assert single.items is None
|
|
248
|
+
assert single.items is not None
|
|
249
|
+
assert len(single.items) == 1
|
|
250
250
|
batch = TransferOrderRequest.model_validate(
|
|
251
|
-
{'idempotency_key': 'batch', 'items': [line]}
|
|
251
|
+
{'idempotency_key': 'batch', 'items': [line, line]}
|
|
252
252
|
)
|
|
253
253
|
assert batch.items is not None
|
|
254
|
+
assert len(batch.items) == 2
|
|
254
255
|
|
|
255
|
-
with pytest.raises(ValidationError, match='not both'):
|
|
256
|
-
TransferOrderRequest.model_validate(
|
|
257
|
-
{**line, 'idempotency_key': 'both', 'items': [line]}
|
|
258
|
-
)
|
|
259
256
|
with pytest.raises(ValidationError, match='items must not be empty'):
|
|
260
257
|
TransferOrderRequest.model_validate(
|
|
261
|
-
{
|
|
262
|
-
)
|
|
263
|
-
with pytest.raises(ValidationError, match='Batch exceeds maximum'):
|
|
264
|
-
TransferOrderRequest.model_validate(
|
|
265
|
-
{
|
|
266
|
-
'idempotency_key': 'too-many',
|
|
267
|
-
'items': [line] * (MAX_TRANSFER_ORDER_BATCH_LINES + 1),
|
|
268
|
-
}
|
|
258
|
+
{'idempotency_key': 'empty', 'items': []}
|
|
269
259
|
)
|
|
260
|
+
with pytest.raises(ValidationError):
|
|
261
|
+
TransferOrderRequest.model_validate({'idempotency_key': 'missing'})
|
|
File without changes
|
|
File without changes
|
{cuenca_validations-2.1.48.dev0.dist-info → cuenca_validations-2.1.48.dev2.dist-info}/top_level.txt
RENAMED
|
File without changes
|