Skip to content

Commit 43641d1

Browse files
authored
Update User class with new fields (#427)
* Update User class with new fields * Update cuenca-validations to version 2.1.16.dev7 * Add income_type field to User class * Update cuenca-validations to version 2.1.16.dev9 * Update version to 2.1.10.dev1 in version.py * Update cuenca-validations to version 2.1.16.dev10 and bump internal version to 2.1.10.dev2 * Update cuenca-validations to version 2.1.16 and set internal version to 2.1.10
1 parent 432a69e commit 43641d1

File tree

4 files changed

+35
-5
lines changed

4 files changed

+35
-5
lines changed

cuenca/resources/users.py

Lines changed: 31 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -14,7 +14,15 @@
1414
UserStatus,
1515
UserUpdateRequest,
1616
)
17-
from cuenca_validations.types.enums import Country, Gender, State
17+
from cuenca_validations.types.enums import (
18+
AccountUseType,
19+
Country,
20+
Gender,
21+
IncomeType,
22+
MonthlyMovementsType,
23+
MonthlySpendingType,
24+
State,
25+
)
1826
from cuenca_validations.types.general import SerializableHttpUrl
1927
from cuenca_validations.types.identities import AddressRequest, Curp
2028
from pydantic import ConfigDict, EmailStr, Field
@@ -59,6 +67,11 @@ class User(Creatable, Retrievable, Updateable, Queryable):
5967
platform_id: Optional[str] = None
6068
clabe: Optional[Clabe] = None
6169
fiscal_regime_code: Optional[SATRegimeCode] = None
70+
fiscal_address: Optional[Address] = None
71+
account_use_type: Optional[AccountUseType] = None
72+
monthly_spending_type: Optional[MonthlySpendingType] = None
73+
monthly_movements_type: Optional[MonthlyMovementsType] = None
74+
income_type: Optional[IncomeType] = None
6275
# These fields are added by identify when retrieving a User:
6376
names: Optional[str] = None
6477
first_surname: Optional[str] = None
@@ -110,6 +123,10 @@ def create(
110123
address: Optional[AddressRequest] = None,
111124
email_verification_id: Optional[str] = None,
112125
phone_verification_id: Optional[str] = None,
126+
account_use_type: Optional[AccountUseType] = None,
127+
monthly_spending_type: Optional[MonthlySpendingType] = None,
128+
monthly_movements_type: Optional[MonthlyMovementsType] = None,
129+
income_type: Optional[IncomeType] = None,
113130
*,
114131
session: Session = global_session,
115132
) -> 'User':
@@ -119,6 +136,9 @@ def create(
119136
address=address,
120137
email_verification_id=email_verification_id,
121138
phone_verification_id=phone_verification_id,
139+
account_use_type=account_use_type,
140+
monthly_spending_type=monthly_spending_type,
141+
monthly_movements_type=monthly_movements_type,
122142
)
123143
return cls._create(session=session, **req.model_dump())
124144

@@ -137,6 +157,11 @@ def update(
137157
phone_verification_id: Optional[str] = None,
138158
curp_document: Optional[SerializableHttpUrl] = None,
139159
fiscal_regime_code: Optional[SATRegimeCode] = None,
160+
fiscal_address: Optional[AddressRequest] = None,
161+
account_use_type: Optional[AccountUseType] = None,
162+
monthly_spending_type: Optional[MonthlySpendingType] = None,
163+
monthly_movements_type: Optional[MonthlyMovementsType] = None,
164+
income_type: Optional[IncomeType] = None,
140165
pronouns: Optional[str] = None,
141166
*,
142167
session: Session = global_session,
@@ -153,6 +178,11 @@ def update(
153178
phone_verification_id=phone_verification_id,
154179
curp_document=curp_document,
155180
fiscal_regime_code=fiscal_regime_code,
181+
fiscal_address=fiscal_address,
182+
account_use_type=account_use_type,
183+
monthly_spending_type=monthly_spending_type,
184+
monthly_movements_type=monthly_movements_type,
185+
income_type=income_type,
156186
pronouns=pronouns,
157187
)
158188
return cls._update(id=user_id, **request.model_dump(), session=session)

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.9'
1+
__version__ = '2.1.10'
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.14
2+
cuenca-validations==2.1.16
33
pydantic-extra-types==2.10.2

tests/resources/cassettes/test_session_create.yaml

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -139,7 +139,7 @@ interactions:
139139
code: 201
140140
message: Created
141141
- request:
142-
body: '{"profession": "Comercio", "email_verification_id": null, "phone_verification_id":
142+
body: '{"profession": "comercio", "email_verification_id": null, "phone_verification_id":
143143
null, "address": null, "beneficiaries": null, "govt_id": null, "proof_of_address":
144144
null, "proof_of_life": null, "curp_document_uri": null, "fiscal_regime_code":
145145
null, "pronouns": null}'
@@ -160,7 +160,7 @@ interactions:
160160
body:
161161
string: '{"id":"USPR4JxMuwSG60u2h4gBpB6Q","created_at":"2025-07-29T17:26:51.788000","updated_at":"2025-07-29T17:26:56.475244","platform_id":"PTZbBlk__kQt-wfwzP5nwA9A","user_type":"physical","level":0,"required_level":3,"phone_number":"+525555555552","phone_number_is_active":true,"email_address":"test-cuenca-06@yopmail.com","email_address_is_active":true,"clabe":"723324548297159645","status":"active","address":{"street":"calle
162162
1","ext_number":"2","int_number":"3","postal_code":"40106","colonia":"El Naranjo","state":"GR","city":"Iguala
163-
de la Independencia","country":"MX","created_at":"2025-07-29T17:26:51.788000","full_name":null},"identity_uri":"/identities/IDfN3QVig1Qui8oZNrmA4hfw","profession":"Comercio","user_tos_agreements_id":null,"blacklist_validation_status":"succeeded","govt_id":null,"proof_of_address":null,"proof_of_life":null,"beneficiaries":[],"curp_status":"succeeded","pronouns":null,"fiscal_regime_code":null,"cash_reference_number":null,"names":"José","first_surname":"López","second_surname":"Hernández","curp":"LOHJ660606HDFPRS02","rfc":"MOOG960621GJ1","gender":"male","date_of_birth":"1996-06-21","state_of_birth":"GR","nationality":"MX","country_of_birth":"MX"}'
163+
de la Independencia","country":"MX","created_at":"2025-07-29T17:26:51.788000","full_name":null},"identity_uri":"/identities/IDfN3QVig1Qui8oZNrmA4hfw","profession":"comercio","user_tos_agreements_id":null,"blacklist_validation_status":"succeeded","govt_id":null,"proof_of_address":null,"proof_of_life":null,"beneficiaries":[],"curp_status":"succeeded","pronouns":null,"fiscal_regime_code":null,"cash_reference_number":null,"names":"José","first_surname":"López","second_surname":"Hernández","curp":"LOHJ660606HDFPRS02","rfc":"MOOG960621GJ1","gender":"male","date_of_birth":"1996-06-21","state_of_birth":"GR","nationality":"MX","country_of_birth":"MX"}'
164164
headers:
165165
Connection:
166166
- keep-alive

0 commit comments

Comments
 (0)