Skip to content
Merged
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
32 changes: 31 additions & 1 deletion cuenca/resources/users.py
Original file line number Diff line number Diff line change
Expand Up @@ -14,7 +14,15 @@
UserStatus,
UserUpdateRequest,
)
from cuenca_validations.types.enums import Country, Gender, State
from cuenca_validations.types.enums import (
AccountUseType,
Country,
Gender,
IncomeType,
MonthlyMovementsType,
MonthlySpendingType,
State,
)
from cuenca_validations.types.general import SerializableHttpUrl
from cuenca_validations.types.identities import AddressRequest, Curp
from pydantic import ConfigDict, EmailStr, Field
Expand Down Expand Up @@ -59,6 +67,11 @@ class User(Creatable, Retrievable, Updateable, Queryable):
platform_id: Optional[str] = None
clabe: Optional[Clabe] = None
fiscal_regime_code: Optional[SATRegimeCode] = None
fiscal_address: Optional[Address] = None
account_use_type: Optional[AccountUseType] = None
monthly_spending_type: Optional[MonthlySpendingType] = None
monthly_movements_type: Optional[MonthlyMovementsType] = None
income_type: Optional[IncomeType] = None
# These fields are added by identify when retrieving a User:
names: Optional[str] = None
first_surname: Optional[str] = None
Expand Down Expand Up @@ -110,6 +123,10 @@ def create(
address: Optional[AddressRequest] = None,
email_verification_id: Optional[str] = None,
phone_verification_id: Optional[str] = None,
account_use_type: Optional[AccountUseType] = None,
monthly_spending_type: Optional[MonthlySpendingType] = None,
monthly_movements_type: Optional[MonthlyMovementsType] = None,
income_type: Optional[IncomeType] = None,
*,
session: Session = global_session,
) -> 'User':
Expand All @@ -119,6 +136,9 @@ def create(
address=address,
email_verification_id=email_verification_id,
phone_verification_id=phone_verification_id,
account_use_type=account_use_type,
monthly_spending_type=monthly_spending_type,
monthly_movements_type=monthly_movements_type,
)
return cls._create(session=session, **req.model_dump())

Expand All @@ -137,6 +157,11 @@ def update(
phone_verification_id: Optional[str] = None,
curp_document: Optional[SerializableHttpUrl] = None,
fiscal_regime_code: Optional[SATRegimeCode] = None,
fiscal_address: Optional[AddressRequest] = None,
account_use_type: Optional[AccountUseType] = None,
monthly_spending_type: Optional[MonthlySpendingType] = None,
monthly_movements_type: Optional[MonthlyMovementsType] = None,
income_type: Optional[IncomeType] = None,
pronouns: Optional[str] = None,
*,
session: Session = global_session,
Expand All @@ -153,6 +178,11 @@ def update(
phone_verification_id=phone_verification_id,
curp_document=curp_document,
fiscal_regime_code=fiscal_regime_code,
fiscal_address=fiscal_address,
account_use_type=account_use_type,
monthly_spending_type=monthly_spending_type,
monthly_movements_type=monthly_movements_type,
income_type=income_type,
pronouns=pronouns,
)
return cls._update(id=user_id, **request.model_dump(), session=session)
Expand Down
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.9'
__version__ = '2.1.10'
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.14
cuenca-validations==2.1.16
pydantic-extra-types==2.10.2
4 changes: 2 additions & 2 deletions tests/resources/cassettes/test_session_create.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -139,7 +139,7 @@ interactions:
code: 201
message: Created
- request:
body: '{"profession": "Comercio", "email_verification_id": null, "phone_verification_id":
body: '{"profession": "comercio", "email_verification_id": null, "phone_verification_id":
null, "address": null, "beneficiaries": null, "govt_id": null, "proof_of_address":
null, "proof_of_life": null, "curp_document_uri": null, "fiscal_regime_code":
null, "pronouns": null}'
Expand All @@ -160,7 +160,7 @@ interactions:
body:
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
1","ext_number":"2","int_number":"3","postal_code":"40106","colonia":"El Naranjo","state":"GR","city":"Iguala
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"}'
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"}'
headers:
Connection:
- keep-alive
Expand Down
Loading