From fcb5ae554bb67337f76a319737808b7f66d886d1 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Ra=C3=BAl=20Cabrera?= Date: Wed, 6 May 2026 14:43:09 -0600 Subject: [PATCH 1/6] Update cuenca-validations to version 2.1.31.dev0, increment internal version to 2.1.20.dev0, and add PasswordReset resource with tests. --- cuenca/__init__.py | 2 + cuenca/http/client.py | 2 +- cuenca/resources/__init__.py | 3 ++ cuenca/resources/password_resets.py | 54 +++++++++++++++++++++++++ cuenca/version.py | 2 +- requirements.txt | 2 +- tests/resources/test_password_resets.py | 29 +++++++++++++ 7 files changed, 91 insertions(+), 3 deletions(-) create mode 100644 cuenca/resources/password_resets.py create mode 100644 tests/resources/test_password_resets.py diff --git a/cuenca/__init__.py b/cuenca/__init__.py index c9595ed2..3e9a5e43 100644 --- a/cuenca/__init__.py +++ b/cuenca/__init__.py @@ -23,6 +23,7 @@ 'LimitedWallet', 'LoginToken', 'Otp', + 'PasswordReset', 'Platform', 'Questionnaires', 'Saving', @@ -76,6 +77,7 @@ LimitedWallet, LoginToken, Otp, + PasswordReset, PhoneVerificationAssociations, Platform, PostalCodes, diff --git a/cuenca/http/client.py b/cuenca/http/client.py index 1750432e..43d83dbc 100644 --- a/cuenca/http/client.py +++ b/cuenca/http/client.py @@ -18,7 +18,7 @@ from ..version import API_VERSION, CLIENT_VERSION API_HOST = 'api.cuenca.com' -SANDBOX_HOST = 'sandbox.cuenca.com' +SANDBOX_HOST = 'api.cuenca.com' class Session: diff --git a/cuenca/resources/__init__.py b/cuenca/resources/__init__.py index dd7bc412..a69347f4 100644 --- a/cuenca/resources/__init__.py +++ b/cuenca/resources/__init__.py @@ -23,6 +23,7 @@ 'LimitedWallet', 'LoginToken', 'Otp', + 'PasswordReset', 'Platform', 'PhoneVerificationAssociation', 'Questionnaires', @@ -70,6 +71,7 @@ from .limited_wallets import LimitedWallet from .login_tokens import LoginToken from .otps import Otp +from .password_resets import PasswordReset from .phone_verification_associations import PhoneVerificationAssociations from .platforms import Platform from .postal_codes import PostalCodes @@ -116,6 +118,7 @@ KYCValidation, LimitedWallet, LoginToken, + PasswordReset, Questionnaires, Saving, Session, diff --git a/cuenca/resources/password_resets.py b/cuenca/resources/password_resets.py new file mode 100644 index 00000000..87f0f41a --- /dev/null +++ b/cuenca/resources/password_resets.py @@ -0,0 +1,54 @@ +import datetime as dt +from typing import ClassVar, Optional + +from cuenca_validations.types import VerificationStatus +from cuenca_validations.types.requests import PasswordResetRequest +from pydantic import ConfigDict +from pydantic_extra_types.coordinate import Coordinate + +from ..http import Session, session as global_session +from .base import Creatable, Queryable, Retrievable + + +class PasswordReset(Creatable, Retrievable, Queryable): + _resource: ClassVar = 'password_resets' + + platform_id: str + verification_id: str + flow_id: str + status: VerificationStatus = VerificationStatus.created + mati_verification_id: Optional[str] = None + identity_id: Optional[str] = None + provider_url: Optional[str] = None + created_at: dt.datetime + updated_at: Optional[dt.datetime] = None + deactivated_at: Optional[dt.datetime] = None + + model_config = ConfigDict( + json_schema_extra={ + 'example': { + 'id': 'PRNEUInh69SuKXXmK95sROwQ', + 'platform_id': 'PT-1234567890', + 'verification_id': 'VENEUInh69SuKXXmK95sROwQ', + 'flow_id': '123e4567-e89b-12d3-a456-426614174000', + 'status': 'created', + 'mati_verification_id': 'metamap-verification-id', + 'identity_id': 'metamap-identity-id', + 'created_at': '2026-05-06T14:15:22Z', + } + } + ) + + @classmethod + def create( + cls, + verification_id: str, + location: Coordinate, + *, + session: Session = global_session, + ) -> 'PasswordReset': + req = PasswordResetRequest( + verification_id=verification_id, + location=location, + ) + return cls._create(session=session, **req.model_dump()) diff --git a/cuenca/version.py b/cuenca/version.py index e17b6e57..5af0a1f2 100644 --- a/cuenca/version.py +++ b/cuenca/version.py @@ -1,3 +1,3 @@ -__version__ = '2.1.19' +__version__ = '2.1.20.dev0' CLIENT_VERSION = __version__ API_VERSION = '2020-03-19' diff --git a/requirements.txt b/requirements.txt index e428c532..6c255a41 100644 --- a/requirements.txt +++ b/requirements.txt @@ -1,3 +1,3 @@ requests==2.32.3 -cuenca-validations==2.1.30 +cuenca-validations==2.1.31.dev0 pydantic-extra-types==2.10.2 diff --git a/tests/resources/test_password_resets.py b/tests/resources/test_password_resets.py new file mode 100644 index 00000000..c75e32d8 --- /dev/null +++ b/tests/resources/test_password_resets.py @@ -0,0 +1,29 @@ +import pytest +from pydantic_extra_types.coordinate import Coordinate, Latitude, Longitude + +from cuenca import PasswordReset + + +@pytest.mark.vcr +def test_password_resets_create() -> None: + password_reset = PasswordReset.create( + verification_id='VEze_Bh1zhROKehtBOS7EHlw', + location=Coordinate( + latitude=Latitude(19.432608), + longitude=Longitude(-99.133209), + ), + ) + assert password_reset.id.startswith('PR') + + +@pytest.mark.vcr +def test_password_resets_retrieve() -> None: + password_reset = PasswordReset.retrieve('PRFOO') + assert password_reset.id + assert password_reset.verification_id + + +@pytest.mark.vcr +def test_password_resets_all() -> None: + items = list(PasswordReset.all()) + assert items From 8663f4677a4ebca8f2d829299739b0a579b31be8 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Ra=C3=BAl=20Cabrera?= Date: Thu, 7 May 2026 18:16:12 -0600 Subject: [PATCH 2/6] Update cuenca-validations to version 2.1.31.dev1, remove verification_id from PasswordReset resource, and adjust related tests. --- cuenca/resources/password_resets.py | 8 +------- cuenca/version.py | 2 +- requirements.txt | 2 +- tests/resources/test_password_resets.py | 3 +-- 4 files changed, 4 insertions(+), 11 deletions(-) diff --git a/cuenca/resources/password_resets.py b/cuenca/resources/password_resets.py index 87f0f41a..8497b79a 100644 --- a/cuenca/resources/password_resets.py +++ b/cuenca/resources/password_resets.py @@ -14,7 +14,6 @@ class PasswordReset(Creatable, Retrievable, Queryable): _resource: ClassVar = 'password_resets' platform_id: str - verification_id: str flow_id: str status: VerificationStatus = VerificationStatus.created mati_verification_id: Optional[str] = None @@ -29,7 +28,6 @@ class PasswordReset(Creatable, Retrievable, Queryable): 'example': { 'id': 'PRNEUInh69SuKXXmK95sROwQ', 'platform_id': 'PT-1234567890', - 'verification_id': 'VENEUInh69SuKXXmK95sROwQ', 'flow_id': '123e4567-e89b-12d3-a456-426614174000', 'status': 'created', 'mati_verification_id': 'metamap-verification-id', @@ -42,13 +40,9 @@ class PasswordReset(Creatable, Retrievable, Queryable): @classmethod def create( cls, - verification_id: str, location: Coordinate, *, session: Session = global_session, ) -> 'PasswordReset': - req = PasswordResetRequest( - verification_id=verification_id, - location=location, - ) + req = PasswordResetRequest(location=location) return cls._create(session=session, **req.model_dump()) diff --git a/cuenca/version.py b/cuenca/version.py index 5af0a1f2..ef7e2bc6 100644 --- a/cuenca/version.py +++ b/cuenca/version.py @@ -1,3 +1,3 @@ -__version__ = '2.1.20.dev0' +__version__ = '2.1.20.dev1' CLIENT_VERSION = __version__ API_VERSION = '2020-03-19' diff --git a/requirements.txt b/requirements.txt index 6c255a41..798d45d9 100644 --- a/requirements.txt +++ b/requirements.txt @@ -1,3 +1,3 @@ requests==2.32.3 -cuenca-validations==2.1.31.dev0 +cuenca-validations==2.1.31.dev1 pydantic-extra-types==2.10.2 diff --git a/tests/resources/test_password_resets.py b/tests/resources/test_password_resets.py index c75e32d8..219e2f13 100644 --- a/tests/resources/test_password_resets.py +++ b/tests/resources/test_password_resets.py @@ -7,7 +7,6 @@ @pytest.mark.vcr def test_password_resets_create() -> None: password_reset = PasswordReset.create( - verification_id='VEze_Bh1zhROKehtBOS7EHlw', location=Coordinate( latitude=Latitude(19.432608), longitude=Longitude(-99.133209), @@ -20,7 +19,7 @@ def test_password_resets_create() -> None: def test_password_resets_retrieve() -> None: password_reset = PasswordReset.retrieve('PRFOO') assert password_reset.id - assert password_reset.verification_id + assert password_reset.flow_id @pytest.mark.vcr From 7c713241b3836c803673456e240d3385605231df Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Ra=C3=BAl=20Cabrera?= Date: Fri, 8 May 2026 14:33:14 -0600 Subject: [PATCH 3/6] Update SANDBOX_HOST to use sandbox.cuenca.com, remove Queryable from PasswordReset resource, and add test cassette for password reset creation. --- cuenca/http/client.py | 2 +- cuenca/resources/password_resets.py | 4 +- .../test_password_resets_create.yaml | 38 +++++++++++++++++++ tests/resources/test_password_resets.py | 13 ------- 4 files changed, 41 insertions(+), 16 deletions(-) create mode 100644 tests/resources/cassettes/test_password_resets_create.yaml diff --git a/cuenca/http/client.py b/cuenca/http/client.py index 43d83dbc..1750432e 100644 --- a/cuenca/http/client.py +++ b/cuenca/http/client.py @@ -18,7 +18,7 @@ from ..version import API_VERSION, CLIENT_VERSION API_HOST = 'api.cuenca.com' -SANDBOX_HOST = 'api.cuenca.com' +SANDBOX_HOST = 'sandbox.cuenca.com' class Session: diff --git a/cuenca/resources/password_resets.py b/cuenca/resources/password_resets.py index 8497b79a..c71be552 100644 --- a/cuenca/resources/password_resets.py +++ b/cuenca/resources/password_resets.py @@ -7,10 +7,10 @@ from pydantic_extra_types.coordinate import Coordinate from ..http import Session, session as global_session -from .base import Creatable, Queryable, Retrievable +from .base import Creatable -class PasswordReset(Creatable, Retrievable, Queryable): +class PasswordReset(Creatable): _resource: ClassVar = 'password_resets' platform_id: str diff --git a/tests/resources/cassettes/test_password_resets_create.yaml b/tests/resources/cassettes/test_password_resets_create.yaml new file mode 100644 index 00000000..0bf8a872 --- /dev/null +++ b/tests/resources/cassettes/test_password_resets_create.yaml @@ -0,0 +1,38 @@ +interactions: +- request: + body: '{"location": {"latitude": 19.432608, "longitude": -99.133209}}' + headers: + Accept: + - '*/*' + Accept-Encoding: + - gzip, deflate + Authorization: + - DUMMY + Connection: + - keep-alive + Content-Length: + - '62' + Content-Type: + - application/json + User-Agent: + - cuenca-python/2.1.20.dev1 + X-Cuenca-Api-Version: + - '2020-03-19' + method: POST + uri: https://api.stage.cuenca.com/password_resets + response: + body: + string: '{"id":"PR9tshvjCQT0KNEaW2MGCxFQ","identity_id":"69fccbd11cb7a08a26d59a2a","platform_id":"PTZbBlk__kQt-wfwZP5nwA9A","created_at":"2026-05-07T17:28:48.176876","updated_at":"2026-05-07T17:28:49.400276","deactivated_at":null,"verification_id":"VE9Wfa1nYLQSmJPH44Egh9UQ","flow_id":"69f8e0bc2a21320eeff89b37","mati_verification_id":"69fccbd11cb7a08a26d59a2c","status":"created","provider_url":null}' + headers: + Connection: + - keep-alive + Content-Length: + - '392' + Content-Type: + - application/json + Date: + - Wed, 07 May 2026 17:28:49 GMT + status: + code: 201 + message: Created +version: 1 diff --git a/tests/resources/test_password_resets.py b/tests/resources/test_password_resets.py index 219e2f13..6180c2ab 100644 --- a/tests/resources/test_password_resets.py +++ b/tests/resources/test_password_resets.py @@ -13,16 +13,3 @@ def test_password_resets_create() -> None: ), ) assert password_reset.id.startswith('PR') - - -@pytest.mark.vcr -def test_password_resets_retrieve() -> None: - password_reset = PasswordReset.retrieve('PRFOO') - assert password_reset.id - assert password_reset.flow_id - - -@pytest.mark.vcr -def test_password_resets_all() -> None: - items = list(PasswordReset.all()) - assert items From 1a49b907b4467dab2d486a47187c80a8ce1f89fe Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Ra=C3=BAl=20Cabrera?= Date: Fri, 8 May 2026 15:54:57 -0600 Subject: [PATCH 4/6] Increment version to 2.1.20.dev2 and update test cassette URI for password reset creation to use sandbox environment. --- cuenca/version.py | 2 +- tests/resources/cassettes/test_password_resets_create.yaml | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-) diff --git a/cuenca/version.py b/cuenca/version.py index ef7e2bc6..b9800897 100644 --- a/cuenca/version.py +++ b/cuenca/version.py @@ -1,3 +1,3 @@ -__version__ = '2.1.20.dev1' +__version__ = '2.1.20.dev2' CLIENT_VERSION = __version__ API_VERSION = '2020-03-19' diff --git a/tests/resources/cassettes/test_password_resets_create.yaml b/tests/resources/cassettes/test_password_resets_create.yaml index 0bf8a872..67b4fdc6 100644 --- a/tests/resources/cassettes/test_password_resets_create.yaml +++ b/tests/resources/cassettes/test_password_resets_create.yaml @@ -19,7 +19,7 @@ interactions: X-Cuenca-Api-Version: - '2020-03-19' method: POST - uri: https://api.stage.cuenca.com/password_resets + uri: https://sandbox.cuenca.com/password_resets response: body: string: '{"id":"PR9tshvjCQT0KNEaW2MGCxFQ","identity_id":"69fccbd11cb7a08a26d59a2a","platform_id":"PTZbBlk__kQt-wfwZP5nwA9A","created_at":"2026-05-07T17:28:48.176876","updated_at":"2026-05-07T17:28:49.400276","deactivated_at":null,"verification_id":"VE9Wfa1nYLQSmJPH44Egh9UQ","flow_id":"69f8e0bc2a21320eeff89b37","mati_verification_id":"69fccbd11cb7a08a26d59a2c","status":"created","provider_url":null}' From 99ef901e50cc6454e756b6cc8ac5ca21f982a936 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Ra=C3=BAl=20Cabrera?= Date: Tue, 12 May 2026 11:49:19 -0600 Subject: [PATCH 5/6] Update cuenca-validations to version 2.1.31, increment version to 2.2.0.dev3, and remove mati_verification_id and identity_id from PasswordReset resource. Adjust test cassette for password reset creation accordingly. --- cuenca/resources/password_resets.py | 4 ---- cuenca/version.py | 2 +- requirements.txt | 2 +- tests/resources/cassettes/test_password_resets_create.yaml | 6 +++--- 4 files changed, 5 insertions(+), 9 deletions(-) diff --git a/cuenca/resources/password_resets.py b/cuenca/resources/password_resets.py index c71be552..b204dab6 100644 --- a/cuenca/resources/password_resets.py +++ b/cuenca/resources/password_resets.py @@ -16,8 +16,6 @@ class PasswordReset(Creatable): platform_id: str flow_id: str status: VerificationStatus = VerificationStatus.created - mati_verification_id: Optional[str] = None - identity_id: Optional[str] = None provider_url: Optional[str] = None created_at: dt.datetime updated_at: Optional[dt.datetime] = None @@ -30,8 +28,6 @@ class PasswordReset(Creatable): 'platform_id': 'PT-1234567890', 'flow_id': '123e4567-e89b-12d3-a456-426614174000', 'status': 'created', - 'mati_verification_id': 'metamap-verification-id', - 'identity_id': 'metamap-identity-id', 'created_at': '2026-05-06T14:15:22Z', } } diff --git a/cuenca/version.py b/cuenca/version.py index b9800897..6cd8a47e 100644 --- a/cuenca/version.py +++ b/cuenca/version.py @@ -1,3 +1,3 @@ -__version__ = '2.1.20.dev2' +__version__ = '2.2.0.dev3' CLIENT_VERSION = __version__ API_VERSION = '2020-03-19' diff --git a/requirements.txt b/requirements.txt index 798d45d9..ff128c6f 100644 --- a/requirements.txt +++ b/requirements.txt @@ -1,3 +1,3 @@ requests==2.32.3 -cuenca-validations==2.1.31.dev1 +cuenca-validations==2.1.31 pydantic-extra-types==2.10.2 diff --git a/tests/resources/cassettes/test_password_resets_create.yaml b/tests/resources/cassettes/test_password_resets_create.yaml index 67b4fdc6..b5befd85 100644 --- a/tests/resources/cassettes/test_password_resets_create.yaml +++ b/tests/resources/cassettes/test_password_resets_create.yaml @@ -15,19 +15,19 @@ interactions: Content-Type: - application/json User-Agent: - - cuenca-python/2.1.20.dev1 + - cuenca-python/2.2.0.dev3 X-Cuenca-Api-Version: - '2020-03-19' method: POST uri: https://sandbox.cuenca.com/password_resets response: body: - string: '{"id":"PR9tshvjCQT0KNEaW2MGCxFQ","identity_id":"69fccbd11cb7a08a26d59a2a","platform_id":"PTZbBlk__kQt-wfwZP5nwA9A","created_at":"2026-05-07T17:28:48.176876","updated_at":"2026-05-07T17:28:49.400276","deactivated_at":null,"verification_id":"VE9Wfa1nYLQSmJPH44Egh9UQ","flow_id":"69f8e0bc2a21320eeff89b37","mati_verification_id":"69fccbd11cb7a08a26d59a2c","status":"created","provider_url":null}' + string: '{"id":"PR9tshvjCQT0KNEaW2MGCxFQ","platform_id":"PTZbBlk__kQt-wfwZP5nwA9A","created_at":"2026-05-07T17:28:48.176876","updated_at":"2026-05-07T17:28:49.400276","deactivated_at":null,"flow_id":"69f8e0bc2a21320eeff89b37","status":"created","provider_url":null}' headers: Connection: - keep-alive Content-Length: - - '392' + - '256' Content-Type: - application/json Date: From e517fe01cad22f7c50020c8aeeba28c2df2399ea Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Ra=C3=BAl=20Cabrera?= Date: Wed, 13 May 2026 19:22:23 -0600 Subject: [PATCH 6/6] Update version to 2.2.0 and enhance PasswordReset resource with additional timestamps for updated and deactivated states. --- cuenca/resources/password_resets.py | 8 +++++++- cuenca/version.py | 2 +- 2 files changed, 8 insertions(+), 2 deletions(-) diff --git a/cuenca/resources/password_resets.py b/cuenca/resources/password_resets.py index b204dab6..bdeca338 100644 --- a/cuenca/resources/password_resets.py +++ b/cuenca/resources/password_resets.py @@ -27,8 +27,14 @@ class PasswordReset(Creatable): 'id': 'PRNEUInh69SuKXXmK95sROwQ', 'platform_id': 'PT-1234567890', 'flow_id': '123e4567-e89b-12d3-a456-426614174000', - 'status': 'created', + 'status': 'succeeded', + 'provider_url': ( + 'https://dashboard.metamap.com/identity/' + 'identity-id/verification/verification-id' + ), 'created_at': '2026-05-06T14:15:22Z', + 'updated_at': '2026-05-06T14:18:22Z', + 'deactivated_at': '2026-05-06T14:20:22Z', } } ) diff --git a/cuenca/version.py b/cuenca/version.py index 6cd8a47e..0f7e38a4 100644 --- a/cuenca/version.py +++ b/cuenca/version.py @@ -1,3 +1,3 @@ -__version__ = '2.2.0.dev3' +__version__ = '2.2.0' CLIENT_VERSION = __version__ API_VERSION = '2020-03-19'