Skip to content

Commit 9292f88

Browse files
authored
Add phone_verification_id and email_verification_id to User.update (#287)
* add emv and phv * bump version * bump version * add test * remove sensitive data
1 parent b002b08 commit 9292f88

File tree

5 files changed

+122
-2
lines changed

5 files changed

+122
-2
lines changed

cuenca/resources/users.py

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -140,6 +140,8 @@ def update(
140140
terms_of_service: Optional[TOSUpdateRequest] = None,
141141
verification_id: Optional[str] = None,
142142
status: Optional[UserStatus] = None,
143+
email_verification_id: Optional[str] = None,
144+
phone_verification_id: Optional[str] = None,
143145
*,
144146
session: Session = global_session,
145147
):
@@ -154,6 +156,8 @@ def update(
154156
proof_of_life=proof_of_life,
155157
terms_of_service=terms_of_service,
156158
verification_id=verification_id,
159+
email_verification_id=email_verification_id,
160+
phone_verification_id=phone_verification_id,
157161
status=status,
158162
)
159163
return cast(

cuenca/version.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,3 @@
1-
__version__ = '0.13.3'
1+
__version__ = '0.13.4'
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.27.1
2-
cuenca-validations==0.10.16
2+
cuenca-validations==0.10.17
33
dataclasses>=0.7;python_version<"3.7"
Lines changed: 102 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,102 @@
1+
interactions:
2+
- request:
3+
body: '{"type": "email", "recipient": "mail@cuenca.com", "platform_id": "PL01"}'
4+
headers:
5+
Accept:
6+
- '*/*'
7+
Accept-Encoding:
8+
- gzip, deflate
9+
Authorization:
10+
- DUMMY
11+
Connection:
12+
- keep-alive
13+
Content-Length:
14+
- '72'
15+
Content-Type:
16+
- application/json
17+
User-Agent:
18+
- cuenca-python/0.13.4.dev1
19+
X-Cuenca-Api-Version:
20+
- '2020-03-19'
21+
method: POST
22+
uri: https://sandbox.cuenca.com/verifications
23+
response:
24+
body:
25+
string: '{"id":"VE-4xUIsrHTB62U8vjfkx4mw","identity_id":null,"platform_id":"PL01","created_at":"2022-06-28T16:30:52.496393","updated_at":"2022-06-28T16:30:52.496685","deactivated_at":null,"recipient":"mail@cuenca.com","language":"en","type":"email"}'
26+
headers:
27+
Connection:
28+
- keep-alive
29+
Content-Length:
30+
- '240'
31+
Content-Type:
32+
- application/json
33+
Date:
34+
- Tue, 28 Jun 2022 16:30:52 GMT
35+
x-amz-apigw-id:
36+
- UcPtdG2oiYcFmuQ=
37+
x-amzn-Remapped-Connection:
38+
- keep-alive
39+
x-amzn-Remapped-Content-Length:
40+
- '240'
41+
x-amzn-Remapped-Date:
42+
- Tue, 28 Jun 2022 16:30:52 GMT
43+
x-amzn-Remapped-Server:
44+
- nginx/1.22.0
45+
x-amzn-RequestId:
46+
- aa54f7c1-ce61-4fed-b12a-d08ca75e120d
47+
status:
48+
code: 201
49+
message: Created
50+
- request:
51+
body: '{"phone_number": null, "email_address": null, "profession": null, "verification_id":
52+
null, "email_verification_id": "VE-4xUIsrHTB62U8vjfkx4mw", "phone_verification_id":
53+
null, "address": null, "beneficiaries": null, "govt_id": null, "proof_of_address":
54+
null, "proof_of_life": null, "status": null, "terms_of_service": null, "platform_terms_of_service":
55+
null}'
56+
headers:
57+
Accept:
58+
- '*/*'
59+
Accept-Encoding:
60+
- gzip, deflate
61+
Authorization:
62+
- DUMMY
63+
Connection:
64+
- keep-alive
65+
Content-Length:
66+
- '357'
67+
Content-Type:
68+
- application/json
69+
User-Agent:
70+
- cuenca-python/0.13.4.dev1
71+
X-Cuenca-Api-Version:
72+
- '2020-03-19'
73+
method: PATCH
74+
uri: https://sandbox.cuenca.com/users/USV6ONckmjQNOM9p3_bRMyxg
75+
response:
76+
body:
77+
string: '{"id":"USV6ONckmjQNOM9p3_bRMyxg","identity_uri":"/identities/IDvq7J_lS0Sr2E6C62oCfn3g","created_at":"2022-06-24T16:26:56.882000","updated_at":"2022-06-28T20:27:10.579110","platform_id":"PTZbBlk__kQt-wfwzP5nwA9A","level":0,"required_level":4,"phone_number":"+525511223344","email_address":"mail@cuenca.com","profession":null,"clabe":null,"status":"in_review","terms_of_service":null,"blacklist_validation_status":"succeeded","address":null,"govt_id":null,"proof_of_address":null,"proof_of_life":null,"beneficiaries":null,"names":"Miguel","first_surname":"Acosta","second_surname":"Ventura","curp":"LOHJ660606HDFPRS02","rfc":"LOHJ660606HDFP"}'
78+
headers:
79+
Connection:
80+
- keep-alive
81+
Content-Length:
82+
- '639'
83+
Content-Type:
84+
- application/json
85+
Date:
86+
- Tue, 28 Jun 2022 20:27:10 GMT
87+
x-amz-apigw-id:
88+
- UcyUwHEZCYcF3jQ=
89+
x-amzn-Remapped-Connection:
90+
- keep-alive
91+
x-amzn-Remapped-Content-Length:
92+
- '639'
93+
x-amzn-Remapped-Date:
94+
- Tue, 28 Jun 2022 20:27:10 GMT
95+
x-amzn-Remapped-Server:
96+
- nginx/1.22.0
97+
x-amzn-RequestId:
98+
- 9aa44bc1-b948-41c7-ad81-ec7e2723d64e
99+
status:
100+
code: 200
101+
message: OK
102+
version: 1

tests/resources/test_users.py

Lines changed: 14 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,7 @@
11
import pytest
2+
from cuenca_validations.types import VerificationType
23

4+
from cuenca import Verification
35
from cuenca.resources import CurpValidation, User
46

57

@@ -70,3 +72,15 @@ def test_user_query_all_identity_id():
7072
assert len(users) == 2
7173
assert users[0].id != users[1].id
7274
assert users[0].identity_uri == users[1].identity_uri
75+
76+
77+
@pytest.mark.vcr
78+
def test_user_update_user_email_from_verification():
79+
user_id = 'USV6ONckmjQNOM9p3_bRMyxg'
80+
ver = Verification.create(
81+
recipient='mail@cuenca.com',
82+
type=VerificationType.email,
83+
platform_id='PL01',
84+
)
85+
user = User.update(user_id, email_verification_id=ver.id)
86+
assert user.to_dict()['email_address'] == ver.recipient

0 commit comments

Comments
 (0)