diff --git a/cuenca/resources/users.py b/cuenca/resources/users.py index c44cc0ac..295dd0d2 100644 --- a/cuenca/resources/users.py +++ b/cuenca/resources/users.py @@ -9,7 +9,6 @@ PhoneNumber, SATRegimeCode, TOSAgreement, - TOSRequest, UserQuery, UserRequest, UserStatus, @@ -17,7 +16,7 @@ ) from cuenca_validations.types.enums import Country, Gender, State from cuenca_validations.types.general import SerializableHttpUrl -from cuenca_validations.types.identities import Curp +from cuenca_validations.types.identities import AddressRequest, Curp from pydantic import ConfigDict, EmailStr, Field from ..http import Session, session as global_session @@ -107,29 +106,19 @@ def balance(self) -> int: def create( cls, curp: Curp, - phone_number: Optional[PhoneNumber] = None, - email_address: Optional[EmailStr] = None, profession: Optional[str] = None, - address: Optional[Address] = None, + address: Optional[AddressRequest] = None, email_verification_id: Optional[str] = None, phone_verification_id: Optional[str] = None, - status: Optional[UserStatus] = None, - required_level: Optional[int] = None, - terms_of_service: Optional[TOSRequest] = None, *, session: Session = global_session, ) -> 'User': req = UserRequest( curp=curp, - phone_number=phone_number, - email_address=email_address, profession=profession, address=address, email_verification_id=email_verification_id, phone_verification_id=phone_verification_id, - required_level=required_level, - status=status, - terms_of_service=terms_of_service, ) return cls._create(session=session, **req.model_dump()) @@ -137,40 +126,34 @@ def create( def update( cls, user_id: str, - phone_number: Optional[PhoneNumber] = None, - email_address: Optional[str] = None, profession: Optional[str] = None, - address: Optional[Address] = None, + address: Optional[AddressRequest] = None, beneficiaries: Optional[list[Beneficiary]] = None, govt_id: Optional[KYCFile] = None, proof_of_address: Optional[KYCFile] = None, proof_of_life: Optional[KYCFile] = None, - terms_of_service: Optional[TOSRequest] = None, - verification_id: Optional[str] = None, status: Optional[UserStatus] = None, email_verification_id: Optional[str] = None, phone_verification_id: Optional[str] = None, curp_document: Optional[SerializableHttpUrl] = None, fiscal_regime_code: Optional[SATRegimeCode] = None, + pronouns: Optional[str] = None, *, session: Session = global_session, ) -> 'User': request = UserUpdateRequest( - phone_number=phone_number, - email_address=email_address, profession=profession, address=address, beneficiaries=beneficiaries, govt_id=govt_id, proof_of_address=proof_of_address, proof_of_life=proof_of_life, - terms_of_service=terms_of_service, - verification_id=verification_id, + status=status, email_verification_id=email_verification_id, phone_verification_id=phone_verification_id, curp_document=curp_document, fiscal_regime_code=fiscal_regime_code, - status=status, + pronouns=pronouns, ) return cls._update(id=user_id, **request.model_dump(), session=session) diff --git a/cuenca/version.py b/cuenca/version.py index 1d8a80ac..dc9e0d9e 100644 --- a/cuenca/version.py +++ b/cuenca/version.py @@ -1,3 +1,3 @@ -__version__ = '2.1.8' +__version__ = '2.1.9' CLIENT_VERSION = __version__ API_VERSION = '2020-03-19' diff --git a/requirements.txt b/requirements.txt index ea8bb83f..d85d103b 100644 --- a/requirements.txt +++ b/requirements.txt @@ -1,3 +1,3 @@ requests==2.32.3 -cuenca-validations==2.1.13 +cuenca-validations==2.1.14 pydantic-extra-types==2.10.2 diff --git a/tests/conftest.py b/tests/conftest.py index 73269127..c22b96f3 100644 --- a/tests/conftest.py +++ b/tests/conftest.py @@ -36,8 +36,8 @@ def curp_validation_request() -> dict: names='José', first_surname='López', second_surname='Hernández', - date_of_birth=dt.date(1966, 6, 6), - state_of_birth=State.DF, + date_of_birth=dt.date(1996, 6, 21), + state_of_birth=State.GR, country_of_birth=Country.MX, gender=Gender.male, ) @@ -48,17 +48,15 @@ def curp_validation_request() -> dict: def user_request() -> dict: user_dict = dict( curp='LOHJ660606HDFPRS02', - phone_number='+525511223344', - email_address='jose@test.com', profession=Profession.empleado, address=dict( street='calle 1', ext_number='2', int_number='3', - postal_code_id='PC2ygq9j2bS9-9tsuVawzErA', + postal_code_id='PCLo4hi65YTKaAnph27E_2SQ', ), - phone_verification_id='VERdkuqOCjSA2PSS-VCj7HhQ', - email_verification_id='VERppwdqsQSAQFFF-CDsWD8s', + phone_verification_id='VEJlFhtVOgQMG5EpkThHL5Tg', + email_verification_id='VE_r7hBIlaSfe2pEOvMtBEog', ) return user_dict diff --git a/tests/resources/cassettes/test_session_create.yaml b/tests/resources/cassettes/test_session_create.yaml index f1d0974b..b5402ee9 100644 --- a/tests/resources/cassettes/test_session_create.yaml +++ b/tests/resources/cassettes/test_session_create.yaml @@ -1,210 +1,187 @@ interactions: - request: - body: '{"names": "Jos\u00e9", "first_surname": "L\u00f3pez", "second_surname": - "Hern\u00e1ndez", "date_of_birth": "1966-06-06", "state_of_birth": "DF", "country_of_birth": - "MX", "gender": "male", "manual_curp": null}' + body: '{"names": "José", "first_surname": "López", "second_surname": "Hernández", + "date_of_birth": "1996-06-21", "state_of_birth": "GR", "country_of_birth": "MX", + "gender": "male", "manual_curp": null}' headers: - Accept: - - '*/*' - Accept-Encoding: - - gzip, deflate Authorization: - DUMMY - Connection: - - keep-alive Content-Length: - - '209' + - '195' Content-Type: - application/json User-Agent: - - cuenca-python/0.7.15.dev3 + - cuenca-python/2.1.8 X-Cuenca-Api-Version: - '2020-03-19' method: POST uri: https://sandbox.cuenca.com/curp_validations response: body: - string: "{\"id\":\"CV3ZZrphyVSPaGihGwWO8QJQ\",\"created_at\":\"2022-02-09T18:29:24.320854\",\"names\":\"Jos\xE9\",\"first_surname\":\"L\xF3pez\",\"second_surname\":\"Hern\xE1ndez\",\"date_of_birth\":\"1966-06-06\",\"country_of_birth\":\"MX\",\"state_of_birth\":\"DF\",\"gender\":\"male\",\"nationality\":\"MX\",\"manual_curp\":null,\"calculated_curp\":\"LOHJ660606HDFPRS02\",\"validated_curp\":\"LOHJ660606HDFPRS02\",\"renapo_curp_match\":true,\"renapo_full_match\":true}" + string: '{"id":"CViW6DNWVHSEu5QBEYWxC1Wg","created_at":"2025-07-29T17:26:50.871212","names":"José","first_surname":"López","second_surname":"Hernández","date_of_birth":"1996-06-21","country_of_birth":"MX","state_of_birth":"GR","gender":"male","nationality":"MX","manual_curp":null,"calculated_curp":"LOHJ660606HDFPRS02","validated_curp":"LOHJ660606HDFPRS02","renapo_curp_match":true,"renapo_full_match":true,"cve_entidad_emisora":null,"cve_entidad_nacimiento":null,"fecha_nacimiento":null,"fecha_nacimiento_axu":null,"nacionalidad":null,"codigo_error":null,"descripcion_error":null,"documento_probatorio":null,"anio_registro":null,"numero_acta":null,"clave_entidad_federativa_registro":null,"clave_municipio_registro":null,"numero_registro_nacional_extranjeros":null,"folio_carta":null,"folio_certificado":null,"clave_unica_refugiado":null,"estatus":null,"nivel_confiabilidad":null,"curp_historicas":null}' headers: Connection: - keep-alive Content-Length: - - '402' + - '897' Content-Type: - application/json Date: - - Wed, 09 Feb 2022 18:29:24 GMT + - Tue, 29 Jul 2025 17:26:51 GMT X-Request-Time: - - 'value: 0.179' + - 'value: 0.273' x-amz-apigw-id: - - NSYwrGdkCYcF5Og= + - Oe2ePGF3iYcEecQ= x-amzn-Remapped-Connection: - keep-alive x-amzn-Remapped-Content-Length: - - '402' + - '897' x-amzn-Remapped-Date: - - Wed, 09 Feb 2022 18:29:24 GMT + - Tue, 29 Jul 2025 17:26:51 GMT x-amzn-Remapped-Server: - - nginx/1.20.2 + - nginx/1.28.0 x-amzn-RequestId: - - 9b033a9b-3129-40a8-a366-66875c1b8e39 + - 82794d72-54b2-44a3-844f-bd20d3b07515 status: code: 201 message: Created - request: - body: '{"curp": "LOHJ660606HDFPRS02", "phone_number": "+525511223344", "email_address": - "jose@test.com", "profession": "employee", "address": {"street": "calle 1", - "ext_number": "2", "postal_code": "09900", "state": "DF", "country": "MX", "city": - null, "int_number": "3"}}' + body: '{"curp": "LOHJ660606HDFPRS02", "profession": "Empleado(a/e)", "address": + {"street": "calle 1", "ext_number": "2", "int_number": "3", "postal_code_id": + "PCLo4hi65YTKaAnph27E_2SQ"}, "phone_verification_id": "VEJlFhtVOgQMG5EpkThHL5Tg", + "email_verification_id": "VE_r7hBIlaSfe2pEOvMtBEog"}' headers: - Accept: - - '*/*' - Accept-Encoding: - - gzip, deflate Authorization: - DUMMY - Connection: - - keep-alive Content-Length: - - '265' + - '285' Content-Type: - application/json User-Agent: - - cuenca-python/0.7.15.dev3 + - cuenca-python/2.1.8 X-Cuenca-Api-Version: - '2020-03-19' method: POST uri: https://sandbox.cuenca.com/users response: body: - string: "{\"id\":\"USz-lkjzCBTO2wFzR-FswiqA\",\"identity_uri\":\"/identities/IDKWLi_wUoTty6WXXg9xfKFQ\",\"created_at\":\"2022-02-09T18:29:24.685833\",\"updated_at\":\"2022-02-09T18:29:24.715958\",\"platform_id\":\"PTW68GgAc_QPmNCmgajmctLg\",\"level\":0,\"phone_number\":\"+525511223344\",\"email_address\":\"jose@test.com\",\"profession\":\"employee\",\"status\":\"active\",\"terms_of_service\":null,\"blacklist_validation_status\":\"not_verified\",\"address\":{\"street\":\"calle - 1\",\"ext_number\":\"2\",\"int_number\":\"3\",\"postal_code\":\"09900\",\"state\":\"DF\",\"city\":null,\"country\":\"MX\",\"created_at\":\"2022-02-09T18:29:24.685718\"},\"govt_id\":null,\"proof_of_address\":null,\"proof_of_life\":null,\"beneficiaries\":null,\"names\":\"Jos\xE9\",\"first_surname\":\"L\xF3pez\",\"second_surname\":\"Hern\xE1ndez\",\"curp\":\"LOHJ660606HDFPRS02\",\"required_level\":4}" + string: '{"id":"USPR4JxMuwSG60u2h4gBpB6Q","created_at":"2025-07-29T17:26:51.788962","updated_at":"2025-07-29T17:26:53.214399","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.788790","full_name":null},"identity_uri":"/identities/IDfN3QVig1Qui8oZNrmA4hfw","profession":"Empleado(a/e)","user_tos_agreements_id":null,"blacklist_validation_status":"not_verified","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 Content-Length: - - '745' + - '1190' Content-Type: - application/json Date: - - Wed, 09 Feb 2022 18:29:25 GMT - X-Request-Time: - - 'value: 0.747' + - Tue, 29 Jul 2025 17:26:54 GMT x-amz-apigw-id: - - NSYwvE85iYcF_CQ= + - Oe2eVHRNCYcEeEw= x-amzn-Remapped-Connection: - keep-alive x-amzn-Remapped-Content-Length: - - '745' + - '1190' x-amzn-Remapped-Date: - - Wed, 09 Feb 2022 18:29:25 GMT + - Tue, 29 Jul 2025 17:26:54 GMT x-amzn-Remapped-Server: - - nginx/1.20.2 + - nginx/1.28.0 x-amzn-RequestId: - - 4804d108-50e8-4dd9-a875-6af3137a8474 + - 1e474c27-934f-440a-8ba4-c06db1bbec55 status: code: 201 message: Created - request: - body: '{"user_id": "USz-lkjzCBTO2wFzR-FswiqA", "type": "session.registration", + body: '{"user_id": "USPR4JxMuwSG60u2h4gBpB6Q", "type": "session.registration", "success_url": "https://example.com/succeeded_registration", "failure_url": "https://example.com/failed_registration"}' headers: - Accept: - - '*/*' - Accept-Encoding: - - gzip, deflate Authorization: - DUMMY - Connection: - - keep-alive Content-Length: - '190' Content-Type: - application/json User-Agent: - - cuenca-python/0.7.15.dev3 + - cuenca-python/2.1.8 X-Cuenca-Api-Version: - '2020-03-19' method: POST uri: https://sandbox.cuenca.com/sessions response: body: - string: '{"id":"SSNiy0wLFnRYG0jR12n8qJyA","created_at":"2022-02-09T18:29:25.694402","updated_at":"2022-02-09T18:29:25.694553","user_id":"USz-lkjzCBTO2wFzR-FswiqA","platform_id":"PTW68GgAc_QPmNCmgajmctLg","expires_at":"2022-02-09T18:39:25.694412","success_url":"https://example.com/succeeded_registration","failure_url":"https://example.com/failed_registration","type":"session.registration"}' + string: '{"id":"SSjUSaWbM1S-26rGdhk2r1Aw","created_at":"2025-07-29T17:26:55.884366","user_id":"USPR4JxMuwSG60u2h4gBpB6Q","platform_id":"PTZbBlk__kQt-wfwzP5nwA9A","expires_at":"2025-07-29T17:36:55.884378","success_url":"https://example.com/succeeded_registration","failure_url":"https://example.com/failed_registration","type":"session.registration"}' headers: Connection: - keep-alive Content-Length: - - '382' + - '340' Content-Type: - application/json Date: - - Wed, 09 Feb 2022 18:29:25 GMT + - Tue, 29 Jul 2025 17:26:55 GMT X-Request-Time: - - 'value: 0.170' + - 'value: 1.506' x-amz-apigw-id: - - NSYw5EVlCYcF2Sg= + - Oe2e0EeiCYcEPfA= x-amzn-Remapped-Connection: - keep-alive x-amzn-Remapped-Content-Length: - - '382' + - '340' x-amzn-Remapped-Date: - - Wed, 09 Feb 2022 18:29:25 GMT + - Tue, 29 Jul 2025 17:26:55 GMT x-amzn-Remapped-Server: - - nginx/1.20.2 + - nginx/1.28.0 x-amzn-RequestId: - - abe06415-7324-4d27-96c2-bf5833967597 + - d01c1d75-a1fb-4692-a856-b118f291bde3 status: code: 201 message: Created - request: - body: '{"email_address": "manu@example.com"}' + 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}' headers: - Accept: - - '*/*' - Accept-Encoding: - - gzip, deflate Authorization: - DUMMY - Connection: - - keep-alive Content-Length: - - '37' + - '267' Content-Type: - application/json User-Agent: - - cuenca-python/0.7.15.dev3 + - cuenca-python/2.1.8 X-Cuenca-Api-Version: - '2020-03-19' method: PATCH - uri: https://sandbox.cuenca.com/users/USz-lkjzCBTO2wFzR-FswiqA + uri: https://sandbox.cuenca.com/users/USPR4JxMuwSG60u2h4gBpB6Q response: body: - string: "{\"id\":\"USz-lkjzCBTO2wFzR-FswiqA\",\"identity_uri\":\"/identities/IDKWLi_wUoTty6WXXg9xfKFQ\",\"created_at\":\"2022-02-09T18:29:24.685000\",\"updated_at\":\"2022-02-09T18:29:25.958447\",\"platform_id\":\"PTW68GgAc_QPmNCmgajmctLg\",\"level\":0,\"phone_number\":\"+525511223344\",\"email_address\":\"manu@example.com\",\"profession\":\"employee\",\"status\":\"active\",\"terms_of_service\":null,\"blacklist_validation_status\":\"not_verified\",\"address\":{\"street\":\"calle - 1\",\"ext_number\":\"2\",\"int_number\":\"3\",\"postal_code\":\"09900\",\"state\":\"DF\",\"city\":null,\"country\":\"MX\",\"created_at\":\"2022-02-09T18:29:24.685000\"},\"govt_id\":null,\"proof_of_address\":null,\"proof_of_life\":null,\"beneficiaries\":null,\"names\":\"Jos\xE9\",\"first_surname\":\"L\xF3pez\",\"second_surname\":\"Hern\xE1ndez\",\"curp\":\"LOHJ660606HDFPRS02\",\"required_level\":4}" + 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"}' headers: Connection: - keep-alive Content-Length: - - '748' + - '1182' Content-Type: - application/json Date: - - Wed, 09 Feb 2022 18:29:26 GMT - X-Request-Time: - - 'value: 0.200' + - Tue, 29 Jul 2025 17:26:56 GMT x-amz-apigw-id: - - NSYw8F5piYcFZbg= + - Oe2fHHFgiYcEGEw= x-amzn-Remapped-Connection: - keep-alive x-amzn-Remapped-Content-Length: - - '748' + - '1182' x-amzn-Remapped-Date: - - Wed, 09 Feb 2022 18:29:26 GMT + - Tue, 29 Jul 2025 17:26:56 GMT x-amzn-Remapped-Server: - - nginx/1.20.2 + - nginx/1.28.0 x-amzn-RequestId: - - d4b85fcc-f94e-45a6-af87-695fd395df0c + - d6c4ad54-9764-4c5c-acf8-2a1f4f5a5f26 status: code: 200 message: OK diff --git a/tests/resources/cassettes/test_user_update.yaml b/tests/resources/cassettes/test_user_update.yaml index aad5f1d4..399e6565 100644 --- a/tests/resources/cassettes/test_user_update.yaml +++ b/tests/resources/cassettes/test_user_update.yaml @@ -1,54 +1,49 @@ interactions: - request: - body: '{"phone_number": "+525555555555", "profession": "programmer", "govt_id": - {"type": "ine", "uri_front": "cuenca.com", "uri_back": "cuenca.com", "is_mx": - true}}' + body: '{"profession": "Sistemas y Comunicaciones", "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": "614", "pronouns": null}' headers: - Accept: - - '*/*' - Accept-Encoding: - - gzip, deflate Authorization: - DUMMY - Connection: - - keep-alive Content-Length: - - '157' + - '285' Content-Type: - application/json User-Agent: - - cuenca-python/0.7.15.dev3 + - cuenca-python/2.1.8 X-Cuenca-Api-Version: - '2020-03-19' method: PATCH - uri: https://sandbox.cuenca.com/users/USCM-zlFcNQk6ue4gZ_mTGeQ + uri: https://sandbox.cuenca.com/users/USPR4JxMuwSG60u2h4gBpB6Q response: body: - string: "{\"id\":\"USCM-zlFcNQk6ue4gZ_mTGeQ\",\"identity_uri\":\"/identities/IDKWLi_wUoTty6WXXg9xfKFQ\",\"created_at\":\"2022-02-09T17:42:56.965000\",\"updated_at\":\"2022-02-09T17:50:41.964498\",\"platform_id\":\"PTW68GgAc_QPmNCmgajmctLg\",\"level\":0,\"phone_number\":\"+525555555555\",\"email_address\":\"jose@test.com\",\"profession\":\"programmer\",\"status\":\"active\",\"terms_of_service\":null,\"blacklist_validation_status\":\"succeeded\",\"address\":{\"street\":\"calle - 1\",\"ext_number\":\"2\",\"int_number\":\"3\",\"postal_code\":\"09900\",\"state\":\"DF\",\"city\":null,\"country\":\"MX\",\"created_at\":\"2022-02-09T17:42:56.964000\"},\"govt_id\":{\"type\":\"ine\",\"uri_front\":\"cuenca.com\",\"uri_back\":\"cuenca.com\",\"is_mx\":true,\"data\":{},\"status\":\"not_verified\"},\"proof_of_address\":null,\"proof_of_life\":null,\"beneficiaries\":null,\"names\":\"Jos\xE9\",\"first_surname\":\"L\xF3pez\",\"second_surname\":\"Hern\xE1ndez\",\"curp\":\"LOHJ660606HDFPRS02\",\"required_level\":4}" + string: '{"id":"USPR4JxMuwSG60u2h4gBpB6Q","created_at":"2025-07-29T17:26:51.788000","updated_at":"2025-07-29T17:42:15.806372","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":"Sistemas + y Comunicaciones","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":"614","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 Content-Length: - - '850' + - '1200' Content-Type: - application/json Date: - - Wed, 09 Feb 2022 17:50:42 GMT - X-Request-Time: - - 'value: 0.341' + - Tue, 29 Jul 2025 17:42:16 GMT x-amz-apigw-id: - - NSTFzHTECYcFa0g= + - Oe4uwGA1CYcETkQ= x-amzn-Remapped-Connection: - keep-alive x-amzn-Remapped-Content-Length: - - '850' + - '1200' x-amzn-Remapped-Date: - - Wed, 09 Feb 2022 17:50:42 GMT + - Tue, 29 Jul 2025 17:42:16 GMT x-amzn-Remapped-Server: - - nginx/1.20.2 + - nginx/1.28.0 x-amzn-RequestId: - - a291c01c-352d-42a3-9d70-4bdce79c084e + - d5109d06-e8a3-45f2-b773-2d7658bf6fac status: code: 200 message: OK diff --git a/tests/resources/test_sessions.py b/tests/resources/test_sessions.py index 9ef92644..cd57dba0 100644 --- a/tests/resources/test_sessions.py +++ b/tests/resources/test_sessions.py @@ -1,5 +1,5 @@ import pytest -from cuenca_validations.types import SessionType +from cuenca_validations.types import Profession, SessionType from pydantic import ValidationError import cuenca @@ -35,5 +35,6 @@ def test_session_create(curp_validation_request: dict, user_request: dict): ephimeral_cuenca_session = cuenca.http.Session() ephimeral_cuenca_session.configure(session_token=user_session.id) - user = User.update(user.id, email_address='manu@example.com') - assert user.email_address == 'manu@example.com' + + user = User.update(user.id, profession=Profession.comercio) + assert user.profession == Profession.comercio diff --git a/tests/resources/test_users.py b/tests/resources/test_users.py index 2df4ba45..a8331c4c 100644 --- a/tests/resources/test_users.py +++ b/tests/resources/test_users.py @@ -2,7 +2,7 @@ import pytest from cuenca_validations.types import VerificationType -from cuenca_validations.types.enums import Profession +from cuenca_validations.types.enums import Profession, SATRegimeCode from cuenca import Verification from cuenca.resources import CurpValidation, User @@ -29,16 +29,10 @@ def test_user_query(): @pytest.mark.vcr def test_user_update(): - user_id = 'USCM-zlFcNQk6ue4gZ_mTGeQ' + user_id = 'USPR4JxMuwSG60u2h4gBpB6Q' changes = dict( profession=Profession.sistemas, - phone_number='+525555555555', - govt_id=dict( - type='ine', - uri_front='cuenca.com', - uri_back='cuenca.com', - is_mx=True, - ), + fiscal_regime_code=SATRegimeCode.INT, ) user = User.update(user_id, **changes) assert all(item in user.to_dict().keys() for item in changes.keys())