cuenca 1.0.3.dev0__tar.gz → 1.0.3.dev3__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-1.0.3.dev0 → cuenca-1.0.3.dev3}/PKG-INFO +2 -2
- {cuenca-1.0.3.dev0 → cuenca-1.0.3.dev3}/cuenca/__init__.py +2 -0
- {cuenca-1.0.3.dev0 → cuenca-1.0.3.dev3}/cuenca/resources/__init__.py +2 -0
- {cuenca-1.0.3.dev0 → cuenca-1.0.3.dev3}/cuenca/resources/api_keys.py +5 -4
- {cuenca-1.0.3.dev0 → cuenca-1.0.3.dev3}/cuenca/resources/arpc.py +2 -2
- {cuenca-1.0.3.dev0 → cuenca-1.0.3.dev3}/cuenca/resources/base.py +46 -36
- {cuenca-1.0.3.dev0 → cuenca-1.0.3.dev3}/cuenca/resources/card_activations.py +3 -1
- {cuenca-1.0.3.dev0 → cuenca-1.0.3.dev3}/cuenca/resources/cards.py +5 -4
- {cuenca-1.0.3.dev0 → cuenca-1.0.3.dev3}/cuenca/resources/clabes.py +2 -2
- {cuenca-1.0.3.dev0 → cuenca-1.0.3.dev3}/cuenca/resources/curp_validations.py +5 -2
- {cuenca-1.0.3.dev0 → cuenca-1.0.3.dev3}/cuenca/resources/endpoints.py +4 -3
- {cuenca-1.0.3.dev0 → cuenca-1.0.3.dev3}/cuenca/resources/file_batches.py +2 -2
- {cuenca-1.0.3.dev0 → cuenca-1.0.3.dev3}/cuenca/resources/files.py +8 -2
- {cuenca-1.0.3.dev0 → cuenca-1.0.3.dev3}/cuenca/resources/kyc_validations.py +4 -2
- {cuenca-1.0.3.dev0 → cuenca-1.0.3.dev3}/cuenca/resources/kyc_verifications.py +3 -3
- {cuenca-1.0.3.dev0 → cuenca-1.0.3.dev3}/cuenca/resources/limited_wallets.py +2 -2
- {cuenca-1.0.3.dev0 → cuenca-1.0.3.dev3}/cuenca/resources/login_tokens.py +2 -2
- cuenca-1.0.3.dev3/cuenca/resources/otps.py +24 -0
- {cuenca-1.0.3.dev0 → cuenca-1.0.3.dev3}/cuenca/resources/platforms.py +2 -2
- {cuenca-1.0.3.dev0 → cuenca-1.0.3.dev3}/cuenca/resources/questionnaires.py +4 -2
- {cuenca-1.0.3.dev0 → cuenca-1.0.3.dev3}/cuenca/resources/resources.py +2 -2
- {cuenca-1.0.3.dev0 → cuenca-1.0.3.dev3}/cuenca/resources/savings.py +3 -3
- {cuenca-1.0.3.dev0 → cuenca-1.0.3.dev3}/cuenca/resources/sessions.py +2 -2
- {cuenca-1.0.3.dev0 → cuenca-1.0.3.dev3}/cuenca/resources/transfers.py +1 -1
- {cuenca-1.0.3.dev0 → cuenca-1.0.3.dev3}/cuenca/resources/user_credentials.py +8 -3
- {cuenca-1.0.3.dev0 → cuenca-1.0.3.dev3}/cuenca/resources/user_lists_validation.py +5 -2
- {cuenca-1.0.3.dev0 → cuenca-1.0.3.dev3}/cuenca/resources/user_logins.py +2 -2
- {cuenca-1.0.3.dev0 → cuenca-1.0.3.dev3}/cuenca/resources/users.py +6 -3
- {cuenca-1.0.3.dev0 → cuenca-1.0.3.dev3}/cuenca/resources/verifications.py +6 -3
- {cuenca-1.0.3.dev0 → cuenca-1.0.3.dev3}/cuenca/resources/wallet_transactions.py +1 -1
- {cuenca-1.0.3.dev0 → cuenca-1.0.3.dev3}/cuenca/version.py +1 -1
- {cuenca-1.0.3.dev0 → cuenca-1.0.3.dev3}/cuenca.egg-info/PKG-INFO +2 -2
- {cuenca-1.0.3.dev0 → cuenca-1.0.3.dev3}/cuenca.egg-info/SOURCES.txt +2 -0
- {cuenca-1.0.3.dev0 → cuenca-1.0.3.dev3}/cuenca.egg-info/requires.txt +1 -1
- {cuenca-1.0.3.dev0 → cuenca-1.0.3.dev3}/setup.py +1 -1
- {cuenca-1.0.3.dev0 → cuenca-1.0.3.dev3}/tests/resources/test_api_keys.py +1 -1
- cuenca-1.0.3.dev3/tests/resources/test_otps.py +28 -0
- {cuenca-1.0.3.dev0 → cuenca-1.0.3.dev3}/LICENSE +0 -0
- {cuenca-1.0.3.dev0 → cuenca-1.0.3.dev3}/README.md +0 -0
- {cuenca-1.0.3.dev0 → cuenca-1.0.3.dev3}/cuenca/exc.py +0 -0
- {cuenca-1.0.3.dev0 → cuenca-1.0.3.dev3}/cuenca/http/__init__.py +0 -0
- {cuenca-1.0.3.dev0 → cuenca-1.0.3.dev3}/cuenca/http/client.py +0 -0
- {cuenca-1.0.3.dev0 → cuenca-1.0.3.dev3}/cuenca/jwt.py +0 -0
- {cuenca-1.0.3.dev0 → cuenca-1.0.3.dev3}/cuenca/py.typed +0 -0
- {cuenca-1.0.3.dev0 → cuenca-1.0.3.dev3}/cuenca/resources/accounts.py +0 -0
- {cuenca-1.0.3.dev0 → cuenca-1.0.3.dev3}/cuenca/resources/balance_entries.py +0 -0
- {cuenca-1.0.3.dev0 → cuenca-1.0.3.dev3}/cuenca/resources/bill_payments.py +0 -0
- {cuenca-1.0.3.dev0 → cuenca-1.0.3.dev3}/cuenca/resources/card_transactions.py +0 -0
- {cuenca-1.0.3.dev0 → cuenca-1.0.3.dev3}/cuenca/resources/card_validations.py +0 -0
- {cuenca-1.0.3.dev0 → cuenca-1.0.3.dev3}/cuenca/resources/cash_references.py +0 -0
- {cuenca-1.0.3.dev0 → cuenca-1.0.3.dev3}/cuenca/resources/commissions.py +0 -0
- {cuenca-1.0.3.dev0 → cuenca-1.0.3.dev3}/cuenca/resources/deposits.py +0 -0
- {cuenca-1.0.3.dev0 → cuenca-1.0.3.dev3}/cuenca/resources/identities.py +0 -0
- {cuenca-1.0.3.dev0 → cuenca-1.0.3.dev3}/cuenca/resources/identity_events.py +0 -0
- {cuenca-1.0.3.dev0 → cuenca-1.0.3.dev3}/cuenca/resources/service_providers.py +0 -0
- {cuenca-1.0.3.dev0 → cuenca-1.0.3.dev3}/cuenca/resources/statements.py +0 -0
- {cuenca-1.0.3.dev0 → cuenca-1.0.3.dev3}/cuenca/resources/user_events.py +0 -0
- {cuenca-1.0.3.dev0 → cuenca-1.0.3.dev3}/cuenca/resources/webhooks.py +0 -0
- {cuenca-1.0.3.dev0 → cuenca-1.0.3.dev3}/cuenca/resources/whatsapp_transfers.py +0 -0
- {cuenca-1.0.3.dev0 → cuenca-1.0.3.dev3}/cuenca.egg-info/dependency_links.txt +0 -0
- {cuenca-1.0.3.dev0 → cuenca-1.0.3.dev3}/cuenca.egg-info/top_level.txt +0 -0
- {cuenca-1.0.3.dev0 → cuenca-1.0.3.dev3}/setup.cfg +0 -0
- {cuenca-1.0.3.dev0 → cuenca-1.0.3.dev3}/tests/__init__.py +0 -0
- {cuenca-1.0.3.dev0 → cuenca-1.0.3.dev3}/tests/conftest.py +0 -0
- {cuenca-1.0.3.dev0 → cuenca-1.0.3.dev3}/tests/http/__init__.py +0 -0
- {cuenca-1.0.3.dev0 → cuenca-1.0.3.dev3}/tests/http/conftest.py +0 -0
- {cuenca-1.0.3.dev0 → cuenca-1.0.3.dev3}/tests/http/test_client.py +0 -0
- {cuenca-1.0.3.dev0 → cuenca-1.0.3.dev3}/tests/resources/__init__.py +0 -0
- {cuenca-1.0.3.dev0 → cuenca-1.0.3.dev3}/tests/resources/test_accounts.py +0 -0
- {cuenca-1.0.3.dev0 → cuenca-1.0.3.dev3}/tests/resources/test_arpc.py +0 -0
- {cuenca-1.0.3.dev0 → cuenca-1.0.3.dev3}/tests/resources/test_balance_entries.py +0 -0
- {cuenca-1.0.3.dev0 → cuenca-1.0.3.dev3}/tests/resources/test_bill_payments.py +0 -0
- {cuenca-1.0.3.dev0 → cuenca-1.0.3.dev3}/tests/resources/test_card_activations.py +0 -0
- {cuenca-1.0.3.dev0 → cuenca-1.0.3.dev3}/tests/resources/test_card_transactions.py +0 -0
- {cuenca-1.0.3.dev0 → cuenca-1.0.3.dev3}/tests/resources/test_card_validations.py +0 -0
- {cuenca-1.0.3.dev0 → cuenca-1.0.3.dev3}/tests/resources/test_cards.py +0 -0
- {cuenca-1.0.3.dev0 → cuenca-1.0.3.dev3}/tests/resources/test_cash_references.py +0 -0
- {cuenca-1.0.3.dev0 → cuenca-1.0.3.dev3}/tests/resources/test_clabes.py +0 -0
- {cuenca-1.0.3.dev0 → cuenca-1.0.3.dev3}/tests/resources/test_commissions.py +0 -0
- {cuenca-1.0.3.dev0 → cuenca-1.0.3.dev3}/tests/resources/test_curp_validations.py +0 -0
- {cuenca-1.0.3.dev0 → cuenca-1.0.3.dev3}/tests/resources/test_deposits.py +0 -0
- {cuenca-1.0.3.dev0 → cuenca-1.0.3.dev3}/tests/resources/test_endpoints.py +0 -0
- {cuenca-1.0.3.dev0 → cuenca-1.0.3.dev3}/tests/resources/test_file_batches.py +0 -0
- {cuenca-1.0.3.dev0 → cuenca-1.0.3.dev3}/tests/resources/test_files.py +0 -0
- {cuenca-1.0.3.dev0 → cuenca-1.0.3.dev3}/tests/resources/test_identities.py +0 -0
- {cuenca-1.0.3.dev0 → cuenca-1.0.3.dev3}/tests/resources/test_identity_events.py +0 -0
- {cuenca-1.0.3.dev0 → cuenca-1.0.3.dev3}/tests/resources/test_kyc_validations.py +0 -0
- {cuenca-1.0.3.dev0 → cuenca-1.0.3.dev3}/tests/resources/test_kyc_verifications.py +0 -0
- {cuenca-1.0.3.dev0 → cuenca-1.0.3.dev3}/tests/resources/test_limited_wallets.py +0 -0
- {cuenca-1.0.3.dev0 → cuenca-1.0.3.dev3}/tests/resources/test_login_tokens.py +0 -0
- {cuenca-1.0.3.dev0 → cuenca-1.0.3.dev3}/tests/resources/test_platforms.py +0 -0
- {cuenca-1.0.3.dev0 → cuenca-1.0.3.dev3}/tests/resources/test_questionnaires.py +0 -0
- {cuenca-1.0.3.dev0 → cuenca-1.0.3.dev3}/tests/resources/test_resources.py +0 -0
- {cuenca-1.0.3.dev0 → cuenca-1.0.3.dev3}/tests/resources/test_savings.py +0 -0
- {cuenca-1.0.3.dev0 → cuenca-1.0.3.dev3}/tests/resources/test_service_providers.py +0 -0
- {cuenca-1.0.3.dev0 → cuenca-1.0.3.dev3}/tests/resources/test_sessions.py +0 -0
- {cuenca-1.0.3.dev0 → cuenca-1.0.3.dev3}/tests/resources/test_statements.py +0 -0
- {cuenca-1.0.3.dev0 → cuenca-1.0.3.dev3}/tests/resources/test_transfers.py +0 -0
- {cuenca-1.0.3.dev0 → cuenca-1.0.3.dev3}/tests/resources/test_user_credentials.py +0 -0
- {cuenca-1.0.3.dev0 → cuenca-1.0.3.dev3}/tests/resources/test_user_events.py +0 -0
- {cuenca-1.0.3.dev0 → cuenca-1.0.3.dev3}/tests/resources/test_user_lists_validation.py +0 -0
- {cuenca-1.0.3.dev0 → cuenca-1.0.3.dev3}/tests/resources/test_user_logins.py +0 -0
- {cuenca-1.0.3.dev0 → cuenca-1.0.3.dev3}/tests/resources/test_users.py +0 -0
- {cuenca-1.0.3.dev0 → cuenca-1.0.3.dev3}/tests/resources/test_verifications.py +0 -0
- {cuenca-1.0.3.dev0 → cuenca-1.0.3.dev3}/tests/resources/test_wallet_transactions.py +0 -0
- {cuenca-1.0.3.dev0 → cuenca-1.0.3.dev3}/tests/resources/test_webhooks.py +0 -0
- {cuenca-1.0.3.dev0 → cuenca-1.0.3.dev3}/tests/resources/test_whatsapp_transfers.py +0 -0
- {cuenca-1.0.3.dev0 → cuenca-1.0.3.dev3}/tests/test_cuenca.py +0 -0
- {cuenca-1.0.3.dev0 → cuenca-1.0.3.dev3}/tests/test_jwt.py +0 -0
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
Metadata-Version: 2.1
|
|
2
2
|
Name: cuenca
|
|
3
|
-
Version: 1.0.3.
|
|
3
|
+
Version: 1.0.3.dev3
|
|
4
4
|
Summary: Cuenca API Client
|
|
5
5
|
Home-page: https://github.com/cuenca-mx/cuenca-python
|
|
6
6
|
Author: Cuenca
|
|
@@ -13,7 +13,7 @@ Description-Content-Type: text/markdown
|
|
|
13
13
|
License-File: LICENSE
|
|
14
14
|
Requires-Dist: requests<28,>=2.24
|
|
15
15
|
Requires-Dist: dataclasses>=0.7; python_version < "3.8"
|
|
16
|
-
Requires-Dist: cuenca-validations<0.
|
|
16
|
+
Requires-Dist: cuenca-validations<0.13.0,>=0.11.3
|
|
17
17
|
|
|
18
18
|
# Cuenca – Python client library
|
|
19
19
|
|
|
@@ -23,6 +23,7 @@ __all__ = [
|
|
|
23
23
|
'KYCVerification',
|
|
24
24
|
'LimitedWallet',
|
|
25
25
|
'LoginToken',
|
|
26
|
+
'Otp',
|
|
26
27
|
'Platform',
|
|
27
28
|
'Questionnaires',
|
|
28
29
|
'Saving',
|
|
@@ -70,6 +71,7 @@ from .resources import (
|
|
|
70
71
|
KYCVerification,
|
|
71
72
|
LimitedWallet,
|
|
72
73
|
LoginToken,
|
|
74
|
+
Otp,
|
|
73
75
|
Platform,
|
|
74
76
|
Questionnaires,
|
|
75
77
|
Saving,
|
|
@@ -22,6 +22,7 @@ __all__ = [
|
|
|
22
22
|
'KYCVerification',
|
|
23
23
|
'LimitedWallet',
|
|
24
24
|
'LoginToken',
|
|
25
|
+
'Otp',
|
|
25
26
|
'Platform',
|
|
26
27
|
'Questionnaires',
|
|
27
28
|
'Saving',
|
|
@@ -62,6 +63,7 @@ from .kyc_validations import KYCValidation
|
|
|
62
63
|
from .kyc_verifications import KYCVerification
|
|
63
64
|
from .limited_wallets import LimitedWallet
|
|
64
65
|
from .login_tokens import LoginToken
|
|
66
|
+
from .otps import Otp
|
|
65
67
|
from .platforms import Platform
|
|
66
68
|
from .questionnaires import Questionnaires
|
|
67
69
|
from .resources import RESOURCES
|
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
import datetime as dt
|
|
2
|
-
from typing import ClassVar, Optional
|
|
2
|
+
from typing import ClassVar, Optional, cast
|
|
3
3
|
|
|
4
4
|
from cuenca_validations.types import ApiKeyQuery, ApiKeyUpdateRequest
|
|
5
5
|
|
|
@@ -36,7 +36,7 @@ class ApiKey(Creatable, Queryable, Retrievable, Updateable):
|
|
|
36
36
|
|
|
37
37
|
@classmethod
|
|
38
38
|
def create(cls, *, session: Session = global_session) -> 'ApiKey':
|
|
39
|
-
return cls._create(session=session)
|
|
39
|
+
return cast('ApiKey', cls._create(session=session))
|
|
40
40
|
|
|
41
41
|
@classmethod
|
|
42
42
|
def deactivate(
|
|
@@ -55,7 +55,7 @@ class ApiKey(Creatable, Queryable, Retrievable, Updateable):
|
|
|
55
55
|
"""
|
|
56
56
|
url = cls._resource + f'/{api_key_id}'
|
|
57
57
|
resp = session.delete(url, dict(minutes=minutes))
|
|
58
|
-
return cls(
|
|
58
|
+
return cast('ApiKey', cls._from_dict(resp))
|
|
59
59
|
|
|
60
60
|
@classmethod
|
|
61
61
|
def update(
|
|
@@ -74,4 +74,5 @@ class ApiKey(Creatable, Queryable, Retrievable, Updateable):
|
|
|
74
74
|
req = ApiKeyUpdateRequest(
|
|
75
75
|
metadata=metadata, user_id=user_id, platform_id=platform_id
|
|
76
76
|
)
|
|
77
|
-
|
|
77
|
+
resp = cls._update(api_key_id, **req.dict(), session=session)
|
|
78
|
+
return cast('ApiKey', resp)
|
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
import datetime as dt
|
|
2
|
-
from typing import ClassVar, Optional
|
|
2
|
+
from typing import ClassVar, Optional, cast
|
|
3
3
|
|
|
4
4
|
from cuenca_validations.types.requests import ARPCRequest
|
|
5
5
|
|
|
@@ -52,4 +52,4 @@ class Arpc(Creatable):
|
|
|
52
52
|
unique_number=unique_number,
|
|
53
53
|
track_data_method=track_data_method,
|
|
54
54
|
)
|
|
55
|
-
return cls._create(session=session, **req.dict())
|
|
55
|
+
return cast('Arpc', cls._create(session=session, **req.dict()))
|
|
@@ -2,7 +2,7 @@ import base64
|
|
|
2
2
|
import datetime as dt
|
|
3
3
|
import json
|
|
4
4
|
from io import BytesIO
|
|
5
|
-
from typing import ClassVar, Generator, Optional,
|
|
5
|
+
from typing import ClassVar, Dict, Generator, Optional, Union
|
|
6
6
|
from urllib.parse import urlencode
|
|
7
7
|
|
|
8
8
|
from cuenca_validations.types import (
|
|
@@ -12,22 +12,34 @@ from cuenca_validations.types import (
|
|
|
12
12
|
TransactionQuery,
|
|
13
13
|
TransactionStatus,
|
|
14
14
|
)
|
|
15
|
-
from pydantic import BaseModel
|
|
15
|
+
from pydantic import BaseModel
|
|
16
16
|
|
|
17
17
|
from ..exc import MultipleResultsFound, NoResultFound
|
|
18
18
|
from ..http import Session, session as global_session
|
|
19
19
|
|
|
20
|
-
R_co = TypeVar('R_co', bound='Resource', covariant=True)
|
|
21
|
-
Q_co = TypeVar('Q_co', bound='Queryable', covariant=True)
|
|
22
|
-
|
|
23
20
|
|
|
24
21
|
class Resource(BaseModel):
|
|
25
22
|
_resource: ClassVar[str]
|
|
26
23
|
|
|
27
24
|
id: str
|
|
28
25
|
|
|
29
|
-
|
|
30
|
-
|
|
26
|
+
@classmethod
|
|
27
|
+
def _from_dict(cls, obj_dict: Dict[str, Union[str, int]]) -> 'Resource':
|
|
28
|
+
cls._filter_excess_fields(obj_dict)
|
|
29
|
+
return cls(**obj_dict)
|
|
30
|
+
|
|
31
|
+
@classmethod
|
|
32
|
+
def _filter_excess_fields(cls, obj_dict):
|
|
33
|
+
"""
|
|
34
|
+
dataclasses don't allow __init__ to be called with excess fields. This
|
|
35
|
+
method allows the API to add fields in the response body without
|
|
36
|
+
breaking the client
|
|
37
|
+
"""
|
|
38
|
+
excess = set(obj_dict.keys()) - set(
|
|
39
|
+
cls.schema().get("properties").keys()
|
|
40
|
+
)
|
|
41
|
+
for f in excess:
|
|
42
|
+
del obj_dict[f]
|
|
31
43
|
|
|
32
44
|
def to_dict(self):
|
|
33
45
|
return SantizedDict(self.dict())
|
|
@@ -36,12 +48,12 @@ class Resource(BaseModel):
|
|
|
36
48
|
class Retrievable(Resource):
|
|
37
49
|
@classmethod
|
|
38
50
|
def retrieve(
|
|
39
|
-
cls
|
|
40
|
-
) ->
|
|
51
|
+
cls, id: str, *, session: Session = global_session
|
|
52
|
+
) -> Resource:
|
|
41
53
|
resp = session.get(f'/{cls._resource}/{id}')
|
|
42
|
-
return cls(
|
|
54
|
+
return cls._from_dict(resp)
|
|
43
55
|
|
|
44
|
-
def refresh(self, *, session: Session = global_session)
|
|
56
|
+
def refresh(self, *, session: Session = global_session):
|
|
45
57
|
new = self.retrieve(self.id, session=session)
|
|
46
58
|
for attr, value in new.__dict__.items():
|
|
47
59
|
setattr(self, attr, value)
|
|
@@ -49,11 +61,9 @@ class Retrievable(Resource):
|
|
|
49
61
|
|
|
50
62
|
class Creatable(Resource):
|
|
51
63
|
@classmethod
|
|
52
|
-
def _create(
|
|
53
|
-
cls: Type[R_co], *, session: Session = global_session, **data
|
|
54
|
-
) -> R_co:
|
|
64
|
+
def _create(cls, *, session: Session = global_session, **data) -> Resource:
|
|
55
65
|
resp = session.post(cls._resource, data)
|
|
56
|
-
return cls(
|
|
66
|
+
return cls._from_dict(resp)
|
|
57
67
|
|
|
58
68
|
|
|
59
69
|
class Updateable(Resource):
|
|
@@ -62,10 +72,10 @@ class Updateable(Resource):
|
|
|
62
72
|
|
|
63
73
|
@classmethod
|
|
64
74
|
def _update(
|
|
65
|
-
cls
|
|
66
|
-
) ->
|
|
75
|
+
cls, id: str, *, session: Session = global_session, **data
|
|
76
|
+
) -> Resource:
|
|
67
77
|
resp = session.patch(f'/{cls._resource}/{id}', data)
|
|
68
|
-
return cls(
|
|
78
|
+
return cls._from_dict(resp)
|
|
69
79
|
|
|
70
80
|
|
|
71
81
|
class Deactivable(Resource):
|
|
@@ -73,20 +83,20 @@ class Deactivable(Resource):
|
|
|
73
83
|
|
|
74
84
|
@classmethod
|
|
75
85
|
def deactivate(
|
|
76
|
-
cls
|
|
77
|
-
) ->
|
|
86
|
+
cls, id: str, *, session: Session = global_session, **data
|
|
87
|
+
) -> Resource:
|
|
78
88
|
resp = session.delete(f'/{cls._resource}/{id}', data)
|
|
79
|
-
return cls(
|
|
89
|
+
return cls._from_dict(resp)
|
|
80
90
|
|
|
81
91
|
@property
|
|
82
|
-
def is_active(self)
|
|
92
|
+
def is_active(self):
|
|
83
93
|
return not self.deactivated_at
|
|
84
94
|
|
|
85
95
|
|
|
86
96
|
class Downloadable(Resource):
|
|
87
97
|
@classmethod
|
|
88
98
|
def download(
|
|
89
|
-
cls
|
|
99
|
+
cls,
|
|
90
100
|
id: str,
|
|
91
101
|
file_format: FileFormat = FileFormat.any,
|
|
92
102
|
*,
|
|
@@ -111,13 +121,13 @@ class Downloadable(Resource):
|
|
|
111
121
|
class Uploadable(Resource):
|
|
112
122
|
@classmethod
|
|
113
123
|
def _upload(
|
|
114
|
-
cls
|
|
124
|
+
cls,
|
|
115
125
|
file: bytes,
|
|
116
126
|
user_id: str,
|
|
117
127
|
*,
|
|
118
128
|
session: Session = global_session,
|
|
119
129
|
**data,
|
|
120
|
-
) ->
|
|
130
|
+
) -> Resource:
|
|
121
131
|
encoded_file = base64.b64encode(file)
|
|
122
132
|
resp = session.request(
|
|
123
133
|
'post',
|
|
@@ -128,7 +138,7 @@ class Uploadable(Resource):
|
|
|
128
138
|
**{k: (None, v) for k, v in data.items()},
|
|
129
139
|
),
|
|
130
140
|
)
|
|
131
|
-
return cls(
|
|
141
|
+
return cls._from_dict(json.loads(resp))
|
|
132
142
|
|
|
133
143
|
|
|
134
144
|
class Queryable(Resource):
|
|
@@ -138,8 +148,8 @@ class Queryable(Resource):
|
|
|
138
148
|
|
|
139
149
|
@classmethod
|
|
140
150
|
def one(
|
|
141
|
-
cls
|
|
142
|
-
) ->
|
|
151
|
+
cls, *, session: Session = global_session, **query_params
|
|
152
|
+
) -> Resource:
|
|
143
153
|
q = cls._query_params(limit=2, **query_params)
|
|
144
154
|
resp = session.get(cls._resource, q.dict())
|
|
145
155
|
items = resp['items']
|
|
@@ -148,12 +158,12 @@ class Queryable(Resource):
|
|
|
148
158
|
raise NoResultFound
|
|
149
159
|
if len_items > 1:
|
|
150
160
|
raise MultipleResultsFound
|
|
151
|
-
return cls(
|
|
161
|
+
return cls._from_dict(items[0])
|
|
152
162
|
|
|
153
163
|
@classmethod
|
|
154
164
|
def first(
|
|
155
|
-
cls
|
|
156
|
-
) -> Optional[
|
|
165
|
+
cls, *, session: Session = global_session, **query_params
|
|
166
|
+
) -> Optional[Resource]:
|
|
157
167
|
q = cls._query_params(limit=1, **query_params)
|
|
158
168
|
resp = session.get(cls._resource, q.dict())
|
|
159
169
|
try:
|
|
@@ -161,12 +171,12 @@ class Queryable(Resource):
|
|
|
161
171
|
except IndexError:
|
|
162
172
|
rv = None
|
|
163
173
|
else:
|
|
164
|
-
rv = cls(
|
|
174
|
+
rv = cls._from_dict(item)
|
|
165
175
|
return rv
|
|
166
176
|
|
|
167
177
|
@classmethod
|
|
168
178
|
def count(
|
|
169
|
-
cls
|
|
179
|
+
cls, *, session: Session = global_session, **query_params
|
|
170
180
|
) -> int:
|
|
171
181
|
q = cls._query_params(count=True, **query_params)
|
|
172
182
|
resp = session.get(cls._resource, q.dict())
|
|
@@ -174,14 +184,14 @@ class Queryable(Resource):
|
|
|
174
184
|
|
|
175
185
|
@classmethod
|
|
176
186
|
def all(
|
|
177
|
-
cls
|
|
178
|
-
) -> Generator[
|
|
187
|
+
cls, *, session: Session = global_session, **query_params
|
|
188
|
+
) -> Generator[Resource, None, None]:
|
|
179
189
|
session = session or global_session
|
|
180
190
|
q = cls._query_params(**query_params)
|
|
181
191
|
next_page_uri = f'{cls._resource}?{urlencode(q.dict())}'
|
|
182
192
|
while next_page_uri:
|
|
183
193
|
page = session.get(next_page_uri)
|
|
184
|
-
yield from (cls(
|
|
194
|
+
yield from (cls._from_dict(item) for item in page['items'])
|
|
185
195
|
next_page_uri = page['next_page_uri']
|
|
186
196
|
|
|
187
197
|
|
|
@@ -42,7 +42,9 @@ class CardActivation(Creatable):
|
|
|
42
42
|
exp_year=exp_year,
|
|
43
43
|
cvv2=cvv2,
|
|
44
44
|
)
|
|
45
|
-
return
|
|
45
|
+
return cast(
|
|
46
|
+
'CardActivation', cls._create(session=session, **req.dict())
|
|
47
|
+
)
|
|
46
48
|
|
|
47
49
|
@property
|
|
48
50
|
def card(self) -> Optional[Card]:
|
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
import datetime as dt
|
|
2
|
-
from typing import ClassVar, Optional
|
|
2
|
+
from typing import ClassVar, Optional, cast
|
|
3
3
|
|
|
4
4
|
from cuenca_validations.types import (
|
|
5
5
|
CardFundingType,
|
|
@@ -81,7 +81,7 @@ class Card(Retrievable, Queryable, Creatable, Updateable):
|
|
|
81
81
|
card_holder_user_id=card_holder_user_id,
|
|
82
82
|
is_dynamic_cvv=is_dynamic_cvv,
|
|
83
83
|
)
|
|
84
|
-
return cls._create(session=session, **req.dict())
|
|
84
|
+
return cast('Card', cls._create(session=session, **req.dict()))
|
|
85
85
|
|
|
86
86
|
@classmethod
|
|
87
87
|
def update(
|
|
@@ -106,7 +106,8 @@ class Card(Retrievable, Queryable, Creatable, Updateable):
|
|
|
106
106
|
req = CardUpdateRequest(
|
|
107
107
|
status=status, pin_block=pin_block, is_dynamic_cvv=is_dynamic_cvv
|
|
108
108
|
)
|
|
109
|
-
|
|
109
|
+
resp = cls._update(card_id, session=session, **req.dict())
|
|
110
|
+
return cast('Card', resp)
|
|
110
111
|
|
|
111
112
|
@classmethod
|
|
112
113
|
def deactivate(
|
|
@@ -117,4 +118,4 @@ class Card(Retrievable, Queryable, Creatable, Updateable):
|
|
|
117
118
|
"""
|
|
118
119
|
url = f'{cls._resource}/{card_id}'
|
|
119
120
|
resp = session.delete(url)
|
|
120
|
-
return cls(
|
|
121
|
+
return cast('Card', cls._from_dict(resp))
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
from typing import ClassVar
|
|
1
|
+
from typing import ClassVar, cast
|
|
2
2
|
|
|
3
3
|
from ..http import Session, session as global_session
|
|
4
4
|
from .base import Creatable, Queryable, Retrievable
|
|
@@ -11,4 +11,4 @@ class Clabe(Creatable, Queryable, Retrievable):
|
|
|
11
11
|
|
|
12
12
|
@classmethod
|
|
13
13
|
def create(cls, session: Session = global_session):
|
|
14
|
-
return cls._create(session=session)
|
|
14
|
+
return cast('Clabe', cls._create(session=session))
|
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
import datetime as dt
|
|
2
|
-
from typing import ClassVar, Optional
|
|
2
|
+
from typing import ClassVar, Optional, cast
|
|
3
3
|
|
|
4
4
|
from cuenca_validations.types import (
|
|
5
5
|
Country,
|
|
@@ -98,4 +98,7 @@ class CurpValidation(Creatable, Retrievable):
|
|
|
98
98
|
gender=gender,
|
|
99
99
|
manual_curp=manual_curp,
|
|
100
100
|
)
|
|
101
|
-
return
|
|
101
|
+
return cast(
|
|
102
|
+
'CurpValidation',
|
|
103
|
+
cls._create(session=session, **req.dict()),
|
|
104
|
+
)
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
from typing import ClassVar, List, Optional
|
|
1
|
+
from typing import ClassVar, List, Optional, cast
|
|
2
2
|
|
|
3
3
|
from cuenca_validations.types.enums import WebhookEvent
|
|
4
4
|
from cuenca_validations.types.requests import (
|
|
@@ -72,7 +72,7 @@ class Endpoint(Creatable, Deactivable, Retrievable, Queryable, Updateable):
|
|
|
72
72
|
:return: New active endpoint
|
|
73
73
|
"""
|
|
74
74
|
req = EndpointRequest(url=url, events=events)
|
|
75
|
-
return cls._create(session=session, **req.dict())
|
|
75
|
+
return cast('Endpoint', cls._create(session=session, **req.dict()))
|
|
76
76
|
|
|
77
77
|
@classmethod
|
|
78
78
|
def update(
|
|
@@ -96,4 +96,5 @@ class Endpoint(Creatable, Deactivable, Retrievable, Queryable, Updateable):
|
|
|
96
96
|
req = EndpointUpdateRequest(
|
|
97
97
|
url=url, is_enable=is_enable, events=events
|
|
98
98
|
)
|
|
99
|
-
|
|
99
|
+
resp = cls._update(endpoint_id, session=session, **req.dict())
|
|
100
|
+
return cast('Endpoint', resp)
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
from typing import ClassVar, Dict, List
|
|
1
|
+
from typing import ClassVar, Dict, List, cast
|
|
2
2
|
|
|
3
3
|
from cuenca_validations.types import BatchFileMetadata, FileBatchUploadRequest
|
|
4
4
|
|
|
@@ -22,4 +22,4 @@ class FileBatch(Creatable, Queryable):
|
|
|
22
22
|
session: Session = global_session,
|
|
23
23
|
) -> 'FileBatch':
|
|
24
24
|
req = FileBatchUploadRequest(files=files, user_id=user_id)
|
|
25
|
-
return cls._create(session=session, **req.dict())
|
|
25
|
+
return cast('FileBatch', cls._create(session=session, **req.dict()))
|
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
from io import BytesIO
|
|
2
|
-
from typing import ClassVar, Optional
|
|
2
|
+
from typing import ClassVar, Optional, cast
|
|
3
3
|
|
|
4
4
|
from cuenca_validations.types import FileQuery, FileUploadRequest, KYCFileType
|
|
5
5
|
from pydantic import HttpUrl
|
|
@@ -44,7 +44,13 @@ class File(Downloadable, Queryable, Uploadable):
|
|
|
44
44
|
is_back=is_back,
|
|
45
45
|
user_id=user_id,
|
|
46
46
|
)
|
|
47
|
-
return
|
|
47
|
+
return cast(
|
|
48
|
+
'File',
|
|
49
|
+
cls._upload(
|
|
50
|
+
session=session,
|
|
51
|
+
**req.dict(),
|
|
52
|
+
),
|
|
53
|
+
)
|
|
48
54
|
|
|
49
55
|
@property
|
|
50
56
|
def file(self) -> bytes:
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
from typing import ClassVar, List, Optional
|
|
1
|
+
from typing import ClassVar, List, Optional, cast
|
|
2
2
|
|
|
3
3
|
from cuenca_validations.types import KYCFile, KYCValidationRequest
|
|
4
4
|
|
|
@@ -38,4 +38,6 @@ class KYCValidation(Creatable, Retrievable, Queryable):
|
|
|
38
38
|
force=force,
|
|
39
39
|
documents=documents,
|
|
40
40
|
)
|
|
41
|
-
return
|
|
41
|
+
return cast(
|
|
42
|
+
'KYCValidation', cls._create(**req.dict(), session=session)
|
|
43
|
+
)
|
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
import datetime as dt
|
|
2
|
-
from typing import ClassVar, Optional
|
|
2
|
+
from typing import ClassVar, Optional, cast
|
|
3
3
|
|
|
4
4
|
from cuenca_validations.types import (
|
|
5
5
|
Address,
|
|
@@ -39,7 +39,7 @@ class KYCVerification(Creatable, Retrievable, Updateable):
|
|
|
39
39
|
|
|
40
40
|
@classmethod
|
|
41
41
|
def create(cls, session: Session = global_session) -> 'KYCVerification':
|
|
42
|
-
return cls._create(session=session)
|
|
42
|
+
return cast('KYCVerification', cls._create(session=session))
|
|
43
43
|
|
|
44
44
|
@classmethod
|
|
45
45
|
def update(
|
|
@@ -48,4 +48,4 @@ class KYCVerification(Creatable, Retrievable, Updateable):
|
|
|
48
48
|
curp: Optional[CurpField] = None,
|
|
49
49
|
) -> 'KYCVerification':
|
|
50
50
|
req = KYCVerificationUpdateRequest(curp=curp)
|
|
51
|
-
return cls._update(id=kyc_id, **req.dict())
|
|
51
|
+
return cast('KYCVerification', cls._update(id=kyc_id, **req.dict()))
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
from typing import ClassVar, Optional
|
|
1
|
+
from typing import ClassVar, Optional, cast
|
|
2
2
|
|
|
3
3
|
from clabe import Clabe
|
|
4
4
|
from cuenca_validations.types import (
|
|
@@ -37,4 +37,4 @@ class LimitedWallet(Wallet):
|
|
|
37
37
|
allowed_curp=allowed_curp,
|
|
38
38
|
allowed_rfc=allowed_rfc,
|
|
39
39
|
)
|
|
40
|
-
return cls._create(**request.dict())
|
|
40
|
+
return cast('LimitedWallet', cls._create(**request.dict()))
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
from typing import ClassVar
|
|
1
|
+
from typing import ClassVar, cast
|
|
2
2
|
|
|
3
3
|
from ..http import Session, session as global_session
|
|
4
4
|
from .base import Creatable
|
|
@@ -17,4 +17,4 @@ class LoginToken(Creatable):
|
|
|
17
17
|
Make sure to store this token in a safe place
|
|
18
18
|
:return: Token that you can use in cuenca.configure
|
|
19
19
|
"""
|
|
20
|
-
return cls._create(session=session)
|
|
20
|
+
return cast('LoginToken', cls._create(session=session))
|
|
@@ -0,0 +1,24 @@
|
|
|
1
|
+
from typing import ClassVar, cast
|
|
2
|
+
|
|
3
|
+
from ..http import Session, session as global_session
|
|
4
|
+
from .base import Creatable
|
|
5
|
+
|
|
6
|
+
|
|
7
|
+
class Otp(Creatable):
|
|
8
|
+
_resource: ClassVar = 'otps'
|
|
9
|
+
secret: str
|
|
10
|
+
|
|
11
|
+
class Config:
|
|
12
|
+
schema_extra = {
|
|
13
|
+
'example': {
|
|
14
|
+
'id': 'OTNEUInh69SuKXXmK95sROwQ',
|
|
15
|
+
'secret': 'somesecret',
|
|
16
|
+
}
|
|
17
|
+
}
|
|
18
|
+
|
|
19
|
+
@classmethod
|
|
20
|
+
def create(cls, session: Session = global_session) -> 'Otp':
|
|
21
|
+
"""
|
|
22
|
+
Use this method to create a OTP seed
|
|
23
|
+
"""
|
|
24
|
+
return cast('Otp', cls._create(session=session))
|
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
import datetime as dt
|
|
2
|
-
from typing import ClassVar, Optional
|
|
2
|
+
from typing import ClassVar, Optional, cast
|
|
3
3
|
|
|
4
4
|
from cuenca_validations.types import Country, PlatformRequest, State
|
|
5
5
|
|
|
@@ -76,4 +76,4 @@ class Platform(Creatable):
|
|
|
76
76
|
phone_number=phone_number,
|
|
77
77
|
email_address=email_address,
|
|
78
78
|
)
|
|
79
|
-
return cls._create(session=session, **req.dict())
|
|
79
|
+
return cast('Platform', cls._create(session=session, **req.dict()))
|
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
import datetime as dt
|
|
2
|
-
from typing import ClassVar
|
|
2
|
+
from typing import ClassVar, cast
|
|
3
3
|
|
|
4
4
|
from cuenca_validations.types import QuestionnairesRequest
|
|
5
5
|
|
|
@@ -38,4 +38,6 @@ class Questionnaires(Creatable, Retrievable):
|
|
|
38
38
|
token=token,
|
|
39
39
|
form_id=form_id,
|
|
40
40
|
)
|
|
41
|
-
return
|
|
41
|
+
return cast(
|
|
42
|
+
'Questionnaires', cls._create(session=session, **req.dict())
|
|
43
|
+
)
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
import re
|
|
2
2
|
from concurrent.futures import ThreadPoolExecutor
|
|
3
|
-
from typing import Dict, List
|
|
3
|
+
from typing import Dict, List, cast
|
|
4
4
|
|
|
5
5
|
from .base import Retrievable
|
|
6
6
|
|
|
@@ -13,7 +13,7 @@ def retrieve_uri(uri: str) -> Retrievable:
|
|
|
13
13
|
if not m:
|
|
14
14
|
raise ValueError(f'uri is not a valid format: {uri}')
|
|
15
15
|
resource, id_ = m.groups()
|
|
16
|
-
return RESOURCES[resource].retrieve(id_)
|
|
16
|
+
return cast(Retrievable, RESOURCES[resource].retrieve(id_))
|
|
17
17
|
|
|
18
18
|
|
|
19
19
|
def retrieve_uris(uris: List[str]) -> List[Retrievable]:
|
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
import datetime as dt
|
|
2
|
-
from typing import ClassVar, Optional
|
|
2
|
+
from typing import ClassVar, Optional, cast
|
|
3
3
|
|
|
4
4
|
from cuenca_validations.types import (
|
|
5
5
|
SavingCategory,
|
|
@@ -34,7 +34,7 @@ class Saving(Wallet, Updateable):
|
|
|
34
34
|
goal_amount=goal_amount,
|
|
35
35
|
goal_date=goal_date,
|
|
36
36
|
)
|
|
37
|
-
return cls._create(**request.dict())
|
|
37
|
+
return cast('Saving', cls._create(**request.dict()))
|
|
38
38
|
|
|
39
39
|
@classmethod
|
|
40
40
|
def update(
|
|
@@ -51,4 +51,4 @@ class Saving(Wallet, Updateable):
|
|
|
51
51
|
goal_amount=goal_amount,
|
|
52
52
|
goal_date=goal_date,
|
|
53
53
|
)
|
|
54
|
-
return cls._update(id=saving_id, **request.dict())
|
|
54
|
+
return cast('Saving', cls._update(id=saving_id, **request.dict()))
|
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
import datetime as dt
|
|
2
|
-
from typing import ClassVar, Optional
|
|
2
|
+
from typing import ClassVar, Optional, cast
|
|
3
3
|
|
|
4
4
|
from cuenca_validations.types import SessionRequest, SessionType
|
|
5
5
|
from pydantic import AnyUrl
|
|
@@ -50,4 +50,4 @@ class Session(Creatable, Retrievable, Queryable):
|
|
|
50
50
|
success_url=success_url,
|
|
51
51
|
failure_url=failure_url,
|
|
52
52
|
)
|
|
53
|
-
return cls._create(session=session, **req.dict())
|
|
53
|
+
return cast('Session', cls._create(session=session, **req.dict()))
|
|
@@ -69,7 +69,7 @@ class Transfer(Transaction, Creatable):
|
|
|
69
69
|
idempotency_key=idempotency_key,
|
|
70
70
|
user_id=user_id,
|
|
71
71
|
)
|
|
72
|
-
return cls._create(**req.dict())
|
|
72
|
+
return cast('Transfer', cls._create(**req.dict()))
|
|
73
73
|
|
|
74
74
|
@classmethod
|
|
75
75
|
def create_many(cls, requests: List[TransferRequest]) -> DictStrAny:
|
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
import datetime as dt
|
|
2
|
-
from typing import ClassVar, Optional
|
|
2
|
+
from typing import ClassVar, Optional, cast
|
|
3
3
|
|
|
4
4
|
from cuenca_validations.types.requests import (
|
|
5
5
|
UserCredentialRequest,
|
|
@@ -25,7 +25,9 @@ class UserCredential(Creatable, Updateable):
|
|
|
25
25
|
session: Session = global_session,
|
|
26
26
|
) -> 'UserCredential':
|
|
27
27
|
req = UserCredentialRequest(password=password, user_id=user_id)
|
|
28
|
-
return
|
|
28
|
+
return cast(
|
|
29
|
+
'UserCredential', cls._create(**req.dict(), session=session)
|
|
30
|
+
)
|
|
29
31
|
|
|
30
32
|
@classmethod
|
|
31
33
|
def update(
|
|
@@ -40,4 +42,7 @@ class UserCredential(Creatable, Updateable):
|
|
|
40
42
|
is_active=is_active,
|
|
41
43
|
password=password,
|
|
42
44
|
)
|
|
43
|
-
return
|
|
45
|
+
return cast(
|
|
46
|
+
'UserCredential',
|
|
47
|
+
cls._update(id=user_id, **req.dict(), session=session),
|
|
48
|
+
)
|
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
import datetime as dt
|
|
2
|
-
from typing import ClassVar, Optional
|
|
2
|
+
from typing import ClassVar, Optional, cast
|
|
3
3
|
|
|
4
4
|
from cuenca_validations.types import UserListsRequest, VerificationStatus
|
|
5
5
|
from cuenca_validations.types.identities import CurpField
|
|
@@ -36,4 +36,7 @@ class UserListsValidation(Creatable, Retrievable):
|
|
|
36
36
|
curp=curp,
|
|
37
37
|
account_number=account_number,
|
|
38
38
|
)
|
|
39
|
-
return
|
|
39
|
+
return cast(
|
|
40
|
+
'UserListsValidation',
|
|
41
|
+
cls._create(session=session, **req.dict()),
|
|
42
|
+
)
|
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
import datetime as dt
|
|
2
|
-
from typing import ClassVar, Optional
|
|
2
|
+
from typing import ClassVar, Optional, cast
|
|
3
3
|
|
|
4
4
|
from cuenca_validations.types.requests import UserLoginRequest
|
|
5
5
|
|
|
@@ -31,7 +31,7 @@ class UserLogin(Creatable):
|
|
|
31
31
|
session: Session = global_session,
|
|
32
32
|
) -> 'UserLogin':
|
|
33
33
|
req = UserLoginRequest(password=password, user_id=user_id)
|
|
34
|
-
login = cls._create(session=session, **req.dict())
|
|
34
|
+
login = cast('UserLogin', cls._create(session=session, **req.dict()))
|
|
35
35
|
if login.success:
|
|
36
36
|
session.headers['X-Cuenca-LoginId'] = login.id
|
|
37
37
|
return login
|
|
@@ -59,7 +59,7 @@ class User(Creatable, Retrievable, Updateable, Queryable):
|
|
|
59
59
|
|
|
60
60
|
@property
|
|
61
61
|
def balance(self) -> int:
|
|
62
|
-
be = BalanceEntry.first(user_id=self.id)
|
|
62
|
+
be = cast(BalanceEntry, BalanceEntry.first(user_id=self.id))
|
|
63
63
|
return be.rolling_balance if be else 0
|
|
64
64
|
|
|
65
65
|
class Config:
|
|
@@ -135,7 +135,7 @@ class User(Creatable, Retrievable, Updateable, Queryable):
|
|
|
135
135
|
status=status,
|
|
136
136
|
terms_of_service=terms_of_service,
|
|
137
137
|
)
|
|
138
|
-
return cls._create(session=session, **req.dict())
|
|
138
|
+
return cast('User', cls._create(session=session, **req.dict()))
|
|
139
139
|
|
|
140
140
|
@classmethod
|
|
141
141
|
def update(
|
|
@@ -174,7 +174,10 @@ class User(Creatable, Retrievable, Updateable, Queryable):
|
|
|
174
174
|
curp_document=curp_document,
|
|
175
175
|
status=status,
|
|
176
176
|
)
|
|
177
|
-
return
|
|
177
|
+
return cast(
|
|
178
|
+
'User',
|
|
179
|
+
cls._update(id=user_id, **request.dict(), session=session),
|
|
180
|
+
)
|
|
178
181
|
|
|
179
182
|
@property
|
|
180
183
|
def identity(self) -> Identity:
|
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
import datetime as dt
|
|
2
|
-
from typing import ClassVar, Optional, Union
|
|
2
|
+
from typing import ClassVar, Optional, Union, cast
|
|
3
3
|
|
|
4
4
|
from cuenca_validations.types import (
|
|
5
5
|
VerificationAttemptRequest,
|
|
@@ -44,7 +44,7 @@ class Verification(Creatable, Updateable):
|
|
|
44
44
|
req = VerificationRequest(
|
|
45
45
|
recipient=recipient, type=type, platform_id=platform_id
|
|
46
46
|
)
|
|
47
|
-
return cls._create(**req.dict(), session=session)
|
|
47
|
+
return cast('Verification', cls._create(**req.dict(), session=session))
|
|
48
48
|
|
|
49
49
|
@classmethod
|
|
50
50
|
def verify(
|
|
@@ -54,4 +54,7 @@ class Verification(Creatable, Updateable):
|
|
|
54
54
|
session: Session = global_session,
|
|
55
55
|
) -> 'Verification':
|
|
56
56
|
req = VerificationAttemptRequest(code=code)
|
|
57
|
-
return
|
|
57
|
+
return cast(
|
|
58
|
+
'Verification',
|
|
59
|
+
cls._update(id=id, **req.dict(), session=session),
|
|
60
|
+
)
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
Metadata-Version: 2.1
|
|
2
2
|
Name: cuenca
|
|
3
|
-
Version: 1.0.3.
|
|
3
|
+
Version: 1.0.3.dev3
|
|
4
4
|
Summary: Cuenca API Client
|
|
5
5
|
Home-page: https://github.com/cuenca-mx/cuenca-python
|
|
6
6
|
Author: Cuenca
|
|
@@ -13,7 +13,7 @@ Description-Content-Type: text/markdown
|
|
|
13
13
|
License-File: LICENSE
|
|
14
14
|
Requires-Dist: requests<28,>=2.24
|
|
15
15
|
Requires-Dist: dataclasses>=0.7; python_version < "3.8"
|
|
16
|
-
Requires-Dist: cuenca-validations<0.
|
|
16
|
+
Requires-Dist: cuenca-validations<0.13.0,>=0.11.3
|
|
17
17
|
|
|
18
18
|
# Cuenca – Python client library
|
|
19
19
|
|
|
@@ -39,6 +39,7 @@ cuenca/resources/kyc_validations.py
|
|
|
39
39
|
cuenca/resources/kyc_verifications.py
|
|
40
40
|
cuenca/resources/limited_wallets.py
|
|
41
41
|
cuenca/resources/login_tokens.py
|
|
42
|
+
cuenca/resources/otps.py
|
|
42
43
|
cuenca/resources/platforms.py
|
|
43
44
|
cuenca/resources/questionnaires.py
|
|
44
45
|
cuenca/resources/resources.py
|
|
@@ -87,6 +88,7 @@ tests/resources/test_kyc_validations.py
|
|
|
87
88
|
tests/resources/test_kyc_verifications.py
|
|
88
89
|
tests/resources/test_limited_wallets.py
|
|
89
90
|
tests/resources/test_login_tokens.py
|
|
91
|
+
tests/resources/test_otps.py
|
|
90
92
|
tests/resources/test_platforms.py
|
|
91
93
|
tests/resources/test_questionnaires.py
|
|
92
94
|
tests/resources/test_resources.py
|
|
@@ -84,7 +84,7 @@ def test_api_key_from_dict():
|
|
|
84
84
|
metadata=None,
|
|
85
85
|
user_id=None,
|
|
86
86
|
)
|
|
87
|
-
api_key = ApiKey(
|
|
87
|
+
api_key = ApiKey._from_dict(api_keys_dict)
|
|
88
88
|
assert not hasattr(api_key, 'extra_field_1')
|
|
89
89
|
assert not hasattr(api_key, 'extra_field_2')
|
|
90
90
|
assert api_key.id is not None
|
|
@@ -0,0 +1,28 @@
|
|
|
1
|
+
import pytest
|
|
2
|
+
|
|
3
|
+
from cuenca import LoginToken, Otp, UserLogin
|
|
4
|
+
from cuenca.http.client import Session
|
|
5
|
+
|
|
6
|
+
|
|
7
|
+
@pytest.fixture(scope='function')
|
|
8
|
+
def session():
|
|
9
|
+
session = Session()
|
|
10
|
+
session.configure(
|
|
11
|
+
'api_key',
|
|
12
|
+
'api_secret',
|
|
13
|
+
sandbox=True,
|
|
14
|
+
)
|
|
15
|
+
return session
|
|
16
|
+
|
|
17
|
+
|
|
18
|
+
@pytest.mark.vcr
|
|
19
|
+
def test_otps(session):
|
|
20
|
+
UserLogin.create('111111', session=session)
|
|
21
|
+
login_token = LoginToken.create(session=session)
|
|
22
|
+
session.headers.pop(
|
|
23
|
+
'X-Cuenca-LoginId',
|
|
24
|
+
)
|
|
25
|
+
session.configure(login_token=login_token.id)
|
|
26
|
+
otp = Otp.create()
|
|
27
|
+
assert otp
|
|
28
|
+
assert type(otp.secret) == str
|
|
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
|
|
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
|
|
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
|
|
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
|
|
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
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|