cuenca 2.0.2.dev2__py3-none-any.whl → 2.0.2.dev3__py3-none-any.whl

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
@@ -1,7 +1,11 @@
1
1
  import datetime as dt
2
2
  from typing import Annotated, ClassVar, Optional
3
3
 
4
- from cuenca_validations.types import ApiKeyQuery, ApiKeyUpdateRequest, Metadata
4
+ from cuenca_validations.types import (
5
+ ApiKeyQuery,
6
+ ApiKeyUpdateRequest,
7
+ LogConfig,
8
+ )
5
9
  from pydantic import ConfigDict
6
10
 
7
11
  from ..http import Session, session as global_session
@@ -12,7 +16,7 @@ class ApiKey(Creatable, Queryable, Retrievable, Updateable):
12
16
  _resource: ClassVar = 'api_keys'
13
17
  _query_params: ClassVar = ApiKeyQuery
14
18
 
15
- secret: Annotated[str, Metadata(sensitive=True, log_chars=4)]
19
+ secret: Annotated[str, LogConfig(masked=True, unmasked_chars_length=4)]
16
20
  deactivated_at: Optional[dt.datetime] = None
17
21
  user_id: Optional[str] = None
18
22
  model_config = ConfigDict(
cuenca/resources/cards.py CHANGED
@@ -1,5 +1,5 @@
1
1
  import datetime as dt
2
- from typing import ClassVar, Optional
2
+ from typing import Annotated, ClassVar, Optional
3
3
 
4
4
  from cuenca_validations.types import (
5
5
  CardFundingType,
@@ -7,6 +7,7 @@ from cuenca_validations.types import (
7
7
  CardStatus,
8
8
  CardType,
9
9
  )
10
+ from cuenca_validations.types.general import LogConfig
10
11
  from cuenca_validations.types.queries import CardQuery
11
12
  from cuenca_validations.types.requests import CardRequest, CardUpdateRequest
12
13
 
@@ -22,7 +23,7 @@ class Card(Retrievable, Queryable, Creatable, Updateable):
22
23
  _query_params: ClassVar = CardQuery
23
24
 
24
25
  user_id: Optional[str] = None
25
- number: str
26
+ number: Annotated[str, LogConfig(masked=True, unmasked_chars_length=4)]
26
27
  exp_month: int
27
28
  exp_year: int
28
29
  cvv2: str
@@ -1,7 +1,7 @@
1
1
  import datetime as dt
2
2
  from typing import Annotated, ClassVar
3
3
 
4
- from cuenca_validations.types import Metadata
4
+ from cuenca_validations.types import LogConfig
5
5
  from pydantic import ConfigDict
6
6
 
7
7
  from ..http import Session, session as global_session
@@ -11,28 +11,16 @@ from .base import Creatable
11
11
  class JwtToken(Creatable):
12
12
  _resource: ClassVar = 'token'
13
13
 
14
- id: Annotated[str, Metadata(sensitive=True, log_chars=4)]
15
- token: Annotated[str, Metadata(sensitive=True, log_chars=4)]
14
+ id: Annotated[str, LogConfig(masked=True, unmasked_chars_length=4)]
15
+ token: Annotated[str, LogConfig(masked=True, unmasked_chars_length=4)]
16
16
  created_at: dt.datetime
17
17
  api_key_uri: str
18
18
 
19
19
  model_config = ConfigDict(
20
20
  json_schema_extra={
21
21
  'example': {
22
- 'id': (
23
- 'eyJ0eXAiOiJKV1QiLCJhbGciOiJIUzI1NiJ9.eyJleHAiOjE3MzgzNjI'
24
- '4NzcsImlhdCI6MTczNzc1ODA3Nywic3ViIjoiQUtzY3p5N3RzaVJkMkl'
25
- 'iakxfbllGb2xRIiwidWlkIjoiNjRiZmQ0OTItZGFhMy0xMWVmLWEyMWU'
26
- 'tMGE1OGE5ZmVhYzAyIn0.Er8kDsw4rtGkwAXpEgUhwyXFiBjYlwDVTGF'
27
- 'tYW7o0go'
28
- ),
29
- 'token': (
30
- 'eyJ0eXAiOiJKV1QiLCJhbGciOiJIUzI1NiJ9.eyJleHAiOjE3MzgzNjI'
31
- '4NzcsImlhdCI6MTczNzc1ODA3Nywic3ViIjoiQUtzY3p5N3RzaVJkMkl'
32
- 'iakxfbllGb2xRIiwidWlkIjoiNjRiZmQ0OTItZGFhMy0xMWVmLWEyMWU'
33
- 'tMGE1OGE5ZmVhYzAyIn0.Er8kDsw4rtGkwAXpEgUhwyXFiBjYlwDVTGF'
34
- 'tYW7o0go'
35
- ),
22
+ 'id': 'jwt_XXXX...redacted',
23
+ 'token': 'jwt_XXXX...redacted',
36
24
  'created_at': '2025-01-24T22:34:37.659667',
37
25
  'api_key_uri': '/api_key/AKsczy7tsiRd2IbjL_nYFolQ',
38
26
  }
@@ -1,6 +1,6 @@
1
1
  from typing import Annotated, ClassVar
2
2
 
3
- from cuenca_validations.types import Metadata
3
+ from cuenca_validations.types import LogConfig
4
4
  from pydantic import ConfigDict
5
5
 
6
6
  from ..http import Session, session as global_session
@@ -10,7 +10,7 @@ from .base import Creatable
10
10
  class LoginToken(Creatable):
11
11
  _resource: ClassVar = 'login_tokens'
12
12
 
13
- id: Annotated[str, Metadata(sensitive=True, log_chars=4)]
13
+ id: Annotated[str, LogConfig(masked=True, unmasked_chars_length=4)]
14
14
 
15
15
  model_config = ConfigDict(
16
16
  json_schema_extra={'example': {'id': 'LTNEUInh69SuKXXmK95sROwQ'}}
cuenca/resources/otps.py CHANGED
@@ -1,6 +1,6 @@
1
1
  from typing import Annotated, ClassVar
2
2
 
3
- from cuenca_validations.types import Metadata
3
+ from cuenca_validations.types import LogConfig
4
4
  from pydantic import ConfigDict
5
5
 
6
6
  from ..http import Session, session as global_session
@@ -9,7 +9,7 @@ from .base import Creatable
9
9
 
10
10
  class Otp(Creatable):
11
11
  _resource: ClassVar = 'otps'
12
- secret: Annotated[str, Metadata(sensitive=True, log_chars=4)]
12
+ secret: Annotated[str, LogConfig(masked=True)]
13
13
 
14
14
  model_config = ConfigDict(
15
15
  json_schema_extra={
@@ -1,7 +1,7 @@
1
1
  import datetime as dt
2
2
  from typing import Annotated, ClassVar, Optional
3
3
 
4
- from cuenca_validations.types import Metadata, SessionRequest, SessionType
4
+ from cuenca_validations.types import LogConfig, SessionRequest, SessionType
5
5
  from cuenca_validations.types.general import SerializableAnyUrl
6
6
  from pydantic import ConfigDict
7
7
 
@@ -12,7 +12,7 @@ from .base import Creatable, Queryable, Retrievable
12
12
  class Session(Creatable, Retrievable, Queryable):
13
13
  _resource: ClassVar = 'sessions'
14
14
 
15
- id: Annotated[str, Metadata(sensitive=True, log_chars=4)]
15
+ id: Annotated[str, LogConfig(masked=True, unmasked_chars_length=4)]
16
16
  created_at: dt.datetime
17
17
  user_id: str
18
18
  platform_id: str
@@ -1,6 +1,7 @@
1
1
  import datetime as dt
2
- from typing import ClassVar, Optional
2
+ from typing import Annotated, ClassVar, Optional
3
3
 
4
+ from cuenca_validations.types import LogConfig
4
5
  from cuenca_validations.types.requests import UserLoginRequest
5
6
  from pydantic import ConfigDict
6
7
 
@@ -11,6 +12,8 @@ from .base import Creatable
11
12
  class UserLogin(Creatable):
12
13
  _resource: ClassVar = 'user_logins'
13
14
 
15
+ id: Annotated[str, LogConfig(masked=True, unmasked_chars_length=4)]
16
+
14
17
  last_login_at: Optional[dt.datetime] = None
15
18
  success: bool
16
19
 
cuenca/version.py CHANGED
@@ -1,3 +1,3 @@
1
- __version__ = '2.0.2.dev2'
1
+ __version__ = '2.0.2.dev3'
2
2
  CLIENT_VERSION = __version__
3
3
  API_VERSION = '2020-03-19'
@@ -1,6 +1,6 @@
1
1
  Metadata-Version: 2.2
2
2
  Name: cuenca
3
- Version: 2.0.2.dev2
3
+ Version: 2.0.2.dev3
4
4
  Summary: Cuenca API Client
5
5
  Home-page: https://github.com/cuenca-mx/cuenca-python
6
6
  Author: Cuenca
@@ -2,12 +2,12 @@ cuenca/__init__.py,sha256=KQOScdvJ-rAsCugliTHsrxnV2A2hCLVpKnwaJpv3qO0,1790
2
2
  cuenca/exc.py,sha256=r_lL03-JS0AsXw71wuNbiwNYLHNDagM56tRxpYyK6Lw,601
3
3
  cuenca/jwt.py,sha256=plB2ttHPZnL0xq3gqubw_Jjtj1QYG2E5bk99N3cn5zg,1502
4
4
  cuenca/py.typed,sha256=47DEQpj8HBSa-_TImW-5JCeuQeRkm5NMpJWZG3hSuFU,0
5
- cuenca/version.py,sha256=gZQRh2bP1f-_MY4q1BhAFxSZzHX348pzlNkuf7IkoYA,83
5
+ cuenca/version.py,sha256=RvzOUU21v_rwXoaEy5BbpAwM8jtYQSvofcREkq3B3uc,83
6
6
  cuenca/http/__init__.py,sha256=V5TG6Ro9d3VY7umzcbtanmvHlGkv-k71H0tqrdMyH-s,49
7
7
  cuenca/http/client.py,sha256=psXJiSgd3SUSJ5jwvhdBWsVMNadenG353BNVXdh7HMY,4168
8
8
  cuenca/resources/__init__.py,sha256=hD0V8_D3DV4aRZSR7hYrrQ-qRXvlVBxilnIEPa4H9nw,3082
9
9
  cuenca/resources/accounts.py,sha256=5yfNxAHpxWFosoR4WrPrDGpBCRkaQk98V-w0wCPPXqU,345
10
- cuenca/resources/api_keys.py,sha256=Sy9QZpcFDNqZrZnAEzG63pKt2igE9CgyxyOrCvjUhEs,2615
10
+ cuenca/resources/api_keys.py,sha256=kKu7AX-UOI3babPmz7UW5nRgIexDoEZY7MIFuualLCQ,2643
11
11
  cuenca/resources/arpc.py,sha256=a9gGIgpBV8RK2ePSPBxI5c4ET4MtKH6Po_HRiv73B5k,1689
12
12
  cuenca/resources/balance_entries.py,sha256=c2p9nXrKpMJ2xlQkTLP_ttycb1RitA979mP46mbZnEc,1073
13
13
  cuenca/resources/base.py,sha256=_DFyX6OOjhm2UO5KSCsupBJYHQYDNzhaZudvy1U8VS8,5742
@@ -15,7 +15,7 @@ cuenca/resources/bill_payments.py,sha256=spZSVCkLoJTOJIvfYim3R1JEUCvCKdRqLmr98M9
15
15
  cuenca/resources/card_activations.py,sha256=hesiP9PWC8pryEv4U-FOVOHZ_X9Il1VhX1dps8PBXUg,1290
16
16
  cuenca/resources/card_transactions.py,sha256=3jrItWf4wOdY1Dd27gUwsrWqHUOXMzGeHzLt9MvW18o,1084
17
17
  cuenca/resources/card_validations.py,sha256=g-ly5Jr2pvWZBIDWp6K9cR7A5YjEZ9PQPaYQRPshZp4,1909
18
- cuenca/resources/cards.py,sha256=wEQo4H-W2qSelYbaaCfj4c2AbZYAzFyA1Y3FjjQZ-tA,3396
18
+ cuenca/resources/cards.py,sha256=DEFAIGD7L1-mTJ705A3i2JTJGz8n-nAkLKQOoEPp6fI,3522
19
19
  cuenca/resources/cash_references.py,sha256=ZVN4ed8pRV3u0BshE3OPJB76FMfLKWHm1rwnk2KvbLc,195
20
20
  cuenca/resources/clabes.py,sha256=mIWnOXLpUQMBRlhaoY5xv0vQXRnZz9basMD99RbUXuc,370
21
21
  cuenca/resources/commissions.py,sha256=Fz5kHq7FPJl8Z0qiu5_z-Ws2jEPqGi1x2OOwXCCM-Yw,513
@@ -26,24 +26,24 @@ cuenca/resources/file_batches.py,sha256=2Fsmz8ryOjvLn3dpsyR0G2iS0zNVR4ajovNkaMZa
26
26
  cuenca/resources/files.py,sha256=WZYRo76fIGXNXk2HzA252dSdIdA4bl3EjB6q0bb6BFg,1837
27
27
  cuenca/resources/identities.py,sha256=IdL495eTjx_2gDRxM9oG_QmDNOwaY7Nv9gzqeZu_Wdk,1092
28
28
  cuenca/resources/identity_events.py,sha256=K1G6IEGlw6n482nZhBo_CJNBdpKFCO6duMQr5y9k4x8,374
29
- cuenca/resources/jwt_tokens.py,sha256=xxZBBNNj9HylTAAT8NVbx2xExq_JLoF98cIUuUOw3U8,1621
29
+ cuenca/resources/jwt_tokens.py,sha256=NSFLMcWKPZLcVR6g8X-RIQ9e4i7VDoQvrkp3GLiapEc,952
30
30
  cuenca/resources/kyc_validations.py,sha256=1G_dr6e1mpLUlqT9RmBgiC06eh0vQjMzosM5w3ZCQoE,1322
31
31
  cuenca/resources/kyc_verifications.py,sha256=ysvVS9zdvFZ1Wyh2G_cr_IMwYeLW5BRLVyAt46hTk4g,1563
32
32
  cuenca/resources/limited_wallets.py,sha256=Z3pKMRmMFTAaCw-KdzGSWfYFHCpy-ZrBwOmalVfSdRU,1049
33
- cuenca/resources/login_tokens.py,sha256=52AOEUngx5uNjUWXNp0icSFGIqu0e2ZulK5JkK7RV0o,788
34
- cuenca/resources/otps.py,sha256=uYPJkBxFSMflAAfQo6GccR1CGSqu93n-OGTlPQmYsJg,725
33
+ cuenca/resources/login_tokens.py,sha256=vxRWqQznxdEUK0R80k0qC0BkTSZwZgUsC2neX8TTd8Q,799
34
+ cuenca/resources/otps.py,sha256=dZEwns98N8uUtRBFCu6Qs6ySHARU9v3zTF6T5rpF43M,711
35
35
  cuenca/resources/platforms.py,sha256=ztGcI-cNnushMRqKqjPaZg_ioS1bpR4vR88osHAyYXw,2560
36
36
  cuenca/resources/questionnaires.py,sha256=TKICPHghEhER83byMhe75Wb798K5veqv47RafYA5VOM,1043
37
37
  cuenca/resources/resources.py,sha256=sDkVwN-RguyoQXJhSYCa95Cem1AUmcgMJeFJveVf6Q0,912
38
38
  cuenca/resources/savings.py,sha256=3DBP1ygxhcScDpLvAQS_fF5chljyDTz4xwnltI0LCAg,1433
39
39
  cuenca/resources/service_providers.py,sha256=x-FNcyiUkdUsNCGudyLGYDbRkD2jPj8-T8U3IumxTVQ,310
40
- cuenca/resources/sessions.py,sha256=I7bpCcglL9BhV6mG2DkJp-fLGnnCyXO2rzZhMf_UsEE,1753
40
+ cuenca/resources/sessions.py,sha256=lWphgjG9SZl81ik7c9tuAI6OE4JUOF0ZfRBvmf4vwyQ,1764
41
41
  cuenca/resources/statements.py,sha256=PqMvhoE9cvBneXjaS7w4JnTzYdDakkCkbdNYrd7b8LI,282
42
42
  cuenca/resources/transfers.py,sha256=v742SAGUIZfvYHfCNtk0hSm2uyhMGh00RbHIIJiqLzQ,3201
43
43
  cuenca/resources/user_credentials.py,sha256=glpxUa5-aYhgJ1ZG1g_c1PAWaQ9eEWP01lauBaccSQQ,1356
44
44
  cuenca/resources/user_events.py,sha256=L57v7clStwxyJX2vwe-357uRTrzeQglDpCCgXRg7v9Y,728
45
45
  cuenca/resources/user_lists_validation.py,sha256=eOADDHKg-RthgeO50Edh4VQtQcNl2tHvdmXMYuGpsCA,1275
46
- cuenca/resources/user_logins.py,sha256=G78OPnxiOd4AVdBsk6UkEH2za-k3IPghRklTiElHYcc,1411
46
+ cuenca/resources/user_logins.py,sha256=KDauv2c5BJUR-C5ZeIjAPsv-8VH11BhoT-wCU9KgrwY,1542
47
47
  cuenca/resources/users.py,sha256=3qb0-_3KBQCooqFUrknQ28ywU2v7s4JMudrd65z5Q-0,6321
48
48
  cuenca/resources/verifications.py,sha256=YyvSh5IpiJ02lHK8k-guTwoHSFoaMYSFk1aC2tPi7n0,1680
49
49
  cuenca/resources/wallet_transactions.py,sha256=8ePZI3-GaEd658GPYizAfHK9GVwlkt1r95-mEb7T3Jg,1030
@@ -76,7 +76,7 @@ tests/resources/test_file_batches.py,sha256=xcVeWZns4j3_RPZEv8W1Ws4-bcaxOXTQzFyU
76
76
  tests/resources/test_files.py,sha256=2VSlvYnGHrw--mYNvA6hlpEw-olbW_Hlq2d4vdn8v7M,961
77
77
  tests/resources/test_identities.py,sha256=0osumiLrzKkGG4XLlL4nIdSp_nGutHaPf55w_IVREps,454
78
78
  tests/resources/test_identity_events.py,sha256=BZlM2RXKtCORdTDQCemY3NAR3KWb3mPNql4sd6oU4-U,344
79
- tests/resources/test_jwt_tokens.py,sha256=XBvtz2C2HbUXXyoxP2iq27nOkLgkUgGI7GSECJzVGRE,664
79
+ tests/resources/test_jwt_tokens.py,sha256=DnZS_kEGhtnb0KWFh9W0tJIiCvo_u1A3iXcu2h3z5WA,184
80
80
  tests/resources/test_kyc_validations.py,sha256=TEyS6encW-InRpcAR4nDCfmkqqnn8yMC9AaS3iWm8Xw,420
81
81
  tests/resources/test_kyc_verifications.py,sha256=Y-ZU61o18I_3NFqMN2w4WGZTzwsIhULAtESqIXiizUY,634
82
82
  tests/resources/test_limited_wallets.py,sha256=c0zDDOip3lJk8chbcGr_nWCdkO9yuL_HbD1IikR5jH4,527
@@ -99,8 +99,8 @@ tests/resources/test_verifications.py,sha256=yyL-bdryQU3MvqnmAgnnzGG9t7UTxWwPiVu
99
99
  tests/resources/test_wallet_transactions.py,sha256=_L2hjPHT4FwwhxksUoaoVHwFFYOGWfF4ScCbk0kb7Hw,3945
100
100
  tests/resources/test_webhooks.py,sha256=nYCqAnlNJcMJKRHhgoHOWTQnFLWQHHvFyY8GVCxGTD8,328
101
101
  tests/resources/test_whatsapp_transfers.py,sha256=4Dmrsbytx7LRrLQo9M8TAL7cGKJufPStkp51UdRCnYU,1030
102
- cuenca-2.0.2.dev2.dist-info/LICENSE,sha256=aWv5PmUiAcNENEAdghcVQSeU56pXJHWexJYgklK9XLg,1063
103
- cuenca-2.0.2.dev2.dist-info/METADATA,sha256=I7n7Fb5ZL3t69Kseco2DVKE3Za-Fe9n1Nr-IuYcvW9w,4966
104
- cuenca-2.0.2.dev2.dist-info/WHEEL,sha256=In9FTNxeP60KnTkGw7wk6mJPYd_dQSjEZmXdBdMCI-8,91
105
- cuenca-2.0.2.dev2.dist-info/top_level.txt,sha256=5h3K7XJTmJniDloPq4sIJHni_xLw-Uoc6ZJ5mcw_lZY,13
106
- cuenca-2.0.2.dev2.dist-info/RECORD,,
102
+ cuenca-2.0.2.dev3.dist-info/LICENSE,sha256=aWv5PmUiAcNENEAdghcVQSeU56pXJHWexJYgklK9XLg,1063
103
+ cuenca-2.0.2.dev3.dist-info/METADATA,sha256=DollwJgBvkx_N5bxRLdOXEQHFIteWhX8RpIDLC8VvMc,4966
104
+ cuenca-2.0.2.dev3.dist-info/WHEEL,sha256=In9FTNxeP60KnTkGw7wk6mJPYd_dQSjEZmXdBdMCI-8,91
105
+ cuenca-2.0.2.dev3.dist-info/top_level.txt,sha256=5h3K7XJTmJniDloPq4sIJHni_xLw-Uoc6ZJ5mcw_lZY,13
106
+ cuenca-2.0.2.dev3.dist-info/RECORD,,
@@ -1,28 +1,10 @@
1
1
  import pytest
2
2
 
3
- from cuenca import JwtToken, LoginToken, 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
3
+ from cuenca import JwtToken
16
4
 
17
5
 
18
6
  @pytest.mark.vcr
19
- def test_jwt_tokens(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
- jwt_token = JwtToken.create(session=session)
7
+ def test_jwt_tokens():
8
+ jwt_token = JwtToken.create()
27
9
  assert jwt_token
28
10
  assert isinstance(jwt_token.token, str)