Skip to content
Merged
Show file tree
Hide file tree
Changes from 1 commit
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 @@ -45,6 +45,7 @@
'TermsOfService',
'UserTOSAgreement',
'PostalCodes',
'ExistPhone',
]

from . import http
Expand All @@ -64,6 +65,7 @@
CurpValidation,
Deposit,
Endpoint,
ExistPhone,
File,
FileBatch,
Identity,
Expand Down
2 changes: 2 additions & 0 deletions cuenca/resources/__init__.py
Original file line number Diff line number Diff line change
Expand Up @@ -16,6 +16,7 @@
'Endpoint',
'File',
'FileBatch',
'ExistPhone',
'Identity',
'IdentityEvent',
'KYCValidation',
Expand Down Expand Up @@ -58,6 +59,7 @@
from .curp_validations import CurpValidation
from .deposits import Deposit
from .endpoints import Endpoint
from .exist_phone import ExistPhone
from .file_batches import FileBatch
from .files import File
from .identities import Identity
Expand Down
12 changes: 12 additions & 0 deletions cuenca/resources/exist_phone.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,12 @@
from typing import ClassVar

from pydantic_extra_types.phone_numbers import PhoneNumber

from .base import Retrievable


class ExistPhone(Retrievable):
_resource: ClassVar = 'exist_phone'

id: PhoneNumber
exist: bool
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.6'
__version__ = '2.1.7'
CLIENT_VERSION = __version__
API_VERSION = '2020-03-19'
40 changes: 40 additions & 0 deletions tests/resources/cassettes/test_exist_phone_retrieve.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,40 @@
interactions:
- request:
body: null
headers:
User-Agent:
- cuenca-python/2.1.7.dev1
X-Cuenca-Api-Version:
- '2020-03-19'
method: GET
uri: https://sandbox.cuenca.com/exist_phone/+527331256958
response:
body:
string: '{"id":"+527331256958","exist":true}'
headers:
Connection:
- keep-alive
Content-Length:
- '35'
Content-Type:
- application/json
Date:
- Thu, 17 Jul 2025 18:34:19 GMT
X-Request-Time:
- 'value: 0.041'
x-amz-apigw-id:
- N3dG4EzACYcEofg=
x-amzn-Remapped-Connection:
- keep-alive
x-amzn-Remapped-Content-Length:
- '35'
x-amzn-Remapped-Date:
- Thu, 17 Jul 2025 18:34:19 GMT
x-amzn-Remapped-Server:
- nginx/1.28.0
x-amzn-RequestId:
- 51d8507c-c023-4b91-aa52-a6bdc499df89
status:
code: 200
message: OK
version: 1
11 changes: 11 additions & 0 deletions tests/resources/test_exist_phone.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,11 @@
import pytest

from cuenca import ExistPhone


@pytest.mark.vcr
def test_exist_phone_retrieve():
phone_number = '+527331256958'
exist_phone: ExistPhone = ExistPhone.retrieve(phone_number)
assert exist_phone.id == phone_number
assert exist_phone.exist
Loading