diff --git a/cashfree_pg/__init__.py b/cashfree_pg/__init__.py index d4c64a6..1f181e4 100644 --- a/cashfree_pg/__init__.py +++ b/cashfree_pg/__init__.py @@ -15,7 +15,7 @@ """ # noqa: E501 -__version__ = "3.2.7" +__version__ = "3.2.8" # import apis into sdk package # import ApiClient diff --git a/cashfree_pg/api_client.py b/cashfree_pg/api_client.py index 873ffa8..7beed65 100644 --- a/cashfree_pg/api_client.py +++ b/cashfree_pg/api_client.py @@ -342,7 +342,7 @@ def PGEligibilityFetchCardlessEmi(self, x_api_version : Annotated[StrictStr, Fie if x_idempotency_key: _header_params["x-idempotency-key"] = x_idempotency_key - _header_params["x-sdk-platform"] = "pythonsdk-3.2.7" + _header_params["x-sdk-platform"] = "pythonsdk-3.2.8" # process the form parameters _form_params = [] @@ -498,7 +498,7 @@ def PGEligibilityFetchOffers(self, x_api_version : Annotated[StrictStr, Field(.. if x_idempotency_key: _header_params["x-idempotency-key"] = x_idempotency_key - _header_params["x-sdk-platform"] = "pythonsdk-3.2.7" + _header_params["x-sdk-platform"] = "pythonsdk-3.2.8" # process the form parameters _form_params = [] @@ -653,7 +653,7 @@ def PGEligibilityFetchPaylater(self, x_api_version : Annotated[StrictStr, Field( if x_idempotency_key: _header_params["x-idempotency-key"] = x_idempotency_key - _header_params["x-sdk-platform"] = "pythonsdk-3.2.7" + _header_params["x-sdk-platform"] = "pythonsdk-3.2.8" # process the form parameters _form_params = [] @@ -809,7 +809,7 @@ def PGEligibilityFetchPaymentMethods(self, x_api_version : Annotated[StrictStr, if x_idempotency_key: _header_params["x-idempotency-key"] = x_idempotency_key - _header_params["x-sdk-platform"] = "pythonsdk-3.2.7" + _header_params["x-sdk-platform"] = "pythonsdk-3.2.8" # process the form parameters _form_params = [] @@ -966,7 +966,7 @@ def PGCreateOffer(self, x_api_version : Annotated[StrictStr, Field(..., descript if x_idempotency_key: _header_params["x-idempotency-key"] = x_idempotency_key - _header_params["x-sdk-platform"] = "pythonsdk-3.2.7" + _header_params["x-sdk-platform"] = "pythonsdk-3.2.8" # process the form parameters _form_params = [] @@ -1124,7 +1124,7 @@ def PGFetchOffer(self, x_api_version : Annotated[StrictStr, Field(..., descripti if x_idempotency_key: _header_params["x-idempotency-key"] = x_idempotency_key - _header_params["x-sdk-platform"] = "pythonsdk-3.2.7" + _header_params["x-sdk-platform"] = "pythonsdk-3.2.8" # process the form parameters _form_params = [] @@ -1270,7 +1270,7 @@ def PGCreateOrder(self, x_api_version : Annotated[StrictStr, Field(..., descript if x_idempotency_key: _header_params["x-idempotency-key"] = x_idempotency_key - _header_params["x-sdk-platform"] = "pythonsdk-3.2.7" + _header_params["x-sdk-platform"] = "pythonsdk-3.2.8" # process the form parameters _form_params = [] @@ -1428,7 +1428,7 @@ def PGFetchOrder(self, x_api_version : Annotated[StrictStr, Field(..., descripti if x_idempotency_key: _header_params["x-idempotency-key"] = x_idempotency_key - _header_params["x-sdk-platform"] = "pythonsdk-3.2.7" + _header_params["x-sdk-platform"] = "pythonsdk-3.2.8" # process the form parameters _form_params = [] @@ -1580,7 +1580,7 @@ def PGFetchRecon(self, x_api_version : Annotated[StrictStr, Field(..., descripti if x_idempotency_key: _header_params["x-idempotency-key"] = x_idempotency_key - _header_params["x-sdk-platform"] = "pythonsdk-3.2.7" + _header_params["x-sdk-platform"] = "pythonsdk-3.2.8" # process the form parameters _form_params = [] @@ -1739,7 +1739,7 @@ def PGCancelLink(self, x_api_version : Annotated[StrictStr, Field(..., descripti if x_idempotency_key: _header_params["x-idempotency-key"] = x_idempotency_key - _header_params["x-sdk-platform"] = "pythonsdk-3.2.7" + _header_params["x-sdk-platform"] = "pythonsdk-3.2.8" # process the form parameters _form_params = [] @@ -1884,7 +1884,7 @@ def PGCreateLink(self, x_api_version : Annotated[StrictStr, Field(..., descripti if x_idempotency_key: _header_params["x-idempotency-key"] = x_idempotency_key - _header_params["x-sdk-platform"] = "pythonsdk-3.2.7" + _header_params["x-sdk-platform"] = "pythonsdk-3.2.8" # process the form parameters _form_params = [] @@ -2042,7 +2042,7 @@ def PGFetchLink(self, x_api_version : Annotated[StrictStr, Field(..., descriptio if x_idempotency_key: _header_params["x-idempotency-key"] = x_idempotency_key - _header_params["x-sdk-platform"] = "pythonsdk-3.2.7" + _header_params["x-sdk-platform"] = "pythonsdk-3.2.8" # process the form parameters _form_params = [] @@ -2191,7 +2191,7 @@ def PGLinkFetchOrders(self, x_api_version : Annotated[StrictStr, Field(..., desc if x_idempotency_key: _header_params["x-idempotency-key"] = x_idempotency_key - _header_params["x-sdk-platform"] = "pythonsdk-3.2.7" + _header_params["x-sdk-platform"] = "pythonsdk-3.2.8" # process the form parameters _form_params = [] @@ -2343,7 +2343,7 @@ def PGAuthorizeOrder(self, x_api_version : Annotated[StrictStr, Field(..., descr if x_idempotency_key: _header_params["x-idempotency-key"] = x_idempotency_key - _header_params["x-sdk-platform"] = "pythonsdk-3.2.7" + _header_params["x-sdk-platform"] = "pythonsdk-3.2.8" # process the form parameters _form_params = [] @@ -2505,7 +2505,7 @@ def PGOrderAuthenticatePayment(self, x_api_version : Annotated[StrictStr, Field( if x_idempotency_key: _header_params["x-idempotency-key"] = x_idempotency_key - _header_params["x-sdk-platform"] = "pythonsdk-3.2.7" + _header_params["x-sdk-platform"] = "pythonsdk-3.2.8" # process the form parameters _form_params = [] @@ -2670,7 +2670,7 @@ def PGOrderFetchPayment(self, x_api_version : Annotated[StrictStr, Field(..., de if x_idempotency_key: _header_params["x-idempotency-key"] = x_idempotency_key - _header_params["x-sdk-platform"] = "pythonsdk-3.2.7" + _header_params["x-sdk-platform"] = "pythonsdk-3.2.8" # process the form parameters _form_params = [] @@ -2819,7 +2819,7 @@ def PGOrderFetchPayments(self, x_api_version : Annotated[StrictStr, Field(..., d if x_idempotency_key: _header_params["x-idempotency-key"] = x_idempotency_key - _header_params["x-sdk-platform"] = "pythonsdk-3.2.7" + _header_params["x-sdk-platform"] = "pythonsdk-3.2.8" # process the form parameters _form_params = [] @@ -2965,7 +2965,7 @@ def PGPayOrder(self, x_api_version : Annotated[StrictStr, Field(..., description if x_idempotency_key: _header_params["x-idempotency-key"] = x_idempotency_key - _header_params["x-sdk-platform"] = "pythonsdk-3.2.7" + _header_params["x-sdk-platform"] = "pythonsdk-3.2.8" # process the form parameters _form_params = [] @@ -3128,7 +3128,7 @@ def PGOrderCreateRefund(self, x_api_version : Annotated[StrictStr, Field(..., de if x_idempotency_key: _header_params["x-idempotency-key"] = x_idempotency_key - _header_params["x-sdk-platform"] = "pythonsdk-3.2.7" + _header_params["x-sdk-platform"] = "pythonsdk-3.2.8" # process the form parameters _form_params = [] @@ -3293,7 +3293,7 @@ def PGOrderFetchRefund(self, x_api_version : Annotated[StrictStr, Field(..., des if x_idempotency_key: _header_params["x-idempotency-key"] = x_idempotency_key - _header_params["x-sdk-platform"] = "pythonsdk-3.2.7" + _header_params["x-sdk-platform"] = "pythonsdk-3.2.8" # process the form parameters _form_params = [] @@ -3442,7 +3442,7 @@ def PGOrderFetchRefunds(self, x_api_version : Annotated[StrictStr, Field(..., de if x_idempotency_key: _header_params["x-idempotency-key"] = x_idempotency_key - _header_params["x-sdk-platform"] = "pythonsdk-3.2.7" + _header_params["x-sdk-platform"] = "pythonsdk-3.2.8" # process the form parameters _form_params = [] @@ -3594,7 +3594,7 @@ def PGFetchSettlements(self, x_api_version : Annotated[StrictStr, Field(..., des if x_idempotency_key: _header_params["x-idempotency-key"] = x_idempotency_key - _header_params["x-sdk-platform"] = "pythonsdk-3.2.7" + _header_params["x-sdk-platform"] = "pythonsdk-3.2.8" # process the form parameters _form_params = [] @@ -3755,7 +3755,7 @@ def PGSettlementFetchRecon(self, x_api_version : Annotated[StrictStr, Field(..., if x_idempotency_key: _header_params["x-idempotency-key"] = x_idempotency_key - _header_params["x-sdk-platform"] = "pythonsdk-3.2.7" + _header_params["x-sdk-platform"] = "pythonsdk-3.2.8" # process the form parameters _form_params = [] @@ -3914,7 +3914,7 @@ def PGOrderFetchSettlement(self, x_api_version : Annotated[StrictStr, Field(..., if x_idempotency_key: _header_params["x-idempotency-key"] = x_idempotency_key - _header_params["x-sdk-platform"] = "pythonsdk-3.2.7" + _header_params["x-sdk-platform"] = "pythonsdk-3.2.8" # process the form parameters _form_params = [] @@ -4070,7 +4070,7 @@ def PGCustomerDeleteInstrument(self, x_api_version : Annotated[StrictStr, Field( if x_idempotency_key: _header_params["x-idempotency-key"] = x_idempotency_key - _header_params["x-sdk-platform"] = "pythonsdk-3.2.7" + _header_params["x-sdk-platform"] = "pythonsdk-3.2.8" # process the form parameters _form_params = [] @@ -4225,7 +4225,7 @@ def PGCustomerFetchInstrument(self, x_api_version : Annotated[StrictStr, Field(. if x_idempotency_key: _header_params["x-idempotency-key"] = x_idempotency_key - _header_params["x-sdk-platform"] = "pythonsdk-3.2.7" + _header_params["x-sdk-platform"] = "pythonsdk-3.2.8" # process the form parameters _form_params = [] @@ -4380,7 +4380,7 @@ def PGCustomerFetchInstruments(self, x_api_version : Annotated[StrictStr, Field( if x_idempotency_key: _header_params["x-idempotency-key"] = x_idempotency_key - _header_params["x-sdk-platform"] = "pythonsdk-3.2.7" + _header_params["x-sdk-platform"] = "pythonsdk-3.2.8" # process the form parameters _form_params = [] @@ -4534,7 +4534,7 @@ def PGCustomerInstrumentsFetchCryptogram(self, x_api_version : Annotated[StrictS if x_idempotency_key: _header_params["x-idempotency-key"] = x_idempotency_key - _header_params["x-sdk-platform"] = "pythonsdk-3.2.7" + _header_params["x-sdk-platform"] = "pythonsdk-3.2.8" # process the form parameters _form_params = [] @@ -4681,7 +4681,7 @@ def SposCreateTerminal(self, x_api_version : Annotated[StrictStr, Field(..., des if x_idempotency_key: _header_params["x-idempotency-key"] = x_idempotency_key - _header_params["x-sdk-platform"] = "pythonsdk-3.2.7" + _header_params["x-sdk-platform"] = "pythonsdk-3.2.8" # process the form parameters _form_params = [] @@ -4836,7 +4836,7 @@ def SposCreateTerminalTransaction(self, x_api_version : Annotated[StrictStr, Fie if x_idempotency_key: _header_params["x-idempotency-key"] = x_idempotency_key - _header_params["x-sdk-platform"] = "pythonsdk-3.2.7" + _header_params["x-sdk-platform"] = "pythonsdk-3.2.8" # process the form parameters _form_params = [] @@ -4994,7 +4994,7 @@ def SposFetchTerminal(self, x_api_version : Annotated[StrictStr, Field(..., desc if x_idempotency_key: _header_params["x-idempotency-key"] = x_idempotency_key - _header_params["x-sdk-platform"] = "pythonsdk-3.2.7" + _header_params["x-sdk-platform"] = "pythonsdk-3.2.8" # process the form parameters _form_params = [] @@ -5148,7 +5148,7 @@ def SposFetchTerminalQrCodes(self, x_api_version : Annotated[StrictStr, Field(.. if x_idempotency_key: _header_params["x-idempotency-key"] = x_idempotency_key - _header_params["x-sdk-platform"] = "pythonsdk-3.2.7" + _header_params["x-sdk-platform"] = "pythonsdk-3.2.8" # process the form parameters _form_params = [] @@ -5237,7 +5237,7 @@ def __init__(self, configuration=None, header_name=None, header_value=None, self.default_headers[header_name] = header_value self.cookie = cookie # Set default User-Agent. - self.user_agent = 'OpenAPI-Generator/3.2.7/python' + self.user_agent = 'OpenAPI-Generator/3.2.8/python' self.client_side_validation = configuration.client_side_validation def __enter__(self): diff --git a/cashfree_pg/configuration.py b/cashfree_pg/configuration.py index 0096953..9cbd7c9 100644 --- a/cashfree_pg/configuration.py +++ b/cashfree_pg/configuration.py @@ -434,7 +434,7 @@ def to_debug_report(self): "OS: {env}\n"\ "Python Version: {pyversion}\n"\ "Version of the API: 2022-09-01\n"\ - "SDK Package Version: 3.2.7".\ + "SDK Package Version: 3.2.8".\ format(env=sys.platform, pyversion=sys.version) def get_host_settings(self): diff --git a/cashfree_pg/models/api_error.py b/cashfree_pg/models/api_error.py index dd07226..7232f56 100644 --- a/cashfree_pg/models/api_error.py +++ b/cashfree_pg/models/api_error.py @@ -58,6 +58,13 @@ def to_json(self) -> str: def from_json(cls, json_str: str) -> ApiError: """Create an instance of ApiError from a JSON string""" return cls.from_dict(json.loads(json_str)) + + @classmethod + def from_json_for_one_of(cls, json_str: str) -> ApiError: + """Create an instance of ApiError from a JSON string""" + if "message", "code", "type" not in json_str: + return None + return cls.from_dict(json.loads(json_str)) def to_dict(self): """Returns the dictionary representation of the model using alias""" diff --git a/cashfree_pg/models/api_error404.py b/cashfree_pg/models/api_error404.py index d978491..27b48c0 100644 --- a/cashfree_pg/models/api_error404.py +++ b/cashfree_pg/models/api_error404.py @@ -58,6 +58,13 @@ def to_json(self) -> str: def from_json(cls, json_str: str) -> ApiError404: """Create an instance of ApiError404 from a JSON string""" return cls.from_dict(json.loads(json_str)) + + @classmethod + def from_json_for_one_of(cls, json_str: str) -> ApiError404: + """Create an instance of ApiError404 from a JSON string""" + if "message", "code", "type" not in json_str: + return None + return cls.from_dict(json.loads(json_str)) def to_dict(self): """Returns the dictionary representation of the model using alias""" diff --git a/cashfree_pg/models/api_error409.py b/cashfree_pg/models/api_error409.py index c2aca5c..4fe7ae7 100644 --- a/cashfree_pg/models/api_error409.py +++ b/cashfree_pg/models/api_error409.py @@ -58,6 +58,13 @@ def to_json(self) -> str: def from_json(cls, json_str: str) -> ApiError409: """Create an instance of ApiError409 from a JSON string""" return cls.from_dict(json.loads(json_str)) + + @classmethod + def from_json_for_one_of(cls, json_str: str) -> ApiError409: + """Create an instance of ApiError409 from a JSON string""" + if "message", "code", "type" not in json_str: + return None + return cls.from_dict(json.loads(json_str)) def to_dict(self): """Returns the dictionary representation of the model using alias""" diff --git a/cashfree_pg/models/api_error502.py b/cashfree_pg/models/api_error502.py index 4ddf3b4..b45e4d7 100644 --- a/cashfree_pg/models/api_error502.py +++ b/cashfree_pg/models/api_error502.py @@ -58,6 +58,13 @@ def to_json(self) -> str: def from_json(cls, json_str: str) -> ApiError502: """Create an instance of ApiError502 from a JSON string""" return cls.from_dict(json.loads(json_str)) + + @classmethod + def from_json_for_one_of(cls, json_str: str) -> ApiError502: + """Create an instance of ApiError502 from a JSON string""" + if "message", "code", "type" not in json_str: + return None + return cls.from_dict(json.loads(json_str)) def to_dict(self): """Returns the dictionary representation of the model using alias""" diff --git a/cashfree_pg/models/app.py b/cashfree_pg/models/app.py index d5518d6..26bfa8e 100644 --- a/cashfree_pg/models/app.py +++ b/cashfree_pg/models/app.py @@ -55,6 +55,13 @@ def to_json(self) -> str: def from_json(cls, json_str: str) -> App: """Create an instance of App from a JSON string""" return cls.from_dict(json.loads(json_str)) + + @classmethod + def from_json_for_one_of(cls, json_str: str) -> App: + """Create an instance of App from a JSON string""" + if "channel", "provider", "phone" not in json_str: + return None + return cls.from_dict(json.loads(json_str)) def to_dict(self): """Returns the dictionary representation of the model using alias""" diff --git a/cashfree_pg/models/app_payment_method.py b/cashfree_pg/models/app_payment_method.py index 533c421..afcf2f8 100644 --- a/cashfree_pg/models/app_payment_method.py +++ b/cashfree_pg/models/app_payment_method.py @@ -47,6 +47,13 @@ def to_json(self) -> str: def from_json(cls, json_str: str) -> AppPaymentMethod: """Create an instance of AppPaymentMethod from a JSON string""" return cls.from_dict(json.loads(json_str)) + + @classmethod + def from_json_for_one_of(cls, json_str: str) -> AppPaymentMethod: + """Create an instance of AppPaymentMethod from a JSON string""" + if "app" not in json_str: + return None + return cls.from_dict(json.loads(json_str)) def to_dict(self): """Returns the dictionary representation of the model using alias""" diff --git a/cashfree_pg/models/authentication_error.py b/cashfree_pg/models/authentication_error.py index f414236..a3b5077 100644 --- a/cashfree_pg/models/authentication_error.py +++ b/cashfree_pg/models/authentication_error.py @@ -48,6 +48,13 @@ def to_json(self) -> str: def from_json(cls, json_str: str) -> AuthenticationError: """Create an instance of AuthenticationError from a JSON string""" return cls.from_dict(json.loads(json_str)) + + @classmethod + def from_json_for_one_of(cls, json_str: str) -> AuthenticationError: + """Create an instance of AuthenticationError from a JSON string""" + if "message", "code", "type" not in json_str: + return None + return cls.from_dict(json.loads(json_str)) def to_dict(self): """Returns the dictionary representation of the model using alias""" diff --git a/cashfree_pg/models/authorization_in_payments_entity.py b/cashfree_pg/models/authorization_in_payments_entity.py index 04a0360..b261f8d 100644 --- a/cashfree_pg/models/authorization_in_payments_entity.py +++ b/cashfree_pg/models/authorization_in_payments_entity.py @@ -73,6 +73,13 @@ def to_json(self) -> str: def from_json(cls, json_str: str) -> AuthorizationInPaymentsEntity: """Create an instance of AuthorizationInPaymentsEntity from a JSON string""" return cls.from_dict(json.loads(json_str)) + + @classmethod + def from_json_for_one_of(cls, json_str: str) -> AuthorizationInPaymentsEntity: + """Create an instance of AuthorizationInPaymentsEntity from a JSON string""" + if "action", "status", "captured_amount", "start_time", "end_time", "approve_by", "action_reference", "action_time" not in json_str: + return None + return cls.from_dict(json.loads(json_str)) def to_dict(self): """Returns the dictionary representation of the model using alias""" diff --git a/cashfree_pg/models/authorize_order_request.py b/cashfree_pg/models/authorize_order_request.py index 4bd4e17..433c08c 100644 --- a/cashfree_pg/models/authorize_order_request.py +++ b/cashfree_pg/models/authorize_order_request.py @@ -57,6 +57,13 @@ def to_json(self) -> str: def from_json(cls, json_str: str) -> AuthorizeOrderRequest: """Create an instance of AuthorizeOrderRequest from a JSON string""" return cls.from_dict(json.loads(json_str)) + + @classmethod + def from_json_for_one_of(cls, json_str: str) -> AuthorizeOrderRequest: + """Create an instance of AuthorizeOrderRequest from a JSON string""" + if "action", "amount" not in json_str: + return None + return cls.from_dict(json.loads(json_str)) def to_dict(self): """Returns the dictionary representation of the model using alias""" diff --git a/cashfree_pg/models/bad_request_error.py b/cashfree_pg/models/bad_request_error.py index e2e6ba7..34f6063 100644 --- a/cashfree_pg/models/bad_request_error.py +++ b/cashfree_pg/models/bad_request_error.py @@ -58,6 +58,13 @@ def to_json(self) -> str: def from_json(cls, json_str: str) -> BadRequestError: """Create an instance of BadRequestError from a JSON string""" return cls.from_dict(json.loads(json_str)) + + @classmethod + def from_json_for_one_of(cls, json_str: str) -> BadRequestError: + """Create an instance of BadRequestError from a JSON string""" + if "message", "code", "type" not in json_str: + return None + return cls.from_dict(json.loads(json_str)) def to_dict(self): """Returns the dictionary representation of the model using alias""" diff --git a/cashfree_pg/models/card.py b/cashfree_pg/models/card.py index bfe57d3..44e258b 100644 --- a/cashfree_pg/models/card.py +++ b/cashfree_pg/models/card.py @@ -86,6 +86,13 @@ def to_json(self) -> str: def from_json(cls, json_str: str) -> Card: """Create an instance of Card from a JSON string""" return cls.from_dict(json.loads(json_str)) + + @classmethod + def from_json_for_one_of(cls, json_str: str) -> Card: + """Create an instance of Card from a JSON string""" + if "channel", "card_number", "card_holder_name", "card_expiry_mm", "card_expiry_yy", "card_cvv", "instrument_id", "cryptogram", "token_requestor_id", "token_type", "card_display", "card_alias", "card_bank_name", "emi_tenure" not in json_str: + return None + return cls.from_dict(json.loads(json_str)) def to_dict(self): """Returns the dictionary representation of the model using alias""" diff --git a/cashfree_pg/models/card_emi.py b/cashfree_pg/models/card_emi.py index 85aed0a..6c458f5 100644 --- a/cashfree_pg/models/card_emi.py +++ b/cashfree_pg/models/card_emi.py @@ -61,6 +61,13 @@ def to_json(self) -> str: def from_json(cls, json_str: str) -> CardEMI: """Create an instance of CardEMI from a JSON string""" return cls.from_dict(json.loads(json_str)) + + @classmethod + def from_json_for_one_of(cls, json_str: str) -> CardEMI: + """Create an instance of CardEMI from a JSON string""" + if "channel", "card_number", "card_holder_name", "card_expiry_mm", "card_expiry_yy", "card_cvv", "card_alias", "card_bank_name", "emi_tenure" not in json_str: + return None + return cls.from_dict(json.loads(json_str)) def to_dict(self): """Returns the dictionary representation of the model using alias""" diff --git a/cashfree_pg/models/card_emi_payment_method.py b/cashfree_pg/models/card_emi_payment_method.py index 891a556..cb1a3b5 100644 --- a/cashfree_pg/models/card_emi_payment_method.py +++ b/cashfree_pg/models/card_emi_payment_method.py @@ -47,6 +47,13 @@ def to_json(self) -> str: def from_json(cls, json_str: str) -> CardEMIPaymentMethod: """Create an instance of CardEMIPaymentMethod from a JSON string""" return cls.from_dict(json.loads(json_str)) + + @classmethod + def from_json_for_one_of(cls, json_str: str) -> CardEMIPaymentMethod: + """Create an instance of CardEMIPaymentMethod from a JSON string""" + if "emi" not in json_str: + return None + return cls.from_dict(json.loads(json_str)) def to_dict(self): """Returns the dictionary representation of the model using alias""" diff --git a/cashfree_pg/models/card_offer.py b/cashfree_pg/models/card_offer.py index c827360..88a6f83 100644 --- a/cashfree_pg/models/card_offer.py +++ b/cashfree_pg/models/card_offer.py @@ -48,6 +48,13 @@ def to_json(self) -> str: def from_json(cls, json_str: str) -> CardOffer: """Create an instance of CardOffer from a JSON string""" return cls.from_dict(json.loads(json_str)) + + @classmethod + def from_json_for_one_of(cls, json_str: str) -> CardOffer: + """Create an instance of CardOffer from a JSON string""" + if "type", "bank_name", "scheme_name" not in json_str: + return None + return cls.from_dict(json.loads(json_str)) def to_dict(self): """Returns the dictionary representation of the model using alias""" diff --git a/cashfree_pg/models/card_payment_method.py b/cashfree_pg/models/card_payment_method.py index 9d3b382..0ffd185 100644 --- a/cashfree_pg/models/card_payment_method.py +++ b/cashfree_pg/models/card_payment_method.py @@ -47,6 +47,13 @@ def to_json(self) -> str: def from_json(cls, json_str: str) -> CardPaymentMethod: """Create an instance of CardPaymentMethod from a JSON string""" return cls.from_dict(json.loads(json_str)) + + @classmethod + def from_json_for_one_of(cls, json_str: str) -> CardPaymentMethod: + """Create an instance of CardPaymentMethod from a JSON string""" + if "card" not in json_str: + return None + return cls.from_dict(json.loads(json_str)) def to_dict(self): """Returns the dictionary representation of the model using alias""" diff --git a/cashfree_pg/models/cardless_emi.py b/cashfree_pg/models/cardless_emi.py index cfb9255..dea293c 100644 --- a/cashfree_pg/models/cardless_emi.py +++ b/cashfree_pg/models/cardless_emi.py @@ -59,6 +59,13 @@ def to_json(self) -> str: def from_json(cls, json_str: str) -> CardlessEMI: """Create an instance of CardlessEMI from a JSON string""" return cls.from_dict(json.loads(json_str)) + + @classmethod + def from_json_for_one_of(cls, json_str: str) -> CardlessEMI: + """Create an instance of CardlessEMI from a JSON string""" + if "channel", "provider", "phone", "emi_tenure" not in json_str: + return None + return cls.from_dict(json.loads(json_str)) def to_dict(self): """Returns the dictionary representation of the model using alias""" diff --git a/cashfree_pg/models/cardless_emi_entity.py b/cashfree_pg/models/cardless_emi_entity.py index 0840cb1..ab24f4d 100644 --- a/cashfree_pg/models/cardless_emi_entity.py +++ b/cashfree_pg/models/cardless_emi_entity.py @@ -48,6 +48,13 @@ def to_json(self) -> str: def from_json(cls, json_str: str) -> CardlessEMIEntity: """Create an instance of CardlessEMIEntity from a JSON string""" return cls.from_dict(json.loads(json_str)) + + @classmethod + def from_json_for_one_of(cls, json_str: str) -> CardlessEMIEntity: + """Create an instance of CardlessEMIEntity from a JSON string""" + if "payment_method", "emi_plans" not in json_str: + return None + return cls.from_dict(json.loads(json_str)) def to_dict(self): """Returns the dictionary representation of the model using alias""" diff --git a/cashfree_pg/models/cardless_emi_payment_method.py b/cashfree_pg/models/cardless_emi_payment_method.py index 34534a4..b97ca0e 100644 --- a/cashfree_pg/models/cardless_emi_payment_method.py +++ b/cashfree_pg/models/cardless_emi_payment_method.py @@ -47,6 +47,13 @@ def to_json(self) -> str: def from_json(cls, json_str: str) -> CardlessEMIPaymentMethod: """Create an instance of CardlessEMIPaymentMethod from a JSON string""" return cls.from_dict(json.loads(json_str)) + + @classmethod + def from_json_for_one_of(cls, json_str: str) -> CardlessEMIPaymentMethod: + """Create an instance of CardlessEMIPaymentMethod from a JSON string""" + if "cardless_emi" not in json_str: + return None + return cls.from_dict(json.loads(json_str)) def to_dict(self): """Returns the dictionary representation of the model using alias""" diff --git a/cashfree_pg/models/cardless_emi_queries.py b/cashfree_pg/models/cardless_emi_queries.py index 572cb4e..bcc57dc 100644 --- a/cashfree_pg/models/cardless_emi_queries.py +++ b/cashfree_pg/models/cardless_emi_queries.py @@ -49,6 +49,13 @@ def to_json(self) -> str: def from_json(cls, json_str: str) -> CardlessEMIQueries: """Create an instance of CardlessEMIQueries from a JSON string""" return cls.from_dict(json.loads(json_str)) + + @classmethod + def from_json_for_one_of(cls, json_str: str) -> CardlessEMIQueries: + """Create an instance of CardlessEMIQueries from a JSON string""" + if "order_id", "amount", "customer_details" not in json_str: + return None + return cls.from_dict(json.loads(json_str)) def to_dict(self): """Returns the dictionary representation of the model using alias""" diff --git a/cashfree_pg/models/cashback_details.py b/cashfree_pg/models/cashback_details.py index 5ba95f1..b3c1973 100644 --- a/cashfree_pg/models/cashback_details.py +++ b/cashfree_pg/models/cashback_details.py @@ -55,6 +55,13 @@ def to_json(self) -> str: def from_json(cls, json_str: str) -> CashbackDetails: """Create an instance of CashbackDetails from a JSON string""" return cls.from_dict(json.loads(json_str)) + + @classmethod + def from_json_for_one_of(cls, json_str: str) -> CashbackDetails: + """Create an instance of CashbackDetails from a JSON string""" + if "cashback_type", "cashback_value", "max_cashback_amount" not in json_str: + return None + return cls.from_dict(json.loads(json_str)) def to_dict(self): """Returns the dictionary representation of the model using alias""" diff --git a/cashfree_pg/models/create_link_request.py b/cashfree_pg/models/create_link_request.py index a12b4be..ec7f867 100644 --- a/cashfree_pg/models/create_link_request.py +++ b/cashfree_pg/models/create_link_request.py @@ -60,6 +60,13 @@ def to_json(self) -> str: def from_json(cls, json_str: str) -> CreateLinkRequest: """Create an instance of CreateLinkRequest from a JSON string""" return cls.from_dict(json.loads(json_str)) + + @classmethod + def from_json_for_one_of(cls, json_str: str) -> CreateLinkRequest: + """Create an instance of CreateLinkRequest from a JSON string""" + if "link_id", "link_amount", "link_currency", "link_purpose", "customer_details", "link_partial_payments", "link_minimum_partial_amount", "link_expiry_time", "link_notify", "link_auto_reminders", "link_notes", "link_meta" not in json_str: + return None + return cls.from_dict(json.loads(json_str)) def to_dict(self): """Returns the dictionary representation of the model using alias""" diff --git a/cashfree_pg/models/create_offer_request.py b/cashfree_pg/models/create_offer_request.py index 4144fb2..70210e1 100644 --- a/cashfree_pg/models/create_offer_request.py +++ b/cashfree_pg/models/create_offer_request.py @@ -53,6 +53,13 @@ def to_json(self) -> str: def from_json(cls, json_str: str) -> CreateOfferRequest: """Create an instance of CreateOfferRequest from a JSON string""" return cls.from_dict(json.loads(json_str)) + + @classmethod + def from_json_for_one_of(cls, json_str: str) -> CreateOfferRequest: + """Create an instance of CreateOfferRequest from a JSON string""" + if "offer_meta", "offer_tnc", "offer_details", "offer_validations" not in json_str: + return None + return cls.from_dict(json.loads(json_str)) def to_dict(self): """Returns the dictionary representation of the model using alias""" diff --git a/cashfree_pg/models/create_order_request.py b/cashfree_pg/models/create_order_request.py index 5cde3b4..4dd4ea5 100644 --- a/cashfree_pg/models/create_order_request.py +++ b/cashfree_pg/models/create_order_request.py @@ -59,6 +59,13 @@ def to_json(self) -> str: def from_json(cls, json_str: str) -> CreateOrderRequest: """Create an instance of CreateOrderRequest from a JSON string""" return cls.from_dict(json.loads(json_str)) + + @classmethod + def from_json_for_one_of(cls, json_str: str) -> CreateOrderRequest: + """Create an instance of CreateOrderRequest from a JSON string""" + if "order_id", "order_amount", "order_currency", "customer_details", "terminal", "order_meta", "order_expiry_time", "order_note", "order_tags", "order_splits" not in json_str: + return None + return cls.from_dict(json.loads(json_str)) def to_dict(self): """Returns the dictionary representation of the model using alias""" diff --git a/cashfree_pg/models/create_terminal_request.py b/cashfree_pg/models/create_terminal_request.py index fb6e66c..95940a5 100644 --- a/cashfree_pg/models/create_terminal_request.py +++ b/cashfree_pg/models/create_terminal_request.py @@ -54,6 +54,13 @@ def to_json(self) -> str: def from_json(cls, json_str: str) -> CreateTerminalRequest: """Create an instance of CreateTerminalRequest from a JSON string""" return cls.from_dict(json.loads(json_str)) + + @classmethod + def from_json_for_one_of(cls, json_str: str) -> CreateTerminalRequest: + """Create an instance of CreateTerminalRequest from a JSON string""" + if "terminal_id", "terminal_phone_no", "terminal_name", "terminal_address", "terminal_email", "terminal_note", "terminal_type", "terminal_meta" not in json_str: + return None + return cls.from_dict(json.loads(json_str)) def to_dict(self): """Returns the dictionary representation of the model using alias""" diff --git a/cashfree_pg/models/create_terminal_request_terminal_meta.py b/cashfree_pg/models/create_terminal_request_terminal_meta.py index 174348b..0a22849 100644 --- a/cashfree_pg/models/create_terminal_request_terminal_meta.py +++ b/cashfree_pg/models/create_terminal_request_terminal_meta.py @@ -46,6 +46,13 @@ def to_json(self) -> str: def from_json(cls, json_str: str) -> CreateTerminalRequestTerminalMeta: """Create an instance of CreateTerminalRequestTerminalMeta from a JSON string""" return cls.from_dict(json.loads(json_str)) + + @classmethod + def from_json_for_one_of(cls, json_str: str) -> CreateTerminalRequestTerminalMeta: + """Create an instance of CreateTerminalRequestTerminalMeta from a JSON string""" + if "terminal_operator" not in json_str: + return None + return cls.from_dict(json.loads(json_str)) def to_dict(self): """Returns the dictionary representation of the model using alias""" diff --git a/cashfree_pg/models/create_terminal_transaction_request.py b/cashfree_pg/models/create_terminal_transaction_request.py index 58d6681..603d811 100644 --- a/cashfree_pg/models/create_terminal_transaction_request.py +++ b/cashfree_pg/models/create_terminal_transaction_request.py @@ -49,6 +49,13 @@ def to_json(self) -> str: def from_json(cls, json_str: str) -> CreateTerminalTransactionRequest: """Create an instance of CreateTerminalTransactionRequest from a JSON string""" return cls.from_dict(json.loads(json_str)) + + @classmethod + def from_json_for_one_of(cls, json_str: str) -> CreateTerminalTransactionRequest: + """Create an instance of CreateTerminalTransactionRequest from a JSON string""" + if "cf_order_id", "cf_terminal_id", "payment_method", "terminal_phone_no" not in json_str: + return None + return cls.from_dict(json.loads(json_str)) def to_dict(self): """Returns the dictionary representation of the model using alias""" diff --git a/cashfree_pg/models/cryptogram_entity.py b/cashfree_pg/models/cryptogram_entity.py index 62d05ae..1cbef6c 100644 --- a/cashfree_pg/models/cryptogram_entity.py +++ b/cashfree_pg/models/cryptogram_entity.py @@ -52,6 +52,13 @@ def to_json(self) -> str: def from_json(cls, json_str: str) -> CryptogramEntity: """Create an instance of CryptogramEntity from a JSON string""" return cls.from_dict(json.loads(json_str)) + + @classmethod + def from_json_for_one_of(cls, json_str: str) -> CryptogramEntity: + """Create an instance of CryptogramEntity from a JSON string""" + if "instrument_id", "token_requestor_id", "card_number", "card_expiry_mm", "card_expiry_yy", "cryptogram", "card_display" not in json_str: + return None + return cls.from_dict(json.loads(json_str)) def to_dict(self): """Returns the dictionary representation of the model using alias""" diff --git a/cashfree_pg/models/customer_details.py b/cashfree_pg/models/customer_details.py index 0f08aa4..2ee2e85 100644 --- a/cashfree_pg/models/customer_details.py +++ b/cashfree_pg/models/customer_details.py @@ -52,6 +52,13 @@ def to_json(self) -> str: def from_json(cls, json_str: str) -> CustomerDetails: """Create an instance of CustomerDetails from a JSON string""" return cls.from_dict(json.loads(json_str)) + + @classmethod + def from_json_for_one_of(cls, json_str: str) -> CustomerDetails: + """Create an instance of CustomerDetails from a JSON string""" + if "customer_id", "customer_email", "customer_phone", "customer_name", "customer_bank_account_number", "customer_bank_ifsc", "customer_bank_code" not in json_str: + return None + return cls.from_dict(json.loads(json_str)) def to_dict(self): """Returns the dictionary representation of the model using alias""" diff --git a/cashfree_pg/models/customer_details_cardless_emi.py b/cashfree_pg/models/customer_details_cardless_emi.py index 6e26378..38da3b8 100644 --- a/cashfree_pg/models/customer_details_cardless_emi.py +++ b/cashfree_pg/models/customer_details_cardless_emi.py @@ -46,6 +46,13 @@ def to_json(self) -> str: def from_json(cls, json_str: str) -> CustomerDetailsCardlessEMI: """Create an instance of CustomerDetailsCardlessEMI from a JSON string""" return cls.from_dict(json.loads(json_str)) + + @classmethod + def from_json_for_one_of(cls, json_str: str) -> CustomerDetailsCardlessEMI: + """Create an instance of CustomerDetailsCardlessEMI from a JSON string""" + if "customer_phone" not in json_str: + return None + return cls.from_dict(json.loads(json_str)) def to_dict(self): """Returns the dictionary representation of the model using alias""" diff --git a/cashfree_pg/models/discount_details.py b/cashfree_pg/models/discount_details.py index e80e4b4..b02adc5 100644 --- a/cashfree_pg/models/discount_details.py +++ b/cashfree_pg/models/discount_details.py @@ -55,6 +55,13 @@ def to_json(self) -> str: def from_json(cls, json_str: str) -> DiscountDetails: """Create an instance of DiscountDetails from a JSON string""" return cls.from_dict(json.loads(json_str)) + + @classmethod + def from_json_for_one_of(cls, json_str: str) -> DiscountDetails: + """Create an instance of DiscountDetails from a JSON string""" + if "discount_type", "discount_value", "max_discount_amount" not in json_str: + return None + return cls.from_dict(json.loads(json_str)) def to_dict(self): """Returns the dictionary representation of the model using alias""" diff --git a/cashfree_pg/models/eligibility_cardless_emi_entity.py b/cashfree_pg/models/eligibility_cardless_emi_entity.py index 498511a..3e128a1 100644 --- a/cashfree_pg/models/eligibility_cardless_emi_entity.py +++ b/cashfree_pg/models/eligibility_cardless_emi_entity.py @@ -50,6 +50,13 @@ def to_json(self) -> str: def from_json(cls, json_str: str) -> EligibilityCardlessEMIEntity: """Create an instance of EligibilityCardlessEMIEntity from a JSON string""" return cls.from_dict(json.loads(json_str)) + + @classmethod + def from_json_for_one_of(cls, json_str: str) -> EligibilityCardlessEMIEntity: + """Create an instance of EligibilityCardlessEMIEntity from a JSON string""" + if "eligibility", "entity_type", "entity_value", "entity_details" not in json_str: + return None + return cls.from_dict(json.loads(json_str)) def to_dict(self): """Returns the dictionary representation of the model using alias""" diff --git a/cashfree_pg/models/eligibility_fetch_cardless_emi_request.py b/cashfree_pg/models/eligibility_fetch_cardless_emi_request.py index dd43110..0bd8644 100644 --- a/cashfree_pg/models/eligibility_fetch_cardless_emi_request.py +++ b/cashfree_pg/models/eligibility_fetch_cardless_emi_request.py @@ -47,6 +47,13 @@ def to_json(self) -> str: def from_json(cls, json_str: str) -> EligibilityFetchCardlessEMIRequest: """Create an instance of EligibilityFetchCardlessEMIRequest from a JSON string""" return cls.from_dict(json.loads(json_str)) + + @classmethod + def from_json_for_one_of(cls, json_str: str) -> EligibilityFetchCardlessEMIRequest: + """Create an instance of EligibilityFetchCardlessEMIRequest from a JSON string""" + if "queries" not in json_str: + return None + return cls.from_dict(json.loads(json_str)) def to_dict(self): """Returns the dictionary representation of the model using alias""" diff --git a/cashfree_pg/models/eligibility_fetch_offers_request.py b/cashfree_pg/models/eligibility_fetch_offers_request.py index 9718c93..f38a04f 100644 --- a/cashfree_pg/models/eligibility_fetch_offers_request.py +++ b/cashfree_pg/models/eligibility_fetch_offers_request.py @@ -49,6 +49,13 @@ def to_json(self) -> str: def from_json(cls, json_str: str) -> EligibilityFetchOffersRequest: """Create an instance of EligibilityFetchOffersRequest from a JSON string""" return cls.from_dict(json.loads(json_str)) + + @classmethod + def from_json_for_one_of(cls, json_str: str) -> EligibilityFetchOffersRequest: + """Create an instance of EligibilityFetchOffersRequest from a JSON string""" + if "queries", "filters" not in json_str: + return None + return cls.from_dict(json.loads(json_str)) def to_dict(self): """Returns the dictionary representation of the model using alias""" diff --git a/cashfree_pg/models/eligibility_fetch_paylater_request.py b/cashfree_pg/models/eligibility_fetch_paylater_request.py index f035663..1f27bf7 100644 --- a/cashfree_pg/models/eligibility_fetch_paylater_request.py +++ b/cashfree_pg/models/eligibility_fetch_paylater_request.py @@ -47,6 +47,13 @@ def to_json(self) -> str: def from_json(cls, json_str: str) -> EligibilityFetchPaylaterRequest: """Create an instance of EligibilityFetchPaylaterRequest from a JSON string""" return cls.from_dict(json.loads(json_str)) + + @classmethod + def from_json_for_one_of(cls, json_str: str) -> EligibilityFetchPaylaterRequest: + """Create an instance of EligibilityFetchPaylaterRequest from a JSON string""" + if "queries" not in json_str: + return None + return cls.from_dict(json.loads(json_str)) def to_dict(self): """Returns the dictionary representation of the model using alias""" diff --git a/cashfree_pg/models/eligibility_fetch_payment_methods_request.py b/cashfree_pg/models/eligibility_fetch_payment_methods_request.py index ad564ab..019b0ee 100644 --- a/cashfree_pg/models/eligibility_fetch_payment_methods_request.py +++ b/cashfree_pg/models/eligibility_fetch_payment_methods_request.py @@ -49,6 +49,13 @@ def to_json(self) -> str: def from_json(cls, json_str: str) -> EligibilityFetchPaymentMethodsRequest: """Create an instance of EligibilityFetchPaymentMethodsRequest from a JSON string""" return cls.from_dict(json.loads(json_str)) + + @classmethod + def from_json_for_one_of(cls, json_str: str) -> EligibilityFetchPaymentMethodsRequest: + """Create an instance of EligibilityFetchPaymentMethodsRequest from a JSON string""" + if "queries", "filters" not in json_str: + return None + return cls.from_dict(json.loads(json_str)) def to_dict(self): """Returns the dictionary representation of the model using alias""" diff --git a/cashfree_pg/models/eligibility_offer_entity.py b/cashfree_pg/models/eligibility_offer_entity.py index 3bdab9e..197dde6 100644 --- a/cashfree_pg/models/eligibility_offer_entity.py +++ b/cashfree_pg/models/eligibility_offer_entity.py @@ -50,6 +50,13 @@ def to_json(self) -> str: def from_json(cls, json_str: str) -> EligibilityOfferEntity: """Create an instance of EligibilityOfferEntity from a JSON string""" return cls.from_dict(json.loads(json_str)) + + @classmethod + def from_json_for_one_of(cls, json_str: str) -> EligibilityOfferEntity: + """Create an instance of EligibilityOfferEntity from a JSON string""" + if "eligibility", "entity_type", "entity_value", "entity_details" not in json_str: + return None + return cls.from_dict(json.loads(json_str)) def to_dict(self): """Returns the dictionary representation of the model using alias""" diff --git a/cashfree_pg/models/eligibility_paylater_entity.py b/cashfree_pg/models/eligibility_paylater_entity.py index c95d6d7..1431a96 100644 --- a/cashfree_pg/models/eligibility_paylater_entity.py +++ b/cashfree_pg/models/eligibility_paylater_entity.py @@ -50,6 +50,13 @@ def to_json(self) -> str: def from_json(cls, json_str: str) -> EligibilityPaylaterEntity: """Create an instance of EligibilityPaylaterEntity from a JSON string""" return cls.from_dict(json.loads(json_str)) + + @classmethod + def from_json_for_one_of(cls, json_str: str) -> EligibilityPaylaterEntity: + """Create an instance of EligibilityPaylaterEntity from a JSON string""" + if "eligibility", "entity_type", "entity_value", "entity_details" not in json_str: + return None + return cls.from_dict(json.loads(json_str)) def to_dict(self): """Returns the dictionary representation of the model using alias""" diff --git a/cashfree_pg/models/eligibility_payment_methods_entity.py b/cashfree_pg/models/eligibility_payment_methods_entity.py index 5faaff0..1e2224a 100644 --- a/cashfree_pg/models/eligibility_payment_methods_entity.py +++ b/cashfree_pg/models/eligibility_payment_methods_entity.py @@ -50,6 +50,13 @@ def to_json(self) -> str: def from_json(cls, json_str: str) -> EligibilityPaymentMethodsEntity: """Create an instance of EligibilityPaymentMethodsEntity from a JSON string""" return cls.from_dict(json.loads(json_str)) + + @classmethod + def from_json_for_one_of(cls, json_str: str) -> EligibilityPaymentMethodsEntity: + """Create an instance of EligibilityPaymentMethodsEntity from a JSON string""" + if "eligibility", "entity_type", "entity_value", "entity_details" not in json_str: + return None + return cls.from_dict(json.loads(json_str)) def to_dict(self): """Returns the dictionary representation of the model using alias""" diff --git a/cashfree_pg/models/eligibility_payment_methods_entity_entity_details.py b/cashfree_pg/models/eligibility_payment_methods_entity_entity_details.py index 6aeae8e..c366e1d 100644 --- a/cashfree_pg/models/eligibility_payment_methods_entity_entity_details.py +++ b/cashfree_pg/models/eligibility_payment_methods_entity_entity_details.py @@ -47,6 +47,13 @@ def to_json(self) -> str: def from_json(cls, json_str: str) -> EligibilityPaymentMethodsEntityEntityDetails: """Create an instance of EligibilityPaymentMethodsEntityEntityDetails from a JSON string""" return cls.from_dict(json.loads(json_str)) + + @classmethod + def from_json_for_one_of(cls, json_str: str) -> EligibilityPaymentMethodsEntityEntityDetails: + """Create an instance of EligibilityPaymentMethodsEntityEntityDetails from a JSON string""" + if "payment_method_details" not in json_str: + return None + return cls.from_dict(json.loads(json_str)) def to_dict(self): """Returns the dictionary representation of the model using alias""" diff --git a/cashfree_pg/models/emi_offer.py b/cashfree_pg/models/emi_offer.py index 32d2b50..6c2c535 100644 --- a/cashfree_pg/models/emi_offer.py +++ b/cashfree_pg/models/emi_offer.py @@ -48,6 +48,13 @@ def to_json(self) -> str: def from_json(cls, json_str: str) -> EMIOffer: """Create an instance of EMIOffer from a JSON string""" return cls.from_dict(json.loads(json_str)) + + @classmethod + def from_json_for_one_of(cls, json_str: str) -> EMIOffer: + """Create an instance of EMIOffer from a JSON string""" + if "type", "issuer", "tenures" not in json_str: + return None + return cls.from_dict(json.loads(json_str)) def to_dict(self): """Returns the dictionary representation of the model using alias""" diff --git a/cashfree_pg/models/emi_plans_array.py b/cashfree_pg/models/emi_plans_array.py index fbaff18..fa9a324 100644 --- a/cashfree_pg/models/emi_plans_array.py +++ b/cashfree_pg/models/emi_plans_array.py @@ -51,6 +51,13 @@ def to_json(self) -> str: def from_json(cls, json_str: str) -> EMIPlansArray: """Create an instance of EMIPlansArray from a JSON string""" return cls.from_dict(json.loads(json_str)) + + @classmethod + def from_json_for_one_of(cls, json_str: str) -> EMIPlansArray: + """Create an instance of EMIPlansArray from a JSON string""" + if "tenure", "interest_rate", "currency", "emi", "total_interest", "total_amount" not in json_str: + return None + return cls.from_dict(json.loads(json_str)) def to_dict(self): """Returns the dictionary representation of the model using alias""" diff --git a/cashfree_pg/models/error_details_in_payments_entity.py b/cashfree_pg/models/error_details_in_payments_entity.py index d3f9166..323a68b 100644 --- a/cashfree_pg/models/error_details_in_payments_entity.py +++ b/cashfree_pg/models/error_details_in_payments_entity.py @@ -52,6 +52,13 @@ def to_json(self) -> str: def from_json(cls, json_str: str) -> ErrorDetailsInPaymentsEntity: """Create an instance of ErrorDetailsInPaymentsEntity from a JSON string""" return cls.from_dict(json.loads(json_str)) + + @classmethod + def from_json_for_one_of(cls, json_str: str) -> ErrorDetailsInPaymentsEntity: + """Create an instance of ErrorDetailsInPaymentsEntity from a JSON string""" + if "error_code", "error_description", "error_reason", "error_source", "error_code_raw", "error_description_raw", "error_subcode_raw" not in json_str: + return None + return cls.from_dict(json.loads(json_str)) def to_dict(self): """Returns the dictionary representation of the model using alias""" diff --git a/cashfree_pg/models/fetch_recon_request.py b/cashfree_pg/models/fetch_recon_request.py index 41adc51..ce984f1 100644 --- a/cashfree_pg/models/fetch_recon_request.py +++ b/cashfree_pg/models/fetch_recon_request.py @@ -49,6 +49,13 @@ def to_json(self) -> str: def from_json(cls, json_str: str) -> FetchReconRequest: """Create an instance of FetchReconRequest from a JSON string""" return cls.from_dict(json.loads(json_str)) + + @classmethod + def from_json_for_one_of(cls, json_str: str) -> FetchReconRequest: + """Create an instance of FetchReconRequest from a JSON string""" + if "pagination", "filters" not in json_str: + return None + return cls.from_dict(json.loads(json_str)) def to_dict(self): """Returns the dictionary representation of the model using alias""" diff --git a/cashfree_pg/models/fetch_recon_request_filters.py b/cashfree_pg/models/fetch_recon_request_filters.py index b9efa37..85dd9c1 100644 --- a/cashfree_pg/models/fetch_recon_request_filters.py +++ b/cashfree_pg/models/fetch_recon_request_filters.py @@ -47,6 +47,13 @@ def to_json(self) -> str: def from_json(cls, json_str: str) -> FetchReconRequestFilters: """Create an instance of FetchReconRequestFilters from a JSON string""" return cls.from_dict(json.loads(json_str)) + + @classmethod + def from_json_for_one_of(cls, json_str: str) -> FetchReconRequestFilters: + """Create an instance of FetchReconRequestFilters from a JSON string""" + if "start_date", "end_date" not in json_str: + return None + return cls.from_dict(json.loads(json_str)) def to_dict(self): """Returns the dictionary representation of the model using alias""" diff --git a/cashfree_pg/models/fetch_recon_request_pagination.py b/cashfree_pg/models/fetch_recon_request_pagination.py index fdffa7a..5b70d5e 100644 --- a/cashfree_pg/models/fetch_recon_request_pagination.py +++ b/cashfree_pg/models/fetch_recon_request_pagination.py @@ -47,6 +47,13 @@ def to_json(self) -> str: def from_json(cls, json_str: str) -> FetchReconRequestPagination: """Create an instance of FetchReconRequestPagination from a JSON string""" return cls.from_dict(json.loads(json_str)) + + @classmethod + def from_json_for_one_of(cls, json_str: str) -> FetchReconRequestPagination: + """Create an instance of FetchReconRequestPagination from a JSON string""" + if "limit", "cursor" not in json_str: + return None + return cls.from_dict(json.loads(json_str)) def to_dict(self): """Returns the dictionary representation of the model using alias""" diff --git a/cashfree_pg/models/fetch_settlements_request.py b/cashfree_pg/models/fetch_settlements_request.py index ba17dac..d557cfc 100644 --- a/cashfree_pg/models/fetch_settlements_request.py +++ b/cashfree_pg/models/fetch_settlements_request.py @@ -49,6 +49,13 @@ def to_json(self) -> str: def from_json(cls, json_str: str) -> FetchSettlementsRequest: """Create an instance of FetchSettlementsRequest from a JSON string""" return cls.from_dict(json.loads(json_str)) + + @classmethod + def from_json_for_one_of(cls, json_str: str) -> FetchSettlementsRequest: + """Create an instance of FetchSettlementsRequest from a JSON string""" + if "pagination", "filters" not in json_str: + return None + return cls.from_dict(json.loads(json_str)) def to_dict(self): """Returns the dictionary representation of the model using alias""" diff --git a/cashfree_pg/models/fetch_settlements_request_filters.py b/cashfree_pg/models/fetch_settlements_request_filters.py index 069ad76..3630f75 100644 --- a/cashfree_pg/models/fetch_settlements_request_filters.py +++ b/cashfree_pg/models/fetch_settlements_request_filters.py @@ -49,6 +49,13 @@ def to_json(self) -> str: def from_json(cls, json_str: str) -> FetchSettlementsRequestFilters: """Create an instance of FetchSettlementsRequestFilters from a JSON string""" return cls.from_dict(json.loads(json_str)) + + @classmethod + def from_json_for_one_of(cls, json_str: str) -> FetchSettlementsRequestFilters: + """Create an instance of FetchSettlementsRequestFilters from a JSON string""" + if "cf_settlement_ids", "settlement_utrs", "start_date", "end_date" not in json_str: + return None + return cls.from_dict(json.loads(json_str)) def to_dict(self): """Returns the dictionary representation of the model using alias""" diff --git a/cashfree_pg/models/fetch_settlements_request_pagination.py b/cashfree_pg/models/fetch_settlements_request_pagination.py index 01882c4..351fc22 100644 --- a/cashfree_pg/models/fetch_settlements_request_pagination.py +++ b/cashfree_pg/models/fetch_settlements_request_pagination.py @@ -47,6 +47,13 @@ def to_json(self) -> str: def from_json(cls, json_str: str) -> FetchSettlementsRequestPagination: """Create an instance of FetchSettlementsRequestPagination from a JSON string""" return cls.from_dict(json.loads(json_str)) + + @classmethod + def from_json_for_one_of(cls, json_str: str) -> FetchSettlementsRequestPagination: + """Create an instance of FetchSettlementsRequestPagination from a JSON string""" + if "limit", "cursor" not in json_str: + return None + return cls.from_dict(json.loads(json_str)) def to_dict(self): """Returns the dictionary representation of the model using alias""" diff --git a/cashfree_pg/models/fetch_terminal_qr_codes_entity.py b/cashfree_pg/models/fetch_terminal_qr_codes_entity.py index ac40972..bd8c5f7 100644 --- a/cashfree_pg/models/fetch_terminal_qr_codes_entity.py +++ b/cashfree_pg/models/fetch_terminal_qr_codes_entity.py @@ -49,6 +49,13 @@ def to_json(self) -> str: def from_json(cls, json_str: str) -> FetchTerminalQRCodesEntity: """Create an instance of FetchTerminalQRCodesEntity from a JSON string""" return cls.from_dict(json.loads(json_str)) + + @classmethod + def from_json_for_one_of(cls, json_str: str) -> FetchTerminalQRCodesEntity: + """Create an instance of FetchTerminalQRCodesEntity from a JSON string""" + if "bank", "qrCode", "qrCodeUrl", "status" not in json_str: + return None + return cls.from_dict(json.loads(json_str)) def to_dict(self): """Returns the dictionary representation of the model using alias""" diff --git a/cashfree_pg/models/idempotency_error.py b/cashfree_pg/models/idempotency_error.py index ac10570..952b632 100644 --- a/cashfree_pg/models/idempotency_error.py +++ b/cashfree_pg/models/idempotency_error.py @@ -58,6 +58,13 @@ def to_json(self) -> str: def from_json(cls, json_str: str) -> IdempotencyError: """Create an instance of IdempotencyError from a JSON string""" return cls.from_dict(json.loads(json_str)) + + @classmethod + def from_json_for_one_of(cls, json_str: str) -> IdempotencyError: + """Create an instance of IdempotencyError from a JSON string""" + if "message", "code", "type" not in json_str: + return None + return cls.from_dict(json.loads(json_str)) def to_dict(self): """Returns the dictionary representation of the model using alias""" diff --git a/cashfree_pg/models/instrument_entity.py b/cashfree_pg/models/instrument_entity.py index bffecc5..76e32f4 100644 --- a/cashfree_pg/models/instrument_entity.py +++ b/cashfree_pg/models/instrument_entity.py @@ -75,6 +75,13 @@ def to_json(self) -> str: def from_json(cls, json_str: str) -> InstrumentEntity: """Create an instance of InstrumentEntity from a JSON string""" return cls.from_dict(json.loads(json_str)) + + @classmethod + def from_json_for_one_of(cls, json_str: str) -> InstrumentEntity: + """Create an instance of InstrumentEntity from a JSON string""" + if "customer_id", "afa_reference", "instrument_id", "instrument_type", "instrument_uid", "instrument_display", "instrument_status", "created_at", "instrument_meta" not in json_str: + return None + return cls.from_dict(json.loads(json_str)) def to_dict(self): """Returns the dictionary representation of the model using alias""" diff --git a/cashfree_pg/models/instrument_webhook.py b/cashfree_pg/models/instrument_webhook.py index 98c953e..d00b731 100644 --- a/cashfree_pg/models/instrument_webhook.py +++ b/cashfree_pg/models/instrument_webhook.py @@ -47,6 +47,13 @@ def to_json(self) -> str: def from_json(cls, json_str: str) -> InstrumentWebhook: """Create an instance of InstrumentWebhook from a JSON string""" return cls.from_dict(json.loads(json_str)) + + @classmethod + def from_json_for_one_of(cls, json_str: str) -> InstrumentWebhook: + """Create an instance of InstrumentWebhook from a JSON string""" + if "data" not in json_str: + return None + return cls.from_dict(json.loads(json_str)) def to_dict(self): """Returns the dictionary representation of the model using alias""" diff --git a/cashfree_pg/models/instrument_webhook_data.py b/cashfree_pg/models/instrument_webhook_data.py index 0ddb7c4..d0ff18d 100644 --- a/cashfree_pg/models/instrument_webhook_data.py +++ b/cashfree_pg/models/instrument_webhook_data.py @@ -49,6 +49,13 @@ def to_json(self) -> str: def from_json(cls, json_str: str) -> InstrumentWebhookData: """Create an instance of InstrumentWebhookData from a JSON string""" return cls.from_dict(json.loads(json_str)) + + @classmethod + def from_json_for_one_of(cls, json_str: str) -> InstrumentWebhookData: + """Create an instance of InstrumentWebhookData from a JSON string""" + if "data", "event_time", "type" not in json_str: + return None + return cls.from_dict(json.loads(json_str)) def to_dict(self): """Returns the dictionary representation of the model using alias""" diff --git a/cashfree_pg/models/instrument_webhook_data_entity.py b/cashfree_pg/models/instrument_webhook_data_entity.py index 22e910e..1c9f6e8 100644 --- a/cashfree_pg/models/instrument_webhook_data_entity.py +++ b/cashfree_pg/models/instrument_webhook_data_entity.py @@ -47,6 +47,13 @@ def to_json(self) -> str: def from_json(cls, json_str: str) -> InstrumentWebhookDataEntity: """Create an instance of InstrumentWebhookDataEntity from a JSON string""" return cls.from_dict(json.loads(json_str)) + + @classmethod + def from_json_for_one_of(cls, json_str: str) -> InstrumentWebhookDataEntity: + """Create an instance of InstrumentWebhookDataEntity from a JSON string""" + if "instrument" not in json_str: + return None + return cls.from_dict(json.loads(json_str)) def to_dict(self): """Returns the dictionary representation of the model using alias""" diff --git a/cashfree_pg/models/link_customer_details_entity.py b/cashfree_pg/models/link_customer_details_entity.py index edede7a..d694e69 100644 --- a/cashfree_pg/models/link_customer_details_entity.py +++ b/cashfree_pg/models/link_customer_details_entity.py @@ -48,6 +48,13 @@ def to_json(self) -> str: def from_json(cls, json_str: str) -> LinkCustomerDetailsEntity: """Create an instance of LinkCustomerDetailsEntity from a JSON string""" return cls.from_dict(json.loads(json_str)) + + @classmethod + def from_json_for_one_of(cls, json_str: str) -> LinkCustomerDetailsEntity: + """Create an instance of LinkCustomerDetailsEntity from a JSON string""" + if "customer_phone", "customer_email", "customer_name" not in json_str: + return None + return cls.from_dict(json.loads(json_str)) def to_dict(self): """Returns the dictionary representation of the model using alias""" diff --git a/cashfree_pg/models/link_entity.py b/cashfree_pg/models/link_entity.py index 46c1117..09e4541 100644 --- a/cashfree_pg/models/link_entity.py +++ b/cashfree_pg/models/link_entity.py @@ -64,6 +64,13 @@ def to_json(self) -> str: def from_json(cls, json_str: str) -> LinkEntity: """Create an instance of LinkEntity from a JSON string""" return cls.from_dict(json.loads(json_str)) + + @classmethod + def from_json_for_one_of(cls, json_str: str) -> LinkEntity: + """Create an instance of LinkEntity from a JSON string""" + if "cf_link_id", "link_id", "link_status", "link_currency", "link_amount", "link_amount_paid", "link_partial_payments", "link_minimum_partial_amount", "link_purpose", "link_created_at", "customer_details", "link_meta", "link_url", "link_expiry_time", "link_notes", "link_auto_reminders", "link_notify" not in json_str: + return None + return cls.from_dict(json.loads(json_str)) def to_dict(self): """Returns the dictionary representation of the model using alias""" diff --git a/cashfree_pg/models/link_meta_entity.py b/cashfree_pg/models/link_meta_entity.py index 49b48c0..abef5d8 100644 --- a/cashfree_pg/models/link_meta_entity.py +++ b/cashfree_pg/models/link_meta_entity.py @@ -49,6 +49,13 @@ def to_json(self) -> str: def from_json(cls, json_str: str) -> LinkMetaEntity: """Create an instance of LinkMetaEntity from a JSON string""" return cls.from_dict(json.loads(json_str)) + + @classmethod + def from_json_for_one_of(cls, json_str: str) -> LinkMetaEntity: + """Create an instance of LinkMetaEntity from a JSON string""" + if "notify_url", "upi_intent", "return_url", "payment_methods" not in json_str: + return None + return cls.from_dict(json.loads(json_str)) def to_dict(self): """Returns the dictionary representation of the model using alias""" diff --git a/cashfree_pg/models/link_notify_entity.py b/cashfree_pg/models/link_notify_entity.py index 8ea4e5d..4d93f3a 100644 --- a/cashfree_pg/models/link_notify_entity.py +++ b/cashfree_pg/models/link_notify_entity.py @@ -47,6 +47,13 @@ def to_json(self) -> str: def from_json(cls, json_str: str) -> LinkNotifyEntity: """Create an instance of LinkNotifyEntity from a JSON string""" return cls.from_dict(json.loads(json_str)) + + @classmethod + def from_json_for_one_of(cls, json_str: str) -> LinkNotifyEntity: + """Create an instance of LinkNotifyEntity from a JSON string""" + if "send_sms", "send_email" not in json_str: + return None + return cls.from_dict(json.loads(json_str)) def to_dict(self): """Returns the dictionary representation of the model using alias""" diff --git a/cashfree_pg/models/net_banking_payment_method.py b/cashfree_pg/models/net_banking_payment_method.py index e306585..b823c93 100644 --- a/cashfree_pg/models/net_banking_payment_method.py +++ b/cashfree_pg/models/net_banking_payment_method.py @@ -47,6 +47,13 @@ def to_json(self) -> str: def from_json(cls, json_str: str) -> NetBankingPaymentMethod: """Create an instance of NetBankingPaymentMethod from a JSON string""" return cls.from_dict(json.loads(json_str)) + + @classmethod + def from_json_for_one_of(cls, json_str: str) -> NetBankingPaymentMethod: + """Create an instance of NetBankingPaymentMethod from a JSON string""" + if "netbanking" not in json_str: + return None + return cls.from_dict(json.loads(json_str)) def to_dict(self): """Returns the dictionary representation of the model using alias""" diff --git a/cashfree_pg/models/netbanking.py b/cashfree_pg/models/netbanking.py index 64cdaab..372b09e 100644 --- a/cashfree_pg/models/netbanking.py +++ b/cashfree_pg/models/netbanking.py @@ -58,6 +58,13 @@ def to_json(self) -> str: def from_json(cls, json_str: str) -> Netbanking: """Create an instance of Netbanking from a JSON string""" return cls.from_dict(json.loads(json_str)) + + @classmethod + def from_json_for_one_of(cls, json_str: str) -> Netbanking: + """Create an instance of Netbanking from a JSON string""" + if "channel", "netbanking_bank_code", "netbanking_bank_name" not in json_str: + return None + return cls.from_dict(json.loads(json_str)) def to_dict(self): """Returns the dictionary representation of the model using alias""" diff --git a/cashfree_pg/models/offer_all.py b/cashfree_pg/models/offer_all.py index f042b7e..3dbf325 100644 --- a/cashfree_pg/models/offer_all.py +++ b/cashfree_pg/models/offer_all.py @@ -46,6 +46,13 @@ def to_json(self) -> str: def from_json(cls, json_str: str) -> OfferAll: """Create an instance of OfferAll from a JSON string""" return cls.from_dict(json.loads(json_str)) + + @classmethod + def from_json_for_one_of(cls, json_str: str) -> OfferAll: + """Create an instance of OfferAll from a JSON string""" + if "all" not in json_str: + return None + return cls.from_dict(json.loads(json_str)) def to_dict(self): """Returns the dictionary representation of the model using alias""" diff --git a/cashfree_pg/models/offer_card.py b/cashfree_pg/models/offer_card.py index e181049..b0da2d8 100644 --- a/cashfree_pg/models/offer_card.py +++ b/cashfree_pg/models/offer_card.py @@ -47,6 +47,13 @@ def to_json(self) -> str: def from_json(cls, json_str: str) -> OfferCard: """Create an instance of OfferCard from a JSON string""" return cls.from_dict(json.loads(json_str)) + + @classmethod + def from_json_for_one_of(cls, json_str: str) -> OfferCard: + """Create an instance of OfferCard from a JSON string""" + if "card" not in json_str: + return None + return cls.from_dict(json.loads(json_str)) def to_dict(self): """Returns the dictionary representation of the model using alias""" diff --git a/cashfree_pg/models/offer_details.py b/cashfree_pg/models/offer_details.py index 6d6440f..29162fc 100644 --- a/cashfree_pg/models/offer_details.py +++ b/cashfree_pg/models/offer_details.py @@ -57,6 +57,13 @@ def to_json(self) -> str: def from_json(cls, json_str: str) -> OfferDetails: """Create an instance of OfferDetails from a JSON string""" return cls.from_dict(json.loads(json_str)) + + @classmethod + def from_json_for_one_of(cls, json_str: str) -> OfferDetails: + """Create an instance of OfferDetails from a JSON string""" + if "offer_type", "discount_details", "cashback_details" not in json_str: + return None + return cls.from_dict(json.loads(json_str)) def to_dict(self): """Returns the dictionary representation of the model using alias""" diff --git a/cashfree_pg/models/offer_emi.py b/cashfree_pg/models/offer_emi.py index 9b308a4..878c87e 100644 --- a/cashfree_pg/models/offer_emi.py +++ b/cashfree_pg/models/offer_emi.py @@ -47,6 +47,13 @@ def to_json(self) -> str: def from_json(cls, json_str: str) -> OfferEMI: """Create an instance of OfferEMI from a JSON string""" return cls.from_dict(json.loads(json_str)) + + @classmethod + def from_json_for_one_of(cls, json_str: str) -> OfferEMI: + """Create an instance of OfferEMI from a JSON string""" + if "emi" not in json_str: + return None + return cls.from_dict(json.loads(json_str)) def to_dict(self): """Returns the dictionary representation of the model using alias""" diff --git a/cashfree_pg/models/offer_entity.py b/cashfree_pg/models/offer_entity.py index 3d476d5..ce459bc 100644 --- a/cashfree_pg/models/offer_entity.py +++ b/cashfree_pg/models/offer_entity.py @@ -55,6 +55,13 @@ def to_json(self) -> str: def from_json(cls, json_str: str) -> OfferEntity: """Create an instance of OfferEntity from a JSON string""" return cls.from_dict(json.loads(json_str)) + + @classmethod + def from_json_for_one_of(cls, json_str: str) -> OfferEntity: + """Create an instance of OfferEntity from a JSON string""" + if "offer_id", "offer_status", "offer_meta", "offer_tnc", "offer_details", "offer_validations" not in json_str: + return None + return cls.from_dict(json.loads(json_str)) def to_dict(self): """Returns the dictionary representation of the model using alias""" diff --git a/cashfree_pg/models/offer_filters.py b/cashfree_pg/models/offer_filters.py index b207c42..0e964c2 100644 --- a/cashfree_pg/models/offer_filters.py +++ b/cashfree_pg/models/offer_filters.py @@ -47,6 +47,13 @@ def to_json(self) -> str: def from_json(cls, json_str: str) -> OfferFilters: """Create an instance of OfferFilters from a JSON string""" return cls.from_dict(json.loads(json_str)) + + @classmethod + def from_json_for_one_of(cls, json_str: str) -> OfferFilters: + """Create an instance of OfferFilters from a JSON string""" + if "offer_type" not in json_str: + return None + return cls.from_dict(json.loads(json_str)) def to_dict(self): """Returns the dictionary representation of the model using alias""" diff --git a/cashfree_pg/models/offer_meta.py b/cashfree_pg/models/offer_meta.py index 8aa37f1..1e07437 100644 --- a/cashfree_pg/models/offer_meta.py +++ b/cashfree_pg/models/offer_meta.py @@ -50,6 +50,13 @@ def to_json(self) -> str: def from_json(cls, json_str: str) -> OfferMeta: """Create an instance of OfferMeta from a JSON string""" return cls.from_dict(json.loads(json_str)) + + @classmethod + def from_json_for_one_of(cls, json_str: str) -> OfferMeta: + """Create an instance of OfferMeta from a JSON string""" + if "offer_title", "offer_description", "offer_code", "offer_start_time", "offer_end_time" not in json_str: + return None + return cls.from_dict(json.loads(json_str)) def to_dict(self): """Returns the dictionary representation of the model using alias""" diff --git a/cashfree_pg/models/offer_nb.py b/cashfree_pg/models/offer_nb.py index 72f73e5..1d888ef 100644 --- a/cashfree_pg/models/offer_nb.py +++ b/cashfree_pg/models/offer_nb.py @@ -47,6 +47,13 @@ def to_json(self) -> str: def from_json(cls, json_str: str) -> OfferNB: """Create an instance of OfferNB from a JSON string""" return cls.from_dict(json.loads(json_str)) + + @classmethod + def from_json_for_one_of(cls, json_str: str) -> OfferNB: + """Create an instance of OfferNB from a JSON string""" + if "netbanking" not in json_str: + return None + return cls.from_dict(json.loads(json_str)) def to_dict(self): """Returns the dictionary representation of the model using alias""" diff --git a/cashfree_pg/models/offer_nb_netbanking.py b/cashfree_pg/models/offer_nb_netbanking.py index 81e0eca..d08b56b 100644 --- a/cashfree_pg/models/offer_nb_netbanking.py +++ b/cashfree_pg/models/offer_nb_netbanking.py @@ -46,6 +46,13 @@ def to_json(self) -> str: def from_json(cls, json_str: str) -> OfferNBNetbanking: """Create an instance of OfferNBNetbanking from a JSON string""" return cls.from_dict(json.loads(json_str)) + + @classmethod + def from_json_for_one_of(cls, json_str: str) -> OfferNBNetbanking: + """Create an instance of OfferNBNetbanking from a JSON string""" + if "bank_name" not in json_str: + return None + return cls.from_dict(json.loads(json_str)) def to_dict(self): """Returns the dictionary representation of the model using alias""" diff --git a/cashfree_pg/models/offer_paylater.py b/cashfree_pg/models/offer_paylater.py index aa7eba9..ef8e1e8 100644 --- a/cashfree_pg/models/offer_paylater.py +++ b/cashfree_pg/models/offer_paylater.py @@ -47,6 +47,13 @@ def to_json(self) -> str: def from_json(cls, json_str: str) -> OfferPaylater: """Create an instance of OfferPaylater from a JSON string""" return cls.from_dict(json.loads(json_str)) + + @classmethod + def from_json_for_one_of(cls, json_str: str) -> OfferPaylater: + """Create an instance of OfferPaylater from a JSON string""" + if "paylater" not in json_str: + return None + return cls.from_dict(json.loads(json_str)) def to_dict(self): """Returns the dictionary representation of the model using alias""" diff --git a/cashfree_pg/models/offer_queries.py b/cashfree_pg/models/offer_queries.py index 103eabc..0e77614 100644 --- a/cashfree_pg/models/offer_queries.py +++ b/cashfree_pg/models/offer_queries.py @@ -47,6 +47,13 @@ def to_json(self) -> str: def from_json(cls, json_str: str) -> OfferQueries: """Create an instance of OfferQueries from a JSON string""" return cls.from_dict(json.loads(json_str)) + + @classmethod + def from_json_for_one_of(cls, json_str: str) -> OfferQueries: + """Create an instance of OfferQueries from a JSON string""" + if "order_id", "amount" not in json_str: + return None + return cls.from_dict(json.loads(json_str)) def to_dict(self): """Returns the dictionary representation of the model using alias""" diff --git a/cashfree_pg/models/offer_tnc.py b/cashfree_pg/models/offer_tnc.py index 9b7911a..af0606d 100644 --- a/cashfree_pg/models/offer_tnc.py +++ b/cashfree_pg/models/offer_tnc.py @@ -54,6 +54,13 @@ def to_json(self) -> str: def from_json(cls, json_str: str) -> OfferTnc: """Create an instance of OfferTnc from a JSON string""" return cls.from_dict(json.loads(json_str)) + + @classmethod + def from_json_for_one_of(cls, json_str: str) -> OfferTnc: + """Create an instance of OfferTnc from a JSON string""" + if "offer_tnc_type", "offer_tnc_value" not in json_str: + return None + return cls.from_dict(json.loads(json_str)) def to_dict(self): """Returns the dictionary representation of the model using alias""" diff --git a/cashfree_pg/models/offer_upi.py b/cashfree_pg/models/offer_upi.py index 4cea112..195e08e 100644 --- a/cashfree_pg/models/offer_upi.py +++ b/cashfree_pg/models/offer_upi.py @@ -46,6 +46,13 @@ def to_json(self) -> str: def from_json(cls, json_str: str) -> OfferUPI: """Create an instance of OfferUPI from a JSON string""" return cls.from_dict(json.loads(json_str)) + + @classmethod + def from_json_for_one_of(cls, json_str: str) -> OfferUPI: + """Create an instance of OfferUPI from a JSON string""" + if "upi" not in json_str: + return None + return cls.from_dict(json.loads(json_str)) def to_dict(self): """Returns the dictionary representation of the model using alias""" diff --git a/cashfree_pg/models/offer_validations.py b/cashfree_pg/models/offer_validations.py index 1d5eb20..34bfa6e 100644 --- a/cashfree_pg/models/offer_validations.py +++ b/cashfree_pg/models/offer_validations.py @@ -49,6 +49,13 @@ def to_json(self) -> str: def from_json(cls, json_str: str) -> OfferValidations: """Create an instance of OfferValidations from a JSON string""" return cls.from_dict(json.loads(json_str)) + + @classmethod + def from_json_for_one_of(cls, json_str: str) -> OfferValidations: + """Create an instance of OfferValidations from a JSON string""" + if "min_amount", "payment_method", "max_allowed" not in json_str: + return None + return cls.from_dict(json.loads(json_str)) def to_dict(self): """Returns the dictionary representation of the model using alias""" diff --git a/cashfree_pg/models/offer_validations_payment_method.py b/cashfree_pg/models/offer_validations_payment_method.py index cc82aa7..057b99d 100644 --- a/cashfree_pg/models/offer_validations_payment_method.py +++ b/cashfree_pg/models/offer_validations_payment_method.py @@ -132,7 +132,7 @@ def from_json(cls, json_str: str) -> OfferValidationsPaymentMethod: # deserialize data into OfferAll try: - instance.actual_instance = OfferAll.from_json(json_str) + instance.actual_instance = OfferAll.from_json_for_one_of(json_str) match += 1 if (instance.actual_instance is not None): return instance @@ -140,7 +140,7 @@ def from_json(cls, json_str: str) -> OfferValidationsPaymentMethod: error_messages.append(str(e)) # deserialize data into OfferCard try: - instance.actual_instance = OfferCard.from_json(json_str) + instance.actual_instance = OfferCard.from_json_for_one_of(json_str) match += 1 if (instance.actual_instance is not None): return instance @@ -148,7 +148,7 @@ def from_json(cls, json_str: str) -> OfferValidationsPaymentMethod: error_messages.append(str(e)) # deserialize data into OfferNB try: - instance.actual_instance = OfferNB.from_json(json_str) + instance.actual_instance = OfferNB.from_json_for_one_of(json_str) match += 1 if (instance.actual_instance is not None): return instance @@ -156,7 +156,7 @@ def from_json(cls, json_str: str) -> OfferValidationsPaymentMethod: error_messages.append(str(e)) # deserialize data into OfferWallet try: - instance.actual_instance = OfferWallet.from_json(json_str) + instance.actual_instance = OfferWallet.from_json_for_one_of(json_str) match += 1 if (instance.actual_instance is not None): return instance @@ -164,7 +164,7 @@ def from_json(cls, json_str: str) -> OfferValidationsPaymentMethod: error_messages.append(str(e)) # deserialize data into OfferUPI try: - instance.actual_instance = OfferUPI.from_json(json_str) + instance.actual_instance = OfferUPI.from_json_for_one_of(json_str) match += 1 if (instance.actual_instance is not None): return instance @@ -172,7 +172,7 @@ def from_json(cls, json_str: str) -> OfferValidationsPaymentMethod: error_messages.append(str(e)) # deserialize data into OfferPaylater try: - instance.actual_instance = OfferPaylater.from_json(json_str) + instance.actual_instance = OfferPaylater.from_json_for_one_of(json_str) match += 1 if (instance.actual_instance is not None): return instance @@ -180,7 +180,7 @@ def from_json(cls, json_str: str) -> OfferValidationsPaymentMethod: error_messages.append(str(e)) # deserialize data into OfferEMI try: - instance.actual_instance = OfferEMI.from_json(json_str) + instance.actual_instance = OfferEMI.from_json_for_one_of(json_str) match += 1 if (instance.actual_instance is not None): return instance diff --git a/cashfree_pg/models/offer_wallet.py b/cashfree_pg/models/offer_wallet.py index 04f7922..1a5541f 100644 --- a/cashfree_pg/models/offer_wallet.py +++ b/cashfree_pg/models/offer_wallet.py @@ -47,6 +47,13 @@ def to_json(self) -> str: def from_json(cls, json_str: str) -> OfferWallet: """Create an instance of OfferWallet from a JSON string""" return cls.from_dict(json.loads(json_str)) + + @classmethod + def from_json_for_one_of(cls, json_str: str) -> OfferWallet: + """Create an instance of OfferWallet from a JSON string""" + if "app" not in json_str: + return None + return cls.from_dict(json.loads(json_str)) def to_dict(self): """Returns the dictionary representation of the model using alias""" diff --git a/cashfree_pg/models/order_authenticate_entity.py b/cashfree_pg/models/order_authenticate_entity.py index d4b8cfc..f527e01 100644 --- a/cashfree_pg/models/order_authenticate_entity.py +++ b/cashfree_pg/models/order_authenticate_entity.py @@ -69,6 +69,13 @@ def to_json(self) -> str: def from_json(cls, json_str: str) -> OrderAuthenticateEntity: """Create an instance of OrderAuthenticateEntity from a JSON string""" return cls.from_dict(json.loads(json_str)) + + @classmethod + def from_json_for_one_of(cls, json_str: str) -> OrderAuthenticateEntity: + """Create an instance of OrderAuthenticateEntity from a JSON string""" + if "cf_payment_id", "action", "authenticate_status", "payment_message" not in json_str: + return None + return cls.from_dict(json.loads(json_str)) def to_dict(self): """Returns the dictionary representation of the model using alias""" diff --git a/cashfree_pg/models/order_authenticate_payment_request.py b/cashfree_pg/models/order_authenticate_payment_request.py index 27d5e18..e971170 100644 --- a/cashfree_pg/models/order_authenticate_payment_request.py +++ b/cashfree_pg/models/order_authenticate_payment_request.py @@ -54,6 +54,13 @@ def to_json(self) -> str: def from_json(cls, json_str: str) -> OrderAuthenticatePaymentRequest: """Create an instance of OrderAuthenticatePaymentRequest from a JSON string""" return cls.from_dict(json.loads(json_str)) + + @classmethod + def from_json_for_one_of(cls, json_str: str) -> OrderAuthenticatePaymentRequest: + """Create an instance of OrderAuthenticatePaymentRequest from a JSON string""" + if "otp", "action" not in json_str: + return None + return cls.from_dict(json.loads(json_str)) def to_dict(self): """Returns the dictionary representation of the model using alias""" diff --git a/cashfree_pg/models/order_create_refund_request.py b/cashfree_pg/models/order_create_refund_request.py index 34080d5..f96f076 100644 --- a/cashfree_pg/models/order_create_refund_request.py +++ b/cashfree_pg/models/order_create_refund_request.py @@ -61,6 +61,13 @@ def to_json(self) -> str: def from_json(cls, json_str: str) -> OrderCreateRefundRequest: """Create an instance of OrderCreateRefundRequest from a JSON string""" return cls.from_dict(json.loads(json_str)) + + @classmethod + def from_json_for_one_of(cls, json_str: str) -> OrderCreateRefundRequest: + """Create an instance of OrderCreateRefundRequest from a JSON string""" + if "refund_amount", "refund_id", "refund_note", "refund_speed", "refund_splits" not in json_str: + return None + return cls.from_dict(json.loads(json_str)) def to_dict(self): """Returns the dictionary representation of the model using alias""" diff --git a/cashfree_pg/models/order_entity.py b/cashfree_pg/models/order_entity.py index 6d1f884..0120102 100644 --- a/cashfree_pg/models/order_entity.py +++ b/cashfree_pg/models/order_entity.py @@ -68,6 +68,13 @@ def to_json(self) -> str: def from_json(cls, json_str: str) -> OrderEntity: """Create an instance of OrderEntity from a JSON string""" return cls.from_dict(json.loads(json_str)) + + @classmethod + def from_json_for_one_of(cls, json_str: str) -> OrderEntity: + """Create an instance of OrderEntity from a JSON string""" + if "cf_order_id", "order_id", "entity", "order_currency", "order_amount", "order_status", "payment_session_id", "order_expiry_time", "order_note", "created_at", "order_splits", "customer_details", "order_meta", "payments", "settlements", "refunds", "order_tags" not in json_str: + return None + return cls.from_dict(json.loads(json_str)) def to_dict(self): """Returns the dictionary representation of the model using alias""" diff --git a/cashfree_pg/models/order_meta.py b/cashfree_pg/models/order_meta.py index d2b0bfd..2cecb27 100644 --- a/cashfree_pg/models/order_meta.py +++ b/cashfree_pg/models/order_meta.py @@ -48,6 +48,13 @@ def to_json(self) -> str: def from_json(cls, json_str: str) -> OrderMeta: """Create an instance of OrderMeta from a JSON string""" return cls.from_dict(json.loads(json_str)) + + @classmethod + def from_json_for_one_of(cls, json_str: str) -> OrderMeta: + """Create an instance of OrderMeta from a JSON string""" + if "return_url", "notify_url", "payment_methods" not in json_str: + return None + return cls.from_dict(json.loads(json_str)) def to_dict(self): """Returns the dictionary representation of the model using alias""" diff --git a/cashfree_pg/models/order_pay_data.py b/cashfree_pg/models/order_pay_data.py index e8fac70..d05a000 100644 --- a/cashfree_pg/models/order_pay_data.py +++ b/cashfree_pg/models/order_pay_data.py @@ -49,6 +49,13 @@ def to_json(self) -> str: def from_json(cls, json_str: str) -> OrderPayData: """Create an instance of OrderPayData from a JSON string""" return cls.from_dict(json.loads(json_str)) + + @classmethod + def from_json_for_one_of(cls, json_str: str) -> OrderPayData: + """Create an instance of OrderPayData from a JSON string""" + if "url", "payload", "content_type", "method" not in json_str: + return None + return cls.from_dict(json.loads(json_str)) def to_dict(self): """Returns the dictionary representation of the model using alias""" diff --git a/cashfree_pg/models/pay_order_entity.py b/cashfree_pg/models/pay_order_entity.py index 03a21c2..e0d00c4 100644 --- a/cashfree_pg/models/pay_order_entity.py +++ b/cashfree_pg/models/pay_order_entity.py @@ -82,6 +82,13 @@ def to_json(self) -> str: def from_json(cls, json_str: str) -> PayOrderEntity: """Create an instance of PayOrderEntity from a JSON string""" return cls.from_dict(json.loads(json_str)) + + @classmethod + def from_json_for_one_of(cls, json_str: str) -> PayOrderEntity: + """Create an instance of PayOrderEntity from a JSON string""" + if "payment_amount", "cf_payment_id", "payment_method", "channel", "action", "data" not in json_str: + return None + return cls.from_dict(json.loads(json_str)) def to_dict(self): """Returns the dictionary representation of the model using alias""" diff --git a/cashfree_pg/models/pay_order_request.py b/cashfree_pg/models/pay_order_request.py index 5438fa4..247e2f2 100644 --- a/cashfree_pg/models/pay_order_request.py +++ b/cashfree_pg/models/pay_order_request.py @@ -50,6 +50,13 @@ def to_json(self) -> str: def from_json(cls, json_str: str) -> PayOrderRequest: """Create an instance of PayOrderRequest from a JSON string""" return cls.from_dict(json.loads(json_str)) + + @classmethod + def from_json_for_one_of(cls, json_str: str) -> PayOrderRequest: + """Create an instance of PayOrderRequest from a JSON string""" + if "payment_session_id", "payment_method", "save_instrument", "offer_id" not in json_str: + return None + return cls.from_dict(json.loads(json_str)) def to_dict(self): """Returns the dictionary representation of the model using alias""" diff --git a/cashfree_pg/models/pay_order_request_payment_method.py b/cashfree_pg/models/pay_order_request_payment_method.py index 3ea5990..253a2c2 100644 --- a/cashfree_pg/models/pay_order_request_payment_method.py +++ b/cashfree_pg/models/pay_order_request_payment_method.py @@ -132,7 +132,7 @@ def from_json(cls, json_str: str) -> PayOrderRequestPaymentMethod: # deserialize data into CardPaymentMethod try: - instance.actual_instance = CardPaymentMethod.from_json(json_str) + instance.actual_instance = CardPaymentMethod.from_json_for_one_of(json_str) match += 1 if (instance.actual_instance is not None): return instance @@ -140,7 +140,7 @@ def from_json(cls, json_str: str) -> PayOrderRequestPaymentMethod: error_messages.append(str(e)) # deserialize data into UPIPaymentMethod try: - instance.actual_instance = UPIPaymentMethod.from_json(json_str) + instance.actual_instance = UPIPaymentMethod.from_json_for_one_of(json_str) match += 1 if (instance.actual_instance is not None): return instance @@ -148,7 +148,7 @@ def from_json(cls, json_str: str) -> PayOrderRequestPaymentMethod: error_messages.append(str(e)) # deserialize data into NetBankingPaymentMethod try: - instance.actual_instance = NetBankingPaymentMethod.from_json(json_str) + instance.actual_instance = NetBankingPaymentMethod.from_json_for_one_of(json_str) match += 1 if (instance.actual_instance is not None): return instance @@ -156,7 +156,7 @@ def from_json(cls, json_str: str) -> PayOrderRequestPaymentMethod: error_messages.append(str(e)) # deserialize data into AppPaymentMethod try: - instance.actual_instance = AppPaymentMethod.from_json(json_str) + instance.actual_instance = AppPaymentMethod.from_json_for_one_of(json_str) match += 1 if (instance.actual_instance is not None): return instance @@ -164,7 +164,7 @@ def from_json(cls, json_str: str) -> PayOrderRequestPaymentMethod: error_messages.append(str(e)) # deserialize data into CardEMIPaymentMethod try: - instance.actual_instance = CardEMIPaymentMethod.from_json(json_str) + instance.actual_instance = CardEMIPaymentMethod.from_json_for_one_of(json_str) match += 1 if (instance.actual_instance is not None): return instance @@ -172,7 +172,7 @@ def from_json(cls, json_str: str) -> PayOrderRequestPaymentMethod: error_messages.append(str(e)) # deserialize data into CardlessEMIPaymentMethod try: - instance.actual_instance = CardlessEMIPaymentMethod.from_json(json_str) + instance.actual_instance = CardlessEMIPaymentMethod.from_json_for_one_of(json_str) match += 1 if (instance.actual_instance is not None): return instance @@ -180,7 +180,7 @@ def from_json(cls, json_str: str) -> PayOrderRequestPaymentMethod: error_messages.append(str(e)) # deserialize data into PaylaterPaymentMethod try: - instance.actual_instance = PaylaterPaymentMethod.from_json(json_str) + instance.actual_instance = PaylaterPaymentMethod.from_json_for_one_of(json_str) match += 1 if (instance.actual_instance is not None): return instance diff --git a/cashfree_pg/models/paylater.py b/cashfree_pg/models/paylater.py index 400bedb..434a45d 100644 --- a/cashfree_pg/models/paylater.py +++ b/cashfree_pg/models/paylater.py @@ -58,6 +58,13 @@ def to_json(self) -> str: def from_json(cls, json_str: str) -> Paylater: """Create an instance of Paylater from a JSON string""" return cls.from_dict(json.loads(json_str)) + + @classmethod + def from_json_for_one_of(cls, json_str: str) -> Paylater: + """Create an instance of Paylater from a JSON string""" + if "channel", "provider", "phone" not in json_str: + return None + return cls.from_dict(json.loads(json_str)) def to_dict(self): """Returns the dictionary representation of the model using alias""" diff --git a/cashfree_pg/models/paylater_entity.py b/cashfree_pg/models/paylater_entity.py index 0e75191..64a8572 100644 --- a/cashfree_pg/models/paylater_entity.py +++ b/cashfree_pg/models/paylater_entity.py @@ -46,6 +46,13 @@ def to_json(self) -> str: def from_json(cls, json_str: str) -> PaylaterEntity: """Create an instance of PaylaterEntity from a JSON string""" return cls.from_dict(json.loads(json_str)) + + @classmethod + def from_json_for_one_of(cls, json_str: str) -> PaylaterEntity: + """Create an instance of PaylaterEntity from a JSON string""" + if "payment_method" not in json_str: + return None + return cls.from_dict(json.loads(json_str)) def to_dict(self): """Returns the dictionary representation of the model using alias""" diff --git a/cashfree_pg/models/paylater_offer.py b/cashfree_pg/models/paylater_offer.py index 5e10da6..f6bf2ee 100644 --- a/cashfree_pg/models/paylater_offer.py +++ b/cashfree_pg/models/paylater_offer.py @@ -46,6 +46,13 @@ def to_json(self) -> str: def from_json(cls, json_str: str) -> PaylaterOffer: """Create an instance of PaylaterOffer from a JSON string""" return cls.from_dict(json.loads(json_str)) + + @classmethod + def from_json_for_one_of(cls, json_str: str) -> PaylaterOffer: + """Create an instance of PaylaterOffer from a JSON string""" + if "provider" not in json_str: + return None + return cls.from_dict(json.loads(json_str)) def to_dict(self): """Returns the dictionary representation of the model using alias""" diff --git a/cashfree_pg/models/paylater_payment_method.py b/cashfree_pg/models/paylater_payment_method.py index d16e652..2188cca 100644 --- a/cashfree_pg/models/paylater_payment_method.py +++ b/cashfree_pg/models/paylater_payment_method.py @@ -47,6 +47,13 @@ def to_json(self) -> str: def from_json(cls, json_str: str) -> PaylaterPaymentMethod: """Create an instance of PaylaterPaymentMethod from a JSON string""" return cls.from_dict(json.loads(json_str)) + + @classmethod + def from_json_for_one_of(cls, json_str: str) -> PaylaterPaymentMethod: + """Create an instance of PaylaterPaymentMethod from a JSON string""" + if "paylater" not in json_str: + return None + return cls.from_dict(json.loads(json_str)) def to_dict(self): """Returns the dictionary representation of the model using alias""" diff --git a/cashfree_pg/models/payment_entity.py b/cashfree_pg/models/payment_entity.py index 31d9884..3d6fd24 100644 --- a/cashfree_pg/models/payment_entity.py +++ b/cashfree_pg/models/payment_entity.py @@ -75,6 +75,13 @@ def to_json(self) -> str: def from_json(cls, json_str: str) -> PaymentEntity: """Create an instance of PaymentEntity from a JSON string""" return cls.from_dict(json.loads(json_str)) + + @classmethod + def from_json_for_one_of(cls, json_str: str) -> PaymentEntity: + """Create an instance of PaymentEntity from a JSON string""" + if "cf_payment_id", "order_id", "entity", "error_details", "is_captured", "order_amount", "payment_group", "payment_currency", "payment_amount", "payment_time", "payment_completion_time", "payment_status", "payment_message", "bank_reference", "auth_id", "authorization", "payment_method" not in json_str: + return None + return cls.from_dict(json.loads(json_str)) def to_dict(self): """Returns the dictionary representation of the model using alias""" diff --git a/cashfree_pg/models/payment_entity_payment_method.py b/cashfree_pg/models/payment_entity_payment_method.py index d2a2219..b1dbaaa 100644 --- a/cashfree_pg/models/payment_entity_payment_method.py +++ b/cashfree_pg/models/payment_entity_payment_method.py @@ -132,7 +132,7 @@ def from_json(cls, json_str: str) -> PaymentEntityPaymentMethod: # deserialize data into PaymentMethodCardInPaymentsEntity try: - instance.actual_instance = PaymentMethodCardInPaymentsEntity.from_json(json_str) + instance.actual_instance = PaymentMethodCardInPaymentsEntity.from_json_for_one_of(json_str) match += 1 if (instance.actual_instance is not None): return instance @@ -140,7 +140,7 @@ def from_json(cls, json_str: str) -> PaymentEntityPaymentMethod: error_messages.append(str(e)) # deserialize data into PaymentMethodNetBankingInPaymentsEntity try: - instance.actual_instance = PaymentMethodNetBankingInPaymentsEntity.from_json(json_str) + instance.actual_instance = PaymentMethodNetBankingInPaymentsEntity.from_json_for_one_of(json_str) match += 1 if (instance.actual_instance is not None): return instance @@ -148,7 +148,7 @@ def from_json(cls, json_str: str) -> PaymentEntityPaymentMethod: error_messages.append(str(e)) # deserialize data into PaymentMethodUPIInPaymentsEntity try: - instance.actual_instance = PaymentMethodUPIInPaymentsEntity.from_json(json_str) + instance.actual_instance = PaymentMethodUPIInPaymentsEntity.from_json_for_one_of(json_str) match += 1 if (instance.actual_instance is not None): return instance @@ -156,7 +156,7 @@ def from_json(cls, json_str: str) -> PaymentEntityPaymentMethod: error_messages.append(str(e)) # deserialize data into PaymentMethodAppInPaymentsEntity try: - instance.actual_instance = PaymentMethodAppInPaymentsEntity.from_json(json_str) + instance.actual_instance = PaymentMethodAppInPaymentsEntity.from_json_for_one_of(json_str) match += 1 if (instance.actual_instance is not None): return instance @@ -164,7 +164,7 @@ def from_json(cls, json_str: str) -> PaymentEntityPaymentMethod: error_messages.append(str(e)) # deserialize data into PaymentMethodCardlessEMIInPaymentsEntity try: - instance.actual_instance = PaymentMethodCardlessEMIInPaymentsEntity.from_json(json_str) + instance.actual_instance = PaymentMethodCardlessEMIInPaymentsEntity.from_json_for_one_of(json_str) match += 1 if (instance.actual_instance is not None): return instance @@ -172,7 +172,7 @@ def from_json(cls, json_str: str) -> PaymentEntityPaymentMethod: error_messages.append(str(e)) # deserialize data into PaymentMethodPaylaterInPaymentsEntity try: - instance.actual_instance = PaymentMethodPaylaterInPaymentsEntity.from_json(json_str) + instance.actual_instance = PaymentMethodPaylaterInPaymentsEntity.from_json_for_one_of(json_str) match += 1 if (instance.actual_instance is not None): return instance @@ -180,7 +180,7 @@ def from_json(cls, json_str: str) -> PaymentEntityPaymentMethod: error_messages.append(str(e)) # deserialize data into PaymentMethodCardEMIInPaymentsEntity try: - instance.actual_instance = PaymentMethodCardEMIInPaymentsEntity.from_json(json_str) + instance.actual_instance = PaymentMethodCardEMIInPaymentsEntity.from_json_for_one_of(json_str) match += 1 if (instance.actual_instance is not None): return instance diff --git a/cashfree_pg/models/payment_link_customer_details.py b/cashfree_pg/models/payment_link_customer_details.py index 981c558..e2f23f9 100644 --- a/cashfree_pg/models/payment_link_customer_details.py +++ b/cashfree_pg/models/payment_link_customer_details.py @@ -52,6 +52,13 @@ def to_json(self) -> str: def from_json(cls, json_str: str) -> PaymentLinkCustomerDetails: """Create an instance of PaymentLinkCustomerDetails from a JSON string""" return cls.from_dict(json.loads(json_str)) + + @classmethod + def from_json_for_one_of(cls, json_str: str) -> PaymentLinkCustomerDetails: + """Create an instance of PaymentLinkCustomerDetails from a JSON string""" + if "customer_id", "customer_email", "customer_phone", "customer_name", "customer_bank_account_number", "customer_bank_ifsc", "customer_bank_code" not in json_str: + return None + return cls.from_dict(json.loads(json_str)) def to_dict(self): """Returns the dictionary representation of the model using alias""" diff --git a/cashfree_pg/models/payment_link_order_entity.py b/cashfree_pg/models/payment_link_order_entity.py index c25bd4d..4d533a8 100644 --- a/cashfree_pg/models/payment_link_order_entity.py +++ b/cashfree_pg/models/payment_link_order_entity.py @@ -69,6 +69,13 @@ def to_json(self) -> str: def from_json(cls, json_str: str) -> PaymentLinkOrderEntity: """Create an instance of PaymentLinkOrderEntity from a JSON string""" return cls.from_dict(json.loads(json_str)) + + @classmethod + def from_json_for_one_of(cls, json_str: str) -> PaymentLinkOrderEntity: + """Create an instance of PaymentLinkOrderEntity from a JSON string""" + if "cf_order_id", "link_id", "order_id", "entity", "order_currency", "order_amount", "order_status", "payment_session_id", "order_expiry_time", "order_note", "created_at", "order_splits", "customer_details", "order_meta", "payments", "settlements", "refunds", "order_tags" not in json_str: + return None + return cls.from_dict(json.loads(json_str)) def to_dict(self): """Returns the dictionary representation of the model using alias""" diff --git a/cashfree_pg/models/payment_method_app_in_payments_entity.py b/cashfree_pg/models/payment_method_app_in_payments_entity.py index 9821205..d7046c4 100644 --- a/cashfree_pg/models/payment_method_app_in_payments_entity.py +++ b/cashfree_pg/models/payment_method_app_in_payments_entity.py @@ -47,6 +47,13 @@ def to_json(self) -> str: def from_json(cls, json_str: str) -> PaymentMethodAppInPaymentsEntity: """Create an instance of PaymentMethodAppInPaymentsEntity from a JSON string""" return cls.from_dict(json.loads(json_str)) + + @classmethod + def from_json_for_one_of(cls, json_str: str) -> PaymentMethodAppInPaymentsEntity: + """Create an instance of PaymentMethodAppInPaymentsEntity from a JSON string""" + if "app" not in json_str: + return None + return cls.from_dict(json.loads(json_str)) def to_dict(self): """Returns the dictionary representation of the model using alias""" diff --git a/cashfree_pg/models/payment_method_app_in_payments_entity_app.py b/cashfree_pg/models/payment_method_app_in_payments_entity_app.py index 595993d..dc31ab6 100644 --- a/cashfree_pg/models/payment_method_app_in_payments_entity_app.py +++ b/cashfree_pg/models/payment_method_app_in_payments_entity_app.py @@ -48,6 +48,13 @@ def to_json(self) -> str: def from_json(cls, json_str: str) -> PaymentMethodAppInPaymentsEntityApp: """Create an instance of PaymentMethodAppInPaymentsEntityApp from a JSON string""" return cls.from_dict(json.loads(json_str)) + + @classmethod + def from_json_for_one_of(cls, json_str: str) -> PaymentMethodAppInPaymentsEntityApp: + """Create an instance of PaymentMethodAppInPaymentsEntityApp from a JSON string""" + if "channel", "provider", "phone" not in json_str: + return None + return cls.from_dict(json.loads(json_str)) def to_dict(self): """Returns the dictionary representation of the model using alias""" diff --git a/cashfree_pg/models/payment_method_card_emiin_payments_entity.py b/cashfree_pg/models/payment_method_card_emiin_payments_entity.py index 6bc784f..5888080 100644 --- a/cashfree_pg/models/payment_method_card_emiin_payments_entity.py +++ b/cashfree_pg/models/payment_method_card_emiin_payments_entity.py @@ -47,6 +47,13 @@ def to_json(self) -> str: def from_json(cls, json_str: str) -> PaymentMethodCardEMIInPaymentsEntity: """Create an instance of PaymentMethodCardEMIInPaymentsEntity from a JSON string""" return cls.from_dict(json.loads(json_str)) + + @classmethod + def from_json_for_one_of(cls, json_str: str) -> PaymentMethodCardEMIInPaymentsEntity: + """Create an instance of PaymentMethodCardEMIInPaymentsEntity from a JSON string""" + if "emi" not in json_str: + return None + return cls.from_dict(json.loads(json_str)) def to_dict(self): """Returns the dictionary representation of the model using alias""" diff --git a/cashfree_pg/models/payment_method_card_emiin_payments_entity_emi.py b/cashfree_pg/models/payment_method_card_emiin_payments_entity_emi.py index d815b22..abd597b 100644 --- a/cashfree_pg/models/payment_method_card_emiin_payments_entity_emi.py +++ b/cashfree_pg/models/payment_method_card_emiin_payments_entity_emi.py @@ -55,6 +55,13 @@ def to_json(self) -> str: def from_json(cls, json_str: str) -> PaymentMethodCardEMIInPaymentsEntityEmi: """Create an instance of PaymentMethodCardEMIInPaymentsEntityEmi from a JSON string""" return cls.from_dict(json.loads(json_str)) + + @classmethod + def from_json_for_one_of(cls, json_str: str) -> PaymentMethodCardEMIInPaymentsEntityEmi: + """Create an instance of PaymentMethodCardEMIInPaymentsEntityEmi from a JSON string""" + if "channel", "card_number", "card_network", "card_type", "card_country", "card_bank_name", "card_network_reference_id", "emi_tenure", "emi_details" not in json_str: + return None + return cls.from_dict(json.loads(json_str)) def to_dict(self): """Returns the dictionary representation of the model using alias""" diff --git a/cashfree_pg/models/payment_method_card_emiin_payments_entity_emi_emi_details.py b/cashfree_pg/models/payment_method_card_emiin_payments_entity_emi_emi_details.py index 05d8ec9..ebe9367 100644 --- a/cashfree_pg/models/payment_method_card_emiin_payments_entity_emi_emi_details.py +++ b/cashfree_pg/models/payment_method_card_emiin_payments_entity_emi_emi_details.py @@ -48,6 +48,13 @@ def to_json(self) -> str: def from_json(cls, json_str: str) -> PaymentMethodCardEMIInPaymentsEntityEmiEmiDetails: """Create an instance of PaymentMethodCardEMIInPaymentsEntityEmiEmiDetails from a JSON string""" return cls.from_dict(json.loads(json_str)) + + @classmethod + def from_json_for_one_of(cls, json_str: str) -> PaymentMethodCardEMIInPaymentsEntityEmiEmiDetails: + """Create an instance of PaymentMethodCardEMIInPaymentsEntityEmiEmiDetails from a JSON string""" + if "emi_amount", "emi_tenure", "emi_interest" not in json_str: + return None + return cls.from_dict(json.loads(json_str)) def to_dict(self): """Returns the dictionary representation of the model using alias""" diff --git a/cashfree_pg/models/payment_method_card_in_payments_entity.py b/cashfree_pg/models/payment_method_card_in_payments_entity.py index 0d81e19..a172906 100644 --- a/cashfree_pg/models/payment_method_card_in_payments_entity.py +++ b/cashfree_pg/models/payment_method_card_in_payments_entity.py @@ -47,6 +47,13 @@ def to_json(self) -> str: def from_json(cls, json_str: str) -> PaymentMethodCardInPaymentsEntity: """Create an instance of PaymentMethodCardInPaymentsEntity from a JSON string""" return cls.from_dict(json.loads(json_str)) + + @classmethod + def from_json_for_one_of(cls, json_str: str) -> PaymentMethodCardInPaymentsEntity: + """Create an instance of PaymentMethodCardInPaymentsEntity from a JSON string""" + if "card" not in json_str: + return None + return cls.from_dict(json.loads(json_str)) def to_dict(self): """Returns the dictionary representation of the model using alias""" diff --git a/cashfree_pg/models/payment_method_card_in_payments_entity_card.py b/cashfree_pg/models/payment_method_card_in_payments_entity_card.py index 1e560b8..bc6f5bc 100644 --- a/cashfree_pg/models/payment_method_card_in_payments_entity_card.py +++ b/cashfree_pg/models/payment_method_card_in_payments_entity_card.py @@ -52,6 +52,13 @@ def to_json(self) -> str: def from_json(cls, json_str: str) -> PaymentMethodCardInPaymentsEntityCard: """Create an instance of PaymentMethodCardInPaymentsEntityCard from a JSON string""" return cls.from_dict(json.loads(json_str)) + + @classmethod + def from_json_for_one_of(cls, json_str: str) -> PaymentMethodCardInPaymentsEntityCard: + """Create an instance of PaymentMethodCardInPaymentsEntityCard from a JSON string""" + if "channel", "card_number", "card_network", "card_type", "card_country", "card_bank_name", "card_network_reference_id" not in json_str: + return None + return cls.from_dict(json.loads(json_str)) def to_dict(self): """Returns the dictionary representation of the model using alias""" diff --git a/cashfree_pg/models/payment_method_cardless_emiin_payments_entity.py b/cashfree_pg/models/payment_method_cardless_emiin_payments_entity.py index d258013..bf2e1e4 100644 --- a/cashfree_pg/models/payment_method_cardless_emiin_payments_entity.py +++ b/cashfree_pg/models/payment_method_cardless_emiin_payments_entity.py @@ -47,6 +47,13 @@ def to_json(self) -> str: def from_json(cls, json_str: str) -> PaymentMethodCardlessEMIInPaymentsEntity: """Create an instance of PaymentMethodCardlessEMIInPaymentsEntity from a JSON string""" return cls.from_dict(json.loads(json_str)) + + @classmethod + def from_json_for_one_of(cls, json_str: str) -> PaymentMethodCardlessEMIInPaymentsEntity: + """Create an instance of PaymentMethodCardlessEMIInPaymentsEntity from a JSON string""" + if "cardless_emi" not in json_str: + return None + return cls.from_dict(json.loads(json_str)) def to_dict(self): """Returns the dictionary representation of the model using alias""" diff --git a/cashfree_pg/models/payment_method_net_banking_in_payments_entity.py b/cashfree_pg/models/payment_method_net_banking_in_payments_entity.py index 61ce7cc..e12a0e9 100644 --- a/cashfree_pg/models/payment_method_net_banking_in_payments_entity.py +++ b/cashfree_pg/models/payment_method_net_banking_in_payments_entity.py @@ -47,6 +47,13 @@ def to_json(self) -> str: def from_json(cls, json_str: str) -> PaymentMethodNetBankingInPaymentsEntity: """Create an instance of PaymentMethodNetBankingInPaymentsEntity from a JSON string""" return cls.from_dict(json.loads(json_str)) + + @classmethod + def from_json_for_one_of(cls, json_str: str) -> PaymentMethodNetBankingInPaymentsEntity: + """Create an instance of PaymentMethodNetBankingInPaymentsEntity from a JSON string""" + if "netbanking" not in json_str: + return None + return cls.from_dict(json.loads(json_str)) def to_dict(self): """Returns the dictionary representation of the model using alias""" diff --git a/cashfree_pg/models/payment_method_net_banking_in_payments_entity_netbanking.py b/cashfree_pg/models/payment_method_net_banking_in_payments_entity_netbanking.py index e2dcdbb..1944a03 100644 --- a/cashfree_pg/models/payment_method_net_banking_in_payments_entity_netbanking.py +++ b/cashfree_pg/models/payment_method_net_banking_in_payments_entity_netbanking.py @@ -48,6 +48,13 @@ def to_json(self) -> str: def from_json(cls, json_str: str) -> PaymentMethodNetBankingInPaymentsEntityNetbanking: """Create an instance of PaymentMethodNetBankingInPaymentsEntityNetbanking from a JSON string""" return cls.from_dict(json.loads(json_str)) + + @classmethod + def from_json_for_one_of(cls, json_str: str) -> PaymentMethodNetBankingInPaymentsEntityNetbanking: + """Create an instance of PaymentMethodNetBankingInPaymentsEntityNetbanking from a JSON string""" + if "channel", "netbanking_bank_code", "netbanking_bank_name" not in json_str: + return None + return cls.from_dict(json.loads(json_str)) def to_dict(self): """Returns the dictionary representation of the model using alias""" diff --git a/cashfree_pg/models/payment_method_paylater_in_payments_entity.py b/cashfree_pg/models/payment_method_paylater_in_payments_entity.py index b6b67b0..8e32489 100644 --- a/cashfree_pg/models/payment_method_paylater_in_payments_entity.py +++ b/cashfree_pg/models/payment_method_paylater_in_payments_entity.py @@ -47,6 +47,13 @@ def to_json(self) -> str: def from_json(cls, json_str: str) -> PaymentMethodPaylaterInPaymentsEntity: """Create an instance of PaymentMethodPaylaterInPaymentsEntity from a JSON string""" return cls.from_dict(json.loads(json_str)) + + @classmethod + def from_json_for_one_of(cls, json_str: str) -> PaymentMethodPaylaterInPaymentsEntity: + """Create an instance of PaymentMethodPaylaterInPaymentsEntity from a JSON string""" + if "paylater" not in json_str: + return None + return cls.from_dict(json.loads(json_str)) def to_dict(self): """Returns the dictionary representation of the model using alias""" diff --git a/cashfree_pg/models/payment_method_upiin_payments_entity.py b/cashfree_pg/models/payment_method_upiin_payments_entity.py index 273430b..6474622 100644 --- a/cashfree_pg/models/payment_method_upiin_payments_entity.py +++ b/cashfree_pg/models/payment_method_upiin_payments_entity.py @@ -47,6 +47,13 @@ def to_json(self) -> str: def from_json(cls, json_str: str) -> PaymentMethodUPIInPaymentsEntity: """Create an instance of PaymentMethodUPIInPaymentsEntity from a JSON string""" return cls.from_dict(json.loads(json_str)) + + @classmethod + def from_json_for_one_of(cls, json_str: str) -> PaymentMethodUPIInPaymentsEntity: + """Create an instance of PaymentMethodUPIInPaymentsEntity from a JSON string""" + if "upi" not in json_str: + return None + return cls.from_dict(json.loads(json_str)) def to_dict(self): """Returns the dictionary representation of the model using alias""" diff --git a/cashfree_pg/models/payment_method_upiin_payments_entity_upi.py b/cashfree_pg/models/payment_method_upiin_payments_entity_upi.py index 3f10323..92970c5 100644 --- a/cashfree_pg/models/payment_method_upiin_payments_entity_upi.py +++ b/cashfree_pg/models/payment_method_upiin_payments_entity_upi.py @@ -47,6 +47,13 @@ def to_json(self) -> str: def from_json(cls, json_str: str) -> PaymentMethodUPIInPaymentsEntityUpi: """Create an instance of PaymentMethodUPIInPaymentsEntityUpi from a JSON string""" return cls.from_dict(json.loads(json_str)) + + @classmethod + def from_json_for_one_of(cls, json_str: str) -> PaymentMethodUPIInPaymentsEntityUpi: + """Create an instance of PaymentMethodUPIInPaymentsEntityUpi from a JSON string""" + if "channel", "upi_id" not in json_str: + return None + return cls.from_dict(json.loads(json_str)) def to_dict(self): """Returns the dictionary representation of the model using alias""" diff --git a/cashfree_pg/models/payment_methods_filters.py b/cashfree_pg/models/payment_methods_filters.py index 140f0aa..113db62 100644 --- a/cashfree_pg/models/payment_methods_filters.py +++ b/cashfree_pg/models/payment_methods_filters.py @@ -46,6 +46,13 @@ def to_json(self) -> str: def from_json(cls, json_str: str) -> PaymentMethodsFilters: """Create an instance of PaymentMethodsFilters from a JSON string""" return cls.from_dict(json.loads(json_str)) + + @classmethod + def from_json_for_one_of(cls, json_str: str) -> PaymentMethodsFilters: + """Create an instance of PaymentMethodsFilters from a JSON string""" + if "payment_methods" not in json_str: + return None + return cls.from_dict(json.loads(json_str)) def to_dict(self): """Returns the dictionary representation of the model using alias""" diff --git a/cashfree_pg/models/payment_methods_queries.py b/cashfree_pg/models/payment_methods_queries.py index 8b82115..2665282 100644 --- a/cashfree_pg/models/payment_methods_queries.py +++ b/cashfree_pg/models/payment_methods_queries.py @@ -47,6 +47,13 @@ def to_json(self) -> str: def from_json(cls, json_str: str) -> PaymentMethodsQueries: """Create an instance of PaymentMethodsQueries from a JSON string""" return cls.from_dict(json.loads(json_str)) + + @classmethod + def from_json_for_one_of(cls, json_str: str) -> PaymentMethodsQueries: + """Create an instance of PaymentMethodsQueries from a JSON string""" + if "amount", "order_id" not in json_str: + return None + return cls.from_dict(json.loads(json_str)) def to_dict(self): """Returns the dictionary representation of the model using alias""" diff --git a/cashfree_pg/models/payment_mode_details.py b/cashfree_pg/models/payment_mode_details.py index a281e12..e89f40f 100644 --- a/cashfree_pg/models/payment_mode_details.py +++ b/cashfree_pg/models/payment_mode_details.py @@ -49,6 +49,13 @@ def to_json(self) -> str: def from_json(cls, json_str: str) -> PaymentModeDetails: """Create an instance of PaymentModeDetails from a JSON string""" return cls.from_dict(json.loads(json_str)) + + @classmethod + def from_json_for_one_of(cls, json_str: str) -> PaymentModeDetails: + """Create an instance of PaymentModeDetails from a JSON string""" + if "nick", "display", "eligibility", "code" not in json_str: + return None + return cls.from_dict(json.loads(json_str)) def to_dict(self): """Returns the dictionary representation of the model using alias""" diff --git a/cashfree_pg/models/payment_url_object.py b/cashfree_pg/models/payment_url_object.py index 8492fdc..6b10711 100644 --- a/cashfree_pg/models/payment_url_object.py +++ b/cashfree_pg/models/payment_url_object.py @@ -46,6 +46,13 @@ def to_json(self) -> str: def from_json(cls, json_str: str) -> PaymentURLObject: """Create an instance of PaymentURLObject from a JSON string""" return cls.from_dict(json.loads(json_str)) + + @classmethod + def from_json_for_one_of(cls, json_str: str) -> PaymentURLObject: + """Create an instance of PaymentURLObject from a JSON string""" + if "url" not in json_str: + return None + return cls.from_dict(json.loads(json_str)) def to_dict(self): """Returns the dictionary representation of the model using alias""" diff --git a/cashfree_pg/models/payment_webhook.py b/cashfree_pg/models/payment_webhook.py index 2c7da64..379336a 100644 --- a/cashfree_pg/models/payment_webhook.py +++ b/cashfree_pg/models/payment_webhook.py @@ -49,6 +49,13 @@ def to_json(self) -> str: def from_json(cls, json_str: str) -> PaymentWebhook: """Create an instance of PaymentWebhook from a JSON string""" return cls.from_dict(json.loads(json_str)) + + @classmethod + def from_json_for_one_of(cls, json_str: str) -> PaymentWebhook: + """Create an instance of PaymentWebhook from a JSON string""" + if "data", "event_time", "type" not in json_str: + return None + return cls.from_dict(json.loads(json_str)) def to_dict(self): """Returns the dictionary representation of the model using alias""" diff --git a/cashfree_pg/models/payment_webhook_customer_entity.py b/cashfree_pg/models/payment_webhook_customer_entity.py index 46bc282..16ff5a0 100644 --- a/cashfree_pg/models/payment_webhook_customer_entity.py +++ b/cashfree_pg/models/payment_webhook_customer_entity.py @@ -49,6 +49,13 @@ def to_json(self) -> str: def from_json(cls, json_str: str) -> PaymentWebhookCustomerEntity: """Create an instance of PaymentWebhookCustomerEntity from a JSON string""" return cls.from_dict(json.loads(json_str)) + + @classmethod + def from_json_for_one_of(cls, json_str: str) -> PaymentWebhookCustomerEntity: + """Create an instance of PaymentWebhookCustomerEntity from a JSON string""" + if "customer_name", "customer_id", "customer_email", "customer_phone" not in json_str: + return None + return cls.from_dict(json.loads(json_str)) def to_dict(self): """Returns the dictionary representation of the model using alias""" diff --git a/cashfree_pg/models/payment_webhook_data_entity.py b/cashfree_pg/models/payment_webhook_data_entity.py index 6c5e303..617d170 100644 --- a/cashfree_pg/models/payment_webhook_data_entity.py +++ b/cashfree_pg/models/payment_webhook_data_entity.py @@ -57,6 +57,13 @@ def to_json(self) -> str: def from_json(cls, json_str: str) -> PaymentWebhookDataEntity: """Create an instance of PaymentWebhookDataEntity from a JSON string""" return cls.from_dict(json.loads(json_str)) + + @classmethod + def from_json_for_one_of(cls, json_str: str) -> PaymentWebhookDataEntity: + """Create an instance of PaymentWebhookDataEntity from a JSON string""" + if "order", "payment", "customer_details", "error_details", "payment_gateway_details", "payment_offers" not in json_str: + return None + return cls.from_dict(json.loads(json_str)) def to_dict(self): """Returns the dictionary representation of the model using alias""" diff --git a/cashfree_pg/models/payment_webhook_error_entity.py b/cashfree_pg/models/payment_webhook_error_entity.py index b8b68df..341f17b 100644 --- a/cashfree_pg/models/payment_webhook_error_entity.py +++ b/cashfree_pg/models/payment_webhook_error_entity.py @@ -51,6 +51,13 @@ def to_json(self) -> str: def from_json(cls, json_str: str) -> PaymentWebhookErrorEntity: """Create an instance of PaymentWebhookErrorEntity from a JSON string""" return cls.from_dict(json.loads(json_str)) + + @classmethod + def from_json_for_one_of(cls, json_str: str) -> PaymentWebhookErrorEntity: + """Create an instance of PaymentWebhookErrorEntity from a JSON string""" + if "error_code", "error_description", "error_reason", "error_source", "error_code_raw", "error_description_raw" not in json_str: + return None + return cls.from_dict(json.loads(json_str)) def to_dict(self): """Returns the dictionary representation of the model using alias""" diff --git a/cashfree_pg/models/payment_webhook_gateway_details_entity.py b/cashfree_pg/models/payment_webhook_gateway_details_entity.py index 8e07194..e3c1673 100644 --- a/cashfree_pg/models/payment_webhook_gateway_details_entity.py +++ b/cashfree_pg/models/payment_webhook_gateway_details_entity.py @@ -50,6 +50,13 @@ def to_json(self) -> str: def from_json(cls, json_str: str) -> PaymentWebhookGatewayDetailsEntity: """Create an instance of PaymentWebhookGatewayDetailsEntity from a JSON string""" return cls.from_dict(json.loads(json_str)) + + @classmethod + def from_json_for_one_of(cls, json_str: str) -> PaymentWebhookGatewayDetailsEntity: + """Create an instance of PaymentWebhookGatewayDetailsEntity from a JSON string""" + if "gateway_name", "gateway_order_id", "gateway_payment_id", "gateway_status_code", "gateway_settlement" not in json_str: + return None + return cls.from_dict(json.loads(json_str)) def to_dict(self): """Returns the dictionary representation of the model using alias""" diff --git a/cashfree_pg/models/payment_webhook_order_entity.py b/cashfree_pg/models/payment_webhook_order_entity.py index 0d5d1a4..104add2 100644 --- a/cashfree_pg/models/payment_webhook_order_entity.py +++ b/cashfree_pg/models/payment_webhook_order_entity.py @@ -49,6 +49,13 @@ def to_json(self) -> str: def from_json(cls, json_str: str) -> PaymentWebhookOrderEntity: """Create an instance of PaymentWebhookOrderEntity from a JSON string""" return cls.from_dict(json.loads(json_str)) + + @classmethod + def from_json_for_one_of(cls, json_str: str) -> PaymentWebhookOrderEntity: + """Create an instance of PaymentWebhookOrderEntity from a JSON string""" + if "order_id", "order_amount", "order_currency", "order_tags" not in json_str: + return None + return cls.from_dict(json.loads(json_str)) def to_dict(self): """Returns the dictionary representation of the model using alias""" diff --git a/cashfree_pg/models/rate_limit_error.py b/cashfree_pg/models/rate_limit_error.py index f863219..c302cc1 100644 --- a/cashfree_pg/models/rate_limit_error.py +++ b/cashfree_pg/models/rate_limit_error.py @@ -58,6 +58,13 @@ def to_json(self) -> str: def from_json(cls, json_str: str) -> RateLimitError: """Create an instance of RateLimitError from a JSON string""" return cls.from_dict(json.loads(json_str)) + + @classmethod + def from_json_for_one_of(cls, json_str: str) -> RateLimitError: + """Create an instance of RateLimitError from a JSON string""" + if "message", "code", "type" not in json_str: + return None + return cls.from_dict(json.loads(json_str)) def to_dict(self): """Returns the dictionary representation of the model using alias""" diff --git a/cashfree_pg/models/recon_entity.py b/cashfree_pg/models/recon_entity.py index 4cc0c6c..020ca0b 100644 --- a/cashfree_pg/models/recon_entity.py +++ b/cashfree_pg/models/recon_entity.py @@ -49,6 +49,13 @@ def to_json(self) -> str: def from_json(cls, json_str: str) -> ReconEntity: """Create an instance of ReconEntity from a JSON string""" return cls.from_dict(json.loads(json_str)) + + @classmethod + def from_json_for_one_of(cls, json_str: str) -> ReconEntity: + """Create an instance of ReconEntity from a JSON string""" + if "cursor", "limit", "data" not in json_str: + return None + return cls.from_dict(json.loads(json_str)) def to_dict(self): """Returns the dictionary representation of the model using alias""" diff --git a/cashfree_pg/models/recon_entity_data_inner.py b/cashfree_pg/models/recon_entity_data_inner.py index 28e920e..d86869d 100644 --- a/cashfree_pg/models/recon_entity_data_inner.py +++ b/cashfree_pg/models/recon_entity_data_inner.py @@ -92,6 +92,13 @@ def to_json(self) -> str: def from_json(cls, json_str: str) -> ReconEntityDataInner: """Create an instance of ReconEntityDataInner from a JSON string""" return cls.from_dict(json.loads(json_str)) + + @classmethod + def from_json_for_one_of(cls, json_str: str) -> ReconEntityDataInner: + """Create an instance of ReconEntityDataInner from a JSON string""" + if "event_id", "event_type", "event_settlement_amount", "event_amount", "sale_type", "event_status", "entity", "event_time", "event_currency", "order_id", "order_amount", "customer_phone", "customer_email", "customer_name", "payment_amount", "payment_utr", "payment_time", "payment_service_charge", "payment_service_tax", "cf_payment_id", "cf_settlement_id", "settlement_date", "settlement_utr", "split_service_charge", "split_service_tax", "vendor_commission", "closed_in_favor_of", "dispute_resolved_on", "dispute_category", "dispute_note", "refund_processed_at", "refund_arn", "refund_note", "refund_id", "adjustment_remarks", "adjustment", "service_tax", "service_charge", "amount_settled", "payment_from", "payment_till", "reason", "settlement_initiated_on", "settlement_type", "settlement_charge", "settlement_tax", "remarks" not in json_str: + return None + return cls.from_dict(json.loads(json_str)) def to_dict(self): """Returns the dictionary representation of the model using alias""" diff --git a/cashfree_pg/models/refund_entity.py b/cashfree_pg/models/refund_entity.py index 752b1ea..bc781d3 100644 --- a/cashfree_pg/models/refund_entity.py +++ b/cashfree_pg/models/refund_entity.py @@ -106,6 +106,13 @@ def to_json(self) -> str: def from_json(cls, json_str: str) -> RefundEntity: """Create an instance of RefundEntity from a JSON string""" return cls.from_dict(json.loads(json_str)) + + @classmethod + def from_json_for_one_of(cls, json_str: str) -> RefundEntity: + """Create an instance of RefundEntity from a JSON string""" + if "cf_payment_id", "cf_refund_id", "order_id", "refund_id", "entity", "refund_amount", "refund_currency", "refund_note", "refund_status", "refund_arn", "refund_charge", "status_description", "metadata", "refund_splits", "refund_type", "refund_mode", "created_at", "processed_at", "refund_speed" not in json_str: + return None + return cls.from_dict(json.loads(json_str)) def to_dict(self): """Returns the dictionary representation of the model using alias""" diff --git a/cashfree_pg/models/refund_speed.py b/cashfree_pg/models/refund_speed.py index 7009d69..4f78ccb 100644 --- a/cashfree_pg/models/refund_speed.py +++ b/cashfree_pg/models/refund_speed.py @@ -49,6 +49,13 @@ def to_json(self) -> str: def from_json(cls, json_str: str) -> RefundSpeed: """Create an instance of RefundSpeed from a JSON string""" return cls.from_dict(json.loads(json_str)) + + @classmethod + def from_json_for_one_of(cls, json_str: str) -> RefundSpeed: + """Create an instance of RefundSpeed from a JSON string""" + if "requested", "accepted", "processed", "message" not in json_str: + return None + return cls.from_dict(json.loads(json_str)) def to_dict(self): """Returns the dictionary representation of the model using alias""" diff --git a/cashfree_pg/models/refund_url_object.py b/cashfree_pg/models/refund_url_object.py index dc619f7..86c02cd 100644 --- a/cashfree_pg/models/refund_url_object.py +++ b/cashfree_pg/models/refund_url_object.py @@ -46,6 +46,13 @@ def to_json(self) -> str: def from_json(cls, json_str: str) -> RefundURLObject: """Create an instance of RefundURLObject from a JSON string""" return cls.from_dict(json.loads(json_str)) + + @classmethod + def from_json_for_one_of(cls, json_str: str) -> RefundURLObject: + """Create an instance of RefundURLObject from a JSON string""" + if "url" not in json_str: + return None + return cls.from_dict(json.loads(json_str)) def to_dict(self): """Returns the dictionary representation of the model using alias""" diff --git a/cashfree_pg/models/refund_webhook.py b/cashfree_pg/models/refund_webhook.py index 3b5f016..1a8a777 100644 --- a/cashfree_pg/models/refund_webhook.py +++ b/cashfree_pg/models/refund_webhook.py @@ -49,6 +49,13 @@ def to_json(self) -> str: def from_json(cls, json_str: str) -> RefundWebhook: """Create an instance of RefundWebhook from a JSON string""" return cls.from_dict(json.loads(json_str)) + + @classmethod + def from_json_for_one_of(cls, json_str: str) -> RefundWebhook: + """Create an instance of RefundWebhook from a JSON string""" + if "data", "event_time", "type" not in json_str: + return None + return cls.from_dict(json.loads(json_str)) def to_dict(self): """Returns the dictionary representation of the model using alias""" diff --git a/cashfree_pg/models/refund_webhook_data_entity.py b/cashfree_pg/models/refund_webhook_data_entity.py index 691c785..12bd24e 100644 --- a/cashfree_pg/models/refund_webhook_data_entity.py +++ b/cashfree_pg/models/refund_webhook_data_entity.py @@ -47,6 +47,13 @@ def to_json(self) -> str: def from_json(cls, json_str: str) -> RefundWebhookDataEntity: """Create an instance of RefundWebhookDataEntity from a JSON string""" return cls.from_dict(json.loads(json_str)) + + @classmethod + def from_json_for_one_of(cls, json_str: str) -> RefundWebhookDataEntity: + """Create an instance of RefundWebhookDataEntity from a JSON string""" + if "refund" not in json_str: + return None + return cls.from_dict(json.loads(json_str)) def to_dict(self): """Returns the dictionary representation of the model using alias""" diff --git a/cashfree_pg/models/saved_instrument_meta.py b/cashfree_pg/models/saved_instrument_meta.py index bf30839..cb46d8b 100644 --- a/cashfree_pg/models/saved_instrument_meta.py +++ b/cashfree_pg/models/saved_instrument_meta.py @@ -50,6 +50,13 @@ def to_json(self) -> str: def from_json(cls, json_str: str) -> SavedInstrumentMeta: """Create an instance of SavedInstrumentMeta from a JSON string""" return cls.from_dict(json.loads(json_str)) + + @classmethod + def from_json_for_one_of(cls, json_str: str) -> SavedInstrumentMeta: + """Create an instance of SavedInstrumentMeta from a JSON string""" + if "card_network", "card_bank_name", "card_country", "card_type", "card_token_details" not in json_str: + return None + return cls.from_dict(json.loads(json_str)) def to_dict(self): """Returns the dictionary representation of the model using alias""" diff --git a/cashfree_pg/models/settlement_entity.py b/cashfree_pg/models/settlement_entity.py index c79c692..b0eef8a 100644 --- a/cashfree_pg/models/settlement_entity.py +++ b/cashfree_pg/models/settlement_entity.py @@ -59,6 +59,13 @@ def to_json(self) -> str: def from_json(cls, json_str: str) -> SettlementEntity: """Create an instance of SettlementEntity from a JSON string""" return cls.from_dict(json.loads(json_str)) + + @classmethod + def from_json_for_one_of(cls, json_str: str) -> SettlementEntity: + """Create an instance of SettlementEntity from a JSON string""" + if "cf_payment_id", "cf_settlement_id", "settlement_currency", "order_id", "entity", "order_amount", "payment_time", "service_charge", "service_tax", "settlement_amount", "settlement_id", "transfer_id", "transfer_time", "transfer_utr" not in json_str: + return None + return cls.from_dict(json.loads(json_str)) def to_dict(self): """Returns the dictionary representation of the model using alias""" diff --git a/cashfree_pg/models/settlement_fetch_recon_request.py b/cashfree_pg/models/settlement_fetch_recon_request.py index 87443ef..5914435 100644 --- a/cashfree_pg/models/settlement_fetch_recon_request.py +++ b/cashfree_pg/models/settlement_fetch_recon_request.py @@ -49,6 +49,13 @@ def to_json(self) -> str: def from_json(cls, json_str: str) -> SettlementFetchReconRequest: """Create an instance of SettlementFetchReconRequest from a JSON string""" return cls.from_dict(json.loads(json_str)) + + @classmethod + def from_json_for_one_of(cls, json_str: str) -> SettlementFetchReconRequest: + """Create an instance of SettlementFetchReconRequest from a JSON string""" + if "pagination", "filters" not in json_str: + return None + return cls.from_dict(json.loads(json_str)) def to_dict(self): """Returns the dictionary representation of the model using alias""" diff --git a/cashfree_pg/models/settlement_fetch_recon_request_filters.py b/cashfree_pg/models/settlement_fetch_recon_request_filters.py index 1e70f07..805e75c 100644 --- a/cashfree_pg/models/settlement_fetch_recon_request_filters.py +++ b/cashfree_pg/models/settlement_fetch_recon_request_filters.py @@ -49,6 +49,13 @@ def to_json(self) -> str: def from_json(cls, json_str: str) -> SettlementFetchReconRequestFilters: """Create an instance of SettlementFetchReconRequestFilters from a JSON string""" return cls.from_dict(json.loads(json_str)) + + @classmethod + def from_json_for_one_of(cls, json_str: str) -> SettlementFetchReconRequestFilters: + """Create an instance of SettlementFetchReconRequestFilters from a JSON string""" + if "cf_settlement_ids", "settlement_utrs", "start_date", "end_date" not in json_str: + return None + return cls.from_dict(json.loads(json_str)) def to_dict(self): """Returns the dictionary representation of the model using alias""" diff --git a/cashfree_pg/models/settlement_recon_entity.py b/cashfree_pg/models/settlement_recon_entity.py index cf2d5ff..15f5b15 100644 --- a/cashfree_pg/models/settlement_recon_entity.py +++ b/cashfree_pg/models/settlement_recon_entity.py @@ -49,6 +49,13 @@ def to_json(self) -> str: def from_json(cls, json_str: str) -> SettlementReconEntity: """Create an instance of SettlementReconEntity from a JSON string""" return cls.from_dict(json.loads(json_str)) + + @classmethod + def from_json_for_one_of(cls, json_str: str) -> SettlementReconEntity: + """Create an instance of SettlementReconEntity from a JSON string""" + if "cursor", "limit", "data" not in json_str: + return None + return cls.from_dict(json.loads(json_str)) def to_dict(self): """Returns the dictionary representation of the model using alias""" diff --git a/cashfree_pg/models/settlement_recon_entity_data_inner.py b/cashfree_pg/models/settlement_recon_entity_data_inner.py index 8360dab..6414ad5 100644 --- a/cashfree_pg/models/settlement_recon_entity_data_inner.py +++ b/cashfree_pg/models/settlement_recon_entity_data_inner.py @@ -80,6 +80,13 @@ def to_json(self) -> str: def from_json(cls, json_str: str) -> SettlementReconEntityDataInner: """Create an instance of SettlementReconEntityDataInner from a JSON string""" return cls.from_dict(json.loads(json_str)) + + @classmethod + def from_json_for_one_of(cls, json_str: str) -> SettlementReconEntityDataInner: + """Create an instance of SettlementReconEntityDataInner from a JSON string""" + if "event_id", "event_type", "event_settlement_amount", "event_amount", "sale_type", "event_status", "entity", "event_time", "event_currency", "order_id", "order_amount", "customer_phone", "customer_email", "customer_name", "payment_amount", "payment_utr", "payment_time", "payment_service_charge", "payment_service_tax", "cf_payment_id", "cf_settlement_id", "settlement_date", "settlement_utr", "split_service_charge", "split_service_tax", "vendor_commission", "closed_in_favor_of", "dispute_resolved_on", "dispute_category", "dispute_note", "refund_processed_at", "refund_arn", "refund_note", "refund_id", "adjustment_remarks" not in json_str: + return None + return cls.from_dict(json.loads(json_str)) def to_dict(self): """Returns the dictionary representation of the model using alias""" diff --git a/cashfree_pg/models/settlement_url_object.py b/cashfree_pg/models/settlement_url_object.py index 569511b..661dd19 100644 --- a/cashfree_pg/models/settlement_url_object.py +++ b/cashfree_pg/models/settlement_url_object.py @@ -46,6 +46,13 @@ def to_json(self) -> str: def from_json(cls, json_str: str) -> SettlementURLObject: """Create an instance of SettlementURLObject from a JSON string""" return cls.from_dict(json.loads(json_str)) + + @classmethod + def from_json_for_one_of(cls, json_str: str) -> SettlementURLObject: + """Create an instance of SettlementURLObject from a JSON string""" + if "url" not in json_str: + return None + return cls.from_dict(json.loads(json_str)) def to_dict(self): """Returns the dictionary representation of the model using alias""" diff --git a/cashfree_pg/models/settlement_webhook.py b/cashfree_pg/models/settlement_webhook.py index 623c04e..cd7e0ce 100644 --- a/cashfree_pg/models/settlement_webhook.py +++ b/cashfree_pg/models/settlement_webhook.py @@ -49,6 +49,13 @@ def to_json(self) -> str: def from_json(cls, json_str: str) -> SettlementWebhook: """Create an instance of SettlementWebhook from a JSON string""" return cls.from_dict(json.loads(json_str)) + + @classmethod + def from_json_for_one_of(cls, json_str: str) -> SettlementWebhook: + """Create an instance of SettlementWebhook from a JSON string""" + if "data", "event_time", "type" not in json_str: + return None + return cls.from_dict(json.loads(json_str)) def to_dict(self): """Returns the dictionary representation of the model using alias""" diff --git a/cashfree_pg/models/settlement_webhook_data_entity.py b/cashfree_pg/models/settlement_webhook_data_entity.py index ec91ebd..27ff932 100644 --- a/cashfree_pg/models/settlement_webhook_data_entity.py +++ b/cashfree_pg/models/settlement_webhook_data_entity.py @@ -47,6 +47,13 @@ def to_json(self) -> str: def from_json(cls, json_str: str) -> SettlementWebhookDataEntity: """Create an instance of SettlementWebhookDataEntity from a JSON string""" return cls.from_dict(json.loads(json_str)) + + @classmethod + def from_json_for_one_of(cls, json_str: str) -> SettlementWebhookDataEntity: + """Create an instance of SettlementWebhookDataEntity from a JSON string""" + if "settlement" not in json_str: + return None + return cls.from_dict(json.loads(json_str)) def to_dict(self): """Returns the dictionary representation of the model using alias""" diff --git a/cashfree_pg/models/terminal_details.py b/cashfree_pg/models/terminal_details.py index 20eb846..6f58987 100644 --- a/cashfree_pg/models/terminal_details.py +++ b/cashfree_pg/models/terminal_details.py @@ -55,6 +55,13 @@ def to_json(self) -> str: def from_json(cls, json_str: str) -> TerminalDetails: """Create an instance of TerminalDetails from a JSON string""" return cls.from_dict(json.loads(json_str)) + + @classmethod + def from_json_for_one_of(cls, json_str: str) -> TerminalDetails: + """Create an instance of TerminalDetails from a JSON string""" + if "added_on", "cf_terminal_id", "last_updated_on", "terminal_address", "terminal_id", "terminal_name", "terminal_note", "terminal_phone_no", "terminal_status", "terminal_type" not in json_str: + return None + return cls.from_dict(json.loads(json_str)) def to_dict(self): """Returns the dictionary representation of the model using alias""" diff --git a/cashfree_pg/models/terminal_entity.py b/cashfree_pg/models/terminal_entity.py index 71fad28..4f99c07 100644 --- a/cashfree_pg/models/terminal_entity.py +++ b/cashfree_pg/models/terminal_entity.py @@ -57,6 +57,13 @@ def to_json(self) -> str: def from_json(cls, json_str: str) -> TerminalEntity: """Create an instance of TerminalEntity from a JSON string""" return cls.from_dict(json.loads(json_str)) + + @classmethod + def from_json_for_one_of(cls, json_str: str) -> TerminalEntity: + """Create an instance of TerminalEntity from a JSON string""" + if "added_on", "cf_terminal_id", "last_updated_on", "terminal_address", "terminal_email", "terminal_type", "teminal_id", "terminal_name", "terminal_note", "terminal_phone_no", "terminal_status", "terminal_meta" not in json_str: + return None + return cls.from_dict(json.loads(json_str)) def to_dict(self): """Returns the dictionary representation of the model using alias""" diff --git a/cashfree_pg/models/terminal_transaction_entity.py b/cashfree_pg/models/terminal_transaction_entity.py index b6fd1d1..8af8bea 100644 --- a/cashfree_pg/models/terminal_transaction_entity.py +++ b/cashfree_pg/models/terminal_transaction_entity.py @@ -51,6 +51,13 @@ def to_json(self) -> str: def from_json(cls, json_str: str) -> TerminalTransactionEntity: """Create an instance of TerminalTransactionEntity from a JSON string""" return cls.from_dict(json.loads(json_str)) + + @classmethod + def from_json_for_one_of(cls, json_str: str) -> TerminalTransactionEntity: + """Create an instance of TerminalTransactionEntity from a JSON string""" + if "cf_payment_id", "payment_amount", "payment_method", "payment_url", "qrcode", "timeout" not in json_str: + return None + return cls.from_dict(json.loads(json_str)) def to_dict(self): """Returns the dictionary representation of the model using alias""" diff --git a/cashfree_pg/models/upi.py b/cashfree_pg/models/upi.py index 7611fc9..2cca84f 100644 --- a/cashfree_pg/models/upi.py +++ b/cashfree_pg/models/upi.py @@ -59,6 +59,13 @@ def to_json(self) -> str: def from_json(cls, json_str: str) -> Upi: """Create an instance of Upi from a JSON string""" return cls.from_dict(json.loads(json_str)) + + @classmethod + def from_json_for_one_of(cls, json_str: str) -> Upi: + """Create an instance of Upi from a JSON string""" + if "channel", "upi_id", "upi_redirect_url", "upi_expiry_minutes", "authorize_only", "authorization" not in json_str: + return None + return cls.from_dict(json.loads(json_str)) def to_dict(self): """Returns the dictionary representation of the model using alias""" diff --git a/cashfree_pg/models/upi_authorize_details.py b/cashfree_pg/models/upi_authorize_details.py index 2130038..0f22ffd 100644 --- a/cashfree_pg/models/upi_authorize_details.py +++ b/cashfree_pg/models/upi_authorize_details.py @@ -48,6 +48,13 @@ def to_json(self) -> str: def from_json(cls, json_str: str) -> UPIAuthorizeDetails: """Create an instance of UPIAuthorizeDetails from a JSON string""" return cls.from_dict(json.loads(json_str)) + + @classmethod + def from_json_for_one_of(cls, json_str: str) -> UPIAuthorizeDetails: + """Create an instance of UPIAuthorizeDetails from a JSON string""" + if "approve_by", "start_time", "end_time" not in json_str: + return None + return cls.from_dict(json.loads(json_str)) def to_dict(self): """Returns the dictionary representation of the model using alias""" diff --git a/cashfree_pg/models/upi_payment_method.py b/cashfree_pg/models/upi_payment_method.py index 139dc51..512be76 100644 --- a/cashfree_pg/models/upi_payment_method.py +++ b/cashfree_pg/models/upi_payment_method.py @@ -47,6 +47,13 @@ def to_json(self) -> str: def from_json(cls, json_str: str) -> UPIPaymentMethod: """Create an instance of UPIPaymentMethod from a JSON string""" return cls.from_dict(json.loads(json_str)) + + @classmethod + def from_json_for_one_of(cls, json_str: str) -> UPIPaymentMethod: + """Create an instance of UPIPaymentMethod from a JSON string""" + if "upi" not in json_str: + return None + return cls.from_dict(json.loads(json_str)) def to_dict(self): """Returns the dictionary representation of the model using alias""" diff --git a/cashfree_pg/models/vendor_split.py b/cashfree_pg/models/vendor_split.py index 8f746aa..659c3e8 100644 --- a/cashfree_pg/models/vendor_split.py +++ b/cashfree_pg/models/vendor_split.py @@ -48,6 +48,13 @@ def to_json(self) -> str: def from_json(cls, json_str: str) -> VendorSplit: """Create an instance of VendorSplit from a JSON string""" return cls.from_dict(json.loads(json_str)) + + @classmethod + def from_json_for_one_of(cls, json_str: str) -> VendorSplit: + """Create an instance of VendorSplit from a JSON string""" + if "vendor_id", "amount", "percentage" not in json_str: + return None + return cls.from_dict(json.loads(json_str)) def to_dict(self): """Returns the dictionary representation of the model using alias""" diff --git a/cashfree_pg/models/wallet_offer.py b/cashfree_pg/models/wallet_offer.py index 694654f..904080b 100644 --- a/cashfree_pg/models/wallet_offer.py +++ b/cashfree_pg/models/wallet_offer.py @@ -46,6 +46,13 @@ def to_json(self) -> str: def from_json(cls, json_str: str) -> WalletOffer: """Create an instance of WalletOffer from a JSON string""" return cls.from_dict(json.loads(json_str)) + + @classmethod + def from_json_for_one_of(cls, json_str: str) -> WalletOffer: + """Create an instance of WalletOffer from a JSON string""" + if "provider" not in json_str: + return None + return cls.from_dict(json.loads(json_str)) def to_dict(self): """Returns the dictionary representation of the model using alias""" diff --git a/configuration.py b/configuration.py index c959079..0096953 100644 --- a/configuration.py +++ b/configuration.py @@ -434,7 +434,7 @@ def to_debug_report(self): "OS: {env}\n"\ "Python Version: {pyversion}\n"\ "Version of the API: 2022-09-01\n"\ - "SDK Package Version: 3.2.6".\ + "SDK Package Version: 3.2.7".\ format(env=sys.platform, pyversion=sys.version) def get_host_settings(self): diff --git a/pyproject.toml b/pyproject.toml index cbc0ff2..4b1a5aa 100644 --- a/pyproject.toml +++ b/pyproject.toml @@ -1,6 +1,6 @@ [tool.poetry] name = "cashfree_pg" -version = "3.2.7" +version = "3.2.8" description = "Cashfree Payment Gateway APIs" authors = ["API Support "] license = "Apache 2.0" diff --git a/setup.py b/setup.py index 8e4f485..ea78a76 100644 --- a/setup.py +++ b/setup.py @@ -22,7 +22,7 @@ # prerequisite: setuptools # http://pypi.python.org/pypi/setuptools NAME = "cashfree_pg" -VERSION = "3.2.7" +VERSION = "3.2.8" with open("README.md", "r", encoding="utf-8") as fh: readme = fh.read() PYTHON_REQUIRES = ">=3.7"