Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 2 additions & 0 deletions cuenca/__init__.py
Original file line number Diff line number Diff line change
Expand Up @@ -23,6 +23,7 @@
'LimitedWallet',
'LoginToken',
'Otp',
'PasswordReset',
'Platform',
'Questionnaires',
'Saving',
Expand Down Expand Up @@ -76,6 +77,7 @@
LimitedWallet,
LoginToken,
Otp,
PasswordReset,
PhoneVerificationAssociations,
Platform,
PostalCodes,
Expand Down
3 changes: 3 additions & 0 deletions cuenca/resources/__init__.py
Original file line number Diff line number Diff line change
Expand Up @@ -23,6 +23,7 @@
'LimitedWallet',
'LoginToken',
'Otp',
'PasswordReset',
'Platform',
'PhoneVerificationAssociation',
'Questionnaires',
Expand Down Expand Up @@ -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
Expand Down Expand Up @@ -116,6 +118,7 @@
KYCValidation,
LimitedWallet,
LoginToken,
PasswordReset,
Questionnaires,
Saving,
Session,
Expand Down
44 changes: 44 additions & 0 deletions cuenca/resources/password_resets.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,44 @@
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


class PasswordReset(Creatable):
_resource: ClassVar = 'password_resets'

platform_id: str
flow_id: str
status: VerificationStatus = VerificationStatus.created
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',
'flow_id': '123e4567-e89b-12d3-a456-426614174000',
'status': 'created',
'created_at': '2026-05-06T14:15:22Z',
}
}
)

@classmethod
def create(
cls,
location: Coordinate,
*,
session: Session = global_session,
) -> 'PasswordReset':
req = PasswordResetRequest(location=location)
return cls._create(session=session, **req.model_dump())
2 changes: 1 addition & 1 deletion cuenca/version.py
Original file line number Diff line number Diff line change
@@ -1,3 +1,3 @@
__version__ = '2.1.19'
__version__ = '2.2.0.dev3'
CLIENT_VERSION = __version__
API_VERSION = '2020-03-19'
2 changes: 1 addition & 1 deletion requirements.txt
Original file line number Diff line number Diff line change
@@ -1,3 +1,3 @@
requests==2.32.3
cuenca-validations==2.1.30
cuenca-validations==2.1.31
pydantic-extra-types==2.10.2
38 changes: 38 additions & 0 deletions tests/resources/cassettes/test_password_resets_create.yaml
Original file line number Diff line number Diff line change
@@ -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.2.0.dev3
X-Cuenca-Api-Version:
- '2020-03-19'
method: POST
uri: https://sandbox.cuenca.com/password_resets
response:
body:
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:
- '256'
Content-Type:
- application/json
Date:
- Wed, 07 May 2026 17:28:49 GMT
status:
code: 201
message: Created
version: 1
15 changes: 15 additions & 0 deletions tests/resources/test_password_resets.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,15 @@
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(
location=Coordinate(
latitude=Latitude(19.432608),
longitude=Longitude(-99.133209),
),
)
assert password_reset.id.startswith('PR')
Comment thread
coderabbitai[bot] marked this conversation as resolved.
Loading