cuenca 2.2.0.dev3__py3-none-any.whl → 2.2.2__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/__init__.py CHANGED
@@ -1,5 +1,7 @@
1
1
  __all__ = [
2
2
  '__version__',
3
+ 'Agent',
4
+ 'AgentVerification',
3
5
  'ApiKey',
4
6
  'Account',
5
7
  'Arpc',
@@ -53,6 +55,8 @@ __all__ = [
53
55
  from . import http
54
56
  from .resources import (
55
57
  Account,
58
+ Agent,
59
+ AgentVerification,
56
60
  ApiKey,
57
61
  Arpc,
58
62
  BalanceEntry,
@@ -1,4 +1,6 @@
1
1
  __all__ = [
2
+ 'Agent',
3
+ 'AgentVerification',
2
4
  'ApiKey',
3
5
  'Account',
4
6
  'Arpc',
@@ -47,6 +49,8 @@ __all__ = [
47
49
  ]
48
50
 
49
51
  from .accounts import Account
52
+ from .agent_verifications import AgentVerification
53
+ from .agents import Agent
50
54
  from .api_keys import ApiKey
51
55
  from .arpc import Arpc
52
56
  from .balance_entries import BalanceEntry
@@ -96,6 +100,8 @@ from .whatsapp_transfers import WhatsappTransfer
96
100
 
97
101
  # avoid circular imports
98
102
  resource_classes = [
103
+ Agent,
104
+ AgentVerification,
99
105
  ApiKey,
100
106
  Account,
101
107
  Arpc,
@@ -0,0 +1,37 @@
1
+ import datetime as dt
2
+ from typing import ClassVar
3
+
4
+ from cuenca_validations.types.identities import PhoneNumber
5
+ from pydantic import ConfigDict
6
+
7
+ from ..http import Session, session as global_session
8
+ from .base import Creatable
9
+
10
+
11
+ class AgentVerification(Creatable):
12
+ _resource: ClassVar = 'agent_verifications'
13
+
14
+ created_at: dt.datetime
15
+ user_id: str
16
+ platform_id: str
17
+ phone_number: PhoneNumber
18
+ pairing_code: str
19
+ deactivated_at: dt.datetime
20
+
21
+ model_config = ConfigDict(
22
+ json_schema_extra={
23
+ 'example': {
24
+ 'id': 'AVjTtPH1mhT65GEgOeomJ4DQ',
25
+ 'created_at': '2026-06-25T22:50:08.495768',
26
+ 'user_id': 'USMP3EPgI4T4CPFyVmXUPi8A',
27
+ 'platform_id': 'PTZbBlk__kQt-wfwzP5nwA9A',
28
+ 'phone_number': '+525512345678',
29
+ 'pairing_code': 'OJC37W',
30
+ 'deactivated_at': '2026-06-25T22:55:08.495779',
31
+ }
32
+ }
33
+ )
34
+
35
+ @classmethod
36
+ def create(cls, session: Session = global_session) -> 'AgentVerification':
37
+ return cls._create(session=session)
@@ -0,0 +1,52 @@
1
+ import datetime as dt
2
+ from typing import ClassVar, Optional
3
+
4
+ from cuenca_validations.types import AgentQuery, AgentRequest, PhoneNumber
5
+ from cuenca_validations.typing import DictStrAny
6
+ from pydantic import ConfigDict, Field
7
+
8
+ from ..http import Session, session as global_session
9
+ from .base import Creatable, Queryable
10
+
11
+
12
+ class Agent(Creatable, Queryable):
13
+ _resource: ClassVar = 'agents'
14
+ _query_params: ClassVar = AgentQuery
15
+
16
+ created_at: dt.datetime
17
+ user_id: str
18
+ platform_id: str
19
+ agent_verification_id: str
20
+ session_id: str
21
+ device_info: DictStrAny = Field(default_factory=dict)
22
+ deactivated_at: Optional[dt.datetime] = None
23
+
24
+ model_config = ConfigDict(
25
+ json_schema_extra={
26
+ 'example': {
27
+ 'id': 'AG1G6Bm0oGQOCRjTDaeFSsyA',
28
+ 'created_at': '2026-06-27T01:56:42.613781',
29
+ 'user_id': 'USMP3EPgI4T4CPFyVmXUPi8A',
30
+ 'platform_id': 'PTZbBlk__kQt-wfwzP5nwA9A',
31
+ 'agent_verification_id': 'AV7A1FLC7MSnqKcb7oAkiQxA',
32
+ 'session_id': 'SSH0M5yteyRHas-PmfT9pu9w',
33
+ 'device_info': {'client': 'cursor', 'os': 'macOS'},
34
+ }
35
+ }
36
+ )
37
+
38
+ @classmethod
39
+ def create(
40
+ cls,
41
+ pairing_code: str,
42
+ phone_number: PhoneNumber,
43
+ device_info: Optional[DictStrAny] = None,
44
+ *,
45
+ session: Session = global_session,
46
+ ) -> 'Agent':
47
+ req = AgentRequest(
48
+ pairing_code=pairing_code,
49
+ phone_number=phone_number,
50
+ device_info=device_info or {},
51
+ )
52
+ return cls._create(session=session, **req.model_dump())
@@ -27,8 +27,14 @@ class PasswordReset(Creatable):
27
27
  'id': 'PRNEUInh69SuKXXmK95sROwQ',
28
28
  'platform_id': 'PT-1234567890',
29
29
  'flow_id': '123e4567-e89b-12d3-a456-426614174000',
30
- 'status': 'created',
30
+ 'status': 'succeeded',
31
+ 'provider_url': (
32
+ 'https://dashboard.metamap.com/identity/'
33
+ 'identity-id/verification/verification-id'
34
+ ),
31
35
  'created_at': '2026-05-06T14:15:22Z',
36
+ 'updated_at': '2026-05-06T14:18:22Z',
37
+ 'deactivated_at': '2026-05-06T14:20:22Z',
32
38
  }
33
39
  }
34
40
  )
@@ -2,20 +2,23 @@ import datetime as dt
2
2
  from typing import ClassVar, Optional, cast
3
3
 
4
4
  from cuenca_validations.types import (
5
+ TransactionStatus,
5
6
  TransferNetwork,
6
7
  TransferQuery,
7
8
  TransferRequest,
9
+ UpdateTransferRequest,
8
10
  )
9
11
  from cuenca_validations.typing import DictStrAny
10
12
  from requests import HTTPError
11
13
 
12
14
  from ..exc import CuencaException
15
+ from ..http import Session, session as global_session
13
16
  from .accounts import Account
14
- from .base import Creatable, Transaction
17
+ from .base import Creatable, Transaction, Updateable
15
18
  from .resources import retrieve_uri
16
19
 
17
20
 
18
- class Transfer(Transaction, Creatable):
21
+ class Transfer(Transaction, Creatable, Updateable):
19
22
  _resource: ClassVar = 'transfers'
20
23
  _query_params: ClassVar = TransferQuery
21
24
 
@@ -71,6 +74,17 @@ class Transfer(Transaction, Creatable):
71
74
  )
72
75
  return cls._create(**req.model_dump())
73
76
 
77
+ @classmethod
78
+ def update(
79
+ cls,
80
+ transfer_id: str,
81
+ status: TransactionStatus,
82
+ *,
83
+ session: Session = global_session,
84
+ ) -> 'Transfer':
85
+ req = UpdateTransferRequest(status=status)
86
+ return cls._update(transfer_id, session=session, **req.model_dump())
87
+
74
88
  @classmethod
75
89
  def create_many(cls, requests: list[TransferRequest]) -> DictStrAny:
76
90
  transfers: DictStrAny = dict(submitted=[], errors=[])
cuenca/version.py CHANGED
@@ -1,3 +1,3 @@
1
- __version__ = '2.2.0.dev3'
1
+ __version__ = '2.2.2'
2
2
  CLIENT_VERSION = __version__
3
3
  API_VERSION = '2020-03-19'
@@ -1,6 +1,6 @@
1
1
  Metadata-Version: 2.4
2
2
  Name: cuenca
3
- Version: 2.2.0.dev3
3
+ Version: 2.2.2
4
4
  Summary: Cuenca API Client
5
5
  Home-page: https://github.com/cuenca-mx/cuenca-python
6
6
  Author: Cuenca
@@ -16,7 +16,7 @@ Requires-Python: >=3.9
16
16
  Description-Content-Type: text/markdown
17
17
  License-File: LICENSE
18
18
  Requires-Dist: requests>=2.32.0
19
- Requires-Dist: cuenca-validations>=2.1.27
19
+ Requires-Dist: cuenca-validations>=2.1.34
20
20
  Requires-Dist: pydantic-extra-types>=2.10.0
21
21
  Dynamic: author
22
22
  Dynamic: author-email
@@ -1,12 +1,14 @@
1
- cuenca/__init__.py,sha256=iRradQitV5UJnzDfw-ktkFFNIdpJq3NVcokoWASFm7Y,2018
1
+ cuenca/__init__.py,sha256=zsTFAP7_uZxDnJfbJGRQrIUICHU4AzIeaHW6bclI2Ag,2090
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=IA6Qcw9aCznvdDQ2PTSvzZaL-p3kfSnadRjljCUHLmM,83
5
+ cuenca/version.py,sha256=SSdgI7ZJEOlT96kX81QbeuZ0FMMjjtVc3XK7kyg-wcs,78
6
6
  cuenca/http/__init__.py,sha256=V5TG6Ro9d3VY7umzcbtanmvHlGkv-k71H0tqrdMyH-s,49
7
7
  cuenca/http/client.py,sha256=psXJiSgd3SUSJ5jwvhdBWsVMNadenG353BNVXdh7HMY,4168
8
- cuenca/resources/__init__.py,sha256=zbHBUgSJ4AR9i33k6NI9R2eFeXD-UwVCG0trGgU40U4,3535
8
+ cuenca/resources/__init__.py,sha256=mNwQjWDgH5lSndDpIQ5bmSoOc2kUfFeZgHV6nEX-gWM,3684
9
9
  cuenca/resources/accounts.py,sha256=5yfNxAHpxWFosoR4WrPrDGpBCRkaQk98V-w0wCPPXqU,345
10
+ cuenca/resources/agent_verifications.py,sha256=y3sE6gW6ce5IxJOUh8-8EuJ3I5xlYy28lIAkKKQub5k,1098
11
+ cuenca/resources/agents.py,sha256=QW4Zul4mUrJrPYq8h9bMWqcF5HVQXscsqWeo5CbApcQ,1644
10
12
  cuenca/resources/api_keys.py,sha256=p65ZUiAu51JhEL_fZDc7_DTR0PMcSa-YQeK9gRFY82s,2618
11
13
  cuenca/resources/arpc.py,sha256=a9gGIgpBV8RK2ePSPBxI5c4ET4MtKH6Po_HRiv73B5k,1689
12
14
  cuenca/resources/balance_entries.py,sha256=c2p9nXrKpMJ2xlQkTLP_ttycb1RitA979mP46mbZnEc,1073
@@ -32,7 +34,7 @@ cuenca/resources/kyc_validations.py,sha256=Omu4qaP0AFa6PDoU5V9gUQmiY8sxOzEuC7qS0
32
34
  cuenca/resources/limited_wallets.py,sha256=Z3pKMRmMFTAaCw-KdzGSWfYFHCpy-ZrBwOmalVfSdRU,1049
33
35
  cuenca/resources/login_tokens.py,sha256=vxRWqQznxdEUK0R80k0qC0BkTSZwZgUsC2neX8TTd8Q,799
34
36
  cuenca/resources/otps.py,sha256=dZEwns98N8uUtRBFCu6Qs6ySHARU9v3zTF6T5rpF43M,711
35
- cuenca/resources/password_resets.py,sha256=slzvroZVaUzETfHfoiDZFQukM2OJrtjtHF4H0yJ_fG0,1338
37
+ cuenca/resources/password_resets.py,sha256=Gsh4wAVWP9vagfTjxItX9AtthK7NQaNJlDYtoVoFlaE,1630
36
38
  cuenca/resources/phone_verification_associations.py,sha256=JydlFi57kVH-3qdCRMfj67tZSz6N--ZX5ULBe9Owu0Q,720
37
39
  cuenca/resources/platforms.py,sha256=ztGcI-cNnushMRqKqjPaZg_ioS1bpR4vR88osHAyYXw,2560
38
40
  cuenca/resources/postal_codes.py,sha256=FOC9P4nZCQVRHMGeG8wHiRtsD083EdHtcKGPuJKj8b8,467
@@ -43,7 +45,7 @@ cuenca/resources/service_providers.py,sha256=x-FNcyiUkdUsNCGudyLGYDbRkD2jPj8-T8U
43
45
  cuenca/resources/sessions.py,sha256=lWphgjG9SZl81ik7c9tuAI6OE4JUOF0ZfRBvmf4vwyQ,1764
44
46
  cuenca/resources/statements.py,sha256=PqMvhoE9cvBneXjaS7w4JnTzYdDakkCkbdNYrd7b8LI,282
45
47
  cuenca/resources/terms_of_service.py,sha256=jaYN7NAxgxR9t0MlExL4bRt9HDunb53Y8bCCZO01mKg,406
46
- cuenca/resources/transfers.py,sha256=v742SAGUIZfvYHfCNtk0hSm2uyhMGh00RbHIIJiqLzQ,3201
48
+ cuenca/resources/transfers.py,sha256=jCsnjM4EMRiRu_To0lAmpuVZbD_dKKL5gDHXxcg7ZoE,3640
47
49
  cuenca/resources/user_credentials.py,sha256=glpxUa5-aYhgJ1ZG1g_c1PAWaQ9eEWP01lauBaccSQQ,1356
48
50
  cuenca/resources/user_events.py,sha256=ktZBoG_dhdfOkyuCHBwWd3lxV3CfA74b9CMfhPTgDC4,739
49
51
  cuenca/resources/user_lists_validation.py,sha256=UrInfZRUVd4nODBIBOTH8ALEZ3pvdYS2_xfFR7UeNrc,1595
@@ -54,7 +56,7 @@ cuenca/resources/verifications.py,sha256=c90Pyd20EXLA5Wy0C1RABxjjivMB--q6yu6uK-R
54
56
  cuenca/resources/wallet_transactions.py,sha256=8ePZI3-GaEd658GPYizAfHK9GVwlkt1r95-mEb7T3Jg,1030
55
57
  cuenca/resources/webhooks.py,sha256=bGjuvkSP3GXo4Q6v8iZ40Md8xc4AQrEmAD3r40VJqxM,392
56
58
  cuenca/resources/whatsapp_transfers.py,sha256=YSL606FBOMGKjhyKK5TiF0di96zdDKoiVtjiz_Zl_ZI,902
57
- cuenca-2.2.0.dev3.dist-info/licenses/LICENSE,sha256=aWv5PmUiAcNENEAdghcVQSeU56pXJHWexJYgklK9XLg,1063
59
+ cuenca-2.2.2.dist-info/licenses/LICENSE,sha256=aWv5PmUiAcNENEAdghcVQSeU56pXJHWexJYgklK9XLg,1063
58
60
  tests/__init__.py,sha256=47DEQpj8HBSa-_TImW-5JCeuQeRkm5NMpJWZG3hSuFU,0
59
61
  tests/conftest.py,sha256=0tgOjjZOitOvFcYU6GRJ29ySdFmDAM3FX8ZGKjJj3Ac,1828
60
62
  tests/test_cuenca.py,sha256=aeha_utz9YiHQg6eJK2PB7g66pVUYFi9U6pYMGXDKvk,1628
@@ -64,6 +66,7 @@ tests/http/conftest.py,sha256=TnVfv_s0eXC55HSJQotxIqV2Rl2WbgNt5Ow6z-ZOjZE,177
64
66
  tests/http/test_client.py,sha256=y0dhBDG4ZKbIvN_TENFGT920mzxwI535imQ99UuqgC0,2594
65
67
  tests/resources/__init__.py,sha256=47DEQpj8HBSa-_TImW-5JCeuQeRkm5NMpJWZG3hSuFU,0
66
68
  tests/resources/test_accounts.py,sha256=q7dD3k9Qj4qnl9v3aXmYSw6ShkLKD2W9FViFU_6VFeY,313
69
+ tests/resources/test_agents.py,sha256=pE2_8QpejfTrSz8FNQCtHiFe4bZwdMAMH8CaraGzEuI,672
67
70
  tests/resources/test_api_keys.py,sha256=1ipbhYGoho_12MnM9UKr5zHNPUk7s_JCXowv5TkmKwo,2272
68
71
  tests/resources/test_arpc.py,sha256=4lRd8fO5vf8rvoh1V8Rw9qjw__fdZCeIh4IEYlU0k5o,489
69
72
  tests/resources/test_balance_entries.py,sha256=myoHpr3XSef_smUijS60EXW7YHcmr6m9b6B_BVW-JtY,643
@@ -98,7 +101,7 @@ tests/resources/test_savings.py,sha256=2qlGo9Qy_bqwYfMmjf9OsPIPVWRb6zlkzaMgg5RWE
98
101
  tests/resources/test_service_providers.py,sha256=yhjTvRdVaTpwEHLVtvX8OD6bMef2W9wUI8MRwLY-i64,563
99
102
  tests/resources/test_sessions.py,sha256=iuRYfn8QVKp_JAbfkvnAuuVnaWSNoDhutpUkMd8SUgQ,1284
100
103
  tests/resources/test_statements.py,sha256=e9S_yn5kD6M8IpfpRmIOJ0Y6aggBkYWQxynY6P7Q7nI,370
101
- tests/resources/test_transfers.py,sha256=bW3igYOdYPDiZtLr8WVIYwfP-dV4sdJ9pbaXFps2ac8,4161
104
+ tests/resources/test_transfers.py,sha256=Xx9eCcE-J2RqWqvVF4LEQjvTd6_-WYP2u8-_p04DFrw,4994
102
105
  tests/resources/test_user_credentials.py,sha256=pJkIMIN4yMkj7AlaBMjI-e2O1YIoFWAh4r9C489GT7s,815
103
106
  tests/resources/test_user_events.py,sha256=aPTyrEVF7jBD8-UQZeVOLbUmj9sni0JRCYgootmaQ8c,292
104
107
  tests/resources/test_user_lists_validation.py,sha256=sZkjCYkySbWtOxM9NVSzZHaoOhXS7N0XD4buD3dke5E,1196
@@ -109,7 +112,7 @@ tests/resources/test_verifications.py,sha256=bBXR-pkmrs-_MekKo9iJS4TDkSyqZ65crsr
109
112
  tests/resources/test_wallet_transactions.py,sha256=_L2hjPHT4FwwhxksUoaoVHwFFYOGWfF4ScCbk0kb7Hw,3945
110
113
  tests/resources/test_webhooks.py,sha256=nYCqAnlNJcMJKRHhgoHOWTQnFLWQHHvFyY8GVCxGTD8,328
111
114
  tests/resources/test_whatsapp_transfers.py,sha256=4Dmrsbytx7LRrLQo9M8TAL7cGKJufPStkp51UdRCnYU,1030
112
- cuenca-2.2.0.dev3.dist-info/METADATA,sha256=nWEAevoa0d3g45W3PVIbXiuT_oIR837CArL7oth5j1k,4989
113
- cuenca-2.2.0.dev3.dist-info/WHEEL,sha256=aeYiig01lYGDzBgS8HxWXOg3uV61G9ijOsup-k9o1sk,91
114
- cuenca-2.2.0.dev3.dist-info/top_level.txt,sha256=5h3K7XJTmJniDloPq4sIJHni_xLw-Uoc6ZJ5mcw_lZY,13
115
- cuenca-2.2.0.dev3.dist-info/RECORD,,
115
+ cuenca-2.2.2.dist-info/METADATA,sha256=Gk8mHDX_2JxLkjYf0_n2JKq5E2RxKfAf3aASZ60KwCU,4984
116
+ cuenca-2.2.2.dist-info/WHEEL,sha256=aeYiig01lYGDzBgS8HxWXOg3uV61G9ijOsup-k9o1sk,91
117
+ cuenca-2.2.2.dist-info/top_level.txt,sha256=5h3K7XJTmJniDloPq4sIJHni_xLw-Uoc6ZJ5mcw_lZY,13
118
+ cuenca-2.2.2.dist-info/RECORD,,
@@ -0,0 +1,22 @@
1
+ import pytest
2
+
3
+ from cuenca.http.client import Session
4
+ from cuenca.resources import Agent, AgentVerification
5
+
6
+
7
+ @pytest.mark.vcr
8
+ def test_agent_create():
9
+ verification = AgentVerification.create() # Created by user in APP
10
+ agent_session = Session()
11
+ agent_session.configure(sandbox=True)
12
+ agent = Agent.create(
13
+ pairing_code=verification.pairing_code,
14
+ phone_number=verification.phone_number,
15
+ device_info={'client': 'cursor', 'os': 'macOS'},
16
+ session=agent_session,
17
+ )
18
+ assert agent.id
19
+ assert agent.agent_verification_id == verification.id
20
+ assert agent.session_id
21
+ assert agent.user_id
22
+ assert agent.platform_id
@@ -130,3 +130,33 @@ def test_invalid_params():
130
130
  with pytest.raises(ValidationError) as e:
131
131
  Transfer.one(invalid_param='invalid_param')
132
132
  assert 'Extra inputs are not permitted' in str(e)
133
+
134
+
135
+ @pytest.mark.vcr
136
+ def test_transfers_update_succeeded():
137
+ transfer = Transfer.update('TR01', status=TransactionStatus.succeeded)
138
+ assert transfer.id == 'TR01'
139
+ assert transfer.status == TransactionStatus.succeeded
140
+
141
+
142
+ @pytest.mark.vcr
143
+ def test_transfers_update_failed():
144
+ transfer = Transfer.update('TR02', status=TransactionStatus.failed)
145
+ assert transfer.id == 'TR02'
146
+ assert transfer.status == TransactionStatus.failed
147
+
148
+
149
+ @pytest.mark.parametrize(
150
+ 'invalid_status',
151
+ [
152
+ TransactionStatus.created,
153
+ TransactionStatus.submitted,
154
+ TransactionStatus.in_review,
155
+ 'cancelled',
156
+ 'approve',
157
+ 'reject',
158
+ ],
159
+ )
160
+ def test_transfers_update_rejects_invalid_status(invalid_status):
161
+ with pytest.raises(ValidationError):
162
+ Transfer.update('TR03', status=invalid_status)