Skip to content

Commit 972cc7e

Browse files
committed
Add PhoneVerificationAssociation resource
1 parent ea31344 commit 972cc7e

File tree

7 files changed

+92
-2
lines changed

7 files changed

+92
-2
lines changed

cuenca/__init__.py

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -46,6 +46,7 @@
4646
'UserTOSAgreement',
4747
'PostalCodes',
4848
'ExistPhone',
49+
'PhoneVerificationAssociation',
4950
]
5051

5152
from . import http
@@ -75,6 +76,7 @@
7576
LimitedWallet,
7677
LoginToken,
7778
Otp,
79+
PhoneVerificationAssociation,
7880
Platform,
7981
PostalCodes,
8082
Questionnaires,

cuenca/resources/__init__.py

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -24,6 +24,7 @@
2424
'LoginToken',
2525
'Otp',
2626
'Platform',
27+
'PhoneVerificationAssociation',
2728
'Questionnaires',
2829
'Saving',
2930
'ServiceProvider',
@@ -69,6 +70,7 @@
6970
from .limited_wallets import LimitedWallet
7071
from .login_tokens import LoginToken
7172
from .otps import Otp
73+
from .phone_verification_association import PhoneVerificationAssociation
7274
from .platforms import Platform
7375
from .postal_codes import PostalCodes
7476
from .questionnaires import Questionnaires
@@ -134,6 +136,7 @@
134136
JwtToken,
135137
TermsOfService,
136138
UserTOSAgreement,
139+
PhoneVerificationAssociation,
137140
]
138141
for resource_cls in resource_classes:
139142
RESOURCES[resource_cls._resource] = resource_cls # type: ignore
Lines changed: 26 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,26 @@
1+
import datetime as dt
2+
from typing import ClassVar
3+
4+
from cuenca_validations.types.requests import (
5+
PhoneVerificationAssociationRequest,
6+
)
7+
8+
from ..http import Session, session as global_session
9+
from .base import Creatable
10+
11+
12+
class PhoneVerificationAssociation(Creatable):
13+
_resource: ClassVar = 'phone_verification_association'
14+
15+
verification_id: str
16+
user_id: str
17+
created_at: dt.datetime
18+
19+
@classmethod
20+
def create(
21+
cls, verification_id: str, session: Session = global_session
22+
) -> 'PhoneVerificationAssociation':
23+
req = PhoneVerificationAssociationRequest(
24+
verification_id=verification_id
25+
)
26+
return cls._create(session=session, **req.model_dump())

cuenca/version.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,3 @@
1-
__version__ = '2.1.7'
1+
__version__ = '2.1.8.dev1'
22
CLIENT_VERSION = __version__
33
API_VERSION = '2020-03-19'

requirements.txt

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,3 @@
11
requests==2.32.3
2-
cuenca-validations==2.1.11
2+
cuenca-validations==2.1.12.dev1
33
pydantic-extra-types==2.10.2
Lines changed: 46 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,46 @@
1+
interactions:
2+
- request:
3+
body: '{"verification_id": "VEeCjasQQWQM-Hr-odTGoKoQ"}'
4+
headers:
5+
Authorization:
6+
- DUMMY
7+
Content-Length:
8+
- '47'
9+
Content-Type:
10+
- application/json
11+
User-Agent:
12+
- cuenca-python/2.1.7
13+
X-Cuenca-Api-Version:
14+
- '2020-03-19'
15+
method: POST
16+
uri: https://sandbox.cuenca.com/phone_verification_association
17+
response:
18+
body:
19+
string: '{"id":"PVuzCh7IsESSyGxyMdjgRY3A","verification_id":"VEeCjasQQWQM-Hr-odTGoKoQ","user_id":"USS2gTzkh_Sm2ZPZGtfNOK_Q","created_at":"2025-07-21T17:07:04.776955"}'
20+
headers:
21+
Connection:
22+
- keep-alive
23+
Content-Length:
24+
- '157'
25+
Content-Type:
26+
- application/json
27+
Date:
28+
- Mon, 21 Jul 2025 17:07:04 GMT
29+
X-Request-Time:
30+
- 'value: 0.487'
31+
x-amz-apigw-id:
32+
- OEcE3FGUCYcEvbw=
33+
x-amzn-Remapped-Connection:
34+
- keep-alive
35+
x-amzn-Remapped-Content-Length:
36+
- '157'
37+
x-amzn-Remapped-Date:
38+
- Mon, 21 Jul 2025 17:07:04 GMT
39+
x-amzn-Remapped-Server:
40+
- nginx/1.28.0
41+
x-amzn-RequestId:
42+
- f10e5016-1ce3-429d-9d00-027a4d018c71
43+
status:
44+
code: 201
45+
message: Created
46+
version: 1
Lines changed: 13 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,13 @@
1+
import pytest
2+
3+
from cuenca import PhoneVerificationAssociation
4+
5+
6+
@pytest.mark.vcr
7+
def test_phone_verification_association_create():
8+
9+
phone_verification_association = PhoneVerificationAssociation.create(
10+
verification_id='VEeCjasQQWQM-Hr-odTGoKoQ',
11+
)
12+
assert phone_verification_association.verification_id
13+
assert phone_verification_association.user_id

0 commit comments

Comments
 (0)