cuenca 1.0.3.dev1__py3-none-any.whl → 2.0.0.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/exc.py +4 -5
- cuenca/resources/api_keys.py +11 -9
- cuenca/resources/arpc.py +6 -5
- cuenca/resources/balance_entries.py +2 -4
- cuenca/resources/base.py +52 -41
- cuenca/resources/card_activations.py +4 -2
- cuenca/resources/card_transactions.py +4 -1
- cuenca/resources/card_validations.py +7 -7
- cuenca/resources/cards.py +7 -6
- cuenca/resources/clabes.py +2 -2
- cuenca/resources/curp_validations.py +46 -42
- cuenca/resources/deposits.py +1 -1
- cuenca/resources/endpoints.py +25 -27
- cuenca/resources/file_batches.py +12 -4
- cuenca/resources/files.py +15 -4
- cuenca/resources/identities.py +13 -13
- cuenca/resources/kyc_validations.py +11 -8
- cuenca/resources/kyc_verifications.py +10 -9
- cuenca/resources/limited_wallets.py +4 -4
- cuenca/resources/login_tokens.py +7 -5
- cuenca/resources/otps.py +5 -3
- cuenca/resources/platforms.py +30 -31
- cuenca/resources/questionnaires.py +8 -5
- cuenca/resources/resources.py +2 -2
- cuenca/resources/savings.py +5 -5
- cuenca/resources/sessions.py +11 -11
- cuenca/resources/transfers.py +5 -4
- cuenca/resources/user_credentials.py +8 -3
- cuenca/resources/user_events.py +5 -3
- cuenca/resources/user_lists_validation.py +7 -3
- cuenca/resources/user_logins.py +7 -6
- cuenca/resources/users.py +49 -51
- cuenca/resources/verifications.py +17 -11
- cuenca/resources/wallet_transactions.py +1 -1
- cuenca/resources/webhooks.py +7 -8
- cuenca/resources/whatsapp_transfers.py +4 -4
- cuenca/version.py +1 -1
- {cuenca-1.0.3.dev1.dist-info → cuenca-2.0.0.dev2.dist-info}/METADATA +10 -6
- {cuenca-1.0.3.dev1.dist-info → cuenca-2.0.0.dev2.dist-info}/RECORD +46 -46
- {cuenca-1.0.3.dev1.dist-info → cuenca-2.0.0.dev2.dist-info}/WHEEL +1 -1
- tests/resources/test_api_keys.py +1 -1
- tests/resources/test_endpoints.py +1 -1
- tests/resources/test_sessions.py +2 -2
- tests/resources/test_transfers.py +1 -1
- {cuenca-1.0.3.dev1.dist-info → cuenca-2.0.0.dev2.dist-info}/LICENSE +0 -0
- {cuenca-1.0.3.dev1.dist-info → cuenca-2.0.0.dev2.dist-info}/top_level.txt +0 -0
cuenca/resources/endpoints.py
CHANGED
|
@@ -1,11 +1,11 @@
|
|
|
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 (
|
|
5
5
|
EndpointRequest,
|
|
6
6
|
EndpointUpdateRequest,
|
|
7
7
|
)
|
|
8
|
-
from pydantic import HttpUrl
|
|
8
|
+
from pydantic import ConfigDict, Field, HttpUrl
|
|
9
9
|
|
|
10
10
|
from ..http import Session, session as global_session
|
|
11
11
|
from .base import Creatable, Deactivable, Queryable, Retrievable, Updateable
|
|
@@ -14,28 +14,24 @@ from .base import Creatable, Deactivable, Queryable, Retrievable, Updateable
|
|
|
14
14
|
class Endpoint(Creatable, Deactivable, Retrievable, Queryable, Updateable):
|
|
15
15
|
_resource: ClassVar = 'endpoints'
|
|
16
16
|
|
|
17
|
-
url: HttpUrl
|
|
18
|
-
secret: str
|
|
19
|
-
|
|
20
|
-
|
|
21
|
-
|
|
22
|
-
|
|
23
|
-
|
|
24
|
-
|
|
25
|
-
|
|
26
|
-
|
|
27
|
-
|
|
28
|
-
|
|
29
|
-
|
|
30
|
-
|
|
31
|
-
|
|
32
|
-
|
|
33
|
-
|
|
34
|
-
|
|
35
|
-
'all events will be enabled for this Endpoint'
|
|
36
|
-
},
|
|
37
|
-
}
|
|
38
|
-
schema_extra = {
|
|
17
|
+
url: HttpUrl = Field(..., description='HTTPS url to send webhooks')
|
|
18
|
+
secret: str = Field(
|
|
19
|
+
...,
|
|
20
|
+
description='token to verify the webhook is sent by Cuenca '
|
|
21
|
+
'using HMAC algorithm',
|
|
22
|
+
)
|
|
23
|
+
is_enable: bool = Field(
|
|
24
|
+
...,
|
|
25
|
+
description='Allows user to turn-off the endpoint without the '
|
|
26
|
+
'need of deleting it',
|
|
27
|
+
)
|
|
28
|
+
events: List[WebhookEvent] = Field(
|
|
29
|
+
...,
|
|
30
|
+
description='list of enabled events. If None, all events will '
|
|
31
|
+
'be enabled for this Endpoint',
|
|
32
|
+
)
|
|
33
|
+
model_config = ConfigDict(
|
|
34
|
+
json_schema_extra={
|
|
39
35
|
'example': {
|
|
40
36
|
'_id': 'ENxxne2Z5VSTKZm_w8Hzffcw',
|
|
41
37
|
'platform_id': 'PTZoPrrPT6Ts-9myamq5h1bA',
|
|
@@ -52,7 +48,8 @@ class Endpoint(Creatable, Deactivable, Retrievable, Queryable, Updateable):
|
|
|
52
48
|
],
|
|
53
49
|
'is_enable': True,
|
|
54
50
|
}
|
|
55
|
-
}
|
|
51
|
+
},
|
|
52
|
+
)
|
|
56
53
|
|
|
57
54
|
@classmethod
|
|
58
55
|
def create(
|
|
@@ -72,7 +69,7 @@ class Endpoint(Creatable, Deactivable, Retrievable, Queryable, Updateable):
|
|
|
72
69
|
:return: New active endpoint
|
|
73
70
|
"""
|
|
74
71
|
req = EndpointRequest(url=url, events=events)
|
|
75
|
-
return cls._create(session=session, **req.dict())
|
|
72
|
+
return cast('Endpoint', cls._create(session=session, **req.dict()))
|
|
76
73
|
|
|
77
74
|
@classmethod
|
|
78
75
|
def update(
|
|
@@ -96,4 +93,5 @@ class Endpoint(Creatable, Deactivable, Retrievable, Queryable, Updateable):
|
|
|
96
93
|
req = EndpointUpdateRequest(
|
|
97
94
|
url=url, is_enable=is_enable, events=events
|
|
98
95
|
)
|
|
99
|
-
|
|
96
|
+
resp = cls._update(endpoint_id, session=session, **req.dict())
|
|
97
|
+
return cast('Endpoint', resp)
|
cuenca/resources/file_batches.py
CHANGED
|
@@ -1,6 +1,10 @@
|
|
|
1
|
-
from typing import ClassVar, Dict, List
|
|
1
|
+
from typing import ClassVar, Dict, List, cast
|
|
2
2
|
|
|
3
|
-
from cuenca_validations.types import
|
|
3
|
+
from cuenca_validations.types import (
|
|
4
|
+
BatchFileMetadata,
|
|
5
|
+
FileBatchUploadRequest,
|
|
6
|
+
FileRequest,
|
|
7
|
+
)
|
|
4
8
|
|
|
5
9
|
from ..http import Session, session as global_session
|
|
6
10
|
from .base import Creatable, Queryable
|
|
@@ -21,5 +25,9 @@ class FileBatch(Creatable, Queryable):
|
|
|
21
25
|
*,
|
|
22
26
|
session: Session = global_session,
|
|
23
27
|
) -> 'FileBatch':
|
|
24
|
-
req = FileBatchUploadRequest(
|
|
25
|
-
|
|
28
|
+
req = FileBatchUploadRequest(
|
|
29
|
+
files=cast(List[FileRequest], files), user_id=user_id
|
|
30
|
+
)
|
|
31
|
+
return cast(
|
|
32
|
+
'FileBatch', cls._create(session=session, **req.model_dump())
|
|
33
|
+
)
|
cuenca/resources/files.py
CHANGED
|
@@ -1,7 +1,12 @@
|
|
|
1
1
|
from io import BytesIO
|
|
2
|
-
from typing import ClassVar, Optional
|
|
2
|
+
from typing import ClassVar, Optional, cast
|
|
3
3
|
|
|
4
|
-
from cuenca_validations.types import
|
|
4
|
+
from cuenca_validations.types import (
|
|
5
|
+
FileExtension,
|
|
6
|
+
FileQuery,
|
|
7
|
+
FileUploadRequest,
|
|
8
|
+
KYCFileType,
|
|
9
|
+
)
|
|
5
10
|
from pydantic import HttpUrl
|
|
6
11
|
|
|
7
12
|
from ..http import Session, session as global_session
|
|
@@ -40,11 +45,17 @@ class File(Downloadable, Queryable, Uploadable):
|
|
|
40
45
|
req = FileUploadRequest(
|
|
41
46
|
file=file.read(),
|
|
42
47
|
type=file_type,
|
|
43
|
-
extension=extension,
|
|
48
|
+
extension=cast(FileExtension, extension),
|
|
44
49
|
is_back=is_back,
|
|
45
50
|
user_id=user_id,
|
|
46
51
|
)
|
|
47
|
-
return
|
|
52
|
+
return cast(
|
|
53
|
+
'File',
|
|
54
|
+
cls._upload(
|
|
55
|
+
session=session,
|
|
56
|
+
**req.dict(),
|
|
57
|
+
),
|
|
58
|
+
)
|
|
48
59
|
|
|
49
60
|
@property
|
|
50
61
|
def file(self) -> bytes:
|
cuenca/resources/identities.py
CHANGED
|
@@ -23,17 +23,17 @@ class Identity(Retrievable, Queryable):
|
|
|
23
23
|
created_at: dt.datetime
|
|
24
24
|
names: str
|
|
25
25
|
first_surname: str
|
|
26
|
-
second_surname: Optional[str]
|
|
27
|
-
curp: Optional[CurpField]
|
|
28
|
-
rfc: Optional[str]
|
|
26
|
+
second_surname: Optional[str] = None
|
|
27
|
+
curp: Optional[CurpField] = None
|
|
28
|
+
rfc: Optional[str] = None
|
|
29
29
|
gender: Gender
|
|
30
|
-
date_of_birth: Optional[dt.date]
|
|
31
|
-
state_of_birth: Optional[State]
|
|
32
|
-
country_of_birth: Optional[str]
|
|
33
|
-
status: Optional[UserStatus]
|
|
34
|
-
tos_agreement: Optional[TOSAgreement]
|
|
35
|
-
blacklist_validation_status: Optional[VerificationStatus]
|
|
36
|
-
address: Optional[Address]
|
|
37
|
-
govt_id: Optional[KYCFile]
|
|
38
|
-
proof_of_address: Optional[KYCFile]
|
|
39
|
-
proof_of_life: Optional[KYCFile]
|
|
30
|
+
date_of_birth: Optional[dt.date] = None
|
|
31
|
+
state_of_birth: Optional[State] = None
|
|
32
|
+
country_of_birth: Optional[str] = None
|
|
33
|
+
status: Optional[UserStatus] = None
|
|
34
|
+
tos_agreement: Optional[TOSAgreement] = None
|
|
35
|
+
blacklist_validation_status: Optional[VerificationStatus] = None
|
|
36
|
+
address: Optional[Address] = None
|
|
37
|
+
govt_id: Optional[KYCFile] = None
|
|
38
|
+
proof_of_address: Optional[KYCFile] = None
|
|
39
|
+
proof_of_life: Optional[KYCFile] = None
|
|
@@ -1,6 +1,7 @@
|
|
|
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
|
+
from pydantic import ConfigDict
|
|
4
5
|
|
|
5
6
|
from ..http import Session, session as global_session
|
|
6
7
|
from .base import Creatable, Queryable, Retrievable
|
|
@@ -9,12 +10,11 @@ from .base import Creatable, Queryable, Retrievable
|
|
|
9
10
|
class KYCValidation(Creatable, Retrievable, Queryable):
|
|
10
11
|
_resource: ClassVar = 'kyc_validations'
|
|
11
12
|
platform_id: str
|
|
12
|
-
attemps: Optional[int]
|
|
13
|
-
verification_id: Optional[str]
|
|
14
|
-
files_uri: Optional[List[str]]
|
|
15
|
-
|
|
16
|
-
|
|
17
|
-
schema_extra = {
|
|
13
|
+
attemps: Optional[int] = None
|
|
14
|
+
verification_id: Optional[str] = None
|
|
15
|
+
files_uri: Optional[List[str]] = None
|
|
16
|
+
model_config = ConfigDict(
|
|
17
|
+
json_schema_extra={
|
|
18
18
|
'example': {
|
|
19
19
|
'id': 'KVNEUInh69SuKXXmK95sROwQ',
|
|
20
20
|
'platform_id': 'PT8UEv02zBTcymd4Kd3MO6pg',
|
|
@@ -24,6 +24,7 @@ class KYCValidation(Creatable, Retrievable, Queryable):
|
|
|
24
24
|
'attemps': '1',
|
|
25
25
|
}
|
|
26
26
|
}
|
|
27
|
+
)
|
|
27
28
|
|
|
28
29
|
@classmethod
|
|
29
30
|
def create(
|
|
@@ -38,4 +39,6 @@ class KYCValidation(Creatable, Retrievable, Queryable):
|
|
|
38
39
|
force=force,
|
|
39
40
|
documents=documents,
|
|
40
41
|
)
|
|
41
|
-
return
|
|
42
|
+
return cast(
|
|
43
|
+
'KYCValidation', cls._create(**req.dict(), session=session)
|
|
44
|
+
)
|
|
@@ -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,
|
|
@@ -7,6 +7,7 @@ from cuenca_validations.types import (
|
|
|
7
7
|
KYCVerificationUpdateRequest,
|
|
8
8
|
Rfc,
|
|
9
9
|
)
|
|
10
|
+
from pydantic import ConfigDict
|
|
10
11
|
|
|
11
12
|
from ..http import Session, session as global_session
|
|
12
13
|
from .base import Creatable, Retrievable, Updateable
|
|
@@ -17,14 +18,13 @@ class KYCVerification(Creatable, Retrievable, Updateable):
|
|
|
17
18
|
|
|
18
19
|
platform_id: str
|
|
19
20
|
created_at: dt.datetime
|
|
20
|
-
deactivated_at: Optional[dt.datetime]
|
|
21
|
-
verification_id: Optional[str]
|
|
21
|
+
deactivated_at: Optional[dt.datetime] = None
|
|
22
|
+
verification_id: Optional[str] = None
|
|
22
23
|
curp: Optional[CurpField] = None
|
|
23
24
|
rfc: Optional[Rfc] = None
|
|
24
25
|
address: Optional[Address] = None
|
|
25
|
-
|
|
26
|
-
|
|
27
|
-
schema_extra = {
|
|
26
|
+
model_config = ConfigDict(
|
|
27
|
+
json_schema_extra={
|
|
28
28
|
'example': {
|
|
29
29
|
'id': 'KVNEUInh69SuKXXmK95sROwQ',
|
|
30
30
|
'updated_at': '2020-05-24T14:15:22Z',
|
|
@@ -36,16 +36,17 @@ class KYCVerification(Creatable, Retrievable, Updateable):
|
|
|
36
36
|
'address': Address.schema().get('example'),
|
|
37
37
|
}
|
|
38
38
|
}
|
|
39
|
+
)
|
|
39
40
|
|
|
40
41
|
@classmethod
|
|
41
42
|
def create(cls, session: Session = global_session) -> 'KYCVerification':
|
|
42
|
-
return cls._create(session=session)
|
|
43
|
+
return cast('KYCVerification', cls._create(session=session))
|
|
43
44
|
|
|
44
45
|
@classmethod
|
|
45
46
|
def update(
|
|
46
47
|
cls,
|
|
47
48
|
kyc_id: str,
|
|
48
|
-
curp:
|
|
49
|
+
curp: CurpField,
|
|
49
50
|
) -> 'KYCVerification':
|
|
50
51
|
req = KYCVerificationUpdateRequest(curp=curp)
|
|
51
|
-
return cls._update(id=kyc_id, **req.dict())
|
|
52
|
+
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 (
|
|
@@ -15,13 +15,13 @@ class LimitedWallet(Wallet):
|
|
|
15
15
|
_resource: ClassVar = 'limited_wallets'
|
|
16
16
|
_query_params: ClassVar = AccountQuery
|
|
17
17
|
account_number: Clabe
|
|
18
|
-
allowed_rfc: Optional[Rfc]
|
|
18
|
+
allowed_rfc: Optional[Rfc] = None
|
|
19
19
|
allowed_curp: CurpField
|
|
20
20
|
|
|
21
21
|
@classmethod
|
|
22
22
|
def create(
|
|
23
23
|
cls,
|
|
24
|
-
allowed_curp:
|
|
24
|
+
allowed_curp: CurpField,
|
|
25
25
|
allowed_rfc: Optional[Rfc] = None,
|
|
26
26
|
) -> 'LimitedWallet':
|
|
27
27
|
"""
|
|
@@ -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()))
|
cuenca/resources/login_tokens.py
CHANGED
|
@@ -1,4 +1,6 @@
|
|
|
1
|
-
from typing import ClassVar
|
|
1
|
+
from typing import ClassVar, cast
|
|
2
|
+
|
|
3
|
+
from pydantic import ConfigDict
|
|
2
4
|
|
|
3
5
|
from ..http import Session, session as global_session
|
|
4
6
|
from .base import Creatable
|
|
@@ -6,9 +8,9 @@ from .base import Creatable
|
|
|
6
8
|
|
|
7
9
|
class LoginToken(Creatable):
|
|
8
10
|
_resource: ClassVar = 'login_tokens'
|
|
9
|
-
|
|
10
|
-
|
|
11
|
-
|
|
11
|
+
model_config = ConfigDict(
|
|
12
|
+
json_schema_extra={'example': {'id': 'LTNEUInh69SuKXXmK95sROwQ'}}
|
|
13
|
+
)
|
|
12
14
|
|
|
13
15
|
@classmethod
|
|
14
16
|
def create(cls, session: Session = global_session) -> 'LoginToken':
|
|
@@ -17,4 +19,4 @@ class LoginToken(Creatable):
|
|
|
17
19
|
Make sure to store this token in a safe place
|
|
18
20
|
:return: Token that you can use in cuenca.configure
|
|
19
21
|
"""
|
|
20
|
-
return cls._create(session=session)
|
|
22
|
+
return cast('LoginToken', cls._create(session=session))
|
cuenca/resources/otps.py
CHANGED
|
@@ -1,5 +1,7 @@
|
|
|
1
1
|
from typing import ClassVar, cast
|
|
2
2
|
|
|
3
|
+
from pydantic import ConfigDict
|
|
4
|
+
|
|
3
5
|
from ..http import Session, session as global_session
|
|
4
6
|
from .base import Creatable
|
|
5
7
|
|
|
@@ -7,14 +9,14 @@ from .base import Creatable
|
|
|
7
9
|
class Otp(Creatable):
|
|
8
10
|
_resource: ClassVar = 'otps'
|
|
9
11
|
secret: str
|
|
10
|
-
|
|
11
|
-
|
|
12
|
-
schema_extra = {
|
|
12
|
+
model_config = ConfigDict(
|
|
13
|
+
json_schema_extra={
|
|
13
14
|
'example': {
|
|
14
15
|
'id': 'OTNEUInh69SuKXXmK95sROwQ',
|
|
15
16
|
'secret': 'somesecret',
|
|
16
17
|
}
|
|
17
18
|
}
|
|
19
|
+
)
|
|
18
20
|
|
|
19
21
|
@classmethod
|
|
20
22
|
def create(cls, session: Session = global_session) -> 'Otp':
|
cuenca/resources/platforms.py
CHANGED
|
@@ -1,7 +1,8 @@
|
|
|
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
|
+
from pydantic import ConfigDict, Field
|
|
5
6
|
|
|
6
7
|
from ..http import Session, session as global_session
|
|
7
8
|
from .base import Creatable
|
|
@@ -11,33 +12,28 @@ class Platform(Creatable):
|
|
|
11
12
|
_resource: ClassVar = 'platforms'
|
|
12
13
|
|
|
13
14
|
created_at: dt.datetime
|
|
14
|
-
name: str
|
|
15
|
-
rfc: Optional[str] = None
|
|
16
|
-
establishment_date: Optional[dt.date] =
|
|
17
|
-
|
|
18
|
-
|
|
19
|
-
|
|
20
|
-
|
|
21
|
-
|
|
22
|
-
|
|
23
|
-
|
|
24
|
-
|
|
25
|
-
|
|
26
|
-
|
|
27
|
-
|
|
28
|
-
|
|
29
|
-
|
|
30
|
-
|
|
31
|
-
|
|
32
|
-
|
|
33
|
-
|
|
34
|
-
|
|
35
|
-
|
|
36
|
-
'email_address': {
|
|
37
|
-
'description': 'email address to contact the platform'
|
|
38
|
-
},
|
|
39
|
-
}
|
|
40
|
-
schema_extra = {
|
|
15
|
+
name: str = Field(..., description='name of the platform being created')
|
|
16
|
+
rfc: Optional[str] = Field(None, description='RFC or CURP of the platform')
|
|
17
|
+
establishment_date: Optional[dt.date] = Field(
|
|
18
|
+
None, description='when the platform was established'
|
|
19
|
+
)
|
|
20
|
+
country: Optional[Country] = Field(
|
|
21
|
+
None, description='country where the platform resides'
|
|
22
|
+
)
|
|
23
|
+
state: Optional[State] = Field(
|
|
24
|
+
None, description='state where the platform resides'
|
|
25
|
+
)
|
|
26
|
+
economic_activity: Optional[str] = Field(
|
|
27
|
+
None, description='what the platform does'
|
|
28
|
+
)
|
|
29
|
+
email_address: Optional[str] = Field(
|
|
30
|
+
None, description='email address to contact the platform'
|
|
31
|
+
)
|
|
32
|
+
phone_number: Optional[str] = Field(
|
|
33
|
+
None, description='phone number to contact the platform'
|
|
34
|
+
)
|
|
35
|
+
model_config = ConfigDict(
|
|
36
|
+
json_schema_extra={
|
|
41
37
|
'example': {
|
|
42
38
|
'id': 'PT0123456789',
|
|
43
39
|
'name': 'Arteria',
|
|
@@ -50,14 +46,15 @@ class Platform(Creatable):
|
|
|
50
46
|
'phone_number': '+525555555555',
|
|
51
47
|
'email_address': 'art@eria.com',
|
|
52
48
|
}
|
|
53
|
-
}
|
|
49
|
+
},
|
|
50
|
+
)
|
|
54
51
|
|
|
55
52
|
@classmethod
|
|
56
53
|
def create(
|
|
57
54
|
cls,
|
|
58
55
|
name: str,
|
|
59
56
|
rfc: Optional[str] = None,
|
|
60
|
-
establishment_date: Optional[
|
|
57
|
+
establishment_date: Optional[dt.date] = None,
|
|
61
58
|
country: Optional[Country] = None,
|
|
62
59
|
state: Optional[State] = None,
|
|
63
60
|
economic_activity: Optional[str] = None,
|
|
@@ -76,4 +73,6 @@ class Platform(Creatable):
|
|
|
76
73
|
phone_number=phone_number,
|
|
77
74
|
email_address=email_address,
|
|
78
75
|
)
|
|
79
|
-
return
|
|
76
|
+
return cast(
|
|
77
|
+
'Platform', cls._create(session=session, **req.model_dump())
|
|
78
|
+
)
|
|
@@ -1,7 +1,8 @@
|
|
|
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
|
+
from pydantic import ConfigDict
|
|
5
6
|
|
|
6
7
|
from ..http import Session, session as global_session
|
|
7
8
|
from .base import Creatable, Retrievable
|
|
@@ -14,15 +15,15 @@ class Questionnaires(Creatable, Retrievable):
|
|
|
14
15
|
token: str
|
|
15
16
|
form_id: str
|
|
16
17
|
user_id: str
|
|
17
|
-
|
|
18
|
-
|
|
19
|
-
schema_extra = {
|
|
18
|
+
model_config = ConfigDict(
|
|
19
|
+
json_schema_extra={
|
|
20
20
|
'example': {
|
|
21
21
|
'user_id': 'US234i23jh23h4h23',
|
|
22
22
|
'token': '3223j23ij23ij3',
|
|
23
23
|
'alert_id': 'ALewifjwiejf',
|
|
24
24
|
}
|
|
25
25
|
}
|
|
26
|
+
)
|
|
26
27
|
|
|
27
28
|
@classmethod
|
|
28
29
|
def create(
|
|
@@ -38,4 +39,6 @@ class Questionnaires(Creatable, Retrievable):
|
|
|
38
39
|
token=token,
|
|
39
40
|
form_id=form_id,
|
|
40
41
|
)
|
|
41
|
-
return
|
|
42
|
+
return cast(
|
|
43
|
+
'Questionnaires', cls._create(session=session, **req.model_dump())
|
|
44
|
+
)
|
cuenca/resources/resources.py
CHANGED
|
@@ -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]:
|
cuenca/resources/savings.py
CHANGED
|
@@ -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,
|
|
@@ -17,8 +17,8 @@ class Saving(Wallet, Updateable):
|
|
|
17
17
|
_query_params: ClassVar = WalletQuery
|
|
18
18
|
name: str
|
|
19
19
|
category: SavingCategory
|
|
20
|
-
goal_amount: Optional[StrictPositiveInt]
|
|
21
|
-
goal_date: Optional[dt.datetime]
|
|
20
|
+
goal_amount: Optional[StrictPositiveInt] = None
|
|
21
|
+
goal_date: Optional[dt.datetime] = None
|
|
22
22
|
|
|
23
23
|
@classmethod
|
|
24
24
|
def create(
|
|
@@ -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()))
|
cuenca/resources/sessions.py
CHANGED
|
@@ -1,8 +1,8 @@
|
|
|
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
|
-
from pydantic import AnyUrl
|
|
5
|
+
from pydantic import AnyUrl, ConfigDict
|
|
6
6
|
|
|
7
7
|
from .. import http
|
|
8
8
|
from .base import Creatable, Queryable, Retrievable
|
|
@@ -16,12 +16,11 @@ class Session(Creatable, Retrievable, Queryable):
|
|
|
16
16
|
user_id: str
|
|
17
17
|
platform_id: str
|
|
18
18
|
expires_at: dt.datetime
|
|
19
|
-
success_url: Optional[AnyUrl]
|
|
20
|
-
failure_url: Optional[AnyUrl]
|
|
21
|
-
type: Optional[SessionType]
|
|
22
|
-
|
|
23
|
-
|
|
24
|
-
schema_extra = {
|
|
19
|
+
success_url: Optional[AnyUrl] = None
|
|
20
|
+
failure_url: Optional[AnyUrl] = None
|
|
21
|
+
type: Optional[SessionType] = None
|
|
22
|
+
model_config = ConfigDict(
|
|
23
|
+
json_schema_extra={
|
|
25
24
|
'example': {
|
|
26
25
|
'id': 'SENEUInh69SuKXXmK95sROwQ',
|
|
27
26
|
'created_at': '2022-08-24T14:15:22Z',
|
|
@@ -33,14 +32,15 @@ class Session(Creatable, Retrievable, Queryable):
|
|
|
33
32
|
'type': 'session.registration',
|
|
34
33
|
}
|
|
35
34
|
}
|
|
35
|
+
)
|
|
36
36
|
|
|
37
37
|
@classmethod
|
|
38
38
|
def create(
|
|
39
39
|
cls,
|
|
40
40
|
user_id: str,
|
|
41
41
|
type: SessionType,
|
|
42
|
-
success_url
|
|
43
|
-
failure_url
|
|
42
|
+
success_url=cast(Optional[AnyUrl], success_url),
|
|
43
|
+
failure_url=cast(Optional[AnyUrl], failure_url),
|
|
44
44
|
*,
|
|
45
45
|
session: http.Session = http.session,
|
|
46
46
|
) -> 'Session':
|
|
@@ -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()))
|
cuenca/resources/transfers.py
CHANGED
|
@@ -1,6 +1,7 @@
|
|
|
1
1
|
import datetime as dt
|
|
2
2
|
from typing import ClassVar, List, Optional, cast
|
|
3
3
|
|
|
4
|
+
from clabe import Clabe
|
|
4
5
|
from cuenca_validations.types import (
|
|
5
6
|
TransferNetwork,
|
|
6
7
|
TransferQuery,
|
|
@@ -25,7 +26,7 @@ class Transfer(Transaction, Creatable):
|
|
|
25
26
|
idempotency_key: str
|
|
26
27
|
network: TransferNetwork
|
|
27
28
|
destination_uri: str
|
|
28
|
-
tracking_key: Optional[str] # clave rastreo if network is SPEI
|
|
29
|
+
tracking_key: Optional[str] = None # clave rastreo if network is SPEI
|
|
29
30
|
|
|
30
31
|
@property # type: ignore
|
|
31
32
|
def destination(self) -> Account:
|
|
@@ -62,14 +63,14 @@ class Transfer(Transaction, Creatable):
|
|
|
62
63
|
if not idempotency_key:
|
|
63
64
|
idempotency_key = cls._gen_idempotency_key(account_number, amount)
|
|
64
65
|
req = TransferRequest(
|
|
65
|
-
account_number=account_number,
|
|
66
|
+
account_number=cast(Clabe, account_number),
|
|
66
67
|
amount=amount,
|
|
67
68
|
descriptor=descriptor,
|
|
68
69
|
recipient_name=recipient_name,
|
|
69
70
|
idempotency_key=idempotency_key,
|
|
70
71
|
user_id=user_id,
|
|
71
72
|
)
|
|
72
|
-
return cls._create(**req.dict())
|
|
73
|
+
return cast('Transfer', cls._create(**req.dict()))
|
|
73
74
|
|
|
74
75
|
@classmethod
|
|
75
76
|
def create_many(cls, requests: List[TransferRequest]) -> DictStrAny:
|
|
@@ -90,4 +91,4 @@ class Transfer(Transaction, Creatable):
|
|
|
90
91
|
idempotency_key, but this provides some level of protection against
|
|
91
92
|
submitting duplicate transfers
|
|
92
93
|
"""
|
|
93
|
-
return f'{dt.datetime.utcnow().date()}:{account_number}:{amount}'
|
|
94
|
+
return f'{dt.datetime.utcnow().date()}: {account_number}: {amount}'
|
|
@@ -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
|
+
)
|