diff --git a/.openapi-generator/FILES b/.openapi-generator/FILES index e0ace29..50d4ead 100644 --- a/.openapi-generator/FILES +++ b/.openapi-generator/FILES @@ -161,10 +161,13 @@ conekta/models/payment_method_card.py conekta/models/payment_method_card_request.py conekta/models/payment_method_card_response.py conekta/models/payment_method_cash.py +conekta/models/payment_method_cash_recurrent_response.py conekta/models/payment_method_cash_request.py conekta/models/payment_method_cash_response.py conekta/models/payment_method_cash_response_all_of_agreements.py conekta/models/payment_method_general_request.py +conekta/models/payment_method_pbb_payment.py +conekta/models/payment_method_pbb_request.py conekta/models/payment_method_response.py conekta/models/payment_method_spei_recurrent.py conekta/models/payment_method_spei_request.py @@ -360,10 +363,13 @@ docs/PaymentMethodCard.md docs/PaymentMethodCardRequest.md docs/PaymentMethodCardResponse.md docs/PaymentMethodCash.md +docs/PaymentMethodCashRecurrentResponse.md docs/PaymentMethodCashRequest.md docs/PaymentMethodCashResponse.md docs/PaymentMethodCashResponseAllOfAgreements.md docs/PaymentMethodGeneralRequest.md +docs/PaymentMethodPbbPayment.md +docs/PaymentMethodPbbRequest.md docs/PaymentMethodResponse.md docs/PaymentMethodSpeiRecurrent.md docs/PaymentMethodSpeiRequest.md diff --git a/README.md b/README.md index 4b9357d..f58c369 100644 --- a/README.md +++ b/README.md @@ -4,7 +4,7 @@ Conekta sdk This Python package is automatically generated by the [OpenAPI Generator](https://openapi-generator.tech) project: - API version: 2.2.0 -- Package version: 7.0.2 +- Package version: 7.0.3 - Generator version: 7.9.0 - Build package: org.openapitools.codegen.languages.PythonClientCodegen For more information, please visit [https://github.com/conekta/openapi/issues](https://github.com/conekta/openapi/issues) @@ -335,10 +335,13 @@ Class | Method | HTTP request | Description - [PaymentMethodCardRequest](docs/PaymentMethodCardRequest.md) - [PaymentMethodCardResponse](docs/PaymentMethodCardResponse.md) - [PaymentMethodCash](docs/PaymentMethodCash.md) + - [PaymentMethodCashRecurrentResponse](docs/PaymentMethodCashRecurrentResponse.md) - [PaymentMethodCashRequest](docs/PaymentMethodCashRequest.md) - [PaymentMethodCashResponse](docs/PaymentMethodCashResponse.md) - [PaymentMethodCashResponseAllOfAgreements](docs/PaymentMethodCashResponseAllOfAgreements.md) - [PaymentMethodGeneralRequest](docs/PaymentMethodGeneralRequest.md) + - [PaymentMethodPbbPayment](docs/PaymentMethodPbbPayment.md) + - [PaymentMethodPbbRequest](docs/PaymentMethodPbbRequest.md) - [PaymentMethodResponse](docs/PaymentMethodResponse.md) - [PaymentMethodSpeiRecurrent](docs/PaymentMethodSpeiRecurrent.md) - [PaymentMethodSpeiRequest](docs/PaymentMethodSpeiRequest.md) diff --git a/VERSION b/VERSION index a8907c0..a50da18 100644 --- a/VERSION +++ b/VERSION @@ -1 +1 @@ -7.0.2 +7.0.3 diff --git a/conekta/__init__.py b/conekta/__init__.py index d877cae..e36c1a2 100644 --- a/conekta/__init__.py +++ b/conekta/__init__.py @@ -15,7 +15,7 @@ """ # noqa: E501 -__version__ = "7.0.2" +__version__ = "7.0.3" # import apis into sdk package from conekta.api.antifraud_api import AntifraudApi @@ -181,10 +181,13 @@ from conekta.models.payment_method_card_request import PaymentMethodCardRequest from conekta.models.payment_method_card_response import PaymentMethodCardResponse from conekta.models.payment_method_cash import PaymentMethodCash +from conekta.models.payment_method_cash_recurrent_response import PaymentMethodCashRecurrentResponse from conekta.models.payment_method_cash_request import PaymentMethodCashRequest from conekta.models.payment_method_cash_response import PaymentMethodCashResponse from conekta.models.payment_method_cash_response_all_of_agreements import PaymentMethodCashResponseAllOfAgreements from conekta.models.payment_method_general_request import PaymentMethodGeneralRequest +from conekta.models.payment_method_pbb_payment import PaymentMethodPbbPayment +from conekta.models.payment_method_pbb_request import PaymentMethodPbbRequest from conekta.models.payment_method_response import PaymentMethodResponse from conekta.models.payment_method_spei_recurrent import PaymentMethodSpeiRecurrent from conekta.models.payment_method_spei_request import PaymentMethodSpeiRequest diff --git a/conekta/api_client.py b/conekta/api_client.py index e08b7e4..ea2f96b 100644 --- a/conekta/api_client.py +++ b/conekta/api_client.py @@ -74,7 +74,7 @@ class ApiClient: 'lang': 'python', 'lang_version': platform.python_version(), 'publisher': 'conekta', - 'bindings_version': '7.0.2', + 'bindings_version': '7.0.3', 'uname': platform.uname() } _pool = None @@ -97,7 +97,7 @@ def __init__( self.default_headers[header_name] = header_value self.cookie = cookie # Set default User-Agent. - self.user_agent = 'Conekta/v2 PythonBindings/7.0.2' + self.user_agent = 'Conekta/v2 PythonBindings/7.0.3' self.conekta_user_agent = json.dumps(self.data) self.client_side_validation = configuration.client_side_validation diff --git a/conekta/configuration.py b/conekta/configuration.py index bf6c7d7..7a927d5 100644 --- a/conekta/configuration.py +++ b/conekta/configuration.py @@ -393,7 +393,7 @@ def to_debug_report(self): "OS: {env}\n"\ "Python Version: {pyversion}\n"\ "Version of the API: 2.2.0\n"\ - "SDK Package Version: 7.0.2".\ + "SDK Package Version: 7.0.3".\ format(env=sys.platform, pyversion=sys.version) def get_host_settings(self): diff --git a/conekta/models/__init__.py b/conekta/models/__init__.py index a16e77a..867744b 100644 --- a/conekta/models/__init__.py +++ b/conekta/models/__init__.py @@ -141,10 +141,13 @@ from conekta.models.payment_method_card_request import PaymentMethodCardRequest from conekta.models.payment_method_card_response import PaymentMethodCardResponse from conekta.models.payment_method_cash import PaymentMethodCash +from conekta.models.payment_method_cash_recurrent_response import PaymentMethodCashRecurrentResponse from conekta.models.payment_method_cash_request import PaymentMethodCashRequest from conekta.models.payment_method_cash_response import PaymentMethodCashResponse from conekta.models.payment_method_cash_response_all_of_agreements import PaymentMethodCashResponseAllOfAgreements from conekta.models.payment_method_general_request import PaymentMethodGeneralRequest +from conekta.models.payment_method_pbb_payment import PaymentMethodPbbPayment +from conekta.models.payment_method_pbb_request import PaymentMethodPbbRequest from conekta.models.payment_method_response import PaymentMethodResponse from conekta.models.payment_method_spei_recurrent import PaymentMethodSpeiRecurrent from conekta.models.payment_method_spei_request import PaymentMethodSpeiRequest diff --git a/conekta/models/charge_order_response_payment_method.py b/conekta/models/charge_order_response_payment_method.py index 80202f0..537db94 100644 --- a/conekta/models/charge_order_response_payment_method.py +++ b/conekta/models/charge_order_response_payment_method.py @@ -22,11 +22,12 @@ from conekta.models.payment_method_bnpl_payment import PaymentMethodBnplPayment from conekta.models.payment_method_card import PaymentMethodCard from conekta.models.payment_method_cash import PaymentMethodCash +from conekta.models.payment_method_pbb_payment import PaymentMethodPbbPayment from pydantic import StrictStr, Field from typing import Union, List, Set, Optional, Dict from typing_extensions import Literal, Self -CHARGEORDERRESPONSEPAYMENTMETHOD_ONE_OF_SCHEMAS = ["PaymentMethodBankTransfer", "PaymentMethodBnplPayment", "PaymentMethodCard", "PaymentMethodCash"] +CHARGEORDERRESPONSEPAYMENTMETHOD_ONE_OF_SCHEMAS = ["PaymentMethodBankTransfer", "PaymentMethodBnplPayment", "PaymentMethodCard", "PaymentMethodCash", "PaymentMethodPbbPayment"] class ChargeOrderResponsePaymentMethod(BaseModel): """ @@ -40,8 +41,10 @@ class ChargeOrderResponsePaymentMethod(BaseModel): oneof_schema_3_validator: Optional[PaymentMethodBankTransfer] = None # data type: PaymentMethodBnplPayment oneof_schema_4_validator: Optional[PaymentMethodBnplPayment] = None - actual_instance: Optional[Union[PaymentMethodBankTransfer, PaymentMethodBnplPayment, PaymentMethodCard, PaymentMethodCash]] = None - one_of_schemas: Set[str] = { "PaymentMethodBankTransfer", "PaymentMethodBnplPayment", "PaymentMethodCard", "PaymentMethodCash" } + # data type: PaymentMethodPbbPayment + oneof_schema_5_validator: Optional[PaymentMethodPbbPayment] = None + actual_instance: Optional[Union[PaymentMethodBankTransfer, PaymentMethodBnplPayment, PaymentMethodCard, PaymentMethodCash, PaymentMethodPbbPayment]] = None + one_of_schemas: Set[str] = { "PaymentMethodBankTransfer", "PaymentMethodBnplPayment", "PaymentMethodCard", "PaymentMethodCash", "PaymentMethodPbbPayment" } model_config = ConfigDict( validate_assignment=True, @@ -87,12 +90,17 @@ def actual_instance_must_validate_oneof(cls, v): error_messages.append(f"Error! Input type `{type(v)}` is not `PaymentMethodBnplPayment`") else: match += 1 + # validate data type: PaymentMethodPbbPayment + if not isinstance(v, PaymentMethodPbbPayment): + error_messages.append(f"Error! Input type `{type(v)}` is not `PaymentMethodPbbPayment`") + else: + match += 1 if match > 1: # more than 1 match - raise ValueError("Multiple matches found when setting `actual_instance` in ChargeOrderResponsePaymentMethod with oneOf schemas: PaymentMethodBankTransfer, PaymentMethodBnplPayment, PaymentMethodCard, PaymentMethodCash. Details: " + ", ".join(error_messages)) + raise ValueError("Multiple matches found when setting `actual_instance` in ChargeOrderResponsePaymentMethod with oneOf schemas: PaymentMethodBankTransfer, PaymentMethodBnplPayment, PaymentMethodCard, PaymentMethodCash, PaymentMethodPbbPayment. Details: " + ", ".join(error_messages)) elif match == 0: # no match - raise ValueError("No match found when setting `actual_instance` in ChargeOrderResponsePaymentMethod with oneOf schemas: PaymentMethodBankTransfer, PaymentMethodBnplPayment, PaymentMethodCard, PaymentMethodCash. Details: " + ", ".join(error_messages)) + raise ValueError("No match found when setting `actual_instance` in ChargeOrderResponsePaymentMethod with oneOf schemas: PaymentMethodBankTransfer, PaymentMethodBnplPayment, PaymentMethodCard, PaymentMethodCash, PaymentMethodPbbPayment. Details: " + ", ".join(error_messages)) else: return v @@ -132,6 +140,11 @@ def from_json(cls, json_str: str) -> Self: instance.actual_instance = PaymentMethodCash.from_json(json_str) return instance + # check if data type is `PaymentMethodPbbPayment` + if _data_type == "pbb_payment": + instance.actual_instance = PaymentMethodPbbPayment.from_json(json_str) + return instance + # check if data type is `PaymentMethodBankTransfer` if _data_type == "payment_method_bank_transfer": instance.actual_instance = PaymentMethodBankTransfer.from_json(json_str) @@ -152,6 +165,11 @@ def from_json(cls, json_str: str) -> Self: instance.actual_instance = PaymentMethodCash.from_json(json_str) return instance + # check if data type is `PaymentMethodPbbPayment` + if _data_type == "payment_method_pbb_payment": + instance.actual_instance = PaymentMethodPbbPayment.from_json(json_str) + return instance + # deserialize data into PaymentMethodCash try: instance.actual_instance = PaymentMethodCash.from_json(json_str) @@ -176,13 +194,19 @@ def from_json(cls, json_str: str) -> Self: match += 1 except (ValidationError, ValueError) as e: error_messages.append(str(e)) + # deserialize data into PaymentMethodPbbPayment + try: + instance.actual_instance = PaymentMethodPbbPayment.from_json(json_str) + match += 1 + except (ValidationError, ValueError) as e: + error_messages.append(str(e)) if match > 1: # more than 1 match - raise ValueError("Multiple matches found when deserializing the JSON string into ChargeOrderResponsePaymentMethod with oneOf schemas: PaymentMethodBankTransfer, PaymentMethodBnplPayment, PaymentMethodCard, PaymentMethodCash. Details: " + ", ".join(error_messages)) + raise ValueError("Multiple matches found when deserializing the JSON string into ChargeOrderResponsePaymentMethod with oneOf schemas: PaymentMethodBankTransfer, PaymentMethodBnplPayment, PaymentMethodCard, PaymentMethodCash, PaymentMethodPbbPayment. Details: " + ", ".join(error_messages)) elif match == 0: # no match - raise ValueError("No match found when deserializing the JSON string into ChargeOrderResponsePaymentMethod with oneOf schemas: PaymentMethodBankTransfer, PaymentMethodBnplPayment, PaymentMethodCard, PaymentMethodCash. Details: " + ", ".join(error_messages)) + raise ValueError("No match found when deserializing the JSON string into ChargeOrderResponsePaymentMethod with oneOf schemas: PaymentMethodBankTransfer, PaymentMethodBnplPayment, PaymentMethodCard, PaymentMethodCash, PaymentMethodPbbPayment. Details: " + ", ".join(error_messages)) else: return instance @@ -196,7 +220,7 @@ def to_json(self) -> str: else: return json.dumps(self.actual_instance) - def to_dict(self) -> Optional[Union[Dict[str, Any], PaymentMethodBankTransfer, PaymentMethodBnplPayment, PaymentMethodCard, PaymentMethodCash]]: + def to_dict(self) -> Optional[Union[Dict[str, Any], PaymentMethodBankTransfer, PaymentMethodBnplPayment, PaymentMethodCard, PaymentMethodCash, PaymentMethodPbbPayment]]: """Returns the dict representation of the actual instance""" if self.actual_instance is None: return None diff --git a/conekta/models/charge_request_payment_method.py b/conekta/models/charge_request_payment_method.py index 7a0629a..d81865f 100644 --- a/conekta/models/charge_request_payment_method.py +++ b/conekta/models/charge_request_payment_method.py @@ -21,24 +21,27 @@ from conekta.models.payment_method_bnpl_request import PaymentMethodBnplRequest from conekta.models.payment_method_card_request import PaymentMethodCardRequest from conekta.models.payment_method_general_request import PaymentMethodGeneralRequest +from conekta.models.payment_method_pbb_request import PaymentMethodPbbRequest from pydantic import StrictStr, Field from typing import Union, List, Set, Optional, Dict from typing_extensions import Literal, Self -CHARGEREQUESTPAYMENTMETHOD_ONE_OF_SCHEMAS = ["PaymentMethodBnplRequest", "PaymentMethodCardRequest", "PaymentMethodGeneralRequest"] +CHARGEREQUESTPAYMENTMETHOD_ONE_OF_SCHEMAS = ["PaymentMethodBnplRequest", "PaymentMethodCardRequest", "PaymentMethodGeneralRequest", "PaymentMethodPbbRequest"] class ChargeRequestPaymentMethod(BaseModel): """ ChargeRequestPaymentMethod """ + # data type: PaymentMethodPbbRequest + oneof_schema_1_validator: Optional[PaymentMethodPbbRequest] = None # data type: PaymentMethodBnplRequest - oneof_schema_1_validator: Optional[PaymentMethodBnplRequest] = None + oneof_schema_2_validator: Optional[PaymentMethodBnplRequest] = None # data type: PaymentMethodCardRequest - oneof_schema_2_validator: Optional[PaymentMethodCardRequest] = None + oneof_schema_3_validator: Optional[PaymentMethodCardRequest] = None # data type: PaymentMethodGeneralRequest - oneof_schema_3_validator: Optional[PaymentMethodGeneralRequest] = None - actual_instance: Optional[Union[PaymentMethodBnplRequest, PaymentMethodCardRequest, PaymentMethodGeneralRequest]] = None - one_of_schemas: Set[str] = { "PaymentMethodBnplRequest", "PaymentMethodCardRequest", "PaymentMethodGeneralRequest" } + oneof_schema_4_validator: Optional[PaymentMethodGeneralRequest] = None + actual_instance: Optional[Union[PaymentMethodBnplRequest, PaymentMethodCardRequest, PaymentMethodGeneralRequest, PaymentMethodPbbRequest]] = None + one_of_schemas: Set[str] = { "PaymentMethodBnplRequest", "PaymentMethodCardRequest", "PaymentMethodGeneralRequest", "PaymentMethodPbbRequest" } model_config = ConfigDict( validate_assignment=True, @@ -61,6 +64,11 @@ def actual_instance_must_validate_oneof(cls, v): instance = ChargeRequestPaymentMethod.model_construct() error_messages = [] match = 0 + # validate data type: PaymentMethodPbbRequest + if not isinstance(v, PaymentMethodPbbRequest): + error_messages.append(f"Error! Input type `{type(v)}` is not `PaymentMethodPbbRequest`") + else: + match += 1 # validate data type: PaymentMethodBnplRequest if not isinstance(v, PaymentMethodBnplRequest): error_messages.append(f"Error! Input type `{type(v)}` is not `PaymentMethodBnplRequest`") @@ -78,10 +86,10 @@ def actual_instance_must_validate_oneof(cls, v): match += 1 if match > 1: # more than 1 match - raise ValueError("Multiple matches found when setting `actual_instance` in ChargeRequestPaymentMethod with oneOf schemas: PaymentMethodBnplRequest, PaymentMethodCardRequest, PaymentMethodGeneralRequest. Details: " + ", ".join(error_messages)) + raise ValueError("Multiple matches found when setting `actual_instance` in ChargeRequestPaymentMethod with oneOf schemas: PaymentMethodBnplRequest, PaymentMethodCardRequest, PaymentMethodGeneralRequest, PaymentMethodPbbRequest. Details: " + ", ".join(error_messages)) elif match == 0: # no match - raise ValueError("No match found when setting `actual_instance` in ChargeRequestPaymentMethod with oneOf schemas: PaymentMethodBnplRequest, PaymentMethodCardRequest, PaymentMethodGeneralRequest. Details: " + ", ".join(error_messages)) + raise ValueError("No match found when setting `actual_instance` in ChargeRequestPaymentMethod with oneOf schemas: PaymentMethodBnplRequest, PaymentMethodCardRequest, PaymentMethodGeneralRequest, PaymentMethodPbbRequest. Details: " + ", ".join(error_messages)) else: return v @@ -96,6 +104,12 @@ def from_json(cls, json_str: str) -> Self: error_messages = [] match = 0 + # deserialize data into PaymentMethodPbbRequest + try: + instance.actual_instance = PaymentMethodPbbRequest.from_json(json_str) + match += 1 + except (ValidationError, ValueError) as e: + error_messages.append(str(e)) # deserialize data into PaymentMethodBnplRequest try: instance.actual_instance = PaymentMethodBnplRequest.from_json(json_str) @@ -117,10 +131,10 @@ def from_json(cls, json_str: str) -> Self: if match > 1: # more than 1 match - raise ValueError("Multiple matches found when deserializing the JSON string into ChargeRequestPaymentMethod with oneOf schemas: PaymentMethodBnplRequest, PaymentMethodCardRequest, PaymentMethodGeneralRequest. Details: " + ", ".join(error_messages)) + raise ValueError("Multiple matches found when deserializing the JSON string into ChargeRequestPaymentMethod with oneOf schemas: PaymentMethodBnplRequest, PaymentMethodCardRequest, PaymentMethodGeneralRequest, PaymentMethodPbbRequest. Details: " + ", ".join(error_messages)) elif match == 0: # no match - raise ValueError("No match found when deserializing the JSON string into ChargeRequestPaymentMethod with oneOf schemas: PaymentMethodBnplRequest, PaymentMethodCardRequest, PaymentMethodGeneralRequest. Details: " + ", ".join(error_messages)) + raise ValueError("No match found when deserializing the JSON string into ChargeRequestPaymentMethod with oneOf schemas: PaymentMethodBnplRequest, PaymentMethodCardRequest, PaymentMethodGeneralRequest, PaymentMethodPbbRequest. Details: " + ", ".join(error_messages)) else: return instance @@ -134,7 +148,7 @@ def to_json(self) -> str: else: return json.dumps(self.actual_instance) - def to_dict(self) -> Optional[Union[Dict[str, Any], PaymentMethodBnplRequest, PaymentMethodCardRequest, PaymentMethodGeneralRequest]]: + def to_dict(self) -> Optional[Union[Dict[str, Any], PaymentMethodBnplRequest, PaymentMethodCardRequest, PaymentMethodGeneralRequest, PaymentMethodPbbRequest]]: """Returns the dict representation of the actual instance""" if self.actual_instance is None: return None diff --git a/conekta/models/charge_response_payment_method.py b/conekta/models/charge_response_payment_method.py index cb79a2f..6ec7f01 100644 --- a/conekta/models/charge_response_payment_method.py +++ b/conekta/models/charge_response_payment_method.py @@ -22,11 +22,12 @@ from conekta.models.payment_method_bnpl_payment import PaymentMethodBnplPayment from conekta.models.payment_method_card import PaymentMethodCard from conekta.models.payment_method_cash import PaymentMethodCash +from conekta.models.payment_method_pbb_payment import PaymentMethodPbbPayment from pydantic import StrictStr, Field from typing import Union, List, Set, Optional, Dict from typing_extensions import Literal, Self -CHARGERESPONSEPAYMENTMETHOD_ONE_OF_SCHEMAS = ["PaymentMethodBankTransfer", "PaymentMethodBnplPayment", "PaymentMethodCard", "PaymentMethodCash"] +CHARGERESPONSEPAYMENTMETHOD_ONE_OF_SCHEMAS = ["PaymentMethodBankTransfer", "PaymentMethodBnplPayment", "PaymentMethodCard", "PaymentMethodCash", "PaymentMethodPbbPayment"] class ChargeResponsePaymentMethod(BaseModel): """ @@ -40,8 +41,10 @@ class ChargeResponsePaymentMethod(BaseModel): oneof_schema_3_validator: Optional[PaymentMethodBankTransfer] = None # data type: PaymentMethodBnplPayment oneof_schema_4_validator: Optional[PaymentMethodBnplPayment] = None - actual_instance: Optional[Union[PaymentMethodBankTransfer, PaymentMethodBnplPayment, PaymentMethodCard, PaymentMethodCash]] = None - one_of_schemas: Set[str] = { "PaymentMethodBankTransfer", "PaymentMethodBnplPayment", "PaymentMethodCard", "PaymentMethodCash" } + # data type: PaymentMethodPbbPayment + oneof_schema_5_validator: Optional[PaymentMethodPbbPayment] = None + actual_instance: Optional[Union[PaymentMethodBankTransfer, PaymentMethodBnplPayment, PaymentMethodCard, PaymentMethodCash, PaymentMethodPbbPayment]] = None + one_of_schemas: Set[str] = { "PaymentMethodBankTransfer", "PaymentMethodBnplPayment", "PaymentMethodCard", "PaymentMethodCash", "PaymentMethodPbbPayment" } model_config = ConfigDict( validate_assignment=True, @@ -87,12 +90,17 @@ def actual_instance_must_validate_oneof(cls, v): error_messages.append(f"Error! Input type `{type(v)}` is not `PaymentMethodBnplPayment`") else: match += 1 + # validate data type: PaymentMethodPbbPayment + if not isinstance(v, PaymentMethodPbbPayment): + error_messages.append(f"Error! Input type `{type(v)}` is not `PaymentMethodPbbPayment`") + else: + match += 1 if match > 1: # more than 1 match - raise ValueError("Multiple matches found when setting `actual_instance` in ChargeResponsePaymentMethod with oneOf schemas: PaymentMethodBankTransfer, PaymentMethodBnplPayment, PaymentMethodCard, PaymentMethodCash. Details: " + ", ".join(error_messages)) + raise ValueError("Multiple matches found when setting `actual_instance` in ChargeResponsePaymentMethod with oneOf schemas: PaymentMethodBankTransfer, PaymentMethodBnplPayment, PaymentMethodCard, PaymentMethodCash, PaymentMethodPbbPayment. Details: " + ", ".join(error_messages)) elif match == 0: # no match - raise ValueError("No match found when setting `actual_instance` in ChargeResponsePaymentMethod with oneOf schemas: PaymentMethodBankTransfer, PaymentMethodBnplPayment, PaymentMethodCard, PaymentMethodCash. Details: " + ", ".join(error_messages)) + raise ValueError("No match found when setting `actual_instance` in ChargeResponsePaymentMethod with oneOf schemas: PaymentMethodBankTransfer, PaymentMethodBnplPayment, PaymentMethodCard, PaymentMethodCash, PaymentMethodPbbPayment. Details: " + ", ".join(error_messages)) else: return v @@ -132,6 +140,11 @@ def from_json(cls, json_str: str) -> Self: instance.actual_instance = PaymentMethodCash.from_json(json_str) return instance + # check if data type is `PaymentMethodPbbPayment` + if _data_type == "pay_by_bank_payment": + instance.actual_instance = PaymentMethodPbbPayment.from_json(json_str) + return instance + # check if data type is `PaymentMethodBankTransfer` if _data_type == "payment_method_bank_transfer": instance.actual_instance = PaymentMethodBankTransfer.from_json(json_str) @@ -152,6 +165,11 @@ def from_json(cls, json_str: str) -> Self: instance.actual_instance = PaymentMethodCash.from_json(json_str) return instance + # check if data type is `PaymentMethodPbbPayment` + if _data_type == "payment_method_pbb_payment": + instance.actual_instance = PaymentMethodPbbPayment.from_json(json_str) + return instance + # deserialize data into PaymentMethodCash try: instance.actual_instance = PaymentMethodCash.from_json(json_str) @@ -176,13 +194,19 @@ def from_json(cls, json_str: str) -> Self: match += 1 except (ValidationError, ValueError) as e: error_messages.append(str(e)) + # deserialize data into PaymentMethodPbbPayment + try: + instance.actual_instance = PaymentMethodPbbPayment.from_json(json_str) + match += 1 + except (ValidationError, ValueError) as e: + error_messages.append(str(e)) if match > 1: # more than 1 match - raise ValueError("Multiple matches found when deserializing the JSON string into ChargeResponsePaymentMethod with oneOf schemas: PaymentMethodBankTransfer, PaymentMethodBnplPayment, PaymentMethodCard, PaymentMethodCash. Details: " + ", ".join(error_messages)) + raise ValueError("Multiple matches found when deserializing the JSON string into ChargeResponsePaymentMethod with oneOf schemas: PaymentMethodBankTransfer, PaymentMethodBnplPayment, PaymentMethodCard, PaymentMethodCash, PaymentMethodPbbPayment. Details: " + ", ".join(error_messages)) elif match == 0: # no match - raise ValueError("No match found when deserializing the JSON string into ChargeResponsePaymentMethod with oneOf schemas: PaymentMethodBankTransfer, PaymentMethodBnplPayment, PaymentMethodCard, PaymentMethodCash. Details: " + ", ".join(error_messages)) + raise ValueError("No match found when deserializing the JSON string into ChargeResponsePaymentMethod with oneOf schemas: PaymentMethodBankTransfer, PaymentMethodBnplPayment, PaymentMethodCard, PaymentMethodCash, PaymentMethodPbbPayment. Details: " + ", ".join(error_messages)) else: return instance @@ -196,7 +220,7 @@ def to_json(self) -> str: else: return json.dumps(self.actual_instance) - def to_dict(self) -> Optional[Union[Dict[str, Any], PaymentMethodBankTransfer, PaymentMethodBnplPayment, PaymentMethodCard, PaymentMethodCash]]: + def to_dict(self) -> Optional[Union[Dict[str, Any], PaymentMethodBankTransfer, PaymentMethodBnplPayment, PaymentMethodCard, PaymentMethodCash, PaymentMethodPbbPayment]]: """Returns the dict representation of the actual instance""" if self.actual_instance is None: return None diff --git a/conekta/models/create_customer_payment_methods_response.py b/conekta/models/create_customer_payment_methods_response.py index 8ba2c21..8922f5c 100644 --- a/conekta/models/create_customer_payment_methods_response.py +++ b/conekta/models/create_customer_payment_methods_response.py @@ -19,13 +19,14 @@ from pydantic import BaseModel, ConfigDict, Field, StrictStr, ValidationError, field_validator from typing import Any, List, Optional from conekta.models.payment_method_card_response import PaymentMethodCardResponse +from conekta.models.payment_method_cash_recurrent_response import PaymentMethodCashRecurrentResponse from conekta.models.payment_method_cash_response import PaymentMethodCashResponse from conekta.models.payment_method_spei_recurrent import PaymentMethodSpeiRecurrent from pydantic import StrictStr, Field from typing import Union, List, Set, Optional, Dict from typing_extensions import Literal, Self -CREATECUSTOMERPAYMENTMETHODSRESPONSE_ONE_OF_SCHEMAS = ["PaymentMethodCardResponse", "PaymentMethodCashResponse", "PaymentMethodSpeiRecurrent"] +CREATECUSTOMERPAYMENTMETHODSRESPONSE_ONE_OF_SCHEMAS = ["PaymentMethodCardResponse", "PaymentMethodCashRecurrentResponse", "PaymentMethodCashResponse", "PaymentMethodSpeiRecurrent"] class CreateCustomerPaymentMethodsResponse(BaseModel): """ @@ -33,12 +34,14 @@ class CreateCustomerPaymentMethodsResponse(BaseModel): """ # data type: PaymentMethodCashResponse oneof_schema_1_validator: Optional[PaymentMethodCashResponse] = None + # data type: PaymentMethodCashRecurrentResponse + oneof_schema_2_validator: Optional[PaymentMethodCashRecurrentResponse] = None # data type: PaymentMethodCardResponse - oneof_schema_2_validator: Optional[PaymentMethodCardResponse] = None + oneof_schema_3_validator: Optional[PaymentMethodCardResponse] = None # data type: PaymentMethodSpeiRecurrent - oneof_schema_3_validator: Optional[PaymentMethodSpeiRecurrent] = None - actual_instance: Optional[Union[PaymentMethodCardResponse, PaymentMethodCashResponse, PaymentMethodSpeiRecurrent]] = None - one_of_schemas: Set[str] = { "PaymentMethodCardResponse", "PaymentMethodCashResponse", "PaymentMethodSpeiRecurrent" } + oneof_schema_4_validator: Optional[PaymentMethodSpeiRecurrent] = None + actual_instance: Optional[Union[PaymentMethodCardResponse, PaymentMethodCashRecurrentResponse, PaymentMethodCashResponse, PaymentMethodSpeiRecurrent]] = None + one_of_schemas: Set[str] = { "PaymentMethodCardResponse", "PaymentMethodCashRecurrentResponse", "PaymentMethodCashResponse", "PaymentMethodSpeiRecurrent" } model_config = ConfigDict( validate_assignment=True, @@ -69,6 +72,11 @@ def actual_instance_must_validate_oneof(cls, v): error_messages.append(f"Error! Input type `{type(v)}` is not `PaymentMethodCashResponse`") else: match += 1 + # validate data type: PaymentMethodCashRecurrentResponse + if not isinstance(v, PaymentMethodCashRecurrentResponse): + error_messages.append(f"Error! Input type `{type(v)}` is not `PaymentMethodCashRecurrentResponse`") + else: + match += 1 # validate data type: PaymentMethodCardResponse if not isinstance(v, PaymentMethodCardResponse): error_messages.append(f"Error! Input type `{type(v)}` is not `PaymentMethodCardResponse`") @@ -81,10 +89,10 @@ def actual_instance_must_validate_oneof(cls, v): match += 1 if match > 1: # more than 1 match - raise ValueError("Multiple matches found when setting `actual_instance` in CreateCustomerPaymentMethodsResponse with oneOf schemas: PaymentMethodCardResponse, PaymentMethodCashResponse, PaymentMethodSpeiRecurrent. Details: " + ", ".join(error_messages)) + raise ValueError("Multiple matches found when setting `actual_instance` in CreateCustomerPaymentMethodsResponse with oneOf schemas: PaymentMethodCardResponse, PaymentMethodCashRecurrentResponse, PaymentMethodCashResponse, PaymentMethodSpeiRecurrent. Details: " + ", ".join(error_messages)) elif match == 0: # no match - raise ValueError("No match found when setting `actual_instance` in CreateCustomerPaymentMethodsResponse with oneOf schemas: PaymentMethodCardResponse, PaymentMethodCashResponse, PaymentMethodSpeiRecurrent. Details: " + ", ".join(error_messages)) + raise ValueError("No match found when setting `actual_instance` in CreateCustomerPaymentMethodsResponse with oneOf schemas: PaymentMethodCardResponse, PaymentMethodCashRecurrentResponse, PaymentMethodCashResponse, PaymentMethodSpeiRecurrent. Details: " + ", ".join(error_messages)) else: return v @@ -114,14 +122,9 @@ def from_json(cls, json_str: str) -> Self: instance.actual_instance = PaymentMethodCashResponse.from_json(json_str) return instance - # check if data type is `PaymentMethodCashResponse` + # check if data type is `PaymentMethodCashRecurrentResponse` if _data_type == "cash_recurrent": - instance.actual_instance = PaymentMethodCashResponse.from_json(json_str) - return instance - - # check if data type is `PaymentMethodCashResponse` - if _data_type == "oxxo_recurrent": - instance.actual_instance = PaymentMethodCashResponse.from_json(json_str) + instance.actual_instance = PaymentMethodCashRecurrentResponse.from_json(json_str) return instance # check if data type is `PaymentMethodSpeiRecurrent` @@ -134,6 +137,11 @@ def from_json(cls, json_str: str) -> Self: instance.actual_instance = PaymentMethodCardResponse.from_json(json_str) return instance + # check if data type is `PaymentMethodCashRecurrentResponse` + if _data_type == "payment_method_cash_recurrent_response": + instance.actual_instance = PaymentMethodCashRecurrentResponse.from_json(json_str) + return instance + # check if data type is `PaymentMethodCashResponse` if _data_type == "payment_method_cash_response": instance.actual_instance = PaymentMethodCashResponse.from_json(json_str) @@ -150,6 +158,12 @@ def from_json(cls, json_str: str) -> Self: match += 1 except (ValidationError, ValueError) as e: error_messages.append(str(e)) + # deserialize data into PaymentMethodCashRecurrentResponse + try: + instance.actual_instance = PaymentMethodCashRecurrentResponse.from_json(json_str) + match += 1 + except (ValidationError, ValueError) as e: + error_messages.append(str(e)) # deserialize data into PaymentMethodCardResponse try: instance.actual_instance = PaymentMethodCardResponse.from_json(json_str) @@ -165,10 +179,10 @@ def from_json(cls, json_str: str) -> Self: if match > 1: # more than 1 match - raise ValueError("Multiple matches found when deserializing the JSON string into CreateCustomerPaymentMethodsResponse with oneOf schemas: PaymentMethodCardResponse, PaymentMethodCashResponse, PaymentMethodSpeiRecurrent. Details: " + ", ".join(error_messages)) + raise ValueError("Multiple matches found when deserializing the JSON string into CreateCustomerPaymentMethodsResponse with oneOf schemas: PaymentMethodCardResponse, PaymentMethodCashRecurrentResponse, PaymentMethodCashResponse, PaymentMethodSpeiRecurrent. Details: " + ", ".join(error_messages)) elif match == 0: # no match - raise ValueError("No match found when deserializing the JSON string into CreateCustomerPaymentMethodsResponse with oneOf schemas: PaymentMethodCardResponse, PaymentMethodCashResponse, PaymentMethodSpeiRecurrent. Details: " + ", ".join(error_messages)) + raise ValueError("No match found when deserializing the JSON string into CreateCustomerPaymentMethodsResponse with oneOf schemas: PaymentMethodCardResponse, PaymentMethodCashRecurrentResponse, PaymentMethodCashResponse, PaymentMethodSpeiRecurrent. Details: " + ", ".join(error_messages)) else: return instance @@ -182,7 +196,7 @@ def to_json(self) -> str: else: return json.dumps(self.actual_instance) - def to_dict(self) -> Optional[Union[Dict[str, Any], PaymentMethodCardResponse, PaymentMethodCashResponse, PaymentMethodSpeiRecurrent]]: + def to_dict(self) -> Optional[Union[Dict[str, Any], PaymentMethodCardResponse, PaymentMethodCashRecurrentResponse, PaymentMethodCashResponse, PaymentMethodSpeiRecurrent]]: """Returns the dict representation of the actual instance""" if self.actual_instance is None: return None diff --git a/conekta/models/customer_payment_methods_data.py b/conekta/models/customer_payment_methods_data.py index e6ef912..2a78e90 100644 --- a/conekta/models/customer_payment_methods_data.py +++ b/conekta/models/customer_payment_methods_data.py @@ -19,13 +19,14 @@ from pydantic import BaseModel, ConfigDict, Field, StrictStr, ValidationError, field_validator from typing import Any, List, Optional from conekta.models.payment_method_card_response import PaymentMethodCardResponse +from conekta.models.payment_method_cash_recurrent_response import PaymentMethodCashRecurrentResponse from conekta.models.payment_method_cash_response import PaymentMethodCashResponse from conekta.models.payment_method_spei_recurrent import PaymentMethodSpeiRecurrent from pydantic import StrictStr, Field from typing import Union, List, Set, Optional, Dict from typing_extensions import Literal, Self -CUSTOMERPAYMENTMETHODSDATA_ONE_OF_SCHEMAS = ["PaymentMethodCardResponse", "PaymentMethodCashResponse", "PaymentMethodSpeiRecurrent"] +CUSTOMERPAYMENTMETHODSDATA_ONE_OF_SCHEMAS = ["PaymentMethodCardResponse", "PaymentMethodCashRecurrentResponse", "PaymentMethodCashResponse", "PaymentMethodSpeiRecurrent"] class CustomerPaymentMethodsData(BaseModel): """ @@ -33,12 +34,14 @@ class CustomerPaymentMethodsData(BaseModel): """ # data type: PaymentMethodCashResponse oneof_schema_1_validator: Optional[PaymentMethodCashResponse] = None + # data type: PaymentMethodCashRecurrentResponse + oneof_schema_2_validator: Optional[PaymentMethodCashRecurrentResponse] = None # data type: PaymentMethodCardResponse - oneof_schema_2_validator: Optional[PaymentMethodCardResponse] = None + oneof_schema_3_validator: Optional[PaymentMethodCardResponse] = None # data type: PaymentMethodSpeiRecurrent - oneof_schema_3_validator: Optional[PaymentMethodSpeiRecurrent] = None - actual_instance: Optional[Union[PaymentMethodCardResponse, PaymentMethodCashResponse, PaymentMethodSpeiRecurrent]] = None - one_of_schemas: Set[str] = { "PaymentMethodCardResponse", "PaymentMethodCashResponse", "PaymentMethodSpeiRecurrent" } + oneof_schema_4_validator: Optional[PaymentMethodSpeiRecurrent] = None + actual_instance: Optional[Union[PaymentMethodCardResponse, PaymentMethodCashRecurrentResponse, PaymentMethodCashResponse, PaymentMethodSpeiRecurrent]] = None + one_of_schemas: Set[str] = { "PaymentMethodCardResponse", "PaymentMethodCashRecurrentResponse", "PaymentMethodCashResponse", "PaymentMethodSpeiRecurrent" } model_config = ConfigDict( validate_assignment=True, @@ -69,6 +72,11 @@ def actual_instance_must_validate_oneof(cls, v): error_messages.append(f"Error! Input type `{type(v)}` is not `PaymentMethodCashResponse`") else: match += 1 + # validate data type: PaymentMethodCashRecurrentResponse + if not isinstance(v, PaymentMethodCashRecurrentResponse): + error_messages.append(f"Error! Input type `{type(v)}` is not `PaymentMethodCashRecurrentResponse`") + else: + match += 1 # validate data type: PaymentMethodCardResponse if not isinstance(v, PaymentMethodCardResponse): error_messages.append(f"Error! Input type `{type(v)}` is not `PaymentMethodCardResponse`") @@ -81,10 +89,10 @@ def actual_instance_must_validate_oneof(cls, v): match += 1 if match > 1: # more than 1 match - raise ValueError("Multiple matches found when setting `actual_instance` in CustomerPaymentMethodsData with oneOf schemas: PaymentMethodCardResponse, PaymentMethodCashResponse, PaymentMethodSpeiRecurrent. Details: " + ", ".join(error_messages)) + raise ValueError("Multiple matches found when setting `actual_instance` in CustomerPaymentMethodsData with oneOf schemas: PaymentMethodCardResponse, PaymentMethodCashRecurrentResponse, PaymentMethodCashResponse, PaymentMethodSpeiRecurrent. Details: " + ", ".join(error_messages)) elif match == 0: # no match - raise ValueError("No match found when setting `actual_instance` in CustomerPaymentMethodsData with oneOf schemas: PaymentMethodCardResponse, PaymentMethodCashResponse, PaymentMethodSpeiRecurrent. Details: " + ", ".join(error_messages)) + raise ValueError("No match found when setting `actual_instance` in CustomerPaymentMethodsData with oneOf schemas: PaymentMethodCardResponse, PaymentMethodCashRecurrentResponse, PaymentMethodCashResponse, PaymentMethodSpeiRecurrent. Details: " + ", ".join(error_messages)) else: return v @@ -114,14 +122,9 @@ def from_json(cls, json_str: str) -> Self: instance.actual_instance = PaymentMethodCashResponse.from_json(json_str) return instance - # check if data type is `PaymentMethodCashResponse` + # check if data type is `PaymentMethodCashRecurrentResponse` if _data_type == "cash_recurrent": - instance.actual_instance = PaymentMethodCashResponse.from_json(json_str) - return instance - - # check if data type is `PaymentMethodCashResponse` - if _data_type == "oxxo_recurrent": - instance.actual_instance = PaymentMethodCashResponse.from_json(json_str) + instance.actual_instance = PaymentMethodCashRecurrentResponse.from_json(json_str) return instance # check if data type is `PaymentMethodSpeiRecurrent` @@ -134,6 +137,11 @@ def from_json(cls, json_str: str) -> Self: instance.actual_instance = PaymentMethodCardResponse.from_json(json_str) return instance + # check if data type is `PaymentMethodCashRecurrentResponse` + if _data_type == "payment_method_cash_recurrent_response": + instance.actual_instance = PaymentMethodCashRecurrentResponse.from_json(json_str) + return instance + # check if data type is `PaymentMethodCashResponse` if _data_type == "payment_method_cash_response": instance.actual_instance = PaymentMethodCashResponse.from_json(json_str) @@ -150,6 +158,12 @@ def from_json(cls, json_str: str) -> Self: match += 1 except (ValidationError, ValueError) as e: error_messages.append(str(e)) + # deserialize data into PaymentMethodCashRecurrentResponse + try: + instance.actual_instance = PaymentMethodCashRecurrentResponse.from_json(json_str) + match += 1 + except (ValidationError, ValueError) as e: + error_messages.append(str(e)) # deserialize data into PaymentMethodCardResponse try: instance.actual_instance = PaymentMethodCardResponse.from_json(json_str) @@ -165,10 +179,10 @@ def from_json(cls, json_str: str) -> Self: if match > 1: # more than 1 match - raise ValueError("Multiple matches found when deserializing the JSON string into CustomerPaymentMethodsData with oneOf schemas: PaymentMethodCardResponse, PaymentMethodCashResponse, PaymentMethodSpeiRecurrent. Details: " + ", ".join(error_messages)) + raise ValueError("Multiple matches found when deserializing the JSON string into CustomerPaymentMethodsData with oneOf schemas: PaymentMethodCardResponse, PaymentMethodCashRecurrentResponse, PaymentMethodCashResponse, PaymentMethodSpeiRecurrent. Details: " + ", ".join(error_messages)) elif match == 0: # no match - raise ValueError("No match found when deserializing the JSON string into CustomerPaymentMethodsData with oneOf schemas: PaymentMethodCardResponse, PaymentMethodCashResponse, PaymentMethodSpeiRecurrent. Details: " + ", ".join(error_messages)) + raise ValueError("No match found when deserializing the JSON string into CustomerPaymentMethodsData with oneOf schemas: PaymentMethodCardResponse, PaymentMethodCashRecurrentResponse, PaymentMethodCashResponse, PaymentMethodSpeiRecurrent. Details: " + ", ".join(error_messages)) else: return instance @@ -182,7 +196,7 @@ def to_json(self) -> str: else: return json.dumps(self.actual_instance) - def to_dict(self) -> Optional[Union[Dict[str, Any], PaymentMethodCardResponse, PaymentMethodCashResponse, PaymentMethodSpeiRecurrent]]: + def to_dict(self) -> Optional[Union[Dict[str, Any], PaymentMethodCardResponse, PaymentMethodCashRecurrentResponse, PaymentMethodCashResponse, PaymentMethodSpeiRecurrent]]: """Returns the dict representation of the actual instance""" if self.actual_instance is None: return None diff --git a/conekta/models/get_customer_payment_method_data_response.py b/conekta/models/get_customer_payment_method_data_response.py index 7bb03a3..254b086 100644 --- a/conekta/models/get_customer_payment_method_data_response.py +++ b/conekta/models/get_customer_payment_method_data_response.py @@ -19,26 +19,29 @@ from pydantic import BaseModel, ConfigDict, Field, StrictStr, ValidationError, field_validator from typing import Any, List, Optional from conekta.models.payment_method_card_response import PaymentMethodCardResponse +from conekta.models.payment_method_cash_recurrent_response import PaymentMethodCashRecurrentResponse from conekta.models.payment_method_cash_response import PaymentMethodCashResponse from conekta.models.payment_method_spei_recurrent import PaymentMethodSpeiRecurrent from pydantic import StrictStr, Field from typing import Union, List, Set, Optional, Dict from typing_extensions import Literal, Self -GETCUSTOMERPAYMENTMETHODDATARESPONSE_ONE_OF_SCHEMAS = ["PaymentMethodCardResponse", "PaymentMethodCashResponse", "PaymentMethodSpeiRecurrent"] +GETCUSTOMERPAYMENTMETHODDATARESPONSE_ONE_OF_SCHEMAS = ["PaymentMethodCardResponse", "PaymentMethodCashRecurrentResponse", "PaymentMethodCashResponse", "PaymentMethodSpeiRecurrent"] class GetCustomerPaymentMethodDataResponse(BaseModel): """ GetCustomerPaymentMethodDataResponse """ + # data type: PaymentMethodCashRecurrentResponse + oneof_schema_1_validator: Optional[PaymentMethodCashRecurrentResponse] = None # data type: PaymentMethodCashResponse - oneof_schema_1_validator: Optional[PaymentMethodCashResponse] = None + oneof_schema_2_validator: Optional[PaymentMethodCashResponse] = None # data type: PaymentMethodCardResponse - oneof_schema_2_validator: Optional[PaymentMethodCardResponse] = None + oneof_schema_3_validator: Optional[PaymentMethodCardResponse] = None # data type: PaymentMethodSpeiRecurrent - oneof_schema_3_validator: Optional[PaymentMethodSpeiRecurrent] = None - actual_instance: Optional[Union[PaymentMethodCardResponse, PaymentMethodCashResponse, PaymentMethodSpeiRecurrent]] = None - one_of_schemas: Set[str] = { "PaymentMethodCardResponse", "PaymentMethodCashResponse", "PaymentMethodSpeiRecurrent" } + oneof_schema_4_validator: Optional[PaymentMethodSpeiRecurrent] = None + actual_instance: Optional[Union[PaymentMethodCardResponse, PaymentMethodCashRecurrentResponse, PaymentMethodCashResponse, PaymentMethodSpeiRecurrent]] = None + one_of_schemas: Set[str] = { "PaymentMethodCardResponse", "PaymentMethodCashRecurrentResponse", "PaymentMethodCashResponse", "PaymentMethodSpeiRecurrent" } model_config = ConfigDict( validate_assignment=True, @@ -64,6 +67,11 @@ def actual_instance_must_validate_oneof(cls, v): instance = GetCustomerPaymentMethodDataResponse.model_construct() error_messages = [] match = 0 + # validate data type: PaymentMethodCashRecurrentResponse + if not isinstance(v, PaymentMethodCashRecurrentResponse): + error_messages.append(f"Error! Input type `{type(v)}` is not `PaymentMethodCashRecurrentResponse`") + else: + match += 1 # validate data type: PaymentMethodCashResponse if not isinstance(v, PaymentMethodCashResponse): error_messages.append(f"Error! Input type `{type(v)}` is not `PaymentMethodCashResponse`") @@ -81,10 +89,10 @@ def actual_instance_must_validate_oneof(cls, v): match += 1 if match > 1: # more than 1 match - raise ValueError("Multiple matches found when setting `actual_instance` in GetCustomerPaymentMethodDataResponse with oneOf schemas: PaymentMethodCardResponse, PaymentMethodCashResponse, PaymentMethodSpeiRecurrent. Details: " + ", ".join(error_messages)) + raise ValueError("Multiple matches found when setting `actual_instance` in GetCustomerPaymentMethodDataResponse with oneOf schemas: PaymentMethodCardResponse, PaymentMethodCashRecurrentResponse, PaymentMethodCashResponse, PaymentMethodSpeiRecurrent. Details: " + ", ".join(error_messages)) elif match == 0: # no match - raise ValueError("No match found when setting `actual_instance` in GetCustomerPaymentMethodDataResponse with oneOf schemas: PaymentMethodCardResponse, PaymentMethodCashResponse, PaymentMethodSpeiRecurrent. Details: " + ", ".join(error_messages)) + raise ValueError("No match found when setting `actual_instance` in GetCustomerPaymentMethodDataResponse with oneOf schemas: PaymentMethodCardResponse, PaymentMethodCashRecurrentResponse, PaymentMethodCashResponse, PaymentMethodSpeiRecurrent. Details: " + ", ".join(error_messages)) else: return v @@ -114,14 +122,9 @@ def from_json(cls, json_str: str) -> Self: instance.actual_instance = PaymentMethodCashResponse.from_json(json_str) return instance - # check if data type is `PaymentMethodCashResponse` + # check if data type is `PaymentMethodCashRecurrentResponse` if _data_type == "cash_recurrent": - instance.actual_instance = PaymentMethodCashResponse.from_json(json_str) - return instance - - # check if data type is `PaymentMethodCashResponse` - if _data_type == "oxxo_recurrent": - instance.actual_instance = PaymentMethodCashResponse.from_json(json_str) + instance.actual_instance = PaymentMethodCashRecurrentResponse.from_json(json_str) return instance # check if data type is `PaymentMethodSpeiRecurrent` @@ -134,6 +137,11 @@ def from_json(cls, json_str: str) -> Self: instance.actual_instance = PaymentMethodCardResponse.from_json(json_str) return instance + # check if data type is `PaymentMethodCashRecurrentResponse` + if _data_type == "payment_method_cash_recurrent_response": + instance.actual_instance = PaymentMethodCashRecurrentResponse.from_json(json_str) + return instance + # check if data type is `PaymentMethodCashResponse` if _data_type == "payment_method_cash_response": instance.actual_instance = PaymentMethodCashResponse.from_json(json_str) @@ -144,6 +152,12 @@ def from_json(cls, json_str: str) -> Self: instance.actual_instance = PaymentMethodSpeiRecurrent.from_json(json_str) return instance + # deserialize data into PaymentMethodCashRecurrentResponse + try: + instance.actual_instance = PaymentMethodCashRecurrentResponse.from_json(json_str) + match += 1 + except (ValidationError, ValueError) as e: + error_messages.append(str(e)) # deserialize data into PaymentMethodCashResponse try: instance.actual_instance = PaymentMethodCashResponse.from_json(json_str) @@ -165,10 +179,10 @@ def from_json(cls, json_str: str) -> Self: if match > 1: # more than 1 match - raise ValueError("Multiple matches found when deserializing the JSON string into GetCustomerPaymentMethodDataResponse with oneOf schemas: PaymentMethodCardResponse, PaymentMethodCashResponse, PaymentMethodSpeiRecurrent. Details: " + ", ".join(error_messages)) + raise ValueError("Multiple matches found when deserializing the JSON string into GetCustomerPaymentMethodDataResponse with oneOf schemas: PaymentMethodCardResponse, PaymentMethodCashRecurrentResponse, PaymentMethodCashResponse, PaymentMethodSpeiRecurrent. Details: " + ", ".join(error_messages)) elif match == 0: # no match - raise ValueError("No match found when deserializing the JSON string into GetCustomerPaymentMethodDataResponse with oneOf schemas: PaymentMethodCardResponse, PaymentMethodCashResponse, PaymentMethodSpeiRecurrent. Details: " + ", ".join(error_messages)) + raise ValueError("No match found when deserializing the JSON string into GetCustomerPaymentMethodDataResponse with oneOf schemas: PaymentMethodCardResponse, PaymentMethodCashRecurrentResponse, PaymentMethodCashResponse, PaymentMethodSpeiRecurrent. Details: " + ", ".join(error_messages)) else: return instance @@ -182,7 +196,7 @@ def to_json(self) -> str: else: return json.dumps(self.actual_instance) - def to_dict(self) -> Optional[Union[Dict[str, Any], PaymentMethodCardResponse, PaymentMethodCashResponse, PaymentMethodSpeiRecurrent]]: + def to_dict(self) -> Optional[Union[Dict[str, Any], PaymentMethodCardResponse, PaymentMethodCashRecurrentResponse, PaymentMethodCashResponse, PaymentMethodSpeiRecurrent]]: """Returns the dict representation of the actual instance""" if self.actual_instance is None: return None diff --git a/conekta/models/payment_method_cash_recurrent_response.py b/conekta/models/payment_method_cash_recurrent_response.py new file mode 100644 index 0000000..3d4481a --- /dev/null +++ b/conekta/models/payment_method_cash_recurrent_response.py @@ -0,0 +1,116 @@ +# coding: utf-8 + +""" + Conekta API + + Conekta sdk + + The version of the OpenAPI document: 2.2.0 + Contact: engineering@conekta.com + Generated by OpenAPI Generator (https://openapi-generator.tech) + + Do not edit the class manually. +""" # noqa: E501 + + +from __future__ import annotations +import pprint +import re # noqa: F401 +import json + +from pydantic import BaseModel, ConfigDict, Field, StrictInt, StrictStr +from typing import Any, ClassVar, Dict, List, Optional +from conekta.models.payment_method_cash_response_all_of_agreements import PaymentMethodCashResponseAllOfAgreements +from typing import Optional, Set +from typing_extensions import Self + +class PaymentMethodCashRecurrentResponse(BaseModel): + """ + Alias of cash response used when type=cash_recurrent + """ # noqa: E501 + type: StrictStr + id: StrictStr + object: StrictStr + created_at: StrictInt + parent_id: Optional[StrictStr] = None + agreements: Optional[List[PaymentMethodCashResponseAllOfAgreements]] = None + reference: Optional[StrictStr] = None + barcode: Optional[StrictStr] = None + barcode_url: Optional[StrictStr] = Field(default=None, description="URL to the barcode image, reference is the same as barcode") + expires_at: Optional[StrictInt] = None + provider: Optional[StrictStr] = None + __properties: ClassVar[List[str]] = ["type", "id", "object", "created_at", "parent_id", "agreements", "reference", "barcode", "barcode_url", "expires_at", "provider"] + + model_config = ConfigDict( + populate_by_name=True, + validate_assignment=True, + protected_namespaces=(), + ) + + + def to_str(self) -> str: + """Returns the string representation of the model using alias""" + return pprint.pformat(self.model_dump(by_alias=True)) + + def to_json(self) -> str: + """Returns the JSON representation of the model using alias""" + # TODO: pydantic v2: use .model_dump_json(by_alias=True, exclude_unset=True) instead + return json.dumps(self.to_dict()) + + @classmethod + def from_json(cls, json_str: str) -> Optional[Self]: + """Create an instance of PaymentMethodCashRecurrentResponse from a JSON string""" + return cls.from_dict(json.loads(json_str)) + + def to_dict(self) -> Dict[str, Any]: + """Return the dictionary representation of the model using alias. + + This has the following differences from calling pydantic's + `self.model_dump(by_alias=True)`: + + * `None` is only added to the output dict for nullable fields that + were set at model initialization. Other fields with value `None` + are ignored. + """ + excluded_fields: Set[str] = set([ + ]) + + _dict = self.model_dump( + by_alias=True, + exclude=excluded_fields, + exclude_none=True, + ) + # override the default output from pydantic by calling `to_dict()` of each item in agreements (list) + _items = [] + if self.agreements: + for _item_agreements in self.agreements: + if _item_agreements: + _items.append(_item_agreements.to_dict()) + _dict['agreements'] = _items + return _dict + + @classmethod + def from_dict(cls, obj: Optional[Dict[str, Any]]) -> Optional[Self]: + """Create an instance of PaymentMethodCashRecurrentResponse from a dict""" + if obj is None: + return None + + if not isinstance(obj, dict): + return cls.model_validate(obj) + + _obj = cls.model_validate({ + "type": obj.get("type"), + "id": obj.get("id"), + "object": obj.get("object"), + "created_at": obj.get("created_at"), + "parent_id": obj.get("parent_id"), + "agreements": [PaymentMethodCashResponseAllOfAgreements.from_dict(_item) for _item in obj["agreements"]] if obj.get("agreements") is not None else None, + "reference": obj.get("reference"), + "barcode": obj.get("barcode"), + "barcode_url": obj.get("barcode_url"), + "expires_at": obj.get("expires_at"), + "provider": obj.get("provider") + }) + return _obj + + diff --git a/conekta/models/payment_method_pbb_payment.py b/conekta/models/payment_method_pbb_payment.py new file mode 100644 index 0000000..8953ce6 --- /dev/null +++ b/conekta/models/payment_method_pbb_payment.py @@ -0,0 +1,101 @@ +# coding: utf-8 + +""" + Conekta API + + Conekta sdk + + The version of the OpenAPI document: 2.2.0 + Contact: engineering@conekta.com + Generated by OpenAPI Generator (https://openapi-generator.tech) + + Do not edit the class manually. +""" # noqa: E501 + + +from __future__ import annotations +import pprint +import re # noqa: F401 +import json + +from pydantic import BaseModel, ConfigDict, Field, StrictStr +from typing import Any, ClassVar, Dict, List, Optional +from typing_extensions import Annotated +from typing import Optional, Set +from typing_extensions import Self + +class PaymentMethodPbbPayment(BaseModel): + """ + PaymentMethodPbbPayment + """ # noqa: E501 + type: Optional[StrictStr] = None + object: StrictStr + deep_link: StrictStr = Field(description="Deep link for the payment, use for mobile apps/flows") + expires_at: Annotated[int, Field(strict=True, gt=0)] = Field(description="Expiration date of the charge") + product_type: StrictStr = Field(description="Product type of the charge") + redirect_url: StrictStr = Field(description="URL to redirect the customer to complete the payment") + reference: StrictStr = Field(description="Reference for the payment") + __properties: ClassVar[List[str]] = ["type", "object", "deep_link", "expires_at", "product_type", "redirect_url", "reference"] + + model_config = ConfigDict( + populate_by_name=True, + validate_assignment=True, + protected_namespaces=(), + ) + + + def to_str(self) -> str: + """Returns the string representation of the model using alias""" + return pprint.pformat(self.model_dump(by_alias=True)) + + def to_json(self) -> str: + """Returns the JSON representation of the model using alias""" + # TODO: pydantic v2: use .model_dump_json(by_alias=True, exclude_unset=True) instead + return json.dumps(self.to_dict()) + + @classmethod + def from_json(cls, json_str: str) -> Optional[Self]: + """Create an instance of PaymentMethodPbbPayment from a JSON string""" + return cls.from_dict(json.loads(json_str)) + + def to_dict(self) -> Dict[str, Any]: + """Return the dictionary representation of the model using alias. + + This has the following differences from calling pydantic's + `self.model_dump(by_alias=True)`: + + * `None` is only added to the output dict for nullable fields that + were set at model initialization. Other fields with value `None` + are ignored. + """ + excluded_fields: Set[str] = set([ + ]) + + _dict = self.model_dump( + by_alias=True, + exclude=excluded_fields, + exclude_none=True, + ) + return _dict + + @classmethod + def from_dict(cls, obj: Optional[Dict[str, Any]]) -> Optional[Self]: + """Create an instance of PaymentMethodPbbPayment from a dict""" + if obj is None: + return None + + if not isinstance(obj, dict): + return cls.model_validate(obj) + + _obj = cls.model_validate({ + "type": obj.get("type"), + "object": obj.get("object"), + "deep_link": obj.get("deep_link"), + "expires_at": obj.get("expires_at"), + "product_type": obj.get("product_type"), + "redirect_url": obj.get("redirect_url"), + "reference": obj.get("reference") + }) + return _obj + + diff --git a/conekta/models/payment_method_pbb_request.py b/conekta/models/payment_method_pbb_request.py new file mode 100644 index 0000000..0772e99 --- /dev/null +++ b/conekta/models/payment_method_pbb_request.py @@ -0,0 +1,100 @@ +# coding: utf-8 + +""" + Conekta API + + Conekta sdk + + The version of the OpenAPI document: 2.2.0 + Contact: engineering@conekta.com + Generated by OpenAPI Generator (https://openapi-generator.tech) + + Do not edit the class manually. +""" # noqa: E501 + + +from __future__ import annotations +import pprint +import re # noqa: F401 +import json + +from pydantic import BaseModel, ConfigDict, Field, StrictStr, field_validator +from typing import Any, ClassVar, Dict, List, Optional +from typing_extensions import Annotated +from typing import Optional, Set +from typing_extensions import Self + +class PaymentMethodPbbRequest(BaseModel): + """ + PaymentMethodPbbRequest + """ # noqa: E501 + type: StrictStr = Field(description="Type of the payment method") + expires_at: Optional[Annotated[int, Field(strict=True, ge=0)]] = Field(default=None, description="Expiration date of the payment method, in Unix timestamp format") + product_type: StrictStr = Field(description="Product type of the payment method, use for the payment method to know the product type") + __properties: ClassVar[List[str]] = ["type", "expires_at", "product_type"] + + @field_validator('product_type') + def product_type_validate_enum(cls, value): + """Validates the enum""" + if value not in set(['bbva_pay_by_bank']): + raise ValueError("must be one of enum values ('bbva_pay_by_bank')") + return value + + model_config = ConfigDict( + populate_by_name=True, + validate_assignment=True, + protected_namespaces=(), + ) + + + def to_str(self) -> str: + """Returns the string representation of the model using alias""" + return pprint.pformat(self.model_dump(by_alias=True)) + + def to_json(self) -> str: + """Returns the JSON representation of the model using alias""" + # TODO: pydantic v2: use .model_dump_json(by_alias=True, exclude_unset=True) instead + return json.dumps(self.to_dict()) + + @classmethod + def from_json(cls, json_str: str) -> Optional[Self]: + """Create an instance of PaymentMethodPbbRequest from a JSON string""" + return cls.from_dict(json.loads(json_str)) + + def to_dict(self) -> Dict[str, Any]: + """Return the dictionary representation of the model using alias. + + This has the following differences from calling pydantic's + `self.model_dump(by_alias=True)`: + + * `None` is only added to the output dict for nullable fields that + were set at model initialization. Other fields with value `None` + are ignored. + """ + excluded_fields: Set[str] = set([ + ]) + + _dict = self.model_dump( + by_alias=True, + exclude=excluded_fields, + exclude_none=True, + ) + return _dict + + @classmethod + def from_dict(cls, obj: Optional[Dict[str, Any]]) -> Optional[Self]: + """Create an instance of PaymentMethodPbbRequest from a dict""" + if obj is None: + return None + + if not isinstance(obj, dict): + return cls.model_validate(obj) + + _obj = cls.model_validate({ + "type": obj.get("type"), + "expires_at": obj.get("expires_at"), + "product_type": obj.get("product_type") + }) + return _obj + + diff --git a/conekta/models/update_customer_payment_methods_response.py b/conekta/models/update_customer_payment_methods_response.py index 321a933..91fd1e1 100644 --- a/conekta/models/update_customer_payment_methods_response.py +++ b/conekta/models/update_customer_payment_methods_response.py @@ -19,13 +19,14 @@ from pydantic import BaseModel, ConfigDict, Field, StrictStr, ValidationError, field_validator from typing import Any, List, Optional from conekta.models.payment_method_card_response import PaymentMethodCardResponse +from conekta.models.payment_method_cash_recurrent_response import PaymentMethodCashRecurrentResponse from conekta.models.payment_method_cash_response import PaymentMethodCashResponse from conekta.models.payment_method_spei_recurrent import PaymentMethodSpeiRecurrent from pydantic import StrictStr, Field from typing import Union, List, Set, Optional, Dict from typing_extensions import Literal, Self -UPDATECUSTOMERPAYMENTMETHODSRESPONSE_ONE_OF_SCHEMAS = ["PaymentMethodCardResponse", "PaymentMethodCashResponse", "PaymentMethodSpeiRecurrent"] +UPDATECUSTOMERPAYMENTMETHODSRESPONSE_ONE_OF_SCHEMAS = ["PaymentMethodCardResponse", "PaymentMethodCashRecurrentResponse", "PaymentMethodCashResponse", "PaymentMethodSpeiRecurrent"] class UpdateCustomerPaymentMethodsResponse(BaseModel): """ @@ -33,12 +34,14 @@ class UpdateCustomerPaymentMethodsResponse(BaseModel): """ # data type: PaymentMethodCashResponse oneof_schema_1_validator: Optional[PaymentMethodCashResponse] = None + # data type: PaymentMethodCashRecurrentResponse + oneof_schema_2_validator: Optional[PaymentMethodCashRecurrentResponse] = None # data type: PaymentMethodCardResponse - oneof_schema_2_validator: Optional[PaymentMethodCardResponse] = None + oneof_schema_3_validator: Optional[PaymentMethodCardResponse] = None # data type: PaymentMethodSpeiRecurrent - oneof_schema_3_validator: Optional[PaymentMethodSpeiRecurrent] = None - actual_instance: Optional[Union[PaymentMethodCardResponse, PaymentMethodCashResponse, PaymentMethodSpeiRecurrent]] = None - one_of_schemas: Set[str] = { "PaymentMethodCardResponse", "PaymentMethodCashResponse", "PaymentMethodSpeiRecurrent" } + oneof_schema_4_validator: Optional[PaymentMethodSpeiRecurrent] = None + actual_instance: Optional[Union[PaymentMethodCardResponse, PaymentMethodCashRecurrentResponse, PaymentMethodCashResponse, PaymentMethodSpeiRecurrent]] = None + one_of_schemas: Set[str] = { "PaymentMethodCardResponse", "PaymentMethodCashRecurrentResponse", "PaymentMethodCashResponse", "PaymentMethodSpeiRecurrent" } model_config = ConfigDict( validate_assignment=True, @@ -69,6 +72,11 @@ def actual_instance_must_validate_oneof(cls, v): error_messages.append(f"Error! Input type `{type(v)}` is not `PaymentMethodCashResponse`") else: match += 1 + # validate data type: PaymentMethodCashRecurrentResponse + if not isinstance(v, PaymentMethodCashRecurrentResponse): + error_messages.append(f"Error! Input type `{type(v)}` is not `PaymentMethodCashRecurrentResponse`") + else: + match += 1 # validate data type: PaymentMethodCardResponse if not isinstance(v, PaymentMethodCardResponse): error_messages.append(f"Error! Input type `{type(v)}` is not `PaymentMethodCardResponse`") @@ -81,10 +89,10 @@ def actual_instance_must_validate_oneof(cls, v): match += 1 if match > 1: # more than 1 match - raise ValueError("Multiple matches found when setting `actual_instance` in UpdateCustomerPaymentMethodsResponse with oneOf schemas: PaymentMethodCardResponse, PaymentMethodCashResponse, PaymentMethodSpeiRecurrent. Details: " + ", ".join(error_messages)) + raise ValueError("Multiple matches found when setting `actual_instance` in UpdateCustomerPaymentMethodsResponse with oneOf schemas: PaymentMethodCardResponse, PaymentMethodCashRecurrentResponse, PaymentMethodCashResponse, PaymentMethodSpeiRecurrent. Details: " + ", ".join(error_messages)) elif match == 0: # no match - raise ValueError("No match found when setting `actual_instance` in UpdateCustomerPaymentMethodsResponse with oneOf schemas: PaymentMethodCardResponse, PaymentMethodCashResponse, PaymentMethodSpeiRecurrent. Details: " + ", ".join(error_messages)) + raise ValueError("No match found when setting `actual_instance` in UpdateCustomerPaymentMethodsResponse with oneOf schemas: PaymentMethodCardResponse, PaymentMethodCashRecurrentResponse, PaymentMethodCashResponse, PaymentMethodSpeiRecurrent. Details: " + ", ".join(error_messages)) else: return v @@ -114,14 +122,9 @@ def from_json(cls, json_str: str) -> Self: instance.actual_instance = PaymentMethodCashResponse.from_json(json_str) return instance - # check if data type is `PaymentMethodCashResponse` + # check if data type is `PaymentMethodCashRecurrentResponse` if _data_type == "cash_recurrent": - instance.actual_instance = PaymentMethodCashResponse.from_json(json_str) - return instance - - # check if data type is `PaymentMethodCashResponse` - if _data_type == "oxxo_recurrent": - instance.actual_instance = PaymentMethodCashResponse.from_json(json_str) + instance.actual_instance = PaymentMethodCashRecurrentResponse.from_json(json_str) return instance # check if data type is `PaymentMethodSpeiRecurrent` @@ -134,6 +137,11 @@ def from_json(cls, json_str: str) -> Self: instance.actual_instance = PaymentMethodCardResponse.from_json(json_str) return instance + # check if data type is `PaymentMethodCashRecurrentResponse` + if _data_type == "payment_method_cash_recurrent_response": + instance.actual_instance = PaymentMethodCashRecurrentResponse.from_json(json_str) + return instance + # check if data type is `PaymentMethodCashResponse` if _data_type == "payment_method_cash_response": instance.actual_instance = PaymentMethodCashResponse.from_json(json_str) @@ -150,6 +158,12 @@ def from_json(cls, json_str: str) -> Self: match += 1 except (ValidationError, ValueError) as e: error_messages.append(str(e)) + # deserialize data into PaymentMethodCashRecurrentResponse + try: + instance.actual_instance = PaymentMethodCashRecurrentResponse.from_json(json_str) + match += 1 + except (ValidationError, ValueError) as e: + error_messages.append(str(e)) # deserialize data into PaymentMethodCardResponse try: instance.actual_instance = PaymentMethodCardResponse.from_json(json_str) @@ -165,10 +179,10 @@ def from_json(cls, json_str: str) -> Self: if match > 1: # more than 1 match - raise ValueError("Multiple matches found when deserializing the JSON string into UpdateCustomerPaymentMethodsResponse with oneOf schemas: PaymentMethodCardResponse, PaymentMethodCashResponse, PaymentMethodSpeiRecurrent. Details: " + ", ".join(error_messages)) + raise ValueError("Multiple matches found when deserializing the JSON string into UpdateCustomerPaymentMethodsResponse with oneOf schemas: PaymentMethodCardResponse, PaymentMethodCashRecurrentResponse, PaymentMethodCashResponse, PaymentMethodSpeiRecurrent. Details: " + ", ".join(error_messages)) elif match == 0: # no match - raise ValueError("No match found when deserializing the JSON string into UpdateCustomerPaymentMethodsResponse with oneOf schemas: PaymentMethodCardResponse, PaymentMethodCashResponse, PaymentMethodSpeiRecurrent. Details: " + ", ".join(error_messages)) + raise ValueError("No match found when deserializing the JSON string into UpdateCustomerPaymentMethodsResponse with oneOf schemas: PaymentMethodCardResponse, PaymentMethodCashRecurrentResponse, PaymentMethodCashResponse, PaymentMethodSpeiRecurrent. Details: " + ", ".join(error_messages)) else: return instance @@ -182,7 +196,7 @@ def to_json(self) -> str: else: return json.dumps(self.actual_instance) - def to_dict(self) -> Optional[Union[Dict[str, Any], PaymentMethodCardResponse, PaymentMethodCashResponse, PaymentMethodSpeiRecurrent]]: + def to_dict(self) -> Optional[Union[Dict[str, Any], PaymentMethodCardResponse, PaymentMethodCashRecurrentResponse, PaymentMethodCashResponse, PaymentMethodSpeiRecurrent]]: """Returns the dict representation of the actual instance""" if self.actual_instance is None: return None diff --git a/conekta/models/update_payment_methods.py b/conekta/models/update_payment_methods.py index 761dda3..5b6fa62 100644 --- a/conekta/models/update_payment_methods.py +++ b/conekta/models/update_payment_methods.py @@ -18,8 +18,9 @@ import re # noqa: F401 import json -from pydantic import BaseModel, ConfigDict, StrictStr +from pydantic import BaseModel, ConfigDict, Field, StrictStr from typing import Any, ClassVar, Dict, List, Optional +from typing_extensions import Annotated from typing import Optional, Set from typing_extensions import Self @@ -27,8 +28,9 @@ class UpdatePaymentMethods(BaseModel): """ UpdatePaymentMethods """ # noqa: E501 - name: Optional[StrictStr] = None - __properties: ClassVar[List[str]] = ["name"] + name: Optional[StrictStr] = Field(default=None, description="The name of the payment method holder") + expires_at: Optional[Annotated[int, Field(strict=True, ge=1)]] = Field(default=None, description="The expiration date of the payment method in Unix timestamp format") + __properties: ClassVar[List[str]] = ["name", "expires_at"] model_config = ConfigDict( populate_by_name=True, @@ -81,7 +83,8 @@ def from_dict(cls, obj: Optional[Dict[str, Any]]) -> Optional[Self]: return cls.model_validate(obj) _obj = cls.model_validate({ - "name": obj.get("name") + "name": obj.get("name"), + "expires_at": obj.get("expires_at") }) return _obj diff --git a/config-python.json b/config-python.json index df54493..d237f02 100644 --- a/config-python.json +++ b/config-python.json @@ -7,14 +7,14 @@ "licenseName": "MIT License", "licenseUrl": "https://www.opensource.org/licenses/mit-license.php", "generateSourceCodeOnly": "false", - "packageVersion": "7.0.2", + "packageVersion": "7.0.3", "packageUrl": "https://github.com/conekta/conekta-python", "projectName": "conekta", "templateDir": "/local/templates/python", "hasBearerMethods" : true, "useOneOfDiscriminatorLookup" : true, "nonCompliantUseDiscriminatorIfCompositionFails" : false, - "httpUserAgent": "Conekta/v2 PythonBindings/7.0.2", + "httpUserAgent": "Conekta/v2 PythonBindings/7.0.3", "files": { "/local/AUTHORS.md" : {}, "/local/CODE_OF_CONDUCT.md": {}, diff --git a/docs/ChargeOrderResponsePaymentMethod.md b/docs/ChargeOrderResponsePaymentMethod.md index 26009ba..3579110 100644 --- a/docs/ChargeOrderResponsePaymentMethod.md +++ b/docs/ChargeOrderResponsePaymentMethod.md @@ -10,7 +10,7 @@ Name | Type | Description | Notes **agreement** | **str** | Agreement ID | [optional] **auth_code** | **str** | | [optional] **cashier_id** | **str** | | [optional] -**reference** | **str** | | [optional] +**reference** | **str** | Reference for the payment | **barcode_url** | **str** | | [optional] **expires_at** | **int** | Expiration date of the charge | **product_type** | **str** | Product type of the charge | @@ -45,8 +45,9 @@ Name | Type | Description | Notes **tracking_code** | **str** | | [optional] **cancel_url** | **str** | URL to redirect the customer after a canceled payment | [optional] **failure_url** | **str** | URL to redirect the customer after a failed payment | [optional] -**redirect_url** | **str** | URL to redirect the customer to complete the payment | [optional] +**redirect_url** | **str** | URL to redirect the customer to complete the payment | **success_url** | **str** | URL to redirect the customer after a successful payment | [optional] +**deep_link** | **str** | Deep link for the payment, use for mobile apps/flows | ## Example diff --git a/docs/ChargeRequestPaymentMethod.md b/docs/ChargeRequestPaymentMethod.md index 50a1cdd..6bdc97d 100644 --- a/docs/ChargeRequestPaymentMethod.md +++ b/docs/ChargeRequestPaymentMethod.md @@ -6,10 +6,11 @@ Name | Type | Description | Notes ------------ | ------------- | ------------- | ------------- **type** | **str** | Type of payment method | +**expires_at** | **int** | Method expiration date as unix timestamp | [optional] +**product_type** | **str** | Product type of the payment method, use for the payment method to know the product type | **cancel_url** | **str** | URL to redirect the customer after a canceled payment | **can_not_expire** | **bool** | Indicates if the payment method can not expire | **failure_url** | **str** | URL to redirect the customer after a failed payment | -**product_type** | **str** | Product type of the payment method, use for the payment method to know the product type | **success_url** | **str** | URL to redirect the customer after a successful payment | **cvc** | **str** | Optional, It is a value that allows identifying the security code of the card. Only for PCI merchants | **exp_month** | **str** | Card expiration month | @@ -17,7 +18,6 @@ Name | Type | Description | Notes **name** | **str** | Cardholder name | **number** | **str** | Card number | **customer_ip_address** | **str** | Optional field used to capture the customer's IP address for fraud prevention and security monitoring purposes | [optional] -**expires_at** | **int** | Method expiration date as unix timestamp | [optional] **monthly_installments** | **int** | How many months without interest to apply, it can be 3, 6, 9, 12 or 18 | [optional] **token_id** | **str** | | [optional] **payment_source_id** | **str** | | [optional] diff --git a/docs/ChargeResponsePaymentMethod.md b/docs/ChargeResponsePaymentMethod.md index 398ce5b..55fa4e0 100644 --- a/docs/ChargeResponsePaymentMethod.md +++ b/docs/ChargeResponsePaymentMethod.md @@ -10,7 +10,7 @@ Name | Type | Description | Notes **agreement** | **str** | Agreement ID | [optional] **auth_code** | **str** | | [optional] **cashier_id** | **str** | | [optional] -**reference** | **str** | | [optional] +**reference** | **str** | Reference for the payment | **barcode_url** | **str** | | [optional] **expires_at** | **int** | Expiration date of the charge | **product_type** | **str** | Product type of the charge | @@ -45,8 +45,9 @@ Name | Type | Description | Notes **tracking_code** | **str** | | [optional] **cancel_url** | **str** | URL to redirect the customer after a canceled payment | [optional] **failure_url** | **str** | URL to redirect the customer after a failed payment | [optional] -**redirect_url** | **str** | URL to redirect the customer to complete the payment | [optional] +**redirect_url** | **str** | URL to redirect the customer to complete the payment | **success_url** | **str** | URL to redirect the customer after a successful payment | [optional] +**deep_link** | **str** | Deep link for the payment, use for mobile apps/flows | ## Example diff --git a/docs/PaymentMethodCashRecurrentResponse.md b/docs/PaymentMethodCashRecurrentResponse.md new file mode 100644 index 0000000..58e1e16 --- /dev/null +++ b/docs/PaymentMethodCashRecurrentResponse.md @@ -0,0 +1,40 @@ +# PaymentMethodCashRecurrentResponse + +Alias of cash response used when type=cash_recurrent + +## Properties + +Name | Type | Description | Notes +------------ | ------------- | ------------- | ------------- +**type** | **str** | | +**id** | **str** | | +**object** | **str** | | +**created_at** | **int** | | +**parent_id** | **str** | | [optional] +**agreements** | [**List[PaymentMethodCashResponseAllOfAgreements]**](PaymentMethodCashResponseAllOfAgreements.md) | | [optional] +**reference** | **str** | | [optional] +**barcode** | **str** | | [optional] +**barcode_url** | **str** | URL to the barcode image, reference is the same as barcode | [optional] +**expires_at** | **int** | | [optional] +**provider** | **str** | | [optional] + +## Example + +```python +from conekta.models.payment_method_cash_recurrent_response import PaymentMethodCashRecurrentResponse + +# TODO update the JSON string below +json = "{}" +# create an instance of PaymentMethodCashRecurrentResponse from a JSON string +payment_method_cash_recurrent_response_instance = PaymentMethodCashRecurrentResponse.from_json(json) +# print the JSON string representation of the object +print(PaymentMethodCashRecurrentResponse.to_json()) + +# convert the object into a dict +payment_method_cash_recurrent_response_dict = payment_method_cash_recurrent_response_instance.to_dict() +# create an instance of PaymentMethodCashRecurrentResponse from a dict +payment_method_cash_recurrent_response_from_dict = PaymentMethodCashRecurrentResponse.from_dict(payment_method_cash_recurrent_response_dict) +``` +[[Back to Model list]](../README.md#documentation-for-models) [[Back to API list]](../README.md#documentation-for-api-endpoints) [[Back to README]](../README.md) + + diff --git a/docs/PaymentMethodPbbPayment.md b/docs/PaymentMethodPbbPayment.md new file mode 100644 index 0000000..b595db0 --- /dev/null +++ b/docs/PaymentMethodPbbPayment.md @@ -0,0 +1,35 @@ +# PaymentMethodPbbPayment + + +## Properties + +Name | Type | Description | Notes +------------ | ------------- | ------------- | ------------- +**type** | **str** | | [optional] +**object** | **str** | | +**deep_link** | **str** | Deep link for the payment, use for mobile apps/flows | +**expires_at** | **int** | Expiration date of the charge | +**product_type** | **str** | Product type of the charge | +**redirect_url** | **str** | URL to redirect the customer to complete the payment | +**reference** | **str** | Reference for the payment | + +## Example + +```python +from conekta.models.payment_method_pbb_payment import PaymentMethodPbbPayment + +# TODO update the JSON string below +json = "{}" +# create an instance of PaymentMethodPbbPayment from a JSON string +payment_method_pbb_payment_instance = PaymentMethodPbbPayment.from_json(json) +# print the JSON string representation of the object +print(PaymentMethodPbbPayment.to_json()) + +# convert the object into a dict +payment_method_pbb_payment_dict = payment_method_pbb_payment_instance.to_dict() +# create an instance of PaymentMethodPbbPayment from a dict +payment_method_pbb_payment_from_dict = PaymentMethodPbbPayment.from_dict(payment_method_pbb_payment_dict) +``` +[[Back to Model list]](../README.md#documentation-for-models) [[Back to API list]](../README.md#documentation-for-api-endpoints) [[Back to README]](../README.md) + + diff --git a/docs/PaymentMethodPbbRequest.md b/docs/PaymentMethodPbbRequest.md new file mode 100644 index 0000000..45c5897 --- /dev/null +++ b/docs/PaymentMethodPbbRequest.md @@ -0,0 +1,31 @@ +# PaymentMethodPbbRequest + + +## Properties + +Name | Type | Description | Notes +------------ | ------------- | ------------- | ------------- +**type** | **str** | Type of the payment method | +**expires_at** | **int** | Expiration date of the payment method, in Unix timestamp format | [optional] +**product_type** | **str** | Product type of the payment method, use for the payment method to know the product type | + +## Example + +```python +from conekta.models.payment_method_pbb_request import PaymentMethodPbbRequest + +# TODO update the JSON string below +json = "{}" +# create an instance of PaymentMethodPbbRequest from a JSON string +payment_method_pbb_request_instance = PaymentMethodPbbRequest.from_json(json) +# print the JSON string representation of the object +print(PaymentMethodPbbRequest.to_json()) + +# convert the object into a dict +payment_method_pbb_request_dict = payment_method_pbb_request_instance.to_dict() +# create an instance of PaymentMethodPbbRequest from a dict +payment_method_pbb_request_from_dict = PaymentMethodPbbRequest.from_dict(payment_method_pbb_request_dict) +``` +[[Back to Model list]](../README.md#documentation-for-models) [[Back to API list]](../README.md#documentation-for-api-endpoints) [[Back to README]](../README.md) + + diff --git a/docs/UpdatePaymentMethods.md b/docs/UpdatePaymentMethods.md index 41459f8..d3e9472 100644 --- a/docs/UpdatePaymentMethods.md +++ b/docs/UpdatePaymentMethods.md @@ -5,7 +5,8 @@ Name | Type | Description | Notes ------------ | ------------- | ------------- | ------------- -**name** | **str** | | [optional] +**name** | **str** | The name of the payment method holder | [optional] +**expires_at** | **int** | The expiration date of the payment method in Unix timestamp format | [optional] ## Example diff --git a/examples/one_time_charge_bnpl.py b/examples/one_time_charge_bnpl.py index 666988a..b92f3ba 100644 --- a/examples/one_time_charge_bnpl.py +++ b/examples/one_time_charge_bnpl.py @@ -12,7 +12,7 @@ # Configure Bearer authorization: bearerAuth configuration = conekta.Configuration( - access_token = os.environ["CONEKTA_PRIVATE_API_KEY"] + access_token = os.environ["CONEKTA_PRIVATE_KEY"] ) @@ -39,7 +39,7 @@ charges=[ conekta.ChargeRequest( payment_method=conekta.ChargeRequestPaymentMethod( - oneof_schema_1_validator=conekta.PaymentMethodBnplRequest( + conekta.PaymentMethodBnplRequest( product_type='aplazo_bnpl', type= 'bnpl', success_url= 'https://www.example.com/success', diff --git a/examples/one_time_charge_pbb.py b/examples/one_time_charge_pbb.py new file mode 100644 index 0000000..5b0b855 --- /dev/null +++ b/examples/one_time_charge_pbb.py @@ -0,0 +1,81 @@ + +import time +import os +import conekta +from conekta.rest import ApiException +from pprint import pprint + +# The client must configure the authentication and authorization parameters +# in accordance with the API server security policy. +# Examples for each auth method are provided below, use the example that +# satisfies your auth use case. + +# Configure Bearer authorization: bearerAuth +configuration = conekta.Configuration( + access_token = os.environ["CONEKTA_PRIVATE_KEY"] +) + + +# Enter a context with an instance of the API client +with conekta.ApiClient(configuration) as api_client: + # Create an instance of the API class + api_instance = conekta.OrdersApi(api_client) + order = conekta.OrderRequest( + line_items=[ + conekta.Product( + name='Test Product', + quantity=1, + unit_price=10000 + ) + ], + customer_info=conekta.OrderRequestCustomerInfo( + conekta.CustomerInfo( + name='John Doe', + email='john.doe@example.com', + phone='555-555-5555' + ) + ), + currency='MXN', + shipping_lines= [ + conekta.ShippingRequest( + amount= 500, + carrier= "fedex", + method= "phisical", + tracking_number= "aaxxx-xxx" + ), + ], + shipping_contact= conekta.CustomerShippingContacts( + address= conekta.CustomerShippingContactsAddress( + street1= "av viva mex", + postal_code= "01600", + city="cdmx", + country= "mx", + state= "cdmx" + ), + receiver= "fran carrero" + ), + charges=[ + conekta.ChargeRequest( + payment_method=conekta.ChargeRequestPaymentMethod( + conekta.PaymentMethodPbbRequest( + product_type='bbva_pay_by_bank', + type= 'pay_by_bank' + ), + ) + ) + ] + + ) + accept_language = 'es' # str | Use for knowing which language to use (optional) (default to 'es') + + try: + # Create order + response = api_instance.create_order(order, accept_language=accept_language) + print("The response of OrdersApi->create_order:\n") + pprint(response) + pprint(f"order id: {response.id}") + print("redirect_url", response.charges.data[0].payment_method.actual_instance.redirect_url) + print("redirect_url", response.charges.data[0].payment_method.actual_instance.deep_link) + print("type", response.charges.data[0].payment_method.actual_instance.type) + except ApiException as e: + print("Exception when calling OrdersApi->create_order: %s\n" % e) diff --git a/pyproject.toml b/pyproject.toml index 74a24f7..ca7281e 100644 --- a/pyproject.toml +++ b/pyproject.toml @@ -1,6 +1,6 @@ [tool.poetry] name = "conekta" -version = "7.0.2" +version = "7.0.3" description = "Conekta API" authors = ["Engineering Conekta "] license = "MIT-LICENSE" diff --git a/setup.py b/setup.py index 79d34fd..ee81d4d 100644 --- a/setup.py +++ b/setup.py @@ -22,7 +22,7 @@ # prerequisite: setuptools # http://pypi.python.org/pypi/setuptools NAME = "conekta" -VERSION = "7.0.2" +VERSION = "7.0.3" PYTHON_REQUIRES = ">= 3.8" REQUIRES = [ "urllib3 >= 1.25.3, < 3.0.0",