diff --git a/.github/workflows/python.yml b/.github/workflows/python.yml index b6de232..90a93b7 100644 --- a/.github/workflows/python.yml +++ b/.github/workflows/python.yml @@ -25,4 +25,4 @@ jobs: - name: Publish distribution 📦 to PyPI uses: pypa/gh-action-pypi-publish@master with: - password: ${{ secrets.PYPI_API_TOKEN }} + password: $<%==%> \ No newline at end of file diff --git a/__init__.py b/__init__.py new file mode 100644 index 0000000..173cfd8 --- /dev/null +++ b/__init__.py @@ -0,0 +1,159 @@ +# coding: utf-8 + +# flake8: noqa + +""" + Cashfree Payment Gateway APIs + + Cashfree's Payment Gateway APIs provide developers with a streamlined pathway to integrate advanced payment processing capabilities into their applications, platforms and websites. + + The version of the OpenAPI document: 2022-09-01 + Contact: developers@cashfree.com + Generated by OpenAPI Generator (https://openapi-generator.tech) + + Do not edit the class manually. +""" # noqa: E501 + + +__version__ = "3.0.1" + +# import apis into sdk package +# import ApiClient +from cashfree_pg.api_response import ApiResponse +from cashfree_pg.api_client import ApiClient +from cashfree_pg.configuration import Configuration +from cashfree_pg.exceptions import OpenApiException +from cashfree_pg.exceptions import ApiTypeError +from cashfree_pg.exceptions import ApiValueError +from cashfree_pg.exceptions import ApiKeyError +from cashfree_pg.exceptions import ApiAttributeError +from cashfree_pg.exceptions import ApiException + +# import models into sdk package +from cashfree_pg.models.api_error import ApiError +from cashfree_pg.models.api_error404 import ApiError404 +from cashfree_pg.models.api_error409 import ApiError409 +from cashfree_pg.models.api_error502 import ApiError502 +from cashfree_pg.models.app import App +from cashfree_pg.models.app_payment_method import AppPaymentMethod +from cashfree_pg.models.authentication_error import AuthenticationError +from cashfree_pg.models.authorization_in_payments_entity import AuthorizationInPaymentsEntity +from cashfree_pg.models.authorize_order_request import AuthorizeOrderRequest +from cashfree_pg.models.bad_request_error import BadRequestError +from cashfree_pg.models.card import Card +from cashfree_pg.models.card_emi import CardEMI +from cashfree_pg.models.card_emi_payment_method import CardEMIPaymentMethod +from cashfree_pg.models.card_offer import CardOffer +from cashfree_pg.models.card_payment_method import CardPaymentMethod +from cashfree_pg.models.cardless_emi import CardlessEMI +from cashfree_pg.models.cardless_emi_entity import CardlessEMIEntity +from cashfree_pg.models.cardless_emi_payment_method import CardlessEMIPaymentMethod +from cashfree_pg.models.cardless_emi_queries import CardlessEMIQueries +from cashfree_pg.models.cashback_details import CashbackDetails +from cashfree_pg.models.create_link_request import CreateLinkRequest +from cashfree_pg.models.create_offer_request import CreateOfferRequest +from cashfree_pg.models.create_order_request import CreateOrderRequest +from cashfree_pg.models.create_order_request_order_meta import CreateOrderRequestOrderMeta +from cashfree_pg.models.create_order_request_terminal import CreateOrderRequestTerminal +from cashfree_pg.models.create_terminal_request import CreateTerminalRequest +from cashfree_pg.models.create_terminal_request_terminal_meta import CreateTerminalRequestTerminalMeta +from cashfree_pg.models.create_terminal_transaction_request import CreateTerminalTransactionRequest +from cashfree_pg.models.cryptogram_entity import CryptogramEntity +from cashfree_pg.models.customer_details import CustomerDetails +from cashfree_pg.models.customer_details_cardless_emi import CustomerDetailsCardlessEMI +from cashfree_pg.models.discount_details import DiscountDetails +from cashfree_pg.models.emi_offer import EMIOffer +from cashfree_pg.models.emi_plans_array import EMIPlansArray +from cashfree_pg.models.eligibility_cardless_emi_entity import EligibilityCardlessEMIEntity +from cashfree_pg.models.eligibility_fetch_cardless_emi_request import EligibilityFetchCardlessEMIRequest +from cashfree_pg.models.eligibility_fetch_offers_request import EligibilityFetchOffersRequest +from cashfree_pg.models.eligibility_fetch_paylater_request import EligibilityFetchPaylaterRequest +from cashfree_pg.models.eligibility_fetch_payment_methods_request import EligibilityFetchPaymentMethodsRequest +from cashfree_pg.models.eligibility_offer_entity import EligibilityOfferEntity +from cashfree_pg.models.eligibility_paylater_entity import EligibilityPaylaterEntity +from cashfree_pg.models.eligibility_payment_methods_entity import EligibilityPaymentMethodsEntity +from cashfree_pg.models.eligibility_payment_methods_entity_entity_details import EligibilityPaymentMethodsEntityEntityDetails +from cashfree_pg.models.error_details_in_payments_entity import ErrorDetailsInPaymentsEntity +from cashfree_pg.models.fetch_recon_request import FetchReconRequest +from cashfree_pg.models.fetch_recon_request_filters import FetchReconRequestFilters +from cashfree_pg.models.fetch_recon_request_pagination import FetchReconRequestPagination +from cashfree_pg.models.fetch_settlements_request import FetchSettlementsRequest +from cashfree_pg.models.fetch_settlements_request_filters import FetchSettlementsRequestFilters +from cashfree_pg.models.fetch_settlements_request_pagination import FetchSettlementsRequestPagination +from cashfree_pg.models.fetch_terminal_qr_codes_entity import FetchTerminalQRCodesEntity +from cashfree_pg.models.idempotency_error import IdempotencyError +from cashfree_pg.models.instrument_entity import InstrumentEntity +from cashfree_pg.models.link_customer_details_entity import LinkCustomerDetailsEntity +from cashfree_pg.models.link_entity import LinkEntity +from cashfree_pg.models.link_meta_entity import LinkMetaEntity +from cashfree_pg.models.link_notify_entity import LinkNotifyEntity +from cashfree_pg.models.net_banking_payment_method import NetBankingPaymentMethod +from cashfree_pg.models.netbanking import Netbanking +from cashfree_pg.models.offer_all import OfferAll +from cashfree_pg.models.offer_card import OfferCard +from cashfree_pg.models.offer_details import OfferDetails +from cashfree_pg.models.offer_emi import OfferEMI +from cashfree_pg.models.offer_entity import OfferEntity +from cashfree_pg.models.offer_filters import OfferFilters +from cashfree_pg.models.offer_meta import OfferMeta +from cashfree_pg.models.offer_nb import OfferNB +from cashfree_pg.models.offer_nb_netbanking import OfferNBNetbanking +from cashfree_pg.models.offer_paylater import OfferPaylater +from cashfree_pg.models.offer_queries import OfferQueries +from cashfree_pg.models.offer_tnc import OfferTnc +from cashfree_pg.models.offer_type import OfferType +from cashfree_pg.models.offer_upi import OfferUPI +from cashfree_pg.models.offer_validations import OfferValidations +from cashfree_pg.models.offer_validations_payment_method import OfferValidationsPaymentMethod +from cashfree_pg.models.offer_wallet import OfferWallet +from cashfree_pg.models.order_authenticate_entity import OrderAuthenticateEntity +from cashfree_pg.models.order_authenticate_payment_request import OrderAuthenticatePaymentRequest +from cashfree_pg.models.order_create_refund_request import OrderCreateRefundRequest +from cashfree_pg.models.order_entity import OrderEntity +from cashfree_pg.models.order_meta import OrderMeta +from cashfree_pg.models.order_pay_data import OrderPayData +from cashfree_pg.models.pay_order_entity import PayOrderEntity +from cashfree_pg.models.pay_order_request import PayOrderRequest +from cashfree_pg.models.pay_order_request_payment_method import PayOrderRequestPaymentMethod +from cashfree_pg.models.paylater import Paylater +from cashfree_pg.models.paylater_entity import PaylaterEntity +from cashfree_pg.models.paylater_offer import PaylaterOffer +from cashfree_pg.models.paylater_payment_method import PaylaterPaymentMethod +from cashfree_pg.models.payment_entity import PaymentEntity +from cashfree_pg.models.payment_method_app_in_payments_entity import PaymentMethodAppInPaymentsEntity +from cashfree_pg.models.payment_method_card_in_payments_entity import PaymentMethodCardInPaymentsEntity +from cashfree_pg.models.payment_method_cardless_emiin_payments_entity import PaymentMethodCardlessEMIInPaymentsEntity +from cashfree_pg.models.payment_method_in_payments_entity import PaymentMethodInPaymentsEntity +from cashfree_pg.models.payment_method_in_payments_entity_payment_method import PaymentMethodInPaymentsEntityPaymentMethod +from cashfree_pg.models.payment_method_net_banking_in_payments_entity import PaymentMethodNetBankingInPaymentsEntity +from cashfree_pg.models.payment_method_paylater_in_payments_entity import PaymentMethodPaylaterInPaymentsEntity +from cashfree_pg.models.payment_method_upiin_payments_entity import PaymentMethodUPIInPaymentsEntity +from cashfree_pg.models.payment_methods_filters import PaymentMethodsFilters +from cashfree_pg.models.payment_methods_queries import PaymentMethodsQueries +from cashfree_pg.models.payment_mode_details import PaymentModeDetails +from cashfree_pg.models.payment_success_webhook import PaymentSuccessWebhook +from cashfree_pg.models.payment_url_object import PaymentURLObject +from cashfree_pg.models.rate_limit_error import RateLimitError +from cashfree_pg.models.recon_entity import ReconEntity +from cashfree_pg.models.recon_entity_data_inner import ReconEntityDataInner +from cashfree_pg.models.refund_entity import RefundEntity +from cashfree_pg.models.refund_speed import RefundSpeed +from cashfree_pg.models.refund_url_object import RefundURLObject +from cashfree_pg.models.saved_instrument_meta import SavedInstrumentMeta +from cashfree_pg.models.settlement_entity import SettlementEntity +from cashfree_pg.models.settlement_fetch_recon_request import SettlementFetchReconRequest +from cashfree_pg.models.settlement_fetch_recon_request_filters import SettlementFetchReconRequestFilters +from cashfree_pg.models.settlement_recon_entity import SettlementReconEntity +from cashfree_pg.models.settlement_recon_entity_data_inner import SettlementReconEntityDataInner +from cashfree_pg.models.settlement_url_object import SettlementURLObject +from cashfree_pg.models.terminal_details import TerminalDetails +from cashfree_pg.models.terminal_entity import TerminalEntity +from cashfree_pg.models.terminal_transaction_entity import TerminalTransactionEntity +from cashfree_pg.models.upi_authorize_details import UPIAuthorizeDetails +from cashfree_pg.models.upi_payment_method import UPIPaymentMethod +from cashfree_pg.models.upi import Upi +from cashfree_pg.models.vendor_split import VendorSplit +from cashfree_pg.models.w_hcustomer_details import WHcustomerDetails +from cashfree_pg.models.w_hdata import WHdata +from cashfree_pg.models.w_horder import WHorder +from cashfree_pg.models.wallet_offer import WalletOffer diff --git a/api_client.py b/api_client.py new file mode 100644 index 0000000..65b2cf4 --- /dev/null +++ b/api_client.py @@ -0,0 +1,5879 @@ +# coding: utf-8 + +""" + Cashfree Payment Gateway APIs + + Cashfree's Payment Gateway APIs provide developers with a streamlined pathway to integrate advanced payment processing capabilities into their applications, platforms and websites. + + The version of the OpenAPI document: 2022-09-01 + Contact: developers@cashfree.com + Generated by OpenAPI Generator (https://openapi-generator.tech) + + Do not edit the class manually. +""" # noqa: E501 + + +import re # noqa: F401 +import io +import warnings + +from pydantic import validate_arguments, ValidationError +from typing_extensions import Annotated + +from cashfree_pg.configuration import Configuration +from cashfree_pg.api_response import ApiResponse +from cashfree_pg.exceptions import ( # noqa: F401 + ApiException, + ApiTypeError, + ApiValueError +) + +import atexit +import datetime as dt +from dateutil.parser import parse +import json +import mimetypes +from multiprocessing.pool import ThreadPool +import os +import re +import tempfile +import warnings +from pydantic import validate_arguments, ValidationError +from typing_extensions import Annotated +from typing import overload, Optional, Union, Awaitable +from pydantic import Field, StrictStr + +from cashfree_pg.configuration import Configuration +from cashfree_pg.api_response import ApiResponse +from cashfree_pg.exceptions import ( # noqa: F401 + ApiTypeError, + ApiValueError +) + +from urllib.parse import quote + +from cashfree_pg.configuration import Configuration +from cashfree_pg.api_response import ApiResponse +import cashfree_pg.models +from cashfree_pg import rest + +from cashfree_pg.models.api_error import * +from cashfree_pg.models.api_error404 import * +from cashfree_pg.models.api_error409 import * +from cashfree_pg.models.api_error502 import * +from cashfree_pg.models.app import * +from cashfree_pg.models.app_payment_method import * +from cashfree_pg.models.authentication_error import * +from cashfree_pg.models.authorization_in_payments_entity import * +from cashfree_pg.models.authorize_order_request import * +from cashfree_pg.models.bad_request_error import * +from cashfree_pg.models.card import * +from cashfree_pg.models.card_emi import * +from cashfree_pg.models.card_emi_payment_method import * +from cashfree_pg.models.card_offer import * +from cashfree_pg.models.card_payment_method import * +from cashfree_pg.models.cardless_emi import * +from cashfree_pg.models.cardless_emi_entity import * +from cashfree_pg.models.cardless_emi_payment_method import * +from cashfree_pg.models.cardless_emi_queries import * +from cashfree_pg.models.cashback_details import * +from cashfree_pg.models.create_link_request import * +from cashfree_pg.models.create_offer_request import * +from cashfree_pg.models.create_order_request import * +from cashfree_pg.models.create_order_request_order_meta import * +from cashfree_pg.models.create_order_request_terminal import * +from cashfree_pg.models.create_terminal_request import * +from cashfree_pg.models.create_terminal_request_terminal_meta import * +from cashfree_pg.models.create_terminal_transaction_request import * +from cashfree_pg.models.cryptogram_entity import * +from cashfree_pg.models.customer_details import * +from cashfree_pg.models.customer_details_cardless_emi import * +from cashfree_pg.models.discount_details import * +from cashfree_pg.models.emi_offer import * +from cashfree_pg.models.emi_plans_array import * +from cashfree_pg.models.eligibility_cardless_emi_entity import * +from cashfree_pg.models.eligibility_fetch_cardless_emi_request import * +from cashfree_pg.models.eligibility_fetch_offers_request import * +from cashfree_pg.models.eligibility_fetch_paylater_request import * +from cashfree_pg.models.eligibility_fetch_payment_methods_request import * +from cashfree_pg.models.eligibility_offer_entity import * +from cashfree_pg.models.eligibility_paylater_entity import * +from cashfree_pg.models.eligibility_payment_methods_entity import * +from cashfree_pg.models.eligibility_payment_methods_entity_entity_details import * +from cashfree_pg.models.error_details_in_payments_entity import * +from cashfree_pg.models.fetch_recon_request import * +from cashfree_pg.models.fetch_recon_request_filters import * +from cashfree_pg.models.fetch_recon_request_pagination import * +from cashfree_pg.models.fetch_settlements_request import * +from cashfree_pg.models.fetch_settlements_request_filters import * +from cashfree_pg.models.fetch_settlements_request_pagination import * +from cashfree_pg.models.fetch_terminal_qr_codes_entity import * +from cashfree_pg.models.idempotency_error import * +from cashfree_pg.models.instrument_entity import * +from cashfree_pg.models.link_customer_details_entity import * +from cashfree_pg.models.link_entity import * +from cashfree_pg.models.link_meta_entity import * +from cashfree_pg.models.link_notify_entity import * +from cashfree_pg.models.net_banking_payment_method import * +from cashfree_pg.models.netbanking import * +from cashfree_pg.models.offer_all import * +from cashfree_pg.models.offer_card import * +from cashfree_pg.models.offer_details import * +from cashfree_pg.models.offer_emi import * +from cashfree_pg.models.offer_entity import * +from cashfree_pg.models.offer_filters import * +from cashfree_pg.models.offer_meta import * +from cashfree_pg.models.offer_nb import * +from cashfree_pg.models.offer_nb_netbanking import * +from cashfree_pg.models.offer_paylater import * +from cashfree_pg.models.offer_queries import * +from cashfree_pg.models.offer_tnc import * +from cashfree_pg.models.offer_type import * +from cashfree_pg.models.offer_upi import * +from cashfree_pg.models.offer_validations import * +from cashfree_pg.models.offer_validations_payment_method import * +from cashfree_pg.models.offer_wallet import * +from cashfree_pg.models.order_authenticate_entity import * +from cashfree_pg.models.order_authenticate_payment_request import * +from cashfree_pg.models.order_create_refund_request import * +from cashfree_pg.models.order_entity import * +from cashfree_pg.models.order_meta import * +from cashfree_pg.models.order_pay_data import * +from cashfree_pg.models.pay_order_entity import * +from cashfree_pg.models.pay_order_request import * +from cashfree_pg.models.pay_order_request_payment_method import * +from cashfree_pg.models.paylater import * +from cashfree_pg.models.paylater_entity import * +from cashfree_pg.models.paylater_offer import * +from cashfree_pg.models.paylater_payment_method import * +from cashfree_pg.models.payment_entity import * +from cashfree_pg.models.payment_method_app_in_payments_entity import * +from cashfree_pg.models.payment_method_card_in_payments_entity import * +from cashfree_pg.models.payment_method_cardless_emiin_payments_entity import * +from cashfree_pg.models.payment_method_in_payments_entity import * +from cashfree_pg.models.payment_method_in_payments_entity_payment_method import * +from cashfree_pg.models.payment_method_net_banking_in_payments_entity import * +from cashfree_pg.models.payment_method_paylater_in_payments_entity import * +from cashfree_pg.models.payment_method_upiin_payments_entity import * +from cashfree_pg.models.payment_methods_filters import * +from cashfree_pg.models.payment_methods_queries import * +from cashfree_pg.models.payment_mode_details import * +from cashfree_pg.models.payment_success_webhook import * +from cashfree_pg.models.payment_url_object import * +from cashfree_pg.models.rate_limit_error import * +from cashfree_pg.models.recon_entity import * +from cashfree_pg.models.recon_entity_data_inner import * +from cashfree_pg.models.refund_entity import * +from cashfree_pg.models.refund_speed import * +from cashfree_pg.models.refund_url_object import * +from cashfree_pg.models.saved_instrument_meta import * +from cashfree_pg.models.settlement_entity import * +from cashfree_pg.models.settlement_fetch_recon_request import * +from cashfree_pg.models.settlement_fetch_recon_request_filters import * +from cashfree_pg.models.settlement_recon_entity import * +from cashfree_pg.models.settlement_recon_entity_data_inner import * +from cashfree_pg.models.settlement_url_object import * +from cashfree_pg.models.terminal_details import * +from cashfree_pg.models.terminal_entity import * +from cashfree_pg.models.terminal_transaction_entity import * +from cashfree_pg.models.upi_authorize_details import * +from cashfree_pg.models.upi_payment_method import * +from cashfree_pg.models.upi import * +from cashfree_pg.models.vendor_split import * +from cashfree_pg.models.w_hcustomer_details import * +from cashfree_pg.models.w_hdata import * +from cashfree_pg.models.w_horder import * +from cashfree_pg.models.wallet_offer import * + +class CFEnvironment(Enum): + SANDBOX = 1 + PRODUCTION = 2 + +class Cashfree: + + XClientId = None + XClientSecret = None + XPartnerKey = None + XClientSignature = None + XPartnerMerchantId = None + XEnvironment = CFEnvironment.SANDBOX + + XProduction = CFEnvironment.PRODUCTION + XSandbox = CFEnvironment.SANDBOX + + @validate_arguments + def PGEligibilityFetchCardlessEmi(self, x_api_version : Annotated[StrictStr, Field(..., description="API version to be used. Format is in YYYY-MM-DD")] = None, eligibility_fetch_cardless_emi_request : Annotated[EligibilityFetchCardlessEMIRequest, Field(..., description="Request Body to get eligible cardless emi options for a customer and order")] = None, x_request_id : Annotated[Optional[StrictStr], Field(description="Request id for the API call. Can be used to resolve tech issues. Communicate this in your tech related queries to cashfree")] = None, x_idempotency_key : Annotated[Optional[StrictStr], Field(description="Idempotency works by saving the resulting status code and body of the first request made for any given idempotency key, regardless of whether it succeeded or failed. Subsequent requests with the same key return the same result, including 500 errors. Currently supported on all POST calls that uses x-client-id & x-client-secret. To use enable, pass x-idempotency-key in the request header. The value of this header must be unique to each operation you are trying to do. One example can be to use the same order_id that you pass while creating orders ")] = None, **kwargs) -> ApiResponse: # noqa: E501 + """Get Eligible Cardless EMI Payment Methods for a customer on an order # noqa: E501 + + Use this API to get eligible Cardless EMI Payment Methods available for a customer on an order basis their phone number. # noqa: E501 + This method makes a synchronous HTTP request by default. To make an + asynchronous HTTP request, please pass async_req=True + + >>> thread = api.PGEligibilityFetchCardlessEmi_with_http_info(x_api_version, eligibility_fetch_cardless_emi_request, x_request_id, x_idempotency_key, async_req=True) + >>> result = thread.get() + + :param x_api_version: API version to be used. Format is in YYYY-MM-DD (required) + :type x_api_version: str + :param eligibility_fetch_cardless_emi_request: Request Body to get eligible cardless emi options for a customer and order (required) + :type eligibility_fetch_cardless_emi_request: EligibilityFetchCardlessEMIRequest + :param x_request_id: Request id for the API call. Can be used to resolve tech issues. Communicate this in your tech related queries to cashfree + :type x_request_id: str + :param x_idempotency_key: Idempotency works by saving the resulting status code and body of the first request made for any given idempotency key, regardless of whether it succeeded or failed. Subsequent requests with the same key return the same result, including 500 errors. Currently supported on all POST calls that uses x-client-id & x-client-secret. To use enable, pass x-idempotency-key in the request header. The value of this header must be unique to each operation you are trying to do. One example can be to use the same order_id that you pass while creating orders + :type x_idempotency_key: str + :param async_req: Whether to execute the request asynchronously. + :type async_req: bool, optional + :param _preload_content: if False, the ApiResponse.data will + be set to none and raw_data will store the + HTTP response body without reading/decoding. + Default is True. + :type _preload_content: bool, optional + :param _return_http_data_only: response data instead of ApiResponse + object with status code, headers, etc + :type _return_http_data_only: bool, optional + :param _request_timeout: timeout setting for this request. If one + number provided, it will be total request + timeout. It can also be a pair (tuple) of + (connection, read) timeouts. + :param _request_auth: set to override the auth_settings for an a single + request; this effectively ignores the authentication + in the spec for a single request. + :type _request_auth: dict, optional + :type _content_type: string, optional: force content-type for the request + :return: Returns the result object. + If the method is called asynchronously, + returns the request thread. + :rtype: tuple(List[EligibilityCardlessEMIEntity], status_code(int), headers(HTTPHeaderDict)) + """ + + api_client = ApiClient.get_default() + host = "https://api.cashfree.com/pg" + if Cashfree.XEnvironment == CFEnvironment.SANDBOX: + host = "https://sandbox.cashfree.com/pg" + configuration = Configuration( + host = host + ) + configuration.api_key['XClientID'] = Cashfree.XClientId + configuration.api_key['XClientSecret'] = Cashfree.XClientSecret + configuration.api_key['XClientSignature'] = Cashfree.XClientSignature + configuration.api_key['XPartnerMerchantId'] = Cashfree.XPartnerMerchantId + configuration.api_key['XPartnerKey'] = Cashfree.XPartnerKey + api_client.configuration = configuration + _params = locals() + + _all_params = [ + 'x_api_version', + 'eligibility_fetch_cardless_emi_request', + 'x_request_id', + 'x_idempotency_key' + ] + _all_params.extend( + [ + 'async_req', + '_return_http_data_only', + '_preload_content', + '_request_timeout', + '_request_auth', + '_content_type', + '_headers' + ] + ) + + # validate the arguments + for _key, _val in _params['kwargs'].items(): + if _key not in _all_params: + raise ApiTypeError( + "Got an unexpected keyword argument '%s'" + " to method PGEligibilityFetchCardlessEmi" % _key + ) + _params[_key] = _val + del _params['kwargs'] + + _collection_formats = {} + + # process the path parameters + _path_params = {} + + # process the query parameters + _query_params = [] + # process the header parameters + _header_params = dict(_params.get('_headers', {})) + if x_request_id: + _header_params["x-request-id"] = x_request_id + + if x_api_version: + _header_params["x-api-version"] = x_api_version + + if x_idempotency_key: + _header_params["x-idempotency-key"] = x_idempotency_key + _header_params["x-sdk-platform"] = "pythonsdk-3.0.1" + + # process the form parameters + _form_params = [] + _files = {} + # process the body parameter + _body_params = None + if _params['eligibility_fetch_cardless_emi_request'] is not None: + _body_params = _params['eligibility_fetch_cardless_emi_request'] + + # set the HTTP header `Accept` + _header_params['Accept'] = api_client.select_header_accept( + ['application/json']) # noqa: E501 + + # set the HTTP header `Content-Type` + _content_types_list = _params.get('_content_type', + api_client.select_header_content_type( + ['application/json'])) + if _content_types_list: + _header_params['Content-Type'] = _content_types_list + + # authentication setting + _auth_settings = ['XPartnerAPIKey', 'XClientSecret', 'XPartnerMerchantID', 'XClientID', 'XClientSignatureHeader'] # noqa: E501 + + _response_types_map = { + '200': "List[EligibilityCardlessEMIEntity]", + '400': "BadRequestError", + '401': "AuthenticationError", + '404': "ApiError404", + '409': "ApiError409", + '422': "IdempotencyError", + '429': "RateLimitError", + '500': "ApiError", + '502': "ApiError502", + } + + return api_client.call_api( + '/eligibility/cardlessemi', 'POST', + _path_params, + _query_params, + _header_params, + body=_body_params, + post_params=_form_params, + files=_files, + response_types_map=_response_types_map, + auth_settings=_auth_settings, + async_req=_params.get('async_req'), + _return_http_data_only=_params.get('_return_http_data_only'), # noqa: E501 + _preload_content=_params.get('_preload_content', True), + _request_timeout=_params.get('_request_timeout'), + collection_formats=_collection_formats, + _request_auth=_params.get('_request_auth')) + @validate_arguments + def PGEligibilityFetchOffers(self, x_api_version : Annotated[StrictStr, Field(..., description="API version to be used. Format is in YYYY-MM-DD")] = None, eligibility_fetch_offers_request : Annotated[EligibilityFetchOffersRequest, Field(..., description="Request Body to get eligible offers for a customer and order")] = None, x_request_id : Annotated[Optional[StrictStr], Field(description="Request id for the API call. Can be used to resolve tech issues. Communicate this in your tech related queries to cashfree")] = None, x_idempotency_key : Annotated[Optional[StrictStr], Field(description="Idempotency works by saving the resulting status code and body of the first request made for any given idempotency key, regardless of whether it succeeded or failed. Subsequent requests with the same key return the same result, including 500 errors. Currently supported on all POST calls that uses x-client-id & x-client-secret. To use enable, pass x-idempotency-key in the request header. The value of this header must be unique to each operation you are trying to do. One example can be to use the same order_id that you pass while creating orders ")] = None, **kwargs) -> ApiResponse: # noqa: E501 + """Get Eligible Offers for an Order # noqa: E501 + + Use this API to get eligible offers for an order_id or order amount. # noqa: E501 + This method makes a synchronous HTTP request by default. To make an + asynchronous HTTP request, please pass async_req=True + + >>> thread = api.PGEligibilityFetchOffers_with_http_info(x_api_version, eligibility_fetch_offers_request, x_request_id, x_idempotency_key, async_req=True) + >>> result = thread.get() + + :param x_api_version: API version to be used. Format is in YYYY-MM-DD (required) + :type x_api_version: str + :param eligibility_fetch_offers_request: Request Body to get eligible offers for a customer and order (required) + :type eligibility_fetch_offers_request: EligibilityFetchOffersRequest + :param x_request_id: Request id for the API call. Can be used to resolve tech issues. Communicate this in your tech related queries to cashfree + :type x_request_id: str + :param x_idempotency_key: Idempotency works by saving the resulting status code and body of the first request made for any given idempotency key, regardless of whether it succeeded or failed. Subsequent requests with the same key return the same result, including 500 errors. Currently supported on all POST calls that uses x-client-id & x-client-secret. To use enable, pass x-idempotency-key in the request header. The value of this header must be unique to each operation you are trying to do. One example can be to use the same order_id that you pass while creating orders + :type x_idempotency_key: str + :param async_req: Whether to execute the request asynchronously. + :type async_req: bool, optional + :param _preload_content: if False, the ApiResponse.data will + be set to none and raw_data will store the + HTTP response body without reading/decoding. + Default is True. + :type _preload_content: bool, optional + :param _return_http_data_only: response data instead of ApiResponse + object with status code, headers, etc + :type _return_http_data_only: bool, optional + :param _request_timeout: timeout setting for this request. If one + number provided, it will be total request + timeout. It can also be a pair (tuple) of + (connection, read) timeouts. + :param _request_auth: set to override the auth_settings for an a single + request; this effectively ignores the authentication + in the spec for a single request. + :type _request_auth: dict, optional + :type _content_type: string, optional: force content-type for the request + :return: Returns the result object. + If the method is called asynchronously, + returns the request thread. + :rtype: tuple(List[EligibilityOfferEntity], status_code(int), headers(HTTPHeaderDict)) + """ + + api_client = ApiClient.get_default() + host = "https://api.cashfree.com/pg" + if Cashfree.XEnvironment == CFEnvironment.SANDBOX: + host = "https://sandbox.cashfree.com/pg" + configuration = Configuration( + host = host + ) + configuration.api_key['XClientID'] = Cashfree.XClientId + configuration.api_key['XClientSecret'] = Cashfree.XClientSecret + configuration.api_key['XClientSignature'] = Cashfree.XClientSignature + configuration.api_key['XPartnerMerchantId'] = Cashfree.XPartnerMerchantId + configuration.api_key['XPartnerKey'] = Cashfree.XPartnerKey + api_client.configuration = configuration + _params = locals() + + _all_params = [ + 'x_api_version', + 'eligibility_fetch_offers_request', + 'x_request_id', + 'x_idempotency_key' + ] + _all_params.extend( + [ + 'async_req', + '_return_http_data_only', + '_preload_content', + '_request_timeout', + '_request_auth', + '_content_type', + '_headers' + ] + ) + + # validate the arguments + for _key, _val in _params['kwargs'].items(): + if _key not in _all_params: + raise ApiTypeError( + "Got an unexpected keyword argument '%s'" + " to method PGEligibilityFetchOffers" % _key + ) + _params[_key] = _val + del _params['kwargs'] + + _collection_formats = {} + + # process the path parameters + _path_params = {} + + # process the query parameters + _query_params = [] + # process the header parameters + _header_params = dict(_params.get('_headers', {})) + if x_request_id: + _header_params["x-request-id"] = x_request_id + + if x_api_version: + _header_params["x-api-version"] = x_api_version + + if x_idempotency_key: + _header_params["x-idempotency-key"] = x_idempotency_key + _header_params["x-sdk-platform"] = "pythonsdk-3.0.1" + + # process the form parameters + _form_params = [] + _files = {} + # process the body parameter + _body_params = None + if _params['eligibility_fetch_offers_request'] is not None: + _body_params = _params['eligibility_fetch_offers_request'] + + # set the HTTP header `Accept` + _header_params['Accept'] = api_client.select_header_accept( + ['application/json']) # noqa: E501 + + # set the HTTP header `Content-Type` + _content_types_list = _params.get('_content_type', + api_client.select_header_content_type( + ['application/json'])) + if _content_types_list: + _header_params['Content-Type'] = _content_types_list + + # authentication setting + _auth_settings = ['XPartnerAPIKey', 'XClientSecret', 'XPartnerMerchantID', 'XClientID', 'XClientSignatureHeader'] # noqa: E501 + + _response_types_map = { + '200': "List[EligibilityOfferEntity]", + '400': "BadRequestError", + '401': "AuthenticationError", + '404': "ApiError404", + '409': "ApiError409", + '422': "IdempotencyError", + '429': "RateLimitError", + '500': "ApiError", + } + + return api_client.call_api( + '/eligibility/offers', 'POST', + _path_params, + _query_params, + _header_params, + body=_body_params, + post_params=_form_params, + files=_files, + response_types_map=_response_types_map, + auth_settings=_auth_settings, + async_req=_params.get('async_req'), + _return_http_data_only=_params.get('_return_http_data_only'), # noqa: E501 + _preload_content=_params.get('_preload_content', True), + _request_timeout=_params.get('_request_timeout'), + collection_formats=_collection_formats, + _request_auth=_params.get('_request_auth')) + @validate_arguments + def PGEligibilityFetchPaylater(self, x_api_version : Annotated[StrictStr, Field(..., description="API version to be used. Format is in YYYY-MM-DD")] = None, eligibility_fetch_paylater_request : Annotated[EligibilityFetchPaylaterRequest, Field(..., description="Request Body to get eligible paylater options for a customer and order")] = None, x_request_id : Annotated[Optional[StrictStr], Field(description="Request id for the API call. Can be used to resolve tech issues. Communicate this in your tech related queries to cashfree")] = None, x_idempotency_key : Annotated[Optional[StrictStr], Field(description="Idempotency works by saving the resulting status code and body of the first request made for any given idempotency key, regardless of whether it succeeded or failed. Subsequent requests with the same key return the same result, including 500 errors. Currently supported on all POST calls that uses x-client-id & x-client-secret. To use enable, pass x-idempotency-key in the request header. The value of this header must be unique to each operation you are trying to do. One example can be to use the same order_id that you pass while creating orders ")] = None, **kwargs) -> ApiResponse: # noqa: E501 + """Get Eligible Paylater for a customer on an order # noqa: E501 + + Use this API to get eligible Paylater Payment Methods for a customer on an order. # noqa: E501 + This method makes a synchronous HTTP request by default. To make an + asynchronous HTTP request, please pass async_req=True + + >>> thread = api.PGEligibilityFetchPaylater_with_http_info(x_api_version, eligibility_fetch_paylater_request, x_request_id, x_idempotency_key, async_req=True) + >>> result = thread.get() + + :param x_api_version: API version to be used. Format is in YYYY-MM-DD (required) + :type x_api_version: str + :param eligibility_fetch_paylater_request: Request Body to get eligible paylater options for a customer and order (required) + :type eligibility_fetch_paylater_request: EligibilityFetchPaylaterRequest + :param x_request_id: Request id for the API call. Can be used to resolve tech issues. Communicate this in your tech related queries to cashfree + :type x_request_id: str + :param x_idempotency_key: Idempotency works by saving the resulting status code and body of the first request made for any given idempotency key, regardless of whether it succeeded or failed. Subsequent requests with the same key return the same result, including 500 errors. Currently supported on all POST calls that uses x-client-id & x-client-secret. To use enable, pass x-idempotency-key in the request header. The value of this header must be unique to each operation you are trying to do. One example can be to use the same order_id that you pass while creating orders + :type x_idempotency_key: str + :param async_req: Whether to execute the request asynchronously. + :type async_req: bool, optional + :param _preload_content: if False, the ApiResponse.data will + be set to none and raw_data will store the + HTTP response body without reading/decoding. + Default is True. + :type _preload_content: bool, optional + :param _return_http_data_only: response data instead of ApiResponse + object with status code, headers, etc + :type _return_http_data_only: bool, optional + :param _request_timeout: timeout setting for this request. If one + number provided, it will be total request + timeout. It can also be a pair (tuple) of + (connection, read) timeouts. + :param _request_auth: set to override the auth_settings for an a single + request; this effectively ignores the authentication + in the spec for a single request. + :type _request_auth: dict, optional + :type _content_type: string, optional: force content-type for the request + :return: Returns the result object. + If the method is called asynchronously, + returns the request thread. + :rtype: tuple(List[EligibilityPaylaterEntity], status_code(int), headers(HTTPHeaderDict)) + """ + + api_client = ApiClient.get_default() + host = "https://api.cashfree.com/pg" + if Cashfree.XEnvironment == CFEnvironment.SANDBOX: + host = "https://sandbox.cashfree.com/pg" + configuration = Configuration( + host = host + ) + configuration.api_key['XClientID'] = Cashfree.XClientId + configuration.api_key['XClientSecret'] = Cashfree.XClientSecret + configuration.api_key['XClientSignature'] = Cashfree.XClientSignature + configuration.api_key['XPartnerMerchantId'] = Cashfree.XPartnerMerchantId + configuration.api_key['XPartnerKey'] = Cashfree.XPartnerKey + api_client.configuration = configuration + _params = locals() + + _all_params = [ + 'x_api_version', + 'eligibility_fetch_paylater_request', + 'x_request_id', + 'x_idempotency_key' + ] + _all_params.extend( + [ + 'async_req', + '_return_http_data_only', + '_preload_content', + '_request_timeout', + '_request_auth', + '_content_type', + '_headers' + ] + ) + + # validate the arguments + for _key, _val in _params['kwargs'].items(): + if _key not in _all_params: + raise ApiTypeError( + "Got an unexpected keyword argument '%s'" + " to method PGEligibilityFetchPaylater" % _key + ) + _params[_key] = _val + del _params['kwargs'] + + _collection_formats = {} + + # process the path parameters + _path_params = {} + + # process the query parameters + _query_params = [] + # process the header parameters + _header_params = dict(_params.get('_headers', {})) + if x_request_id: + _header_params["x-request-id"] = x_request_id + + if x_api_version: + _header_params["x-api-version"] = x_api_version + + if x_idempotency_key: + _header_params["x-idempotency-key"] = x_idempotency_key + _header_params["x-sdk-platform"] = "pythonsdk-3.0.1" + + # process the form parameters + _form_params = [] + _files = {} + # process the body parameter + _body_params = None + if _params['eligibility_fetch_paylater_request'] is not None: + _body_params = _params['eligibility_fetch_paylater_request'] + + # set the HTTP header `Accept` + _header_params['Accept'] = api_client.select_header_accept( + ['application/json']) # noqa: E501 + + # set the HTTP header `Content-Type` + _content_types_list = _params.get('_content_type', + api_client.select_header_content_type( + ['application/json'])) + if _content_types_list: + _header_params['Content-Type'] = _content_types_list + + # authentication setting + _auth_settings = ['XPartnerAPIKey', 'XClientSecret', 'XPartnerMerchantID', 'XClientID', 'XClientSignatureHeader'] # noqa: E501 + + _response_types_map = { + '200': "List[EligibilityPaylaterEntity]", + '400': "BadRequestError", + '401': "AuthenticationError", + '404': "ApiError404", + '409': "ApiError409", + '422': "IdempotencyError", + '429': "RateLimitError", + '500': "ApiError", + '502': "ApiError502", + } + + return api_client.call_api( + '/eligibility/paylater', 'POST', + _path_params, + _query_params, + _header_params, + body=_body_params, + post_params=_form_params, + files=_files, + response_types_map=_response_types_map, + auth_settings=_auth_settings, + async_req=_params.get('async_req'), + _return_http_data_only=_params.get('_return_http_data_only'), # noqa: E501 + _preload_content=_params.get('_preload_content', True), + _request_timeout=_params.get('_request_timeout'), + collection_formats=_collection_formats, + _request_auth=_params.get('_request_auth')) + @validate_arguments + def PGEligibilityFetchPaymentMethods(self, x_api_version : Annotated[StrictStr, Field(..., description="API version to be used. Format is in YYYY-MM-DD")] = None, eligibility_fetch_payment_methods_request : Annotated[EligibilityFetchPaymentMethodsRequest, Field(..., description="Request Body to get eligible payment methods for an account and order")] = None, x_request_id : Annotated[Optional[StrictStr], Field(description="Request id for the API call. Can be used to resolve tech issues. Communicate this in your tech related queries to cashfree")] = None, x_idempotency_key : Annotated[Optional[StrictStr], Field(description="Idempotency works by saving the resulting status code and body of the first request made for any given idempotency key, regardless of whether it succeeded or failed. Subsequent requests with the same key return the same result, including 500 errors. Currently supported on all POST calls that uses x-client-id & x-client-secret. To use enable, pass x-idempotency-key in the request header. The value of this header must be unique to each operation you are trying to do. One example can be to use the same order_id that you pass while creating orders ")] = None, **kwargs) -> ApiResponse: # noqa: E501 + """Get eligible Payment Methods # noqa: E501 + + Use this API to get eligible Payment Methods # noqa: E501 + This method makes a synchronous HTTP request by default. To make an + asynchronous HTTP request, please pass async_req=True + + >>> thread = api.PGEligibilityFetchPaymentMethods_with_http_info(x_api_version, eligibility_fetch_payment_methods_request, x_request_id, x_idempotency_key, async_req=True) + >>> result = thread.get() + + :param x_api_version: API version to be used. Format is in YYYY-MM-DD (required) + :type x_api_version: str + :param eligibility_fetch_payment_methods_request: Request Body to get eligible payment methods for an account and order (required) + :type eligibility_fetch_payment_methods_request: EligibilityFetchPaymentMethodsRequest + :param x_request_id: Request id for the API call. Can be used to resolve tech issues. Communicate this in your tech related queries to cashfree + :type x_request_id: str + :param x_idempotency_key: Idempotency works by saving the resulting status code and body of the first request made for any given idempotency key, regardless of whether it succeeded or failed. Subsequent requests with the same key return the same result, including 500 errors. Currently supported on all POST calls that uses x-client-id & x-client-secret. To use enable, pass x-idempotency-key in the request header. The value of this header must be unique to each operation you are trying to do. One example can be to use the same order_id that you pass while creating orders + :type x_idempotency_key: str + :param async_req: Whether to execute the request asynchronously. + :type async_req: bool, optional + :param _preload_content: if False, the ApiResponse.data will + be set to none and raw_data will store the + HTTP response body without reading/decoding. + Default is True. + :type _preload_content: bool, optional + :param _return_http_data_only: response data instead of ApiResponse + object with status code, headers, etc + :type _return_http_data_only: bool, optional + :param _request_timeout: timeout setting for this request. If one + number provided, it will be total request + timeout. It can also be a pair (tuple) of + (connection, read) timeouts. + :param _request_auth: set to override the auth_settings for an a single + request; this effectively ignores the authentication + in the spec for a single request. + :type _request_auth: dict, optional + :type _content_type: string, optional: force content-type for the request + :return: Returns the result object. + If the method is called asynchronously, + returns the request thread. + :rtype: tuple(List[EligibilityPaymentMethodsEntity], status_code(int), headers(HTTPHeaderDict)) + """ + + api_client = ApiClient.get_default() + host = "https://api.cashfree.com/pg" + if Cashfree.XEnvironment == CFEnvironment.SANDBOX: + host = "https://sandbox.cashfree.com/pg" + configuration = Configuration( + host = host + ) + configuration.api_key['XClientID'] = Cashfree.XClientId + configuration.api_key['XClientSecret'] = Cashfree.XClientSecret + configuration.api_key['XClientSignature'] = Cashfree.XClientSignature + configuration.api_key['XPartnerMerchantId'] = Cashfree.XPartnerMerchantId + configuration.api_key['XPartnerKey'] = Cashfree.XPartnerKey + api_client.configuration = configuration + _params = locals() + + _all_params = [ + 'x_api_version', + 'eligibility_fetch_payment_methods_request', + 'x_request_id', + 'x_idempotency_key' + ] + _all_params.extend( + [ + 'async_req', + '_return_http_data_only', + '_preload_content', + '_request_timeout', + '_request_auth', + '_content_type', + '_headers' + ] + ) + + # validate the arguments + for _key, _val in _params['kwargs'].items(): + if _key not in _all_params: + raise ApiTypeError( + "Got an unexpected keyword argument '%s'" + " to method PGEligibilityFetchPaymentMethods" % _key + ) + _params[_key] = _val + del _params['kwargs'] + + _collection_formats = {} + + # process the path parameters + _path_params = {} + + # process the query parameters + _query_params = [] + # process the header parameters + _header_params = dict(_params.get('_headers', {})) + if x_request_id: + _header_params["x-request-id"] = x_request_id + + if x_api_version: + _header_params["x-api-version"] = x_api_version + + if x_idempotency_key: + _header_params["x-idempotency-key"] = x_idempotency_key + _header_params["x-sdk-platform"] = "pythonsdk-3.0.1" + + # process the form parameters + _form_params = [] + _files = {} + # process the body parameter + _body_params = None + if _params['eligibility_fetch_payment_methods_request'] is not None: + _body_params = _params['eligibility_fetch_payment_methods_request'] + + # set the HTTP header `Accept` + _header_params['Accept'] = api_client.select_header_accept( + ['application/json']) # noqa: E501 + + # set the HTTP header `Content-Type` + _content_types_list = _params.get('_content_type', + api_client.select_header_content_type( + ['application/json'])) + if _content_types_list: + _header_params['Content-Type'] = _content_types_list + + # authentication setting + _auth_settings = ['XPartnerAPIKey', 'XClientSecret', 'XPartnerMerchantID', 'XClientID', 'XClientSignatureHeader'] # noqa: E501 + + _response_types_map = { + '200': "List[EligibilityPaymentMethodsEntity]", + '400': "BadRequestError", + '401': "AuthenticationError", + '404': "ApiError404", + '409': "ApiError409", + '422': "IdempotencyError", + '429': "RateLimitError", + '500': "ApiError", + '502': "ApiError502", + } + + return api_client.call_api( + '/eligibility/payment_methods', 'POST', + _path_params, + _query_params, + _header_params, + body=_body_params, + post_params=_form_params, + files=_files, + response_types_map=_response_types_map, + auth_settings=_auth_settings, + async_req=_params.get('async_req'), + _return_http_data_only=_params.get('_return_http_data_only'), # noqa: E501 + _preload_content=_params.get('_preload_content', True), + _request_timeout=_params.get('_request_timeout'), + collection_formats=_collection_formats, + _request_auth=_params.get('_request_auth')) + + @validate_arguments + def PGCreateOffer(self, x_api_version : Annotated[StrictStr, Field(..., description="API version to be used. Format is in YYYY-MM-DD")] = None, create_offer_request : Annotated[CreateOfferRequest, Field(..., description="Request body to create an offer at Cashfree")] = None, x_request_id : Annotated[Optional[StrictStr], Field(description="Request id for the API call. Can be used to resolve tech issues. Communicate this in your tech related queries to cashfree")] = None, x_idempotency_key : Annotated[Optional[StrictStr], Field(description="Idempotency works by saving the resulting status code and body of the first request made for any given idempotency key, regardless of whether it succeeded or failed. Subsequent requests with the same key return the same result, including 500 errors. Currently supported on all POST calls that uses x-client-id & x-client-secret. To use enable, pass x-idempotency-key in the request header. The value of this header must be unique to each operation you are trying to do. One example can be to use the same order_id that you pass while creating orders ")] = None, **kwargs) -> ApiResponse: # noqa: E501 + """Create Offer # noqa: E501 + + Use this API to create offers with Cashfree from your backend # noqa: E501 + This method makes a synchronous HTTP request by default. To make an + asynchronous HTTP request, please pass async_req=True + + >>> thread = api.PGCreateOffer_with_http_info(x_api_version, create_offer_request, x_request_id, x_idempotency_key, async_req=True) + >>> result = thread.get() + + :param x_api_version: API version to be used. Format is in YYYY-MM-DD (required) + :type x_api_version: str + :param create_offer_request: Request body to create an offer at Cashfree (required) + :type create_offer_request: CreateOfferRequest + :param x_request_id: Request id for the API call. Can be used to resolve tech issues. Communicate this in your tech related queries to cashfree + :type x_request_id: str + :param x_idempotency_key: Idempotency works by saving the resulting status code and body of the first request made for any given idempotency key, regardless of whether it succeeded or failed. Subsequent requests with the same key return the same result, including 500 errors. Currently supported on all POST calls that uses x-client-id & x-client-secret. To use enable, pass x-idempotency-key in the request header. The value of this header must be unique to each operation you are trying to do. One example can be to use the same order_id that you pass while creating orders + :type x_idempotency_key: str + :param async_req: Whether to execute the request asynchronously. + :type async_req: bool, optional + :param _preload_content: if False, the ApiResponse.data will + be set to none and raw_data will store the + HTTP response body without reading/decoding. + Default is True. + :type _preload_content: bool, optional + :param _return_http_data_only: response data instead of ApiResponse + object with status code, headers, etc + :type _return_http_data_only: bool, optional + :param _request_timeout: timeout setting for this request. If one + number provided, it will be total request + timeout. It can also be a pair (tuple) of + (connection, read) timeouts. + :param _request_auth: set to override the auth_settings for an a single + request; this effectively ignores the authentication + in the spec for a single request. + :type _request_auth: dict, optional + :type _content_type: string, optional: force content-type for the request + :return: Returns the result object. + If the method is called asynchronously, + returns the request thread. + :rtype: tuple(OfferEntity, status_code(int), headers(HTTPHeaderDict)) + """ + + api_client = ApiClient.get_default() + host = "https://api.cashfree.com/pg" + if Cashfree.XEnvironment == CFEnvironment.SANDBOX: + host = "https://sandbox.cashfree.com/pg" + configuration = Configuration( + host = host + ) + configuration.api_key['XClientID'] = Cashfree.XClientId + configuration.api_key['XClientSecret'] = Cashfree.XClientSecret + configuration.api_key['XClientSignature'] = Cashfree.XClientSignature + configuration.api_key['XPartnerMerchantId'] = Cashfree.XPartnerMerchantId + configuration.api_key['XPartnerKey'] = Cashfree.XPartnerKey + api_client.configuration = configuration + _params = locals() + + _all_params = [ + 'x_api_version', + 'create_offer_request', + 'x_request_id', + 'x_idempotency_key' + ] + _all_params.extend( + [ + 'async_req', + '_return_http_data_only', + '_preload_content', + '_request_timeout', + '_request_auth', + '_content_type', + '_headers' + ] + ) + + # validate the arguments + for _key, _val in _params['kwargs'].items(): + if _key not in _all_params: + raise ApiTypeError( + "Got an unexpected keyword argument '%s'" + " to method PGCreateOffer" % _key + ) + _params[_key] = _val + del _params['kwargs'] + + _collection_formats = {} + + # process the path parameters + _path_params = {} + + # process the query parameters + _query_params = [] + # process the header parameters + _header_params = dict(_params.get('_headers', {})) + if x_request_id: + _header_params["x-request-id"] = x_request_id + + if x_api_version: + _header_params["x-api-version"] = x_api_version + + if x_idempotency_key: + _header_params["x-idempotency-key"] = x_idempotency_key + _header_params["x-sdk-platform"] = "pythonsdk-3.0.1" + + # process the form parameters + _form_params = [] + _files = {} + # process the body parameter + _body_params = None + if _params['create_offer_request'] is not None: + _body_params = _params['create_offer_request'] + + # set the HTTP header `Accept` + _header_params['Accept'] = api_client.select_header_accept( + ['application/json']) # noqa: E501 + + # set the HTTP header `Content-Type` + _content_types_list = _params.get('_content_type', + api_client.select_header_content_type( + ['application/json'])) + if _content_types_list: + _header_params['Content-Type'] = _content_types_list + + # authentication setting + _auth_settings = ['XPartnerAPIKey', 'XClientSecret', 'XPartnerMerchantID', 'XClientID', 'XClientSignatureHeader'] # noqa: E501 + + _response_types_map = { + '200': "OfferEntity", + '400': "BadRequestError", + '401': "AuthenticationError", + '404': "ApiError404", + '409': "ApiError409", + '422': "IdempotencyError", + '429': "RateLimitError", + '500': "ApiError", + } + + return api_client.call_api( + '/offers', 'POST', + _path_params, + _query_params, + _header_params, + body=_body_params, + post_params=_form_params, + files=_files, + response_types_map=_response_types_map, + auth_settings=_auth_settings, + async_req=_params.get('async_req'), + _return_http_data_only=_params.get('_return_http_data_only'), # noqa: E501 + _preload_content=_params.get('_preload_content', True), + _request_timeout=_params.get('_request_timeout'), + collection_formats=_collection_formats, + _request_auth=_params.get('_request_auth')) + @validate_arguments + def PGFetchOffer(self, x_api_version : Annotated[StrictStr, Field(..., description="API version to be used. Format is in YYYY-MM-DD")] = None, offer_id : Annotated[StrictStr, Field(..., description="The offer ID for which you want to view the offer details.")] = None, x_request_id : Annotated[Optional[StrictStr], Field(description="Request id for the API call. Can be used to resolve tech issues. Communicate this in your tech related queries to cashfree")] = None, x_idempotency_key : Annotated[Optional[StrictStr], Field(description="Idempotency works by saving the resulting status code and body of the first request made for any given idempotency key, regardless of whether it succeeded or failed. Subsequent requests with the same key return the same result, including 500 errors. Currently supported on all POST calls that uses x-client-id & x-client-secret. To use enable, pass x-idempotency-key in the request header. The value of this header must be unique to each operation you are trying to do. One example can be to use the same order_id that you pass while creating orders ")] = None, **kwargs) -> ApiResponse: # noqa: E501 + """Get Offer by ID # noqa: E501 + + Use this API to get offer by offer_id # noqa: E501 + This method makes a synchronous HTTP request by default. To make an + asynchronous HTTP request, please pass async_req=True + + >>> thread = api.PGFetchOffer_with_http_info(x_api_version, offer_id, x_request_id, x_idempotency_key, async_req=True) + >>> result = thread.get() + + :param x_api_version: API version to be used. Format is in YYYY-MM-DD (required) + :type x_api_version: str + :param offer_id: The offer ID for which you want to view the offer details. (required) + :type offer_id: str + :param x_request_id: Request id for the API call. Can be used to resolve tech issues. Communicate this in your tech related queries to cashfree + :type x_request_id: str + :param x_idempotency_key: Idempotency works by saving the resulting status code and body of the first request made for any given idempotency key, regardless of whether it succeeded or failed. Subsequent requests with the same key return the same result, including 500 errors. Currently supported on all POST calls that uses x-client-id & x-client-secret. To use enable, pass x-idempotency-key in the request header. The value of this header must be unique to each operation you are trying to do. One example can be to use the same order_id that you pass while creating orders + :type x_idempotency_key: str + :param async_req: Whether to execute the request asynchronously. + :type async_req: bool, optional + :param _preload_content: if False, the ApiResponse.data will + be set to none and raw_data will store the + HTTP response body without reading/decoding. + Default is True. + :type _preload_content: bool, optional + :param _return_http_data_only: response data instead of ApiResponse + object with status code, headers, etc + :type _return_http_data_only: bool, optional + :param _request_timeout: timeout setting for this request. If one + number provided, it will be total request + timeout. It can also be a pair (tuple) of + (connection, read) timeouts. + :param _request_auth: set to override the auth_settings for an a single + request; this effectively ignores the authentication + in the spec for a single request. + :type _request_auth: dict, optional + :type _content_type: string, optional: force content-type for the request + :return: Returns the result object. + If the method is called asynchronously, + returns the request thread. + :rtype: tuple(OfferEntity, status_code(int), headers(HTTPHeaderDict)) + """ + + api_client = ApiClient.get_default() + host = "https://api.cashfree.com/pg" + if Cashfree.XEnvironment == CFEnvironment.SANDBOX: + host = "https://sandbox.cashfree.com/pg" + configuration = Configuration( + host = host + ) + configuration.api_key['XClientID'] = Cashfree.XClientId + configuration.api_key['XClientSecret'] = Cashfree.XClientSecret + configuration.api_key['XClientSignature'] = Cashfree.XClientSignature + configuration.api_key['XPartnerMerchantId'] = Cashfree.XPartnerMerchantId + configuration.api_key['XPartnerKey'] = Cashfree.XPartnerKey + api_client.configuration = configuration + _params = locals() + + _all_params = [ + 'x_api_version', + 'offer_id', + 'x_request_id', + 'x_idempotency_key' + ] + _all_params.extend( + [ + 'async_req', + '_return_http_data_only', + '_preload_content', + '_request_timeout', + '_request_auth', + '_content_type', + '_headers' + ] + ) + + # validate the arguments + for _key, _val in _params['kwargs'].items(): + if _key not in _all_params: + raise ApiTypeError( + "Got an unexpected keyword argument '%s'" + " to method PGFetchOffer" % _key + ) + _params[_key] = _val + del _params['kwargs'] + + _collection_formats = {} + + # process the path parameters + _path_params = {} + if _params['offer_id']: + _path_params['offer_id'] = _params['offer_id'] + + + # process the query parameters + _query_params = [] + # process the header parameters + _header_params = dict(_params.get('_headers', {})) + if x_request_id: + _header_params["x-request-id"] = x_request_id + + if x_api_version: + _header_params["x-api-version"] = x_api_version + + if x_idempotency_key: + _header_params["x-idempotency-key"] = x_idempotency_key + _header_params["x-sdk-platform"] = "pythonsdk-3.0.1" + + # process the form parameters + _form_params = [] + _files = {} + # process the body parameter + _body_params = None + # set the HTTP header `Accept` + _header_params['Accept'] = api_client.select_header_accept( + ['application/json']) # noqa: E501 + + # authentication setting + _auth_settings = ['XPartnerAPIKey', 'XClientSecret', 'XPartnerMerchantID', 'XClientID', 'XClientSignatureHeader'] # noqa: E501 + + _response_types_map = { + '200': "OfferEntity", + '400': "BadRequestError", + '401': "AuthenticationError", + '404': "ApiError404", + '409': "ApiError409", + '422': "IdempotencyError", + '429': "RateLimitError", + '500': "ApiError", + } + + return api_client.call_api( + '/offers/{offer_id}', 'GET', + _path_params, + _query_params, + _header_params, + body=_body_params, + post_params=_form_params, + files=_files, + response_types_map=_response_types_map, + auth_settings=_auth_settings, + async_req=_params.get('async_req'), + _return_http_data_only=_params.get('_return_http_data_only'), # noqa: E501 + _preload_content=_params.get('_preload_content', True), + _request_timeout=_params.get('_request_timeout'), + collection_formats=_collection_formats, + _request_auth=_params.get('_request_auth')) + + @validate_arguments + def PGCreateOrder(self, x_api_version : Annotated[StrictStr, Field(..., description="API version to be used. Format is in YYYY-MM-DD")] = None, create_order_request : Annotated[CreateOrderRequest, Field(..., description="Request body to create an order at cashfree")] = None, x_request_id : Annotated[Optional[StrictStr], Field(description="Request id for the API call. Can be used to resolve tech issues. Communicate this in your tech related queries to cashfree")] = None, x_idempotency_key : Annotated[Optional[StrictStr], Field(description="Idempotency works by saving the resulting status code and body of the first request made for any given idempotency key, regardless of whether it succeeded or failed. Subsequent requests with the same key return the same result, including 500 errors. Currently supported on all POST calls that uses x-client-id & x-client-secret. To use enable, pass x-idempotency-key in the request header. The value of this header must be unique to each operation you are trying to do. One example can be to use the same order_id that you pass while creating orders ")] = None, **kwargs) -> ApiResponse: # noqa: E501 + """Create Order # noqa: E501 + + ### Order An order is an entity which has a amount and currency associated with it. It is something for which you want to collect payment for. Use this API to create orders with Cashfree from your backend to get a `payment_sessions_id`. You can use the `payment_sessions_id` to create a transaction for the order. # noqa: E501 + This method makes a synchronous HTTP request by default. To make an + asynchronous HTTP request, please pass async_req=True + + >>> thread = api.PGCreateOrder_with_http_info(x_api_version, create_order_request, x_request_id, x_idempotency_key, async_req=True) + >>> result = thread.get() + + :param x_api_version: API version to be used. Format is in YYYY-MM-DD (required) + :type x_api_version: str + :param create_order_request: Request body to create an order at cashfree (required) + :type create_order_request: CreateOrderRequest + :param x_request_id: Request id for the API call. Can be used to resolve tech issues. Communicate this in your tech related queries to cashfree + :type x_request_id: str + :param x_idempotency_key: Idempotency works by saving the resulting status code and body of the first request made for any given idempotency key, regardless of whether it succeeded or failed. Subsequent requests with the same key return the same result, including 500 errors. Currently supported on all POST calls that uses x-client-id & x-client-secret. To use enable, pass x-idempotency-key in the request header. The value of this header must be unique to each operation you are trying to do. One example can be to use the same order_id that you pass while creating orders + :type x_idempotency_key: str + :param async_req: Whether to execute the request asynchronously. + :type async_req: bool, optional + :param _preload_content: if False, the ApiResponse.data will + be set to none and raw_data will store the + HTTP response body without reading/decoding. + Default is True. + :type _preload_content: bool, optional + :param _return_http_data_only: response data instead of ApiResponse + object with status code, headers, etc + :type _return_http_data_only: bool, optional + :param _request_timeout: timeout setting for this request. If one + number provided, it will be total request + timeout. It can also be a pair (tuple) of + (connection, read) timeouts. + :param _request_auth: set to override the auth_settings for an a single + request; this effectively ignores the authentication + in the spec for a single request. + :type _request_auth: dict, optional + :type _content_type: string, optional: force content-type for the request + :return: Returns the result object. + If the method is called asynchronously, + returns the request thread. + :rtype: tuple(OrderEntity, status_code(int), headers(HTTPHeaderDict)) + """ + + api_client = ApiClient.get_default() + host = "https://api.cashfree.com/pg" + if Cashfree.XEnvironment == CFEnvironment.SANDBOX: + host = "https://sandbox.cashfree.com/pg" + configuration = Configuration( + host = host + ) + configuration.api_key['XClientID'] = Cashfree.XClientId + configuration.api_key['XClientSecret'] = Cashfree.XClientSecret + configuration.api_key['XClientSignature'] = Cashfree.XClientSignature + configuration.api_key['XPartnerMerchantId'] = Cashfree.XPartnerMerchantId + configuration.api_key['XPartnerKey'] = Cashfree.XPartnerKey + api_client.configuration = configuration + _params = locals() + + _all_params = [ + 'x_api_version', + 'create_order_request', + 'x_request_id', + 'x_idempotency_key' + ] + _all_params.extend( + [ + 'async_req', + '_return_http_data_only', + '_preload_content', + '_request_timeout', + '_request_auth', + '_content_type', + '_headers' + ] + ) + + # validate the arguments + for _key, _val in _params['kwargs'].items(): + if _key not in _all_params: + raise ApiTypeError( + "Got an unexpected keyword argument '%s'" + " to method PGCreateOrder" % _key + ) + _params[_key] = _val + del _params['kwargs'] + + _collection_formats = {} + + # process the path parameters + _path_params = {} + + # process the query parameters + _query_params = [] + # process the header parameters + _header_params = dict(_params.get('_headers', {})) + if x_request_id: + _header_params["x-request-id"] = x_request_id + + if x_api_version: + _header_params["x-api-version"] = x_api_version + + if x_idempotency_key: + _header_params["x-idempotency-key"] = x_idempotency_key + _header_params["x-sdk-platform"] = "pythonsdk-3.0.1" + + # process the form parameters + _form_params = [] + _files = {} + # process the body parameter + _body_params = None + if _params['create_order_request'] is not None: + _body_params = _params['create_order_request'] + + # set the HTTP header `Accept` + _header_params['Accept'] = api_client.select_header_accept( + ['application/json']) # noqa: E501 + + # set the HTTP header `Content-Type` + _content_types_list = _params.get('_content_type', + api_client.select_header_content_type( + ['application/json'])) + if _content_types_list: + _header_params['Content-Type'] = _content_types_list + + # authentication setting + _auth_settings = ['XPartnerAPIKey', 'XClientSecret', 'XPartnerMerchantID', 'XClientID', 'XClientSignatureHeader'] # noqa: E501 + + _response_types_map = { + '200': "OrderEntity", + '400': "BadRequestError", + '401': "AuthenticationError", + '404': "ApiError404", + '409': "ApiError409", + '422': "IdempotencyError", + '429': "RateLimitError", + '500': "ApiError", + } + + return api_client.call_api( + '/orders', 'POST', + _path_params, + _query_params, + _header_params, + body=_body_params, + post_params=_form_params, + files=_files, + response_types_map=_response_types_map, + auth_settings=_auth_settings, + async_req=_params.get('async_req'), + _return_http_data_only=_params.get('_return_http_data_only'), # noqa: E501 + _preload_content=_params.get('_preload_content', True), + _request_timeout=_params.get('_request_timeout'), + collection_formats=_collection_formats, + _request_auth=_params.get('_request_auth')) + @validate_arguments + def PGFetchOrder(self, x_api_version : Annotated[StrictStr, Field(..., description="API version to be used. Format is in YYYY-MM-DD")] = None, order_id : Annotated[StrictStr, Field(..., description="The id which uniquely identifies your order")] = None, x_request_id : Annotated[Optional[StrictStr], Field(description="Request id for the API call. Can be used to resolve tech issues. Communicate this in your tech related queries to cashfree")] = None, x_idempotency_key : Annotated[Optional[StrictStr], Field(description="Idempotency works by saving the resulting status code and body of the first request made for any given idempotency key, regardless of whether it succeeded or failed. Subsequent requests with the same key return the same result, including 500 errors. Currently supported on all POST calls that uses x-client-id & x-client-secret. To use enable, pass x-idempotency-key in the request header. The value of this header must be unique to each operation you are trying to do. One example can be to use the same order_id that you pass while creating orders ")] = None, **kwargs) -> ApiResponse: # noqa: E501 + """Get Order # noqa: E501 + + Use this API to fetch the order that was created at Cashfree's using the `order_id`. ## When to use this API - To check the status of your order - Once the order is PAID - Once your customer returns to `return_url` # noqa: E501 + This method makes a synchronous HTTP request by default. To make an + asynchronous HTTP request, please pass async_req=True + + >>> thread = api.PGFetchOrder_with_http_info(x_api_version, order_id, x_request_id, x_idempotency_key, async_req=True) + >>> result = thread.get() + + :param x_api_version: API version to be used. Format is in YYYY-MM-DD (required) + :type x_api_version: str + :param order_id: The id which uniquely identifies your order (required) + :type order_id: str + :param x_request_id: Request id for the API call. Can be used to resolve tech issues. Communicate this in your tech related queries to cashfree + :type x_request_id: str + :param x_idempotency_key: Idempotency works by saving the resulting status code and body of the first request made for any given idempotency key, regardless of whether it succeeded or failed. Subsequent requests with the same key return the same result, including 500 errors. Currently supported on all POST calls that uses x-client-id & x-client-secret. To use enable, pass x-idempotency-key in the request header. The value of this header must be unique to each operation you are trying to do. One example can be to use the same order_id that you pass while creating orders + :type x_idempotency_key: str + :param async_req: Whether to execute the request asynchronously. + :type async_req: bool, optional + :param _preload_content: if False, the ApiResponse.data will + be set to none and raw_data will store the + HTTP response body without reading/decoding. + Default is True. + :type _preload_content: bool, optional + :param _return_http_data_only: response data instead of ApiResponse + object with status code, headers, etc + :type _return_http_data_only: bool, optional + :param _request_timeout: timeout setting for this request. If one + number provided, it will be total request + timeout. It can also be a pair (tuple) of + (connection, read) timeouts. + :param _request_auth: set to override the auth_settings for an a single + request; this effectively ignores the authentication + in the spec for a single request. + :type _request_auth: dict, optional + :type _content_type: string, optional: force content-type for the request + :return: Returns the result object. + If the method is called asynchronously, + returns the request thread. + :rtype: tuple(OrderEntity, status_code(int), headers(HTTPHeaderDict)) + """ + + api_client = ApiClient.get_default() + host = "https://api.cashfree.com/pg" + if Cashfree.XEnvironment == CFEnvironment.SANDBOX: + host = "https://sandbox.cashfree.com/pg" + configuration = Configuration( + host = host + ) + configuration.api_key['XClientID'] = Cashfree.XClientId + configuration.api_key['XClientSecret'] = Cashfree.XClientSecret + configuration.api_key['XClientSignature'] = Cashfree.XClientSignature + configuration.api_key['XPartnerMerchantId'] = Cashfree.XPartnerMerchantId + configuration.api_key['XPartnerKey'] = Cashfree.XPartnerKey + api_client.configuration = configuration + _params = locals() + + _all_params = [ + 'x_api_version', + 'order_id', + 'x_request_id', + 'x_idempotency_key' + ] + _all_params.extend( + [ + 'async_req', + '_return_http_data_only', + '_preload_content', + '_request_timeout', + '_request_auth', + '_content_type', + '_headers' + ] + ) + + # validate the arguments + for _key, _val in _params['kwargs'].items(): + if _key not in _all_params: + raise ApiTypeError( + "Got an unexpected keyword argument '%s'" + " to method PGFetchOrder" % _key + ) + _params[_key] = _val + del _params['kwargs'] + + _collection_formats = {} + + # process the path parameters + _path_params = {} + if _params['order_id']: + _path_params['order_id'] = _params['order_id'] + + + # process the query parameters + _query_params = [] + # process the header parameters + _header_params = dict(_params.get('_headers', {})) + if x_request_id: + _header_params["x-request-id"] = x_request_id + + if x_api_version: + _header_params["x-api-version"] = x_api_version + + if x_idempotency_key: + _header_params["x-idempotency-key"] = x_idempotency_key + _header_params["x-sdk-platform"] = "pythonsdk-3.0.1" + + # process the form parameters + _form_params = [] + _files = {} + # process the body parameter + _body_params = None + # set the HTTP header `Accept` + _header_params['Accept'] = api_client.select_header_accept( + ['application/json']) # noqa: E501 + + # authentication setting + _auth_settings = ['XPartnerAPIKey', 'XClientSecret', 'XPartnerMerchantID', 'XClientID', 'XClientSignatureHeader'] # noqa: E501 + + _response_types_map = { + '200': "OrderEntity", + '400': "BadRequestError", + '401': "AuthenticationError", + '404': "ApiError404", + '409': "ApiError409", + '422': "IdempotencyError", + '429': "RateLimitError", + '500': "ApiError", + } + + return api_client.call_api( + '/orders/{order_id}', 'GET', + _path_params, + _query_params, + _header_params, + body=_body_params, + post_params=_form_params, + files=_files, + response_types_map=_response_types_map, + auth_settings=_auth_settings, + async_req=_params.get('async_req'), + _return_http_data_only=_params.get('_return_http_data_only'), # noqa: E501 + _preload_content=_params.get('_preload_content', True), + _request_timeout=_params.get('_request_timeout'), + collection_formats=_collection_formats, + _request_auth=_params.get('_request_auth')) + + @validate_arguments + def PGFetchRecon(self, x_api_version : Annotated[StrictStr, Field(..., description="API version to be used. Format is in YYYY-MM-DD")] = None, fetch_recon_request : Annotated[FetchReconRequest, Field(..., description="Request Body for the reconciliation")] = None, content_type : Annotated[Optional[StrictStr], Field(description="application/json")] = None, x_request_id : Annotated[Optional[StrictStr], Field(description="Request id for the API call. Can be used to resolve tech issues. Communicate this in your tech related queries to cashfree")] = None, x_idempotency_key : Annotated[Optional[StrictStr], Field(description="Idempotency works by saving the resulting status code and body of the first request made for any given idempotency key, regardless of whether it succeeded or failed. Subsequent requests with the same key return the same result, including 500 errors. Currently supported on all POST calls that uses x-client-id & x-client-secret. To use enable, pass x-idempotency-key in the request header. The value of this header must be unique to each operation you are trying to do. One example can be to use the same order_id that you pass while creating orders ")] = None, accept : Annotated[Optional[StrictStr], Field(description="application/json")] = None, **kwargs) -> ApiResponse: # noqa: E501 + """PG Reconciliation # noqa: E501 + + - Use this API to get the payment gateway reconciliation details with date range. - It will have events for your payment account # noqa: E501 + This method makes a synchronous HTTP request by default. To make an + asynchronous HTTP request, please pass async_req=True + + >>> thread = api.PGFetchRecon_with_http_info(x_api_version, fetch_recon_request, content_type, x_request_id, x_idempotency_key, accept, async_req=True) + >>> result = thread.get() + + :param x_api_version: API version to be used. Format is in YYYY-MM-DD (required) + :type x_api_version: str + :param fetch_recon_request: Request Body for the reconciliation (required) + :type fetch_recon_request: FetchReconRequest + :param content_type: application/json + :type content_type: str + :param x_request_id: Request id for the API call. Can be used to resolve tech issues. Communicate this in your tech related queries to cashfree + :type x_request_id: str + :param x_idempotency_key: Idempotency works by saving the resulting status code and body of the first request made for any given idempotency key, regardless of whether it succeeded or failed. Subsequent requests with the same key return the same result, including 500 errors. Currently supported on all POST calls that uses x-client-id & x-client-secret. To use enable, pass x-idempotency-key in the request header. The value of this header must be unique to each operation you are trying to do. One example can be to use the same order_id that you pass while creating orders + :type x_idempotency_key: str + :param accept: application/json + :type accept: str + :param async_req: Whether to execute the request asynchronously. + :type async_req: bool, optional + :param _preload_content: if False, the ApiResponse.data will + be set to none and raw_data will store the + HTTP response body without reading/decoding. + Default is True. + :type _preload_content: bool, optional + :param _return_http_data_only: response data instead of ApiResponse + object with status code, headers, etc + :type _return_http_data_only: bool, optional + :param _request_timeout: timeout setting for this request. If one + number provided, it will be total request + timeout. It can also be a pair (tuple) of + (connection, read) timeouts. + :param _request_auth: set to override the auth_settings for an a single + request; this effectively ignores the authentication + in the spec for a single request. + :type _request_auth: dict, optional + :type _content_type: string, optional: force content-type for the request + :return: Returns the result object. + If the method is called asynchronously, + returns the request thread. + :rtype: tuple(ReconEntity, status_code(int), headers(HTTPHeaderDict)) + """ + + api_client = ApiClient.get_default() + host = "https://api.cashfree.com/pg" + if Cashfree.XEnvironment == CFEnvironment.SANDBOX: + host = "https://sandbox.cashfree.com/pg" + configuration = Configuration( + host = host + ) + configuration.api_key['XClientID'] = Cashfree.XClientId + configuration.api_key['XClientSecret'] = Cashfree.XClientSecret + configuration.api_key['XClientSignature'] = Cashfree.XClientSignature + configuration.api_key['XPartnerMerchantId'] = Cashfree.XPartnerMerchantId + configuration.api_key['XPartnerKey'] = Cashfree.XPartnerKey + api_client.configuration = configuration + _params = locals() + + _all_params = [ + 'x_api_version', + 'fetch_recon_request', + 'content_type', + 'x_request_id', + 'x_idempotency_key', + 'accept' + ] + _all_params.extend( + [ + 'async_req', + '_return_http_data_only', + '_preload_content', + '_request_timeout', + '_request_auth', + '_content_type', + '_headers' + ] + ) + + # validate the arguments + for _key, _val in _params['kwargs'].items(): + if _key not in _all_params: + raise ApiTypeError( + "Got an unexpected keyword argument '%s'" + " to method PGFetchRecon" % _key + ) + _params[_key] = _val + del _params['kwargs'] + + _collection_formats = {} + + # process the path parameters + _path_params = {} + + # process the query parameters + _query_params = [] + # process the header parameters + _header_params = dict(_params.get('_headers', {})) + if x_request_id: + _header_params["x-request-id"] = x_request_id + + if x_api_version: + _header_params["x-api-version"] = x_api_version + + if x_idempotency_key: + _header_params["x-idempotency-key"] = x_idempotency_key + _header_params["x-sdk-platform"] = "pythonsdk-3.0.1" + + # process the form parameters + _form_params = [] + _files = {} + # process the body parameter + _body_params = None + if _params['fetch_recon_request'] is not None: + _body_params = _params['fetch_recon_request'] + + # set the HTTP header `Accept` + _header_params['Accept'] = api_client.select_header_accept( + ['application/json']) # noqa: E501 + + # set the HTTP header `Content-Type` + _content_types_list = _params.get('_content_type', + api_client.select_header_content_type( + ['application/json'])) + if _content_types_list: + _header_params['Content-Type'] = _content_types_list + + # authentication setting + _auth_settings = ['XPartnerAPIKey', 'XClientSecret', 'XPartnerMerchantID', 'XClientID', 'XClientSignatureHeader'] # noqa: E501 + + _response_types_map = { + '200': "ReconEntity", + '400': "BadRequestError", + '401': "AuthenticationError", + '404': "ApiError404", + '409': "ApiError409", + '422': "IdempotencyError", + '429': "RateLimitError", + '500': "ApiError", + } + + return api_client.call_api( + '/recon', 'POST', + _path_params, + _query_params, + _header_params, + body=_body_params, + post_params=_form_params, + files=_files, + response_types_map=_response_types_map, + auth_settings=_auth_settings, + async_req=_params.get('async_req'), + _return_http_data_only=_params.get('_return_http_data_only'), # noqa: E501 + _preload_content=_params.get('_preload_content', True), + _request_timeout=_params.get('_request_timeout'), + collection_formats=_collection_formats, + _request_auth=_params.get('_request_auth')) + + @validate_arguments + def PGCancelLink(self, x_api_version : Annotated[StrictStr, Field(..., description="API version to be used. Format is in YYYY-MM-DD")] = None, link_id : Annotated[StrictStr, Field(..., description="The payment link ID for which you want to view the details.")] = None, x_request_id : Annotated[Optional[StrictStr], Field(description="Request id for the API call. Can be used to resolve tech issues. Communicate this in your tech related queries to cashfree")] = None, x_idempotency_key : Annotated[Optional[StrictStr], Field(description="Idempotency works by saving the resulting status code and body of the first request made for any given idempotency key, regardless of whether it succeeded or failed. Subsequent requests with the same key return the same result, including 500 errors. Currently supported on all POST calls that uses x-client-id & x-client-secret. To use enable, pass x-idempotency-key in the request header. The value of this header must be unique to each operation you are trying to do. One example can be to use the same order_id that you pass while creating orders ")] = None, **kwargs) -> ApiResponse: # noqa: E501 + """Cancel Payment Link # noqa: E501 + + Use this API to cancel a payment link. No further payments can be done against a cancelled link. Only a link in ACTIVE status can be cancelled. # noqa: E501 + This method makes a synchronous HTTP request by default. To make an + asynchronous HTTP request, please pass async_req=True + + >>> thread = api.PGCancelLink_with_http_info(x_api_version, link_id, x_request_id, x_idempotency_key, async_req=True) + >>> result = thread.get() + + :param x_api_version: API version to be used. Format is in YYYY-MM-DD (required) + :type x_api_version: str + :param link_id: The payment link ID for which you want to view the details. (required) + :type link_id: str + :param x_request_id: Request id for the API call. Can be used to resolve tech issues. Communicate this in your tech related queries to cashfree + :type x_request_id: str + :param x_idempotency_key: Idempotency works by saving the resulting status code and body of the first request made for any given idempotency key, regardless of whether it succeeded or failed. Subsequent requests with the same key return the same result, including 500 errors. Currently supported on all POST calls that uses x-client-id & x-client-secret. To use enable, pass x-idempotency-key in the request header. The value of this header must be unique to each operation you are trying to do. One example can be to use the same order_id that you pass while creating orders + :type x_idempotency_key: str + :param async_req: Whether to execute the request asynchronously. + :type async_req: bool, optional + :param _preload_content: if False, the ApiResponse.data will + be set to none and raw_data will store the + HTTP response body without reading/decoding. + Default is True. + :type _preload_content: bool, optional + :param _return_http_data_only: response data instead of ApiResponse + object with status code, headers, etc + :type _return_http_data_only: bool, optional + :param _request_timeout: timeout setting for this request. If one + number provided, it will be total request + timeout. It can also be a pair (tuple) of + (connection, read) timeouts. + :param _request_auth: set to override the auth_settings for an a single + request; this effectively ignores the authentication + in the spec for a single request. + :type _request_auth: dict, optional + :type _content_type: string, optional: force content-type for the request + :return: Returns the result object. + If the method is called asynchronously, + returns the request thread. + :rtype: tuple(LinkEntity, status_code(int), headers(HTTPHeaderDict)) + """ + + api_client = ApiClient.get_default() + host = "https://api.cashfree.com/pg" + if Cashfree.XEnvironment == CFEnvironment.SANDBOX: + host = "https://sandbox.cashfree.com/pg" + configuration = Configuration( + host = host + ) + configuration.api_key['XClientID'] = Cashfree.XClientId + configuration.api_key['XClientSecret'] = Cashfree.XClientSecret + configuration.api_key['XClientSignature'] = Cashfree.XClientSignature + configuration.api_key['XPartnerMerchantId'] = Cashfree.XPartnerMerchantId + configuration.api_key['XPartnerKey'] = Cashfree.XPartnerKey + api_client.configuration = configuration + _params = locals() + + _all_params = [ + 'x_api_version', + 'link_id', + 'x_request_id', + 'x_idempotency_key' + ] + _all_params.extend( + [ + 'async_req', + '_return_http_data_only', + '_preload_content', + '_request_timeout', + '_request_auth', + '_content_type', + '_headers' + ] + ) + + # validate the arguments + for _key, _val in _params['kwargs'].items(): + if _key not in _all_params: + raise ApiTypeError( + "Got an unexpected keyword argument '%s'" + " to method PGCancelLink" % _key + ) + _params[_key] = _val + del _params['kwargs'] + + _collection_formats = {} + + # process the path parameters + _path_params = {} + if _params['link_id']: + _path_params['link_id'] = _params['link_id'] + + + # process the query parameters + _query_params = [] + # process the header parameters + _header_params = dict(_params.get('_headers', {})) + if x_request_id: + _header_params["x-request-id"] = x_request_id + + if x_api_version: + _header_params["x-api-version"] = x_api_version + + if x_idempotency_key: + _header_params["x-idempotency-key"] = x_idempotency_key + _header_params["x-sdk-platform"] = "pythonsdk-3.0.1" + + # process the form parameters + _form_params = [] + _files = {} + # process the body parameter + _body_params = None + # set the HTTP header `Accept` + _header_params['Accept'] = api_client.select_header_accept( + ['application/json']) # noqa: E501 + + # authentication setting + _auth_settings = ['XPartnerAPIKey', 'XClientSecret', 'XPartnerMerchantID', 'XClientID', 'XClientSignatureHeader'] # noqa: E501 + + _response_types_map = { + '200': "LinkEntity", + '400': "BadRequestError", + '401': "AuthenticationError", + '404': "ApiError404", + '409': "ApiError409", + '422': "IdempotencyError", + '429': "RateLimitError", + '500': "ApiError", + } + + return api_client.call_api( + '/links/{link_id}/cancel', 'POST', + _path_params, + _query_params, + _header_params, + body=_body_params, + post_params=_form_params, + files=_files, + response_types_map=_response_types_map, + auth_settings=_auth_settings, + async_req=_params.get('async_req'), + _return_http_data_only=_params.get('_return_http_data_only'), # noqa: E501 + _preload_content=_params.get('_preload_content', True), + _request_timeout=_params.get('_request_timeout'), + collection_formats=_collection_formats, + _request_auth=_params.get('_request_auth')) + @validate_arguments + def PGCreateLink(self, x_api_version : Annotated[StrictStr, Field(..., description="API version to be used. Format is in YYYY-MM-DD")] = None, create_link_request : Annotated[CreateLinkRequest, Field(..., description="Request Body to Create Payment Links")] = None, x_request_id : Annotated[Optional[StrictStr], Field(description="Request id for the API call. Can be used to resolve tech issues. Communicate this in your tech related queries to cashfree")] = None, x_idempotency_key : Annotated[Optional[StrictStr], Field(description="Idempotency works by saving the resulting status code and body of the first request made for any given idempotency key, regardless of whether it succeeded or failed. Subsequent requests with the same key return the same result, including 500 errors. Currently supported on all POST calls that uses x-client-id & x-client-secret. To use enable, pass x-idempotency-key in the request header. The value of this header must be unique to each operation you are trying to do. One example can be to use the same order_id that you pass while creating orders ")] = None, **kwargs) -> ApiResponse: # noqa: E501 + """Create Payment Link # noqa: E501 + + Use this API to create a new payment link. The created payment link url will be available in the API response parameter link_url. # noqa: E501 + This method makes a synchronous HTTP request by default. To make an + asynchronous HTTP request, please pass async_req=True + + >>> thread = api.PGCreateLink_with_http_info(x_api_version, create_link_request, x_request_id, x_idempotency_key, async_req=True) + >>> result = thread.get() + + :param x_api_version: API version to be used. Format is in YYYY-MM-DD (required) + :type x_api_version: str + :param create_link_request: Request Body to Create Payment Links (required) + :type create_link_request: CreateLinkRequest + :param x_request_id: Request id for the API call. Can be used to resolve tech issues. Communicate this in your tech related queries to cashfree + :type x_request_id: str + :param x_idempotency_key: Idempotency works by saving the resulting status code and body of the first request made for any given idempotency key, regardless of whether it succeeded or failed. Subsequent requests with the same key return the same result, including 500 errors. Currently supported on all POST calls that uses x-client-id & x-client-secret. To use enable, pass x-idempotency-key in the request header. The value of this header must be unique to each operation you are trying to do. One example can be to use the same order_id that you pass while creating orders + :type x_idempotency_key: str + :param async_req: Whether to execute the request asynchronously. + :type async_req: bool, optional + :param _preload_content: if False, the ApiResponse.data will + be set to none and raw_data will store the + HTTP response body without reading/decoding. + Default is True. + :type _preload_content: bool, optional + :param _return_http_data_only: response data instead of ApiResponse + object with status code, headers, etc + :type _return_http_data_only: bool, optional + :param _request_timeout: timeout setting for this request. If one + number provided, it will be total request + timeout. It can also be a pair (tuple) of + (connection, read) timeouts. + :param _request_auth: set to override the auth_settings for an a single + request; this effectively ignores the authentication + in the spec for a single request. + :type _request_auth: dict, optional + :type _content_type: string, optional: force content-type for the request + :return: Returns the result object. + If the method is called asynchronously, + returns the request thread. + :rtype: tuple(LinkEntity, status_code(int), headers(HTTPHeaderDict)) + """ + + api_client = ApiClient.get_default() + host = "https://api.cashfree.com/pg" + if Cashfree.XEnvironment == CFEnvironment.SANDBOX: + host = "https://sandbox.cashfree.com/pg" + configuration = Configuration( + host = host + ) + configuration.api_key['XClientID'] = Cashfree.XClientId + configuration.api_key['XClientSecret'] = Cashfree.XClientSecret + configuration.api_key['XClientSignature'] = Cashfree.XClientSignature + configuration.api_key['XPartnerMerchantId'] = Cashfree.XPartnerMerchantId + configuration.api_key['XPartnerKey'] = Cashfree.XPartnerKey + api_client.configuration = configuration + _params = locals() + + _all_params = [ + 'x_api_version', + 'create_link_request', + 'x_request_id', + 'x_idempotency_key' + ] + _all_params.extend( + [ + 'async_req', + '_return_http_data_only', + '_preload_content', + '_request_timeout', + '_request_auth', + '_content_type', + '_headers' + ] + ) + + # validate the arguments + for _key, _val in _params['kwargs'].items(): + if _key not in _all_params: + raise ApiTypeError( + "Got an unexpected keyword argument '%s'" + " to method PGCreateLink" % _key + ) + _params[_key] = _val + del _params['kwargs'] + + _collection_formats = {} + + # process the path parameters + _path_params = {} + + # process the query parameters + _query_params = [] + # process the header parameters + _header_params = dict(_params.get('_headers', {})) + if x_request_id: + _header_params["x-request-id"] = x_request_id + + if x_api_version: + _header_params["x-api-version"] = x_api_version + + if x_idempotency_key: + _header_params["x-idempotency-key"] = x_idempotency_key + _header_params["x-sdk-platform"] = "pythonsdk-3.0.1" + + # process the form parameters + _form_params = [] + _files = {} + # process the body parameter + _body_params = None + if _params['create_link_request'] is not None: + _body_params = _params['create_link_request'] + + # set the HTTP header `Accept` + _header_params['Accept'] = api_client.select_header_accept( + ['application/json']) # noqa: E501 + + # set the HTTP header `Content-Type` + _content_types_list = _params.get('_content_type', + api_client.select_header_content_type( + ['application/json'])) + if _content_types_list: + _header_params['Content-Type'] = _content_types_list + + # authentication setting + _auth_settings = ['XPartnerAPIKey', 'XClientSecret', 'XPartnerMerchantID', 'XClientID', 'XClientSignatureHeader'] # noqa: E501 + + _response_types_map = { + '200': "LinkEntity", + '400': "BadRequestError", + '401': "AuthenticationError", + '404': "ApiError404", + '409': "ApiError409", + '422': "IdempotencyError", + '429': "RateLimitError", + '500': "ApiError", + } + + return api_client.call_api( + '/links', 'POST', + _path_params, + _query_params, + _header_params, + body=_body_params, + post_params=_form_params, + files=_files, + response_types_map=_response_types_map, + auth_settings=_auth_settings, + async_req=_params.get('async_req'), + _return_http_data_only=_params.get('_return_http_data_only'), # noqa: E501 + _preload_content=_params.get('_preload_content', True), + _request_timeout=_params.get('_request_timeout'), + collection_formats=_collection_formats, + _request_auth=_params.get('_request_auth')) + @validate_arguments + def PGFetchLink(self, x_api_version : Annotated[StrictStr, Field(..., description="API version to be used. Format is in YYYY-MM-DD")] = None, link_id : Annotated[StrictStr, Field(..., description="The payment link ID for which you want to view the details.")] = None, x_request_id : Annotated[Optional[StrictStr], Field(description="Request id for the API call. Can be used to resolve tech issues. Communicate this in your tech related queries to cashfree")] = None, x_idempotency_key : Annotated[Optional[StrictStr], Field(description="Idempotency works by saving the resulting status code and body of the first request made for any given idempotency key, regardless of whether it succeeded or failed. Subsequent requests with the same key return the same result, including 500 errors. Currently supported on all POST calls that uses x-client-id & x-client-secret. To use enable, pass x-idempotency-key in the request header. The value of this header must be unique to each operation you are trying to do. One example can be to use the same order_id that you pass while creating orders ")] = None, **kwargs) -> ApiResponse: # noqa: E501 + """Fetch Payment Link Details # noqa: E501 + + Use this API to view all details and status of a payment link. # noqa: E501 + This method makes a synchronous HTTP request by default. To make an + asynchronous HTTP request, please pass async_req=True + + >>> thread = api.PGFetchLink_with_http_info(x_api_version, link_id, x_request_id, x_idempotency_key, async_req=True) + >>> result = thread.get() + + :param x_api_version: API version to be used. Format is in YYYY-MM-DD (required) + :type x_api_version: str + :param link_id: The payment link ID for which you want to view the details. (required) + :type link_id: str + :param x_request_id: Request id for the API call. Can be used to resolve tech issues. Communicate this in your tech related queries to cashfree + :type x_request_id: str + :param x_idempotency_key: Idempotency works by saving the resulting status code and body of the first request made for any given idempotency key, regardless of whether it succeeded or failed. Subsequent requests with the same key return the same result, including 500 errors. Currently supported on all POST calls that uses x-client-id & x-client-secret. To use enable, pass x-idempotency-key in the request header. The value of this header must be unique to each operation you are trying to do. One example can be to use the same order_id that you pass while creating orders + :type x_idempotency_key: str + :param async_req: Whether to execute the request asynchronously. + :type async_req: bool, optional + :param _preload_content: if False, the ApiResponse.data will + be set to none and raw_data will store the + HTTP response body without reading/decoding. + Default is True. + :type _preload_content: bool, optional + :param _return_http_data_only: response data instead of ApiResponse + object with status code, headers, etc + :type _return_http_data_only: bool, optional + :param _request_timeout: timeout setting for this request. If one + number provided, it will be total request + timeout. It can also be a pair (tuple) of + (connection, read) timeouts. + :param _request_auth: set to override the auth_settings for an a single + request; this effectively ignores the authentication + in the spec for a single request. + :type _request_auth: dict, optional + :type _content_type: string, optional: force content-type for the request + :return: Returns the result object. + If the method is called asynchronously, + returns the request thread. + :rtype: tuple(LinkEntity, status_code(int), headers(HTTPHeaderDict)) + """ + + api_client = ApiClient.get_default() + host = "https://api.cashfree.com/pg" + if Cashfree.XEnvironment == CFEnvironment.SANDBOX: + host = "https://sandbox.cashfree.com/pg" + configuration = Configuration( + host = host + ) + configuration.api_key['XClientID'] = Cashfree.XClientId + configuration.api_key['XClientSecret'] = Cashfree.XClientSecret + configuration.api_key['XClientSignature'] = Cashfree.XClientSignature + configuration.api_key['XPartnerMerchantId'] = Cashfree.XPartnerMerchantId + configuration.api_key['XPartnerKey'] = Cashfree.XPartnerKey + api_client.configuration = configuration + _params = locals() + + _all_params = [ + 'x_api_version', + 'link_id', + 'x_request_id', + 'x_idempotency_key' + ] + _all_params.extend( + [ + 'async_req', + '_return_http_data_only', + '_preload_content', + '_request_timeout', + '_request_auth', + '_content_type', + '_headers' + ] + ) + + # validate the arguments + for _key, _val in _params['kwargs'].items(): + if _key not in _all_params: + raise ApiTypeError( + "Got an unexpected keyword argument '%s'" + " to method PGFetchLink" % _key + ) + _params[_key] = _val + del _params['kwargs'] + + _collection_formats = {} + + # process the path parameters + _path_params = {} + if _params['link_id']: + _path_params['link_id'] = _params['link_id'] + + + # process the query parameters + _query_params = [] + # process the header parameters + _header_params = dict(_params.get('_headers', {})) + if x_request_id: + _header_params["x-request-id"] = x_request_id + + if x_api_version: + _header_params["x-api-version"] = x_api_version + + if x_idempotency_key: + _header_params["x-idempotency-key"] = x_idempotency_key + _header_params["x-sdk-platform"] = "pythonsdk-3.0.1" + + # process the form parameters + _form_params = [] + _files = {} + # process the body parameter + _body_params = None + # set the HTTP header `Accept` + _header_params['Accept'] = api_client.select_header_accept( + ['application/json']) # noqa: E501 + + # authentication setting + _auth_settings = ['XPartnerAPIKey', 'XClientSecret', 'XPartnerMerchantID', 'XClientID', 'XClientSignatureHeader'] # noqa: E501 + + _response_types_map = { + '200': "LinkEntity", + '400': "BadRequestError", + '401': "AuthenticationError", + '404': "ApiError404", + '409': "ApiError409", + '422': "IdempotencyError", + '429': "RateLimitError", + '500': "ApiError", + '502': "ApiError502", + } + + return api_client.call_api( + '/links/{link_id}', 'GET', + _path_params, + _query_params, + _header_params, + body=_body_params, + post_params=_form_params, + files=_files, + response_types_map=_response_types_map, + auth_settings=_auth_settings, + async_req=_params.get('async_req'), + _return_http_data_only=_params.get('_return_http_data_only'), # noqa: E501 + _preload_content=_params.get('_preload_content', True), + _request_timeout=_params.get('_request_timeout'), + collection_formats=_collection_formats, + _request_auth=_params.get('_request_auth')) + @validate_arguments + def PGLinkFetchOrders(self, x_api_version : Annotated[StrictStr, Field(..., description="API version to be used. Format is in YYYY-MM-DD")] = None, link_id : Annotated[StrictStr, Field(..., description="The payment link ID for which you want to view the details.")] = None, x_request_id : Annotated[Optional[StrictStr], Field(description="Request id for the API call. Can be used to resolve tech issues. Communicate this in your tech related queries to cashfree")] = None, x_idempotency_key : Annotated[Optional[StrictStr], Field(description="Idempotency works by saving the resulting status code and body of the first request made for any given idempotency key, regardless of whether it succeeded or failed. Subsequent requests with the same key return the same result, including 500 errors. Currently supported on all POST calls that uses x-client-id & x-client-secret. To use enable, pass x-idempotency-key in the request header. The value of this header must be unique to each operation you are trying to do. One example can be to use the same order_id that you pass while creating orders ")] = None, **kwargs) -> ApiResponse: # noqa: E501 + """Get Orders for a Payment Link # noqa: E501 + + Use this API to view all order details for a payment link. # noqa: E501 + This method makes a synchronous HTTP request by default. To make an + asynchronous HTTP request, please pass async_req=True + + >>> thread = api.PGLinkFetchOrders_with_http_info(x_api_version, link_id, x_request_id, x_idempotency_key, async_req=True) + >>> result = thread.get() + + :param x_api_version: API version to be used. Format is in YYYY-MM-DD (required) + :type x_api_version: str + :param link_id: The payment link ID for which you want to view the details. (required) + :type link_id: str + :param x_request_id: Request id for the API call. Can be used to resolve tech issues. Communicate this in your tech related queries to cashfree + :type x_request_id: str + :param x_idempotency_key: Idempotency works by saving the resulting status code and body of the first request made for any given idempotency key, regardless of whether it succeeded or failed. Subsequent requests with the same key return the same result, including 500 errors. Currently supported on all POST calls that uses x-client-id & x-client-secret. To use enable, pass x-idempotency-key in the request header. The value of this header must be unique to each operation you are trying to do. One example can be to use the same order_id that you pass while creating orders + :type x_idempotency_key: str + :param async_req: Whether to execute the request asynchronously. + :type async_req: bool, optional + :param _preload_content: if False, the ApiResponse.data will + be set to none and raw_data will store the + HTTP response body without reading/decoding. + Default is True. + :type _preload_content: bool, optional + :param _return_http_data_only: response data instead of ApiResponse + object with status code, headers, etc + :type _return_http_data_only: bool, optional + :param _request_timeout: timeout setting for this request. If one + number provided, it will be total request + timeout. It can also be a pair (tuple) of + (connection, read) timeouts. + :param _request_auth: set to override the auth_settings for an a single + request; this effectively ignores the authentication + in the spec for a single request. + :type _request_auth: dict, optional + :type _content_type: string, optional: force content-type for the request + :return: Returns the result object. + If the method is called asynchronously, + returns the request thread. + :rtype: tuple(List[OrderEntity], status_code(int), headers(HTTPHeaderDict)) + """ + + api_client = ApiClient.get_default() + host = "https://api.cashfree.com/pg" + if Cashfree.XEnvironment == CFEnvironment.SANDBOX: + host = "https://sandbox.cashfree.com/pg" + configuration = Configuration( + host = host + ) + configuration.api_key['XClientID'] = Cashfree.XClientId + configuration.api_key['XClientSecret'] = Cashfree.XClientSecret + configuration.api_key['XClientSignature'] = Cashfree.XClientSignature + configuration.api_key['XPartnerMerchantId'] = Cashfree.XPartnerMerchantId + configuration.api_key['XPartnerKey'] = Cashfree.XPartnerKey + api_client.configuration = configuration + _params = locals() + + _all_params = [ + 'x_api_version', + 'link_id', + 'x_request_id', + 'x_idempotency_key' + ] + _all_params.extend( + [ + 'async_req', + '_return_http_data_only', + '_preload_content', + '_request_timeout', + '_request_auth', + '_content_type', + '_headers' + ] + ) + + # validate the arguments + for _key, _val in _params['kwargs'].items(): + if _key not in _all_params: + raise ApiTypeError( + "Got an unexpected keyword argument '%s'" + " to method PGLinkFetchOrders" % _key + ) + _params[_key] = _val + del _params['kwargs'] + + _collection_formats = {} + + # process the path parameters + _path_params = {} + if _params['link_id']: + _path_params['link_id'] = _params['link_id'] + + + # process the query parameters + _query_params = [] + # process the header parameters + _header_params = dict(_params.get('_headers', {})) + if x_request_id: + _header_params["x-request-id"] = x_request_id + + if x_api_version: + _header_params["x-api-version"] = x_api_version + + if x_idempotency_key: + _header_params["x-idempotency-key"] = x_idempotency_key + _header_params["x-sdk-platform"] = "pythonsdk-3.0.1" + + # process the form parameters + _form_params = [] + _files = {} + # process the body parameter + _body_params = None + # set the HTTP header `Accept` + _header_params['Accept'] = api_client.select_header_accept( + ['application/json']) # noqa: E501 + + # authentication setting + _auth_settings = ['XPartnerAPIKey', 'XClientSecret', 'XPartnerMerchantID', 'XClientID', 'XClientSignatureHeader'] # noqa: E501 + + _response_types_map = { + '200': "List[OrderEntity]", + '400': "BadRequestError", + '401': "AuthenticationError", + '404': "ApiError404", + '409': "ApiError409", + '422': "IdempotencyError", + '429': "RateLimitError", + '500': "ApiError", + } + + return api_client.call_api( + '/links/{link_id}/orders', 'GET', + _path_params, + _query_params, + _header_params, + body=_body_params, + post_params=_form_params, + files=_files, + response_types_map=_response_types_map, + auth_settings=_auth_settings, + async_req=_params.get('async_req'), + _return_http_data_only=_params.get('_return_http_data_only'), # noqa: E501 + _preload_content=_params.get('_preload_content', True), + _request_timeout=_params.get('_request_timeout'), + collection_formats=_collection_formats, + _request_auth=_params.get('_request_auth')) + + @validate_arguments + def PGAuthorizeOrder(self, x_api_version : Annotated[StrictStr, Field(..., description="API version to be used. Format is in YYYY-MM-DD")] = None, order_id : Annotated[StrictStr, Field(..., description="The id which uniquely identifies your order")] = None, authorize_order_request : Annotated[AuthorizeOrderRequest, Field(..., description="Request to Capture or Void Transactions")] = None, x_request_id : Annotated[Optional[StrictStr], Field(description="Request id for the API call. Can be used to resolve tech issues. Communicate this in your tech related queries to cashfree")] = None, x_idempotency_key : Annotated[Optional[StrictStr], Field(description="Idempotency works by saving the resulting status code and body of the first request made for any given idempotency key, regardless of whether it succeeded or failed. Subsequent requests with the same key return the same result, including 500 errors. Currently supported on all POST calls that uses x-client-id & x-client-secret. To use enable, pass x-idempotency-key in the request header. The value of this header must be unique to each operation you are trying to do. One example can be to use the same order_id that you pass while creating orders ")] = None, **kwargs) -> ApiResponse: # noqa: E501 + """Preauthorization # noqa: E501 + + Use this API to capture or void a preauthorized payment # noqa: E501 + This method makes a synchronous HTTP request by default. To make an + asynchronous HTTP request, please pass async_req=True + + >>> thread = api.PGAuthorizeOrder_with_http_info(x_api_version, order_id, authorize_order_request, x_request_id, x_idempotency_key, async_req=True) + >>> result = thread.get() + + :param x_api_version: API version to be used. Format is in YYYY-MM-DD (required) + :type x_api_version: str + :param order_id: The id which uniquely identifies your order (required) + :type order_id: str + :param authorize_order_request: Request to Capture or Void Transactions (required) + :type authorize_order_request: AuthorizeOrderRequest + :param x_request_id: Request id for the API call. Can be used to resolve tech issues. Communicate this in your tech related queries to cashfree + :type x_request_id: str + :param x_idempotency_key: Idempotency works by saving the resulting status code and body of the first request made for any given idempotency key, regardless of whether it succeeded or failed. Subsequent requests with the same key return the same result, including 500 errors. Currently supported on all POST calls that uses x-client-id & x-client-secret. To use enable, pass x-idempotency-key in the request header. The value of this header must be unique to each operation you are trying to do. One example can be to use the same order_id that you pass while creating orders + :type x_idempotency_key: str + :param async_req: Whether to execute the request asynchronously. + :type async_req: bool, optional + :param _preload_content: if False, the ApiResponse.data will + be set to none and raw_data will store the + HTTP response body without reading/decoding. + Default is True. + :type _preload_content: bool, optional + :param _return_http_data_only: response data instead of ApiResponse + object with status code, headers, etc + :type _return_http_data_only: bool, optional + :param _request_timeout: timeout setting for this request. If one + number provided, it will be total request + timeout. It can also be a pair (tuple) of + (connection, read) timeouts. + :param _request_auth: set to override the auth_settings for an a single + request; this effectively ignores the authentication + in the spec for a single request. + :type _request_auth: dict, optional + :type _content_type: string, optional: force content-type for the request + :return: Returns the result object. + If the method is called asynchronously, + returns the request thread. + :rtype: tuple(PaymentEntity, status_code(int), headers(HTTPHeaderDict)) + """ + + api_client = ApiClient.get_default() + host = "https://api.cashfree.com/pg" + if Cashfree.XEnvironment == CFEnvironment.SANDBOX: + host = "https://sandbox.cashfree.com/pg" + configuration = Configuration( + host = host + ) + configuration.api_key['XClientID'] = Cashfree.XClientId + configuration.api_key['XClientSecret'] = Cashfree.XClientSecret + configuration.api_key['XClientSignature'] = Cashfree.XClientSignature + configuration.api_key['XPartnerMerchantId'] = Cashfree.XPartnerMerchantId + configuration.api_key['XPartnerKey'] = Cashfree.XPartnerKey + api_client.configuration = configuration + _params = locals() + + _all_params = [ + 'x_api_version', + 'order_id', + 'authorize_order_request', + 'x_request_id', + 'x_idempotency_key' + ] + _all_params.extend( + [ + 'async_req', + '_return_http_data_only', + '_preload_content', + '_request_timeout', + '_request_auth', + '_content_type', + '_headers' + ] + ) + + # validate the arguments + for _key, _val in _params['kwargs'].items(): + if _key not in _all_params: + raise ApiTypeError( + "Got an unexpected keyword argument '%s'" + " to method PGAuthorizeOrder" % _key + ) + _params[_key] = _val + del _params['kwargs'] + + _collection_formats = {} + + # process the path parameters + _path_params = {} + if _params['order_id']: + _path_params['order_id'] = _params['order_id'] + + + # process the query parameters + _query_params = [] + # process the header parameters + _header_params = dict(_params.get('_headers', {})) + if x_request_id: + _header_params["x-request-id"] = x_request_id + + if x_api_version: + _header_params["x-api-version"] = x_api_version + + if x_idempotency_key: + _header_params["x-idempotency-key"] = x_idempotency_key + _header_params["x-sdk-platform"] = "pythonsdk-3.0.1" + + # process the form parameters + _form_params = [] + _files = {} + # process the body parameter + _body_params = None + if _params['authorize_order_request'] is not None: + _body_params = _params['authorize_order_request'] + + # set the HTTP header `Accept` + _header_params['Accept'] = api_client.select_header_accept( + ['application/json']) # noqa: E501 + + # set the HTTP header `Content-Type` + _content_types_list = _params.get('_content_type', + api_client.select_header_content_type( + ['application/json'])) + if _content_types_list: + _header_params['Content-Type'] = _content_types_list + + # authentication setting + _auth_settings = ['XPartnerAPIKey', 'XClientSecret', 'XPartnerMerchantID', 'XClientID', 'XClientSignatureHeader'] # noqa: E501 + + _response_types_map = { + '200': "PaymentEntity", + '400': "BadRequestError", + '401': "AuthenticationError", + '404': "ApiError404", + '409': "ApiError409", + '422': "IdempotencyError", + '429': "RateLimitError", + '500': "ApiError", + '502': "ApiError502", + } + + return api_client.call_api( + '/orders/{order_id}/authorization', 'POST', + _path_params, + _query_params, + _header_params, + body=_body_params, + post_params=_form_params, + files=_files, + response_types_map=_response_types_map, + auth_settings=_auth_settings, + async_req=_params.get('async_req'), + _return_http_data_only=_params.get('_return_http_data_only'), # noqa: E501 + _preload_content=_params.get('_preload_content', True), + _request_timeout=_params.get('_request_timeout'), + collection_formats=_collection_formats, + _request_auth=_params.get('_request_auth')) + @validate_arguments + def PGOrderAuthenticatePayment(self, x_api_version : Annotated[StrictStr, Field(..., description="API version to be used. Format is in YYYY-MM-DD")] = None, cf_payment_id : Annotated[StrictStr, Field(..., description="The Cashfree payment or transaction ID.")] = None, order_authenticate_payment_request : Annotated[OrderAuthenticatePaymentRequest, Field(..., description="Request body to submit/resend headless OTP. To use this API make sure you have headless OTP enabled for your account")] = None, x_request_id : Annotated[Optional[StrictStr], Field(description="Request id for the API call. Can be used to resolve tech issues. Communicate this in your tech related queries to cashfree")] = None, x_idempotency_key : Annotated[Optional[StrictStr], Field(description="Idempotency works by saving the resulting status code and body of the first request made for any given idempotency key, regardless of whether it succeeded or failed. Subsequent requests with the same key return the same result, including 500 errors. Currently supported on all POST calls that uses x-client-id & x-client-secret. To use enable, pass x-idempotency-key in the request header. The value of this header must be unique to each operation you are trying to do. One example can be to use the same order_id that you pass while creating orders ")] = None, **kwargs) -> ApiResponse: # noqa: E501 + """Submit or Resend OTP # noqa: E501 + + If you accept OTP on your own page, you can use the below API to send OTP to Cashfree. # noqa: E501 + This method makes a synchronous HTTP request by default. To make an + asynchronous HTTP request, please pass async_req=True + + >>> thread = api.PGOrderAuthenticatePayment_with_http_info(x_api_version, cf_payment_id, order_authenticate_payment_request, x_request_id, x_idempotency_key, async_req=True) + >>> result = thread.get() + + :param x_api_version: API version to be used. Format is in YYYY-MM-DD (required) + :type x_api_version: str + :param cf_payment_id: The Cashfree payment or transaction ID. (required) + :type cf_payment_id: str + :param order_authenticate_payment_request: Request body to submit/resend headless OTP. To use this API make sure you have headless OTP enabled for your account (required) + :type order_authenticate_payment_request: OrderAuthenticatePaymentRequest + :param x_request_id: Request id for the API call. Can be used to resolve tech issues. Communicate this in your tech related queries to cashfree + :type x_request_id: str + :param x_idempotency_key: Idempotency works by saving the resulting status code and body of the first request made for any given idempotency key, regardless of whether it succeeded or failed. Subsequent requests with the same key return the same result, including 500 errors. Currently supported on all POST calls that uses x-client-id & x-client-secret. To use enable, pass x-idempotency-key in the request header. The value of this header must be unique to each operation you are trying to do. One example can be to use the same order_id that you pass while creating orders + :type x_idempotency_key: str + :param async_req: Whether to execute the request asynchronously. + :type async_req: bool, optional + :param _preload_content: if False, the ApiResponse.data will + be set to none and raw_data will store the + HTTP response body without reading/decoding. + Default is True. + :type _preload_content: bool, optional + :param _return_http_data_only: response data instead of ApiResponse + object with status code, headers, etc + :type _return_http_data_only: bool, optional + :param _request_timeout: timeout setting for this request. If one + number provided, it will be total request + timeout. It can also be a pair (tuple) of + (connection, read) timeouts. + :param _request_auth: set to override the auth_settings for an a single + request; this effectively ignores the authentication + in the spec for a single request. + :type _request_auth: dict, optional + :type _content_type: string, optional: force content-type for the request + :return: Returns the result object. + If the method is called asynchronously, + returns the request thread. + :rtype: tuple(OrderAuthenticateEntity, status_code(int), headers(HTTPHeaderDict)) + """ + + api_client = ApiClient.get_default() + host = "https://api.cashfree.com/pg" + if Cashfree.XEnvironment == CFEnvironment.SANDBOX: + host = "https://sandbox.cashfree.com/pg" + configuration = Configuration( + host = host + ) + configuration.api_key['XClientID'] = Cashfree.XClientId + configuration.api_key['XClientSecret'] = Cashfree.XClientSecret + configuration.api_key['XClientSignature'] = Cashfree.XClientSignature + configuration.api_key['XPartnerMerchantId'] = Cashfree.XPartnerMerchantId + configuration.api_key['XPartnerKey'] = Cashfree.XPartnerKey + api_client.configuration = configuration + _params = locals() + + _all_params = [ + 'x_api_version', + 'cf_payment_id', + 'order_authenticate_payment_request', + 'x_request_id', + 'x_idempotency_key' + ] + _all_params.extend( + [ + 'async_req', + '_return_http_data_only', + '_preload_content', + '_request_timeout', + '_request_auth', + '_content_type', + '_headers' + ] + ) + + # validate the arguments + for _key, _val in _params['kwargs'].items(): + if _key not in _all_params: + raise ApiTypeError( + "Got an unexpected keyword argument '%s'" + " to method PGOrderAuthenticatePayment" % _key + ) + _params[_key] = _val + del _params['kwargs'] + + _collection_formats = {} + + # process the path parameters + _path_params = {} + if _params['cf_payment_id']: + _path_params['cf_payment_id'] = _params['cf_payment_id'] + + + # process the query parameters + _query_params = [] + # process the header parameters + _header_params = dict(_params.get('_headers', {})) + if x_request_id: + _header_params["x-request-id"] = x_request_id + + if x_api_version: + _header_params["x-api-version"] = x_api_version + + if x_idempotency_key: + _header_params["x-idempotency-key"] = x_idempotency_key + _header_params["x-sdk-platform"] = "pythonsdk-3.0.1" + + # process the form parameters + _form_params = [] + _files = {} + # process the body parameter + _body_params = None + if _params['order_authenticate_payment_request'] is not None: + _body_params = _params['order_authenticate_payment_request'] + + # set the HTTP header `Accept` + _header_params['Accept'] = api_client.select_header_accept( + ['application/json']) # noqa: E501 + + # set the HTTP header `Content-Type` + _content_types_list = _params.get('_content_type', + api_client.select_header_content_type( + ['application/json'])) + if _content_types_list: + _header_params['Content-Type'] = _content_types_list + + # authentication setting + _auth_settings = [] # noqa: E501 + + _response_types_map = { + '200': "OrderAuthenticateEntity", + '400': "BadRequestError", + '401': "AuthenticationError", + '404': "ApiError404", + '409': "ApiError409", + '422': "IdempotencyError", + '429': "RateLimitError", + '500': "ApiError", + '502': "ApiError502", + } + + return api_client.call_api( + '/orders/pay/authenticate/{cf_payment_id}', 'POST', + _path_params, + _query_params, + _header_params, + body=_body_params, + post_params=_form_params, + files=_files, + response_types_map=_response_types_map, + auth_settings=_auth_settings, + async_req=_params.get('async_req'), + _return_http_data_only=_params.get('_return_http_data_only'), # noqa: E501 + _preload_content=_params.get('_preload_content', True), + _request_timeout=_params.get('_request_timeout'), + collection_formats=_collection_formats, + _request_auth=_params.get('_request_auth')) + @validate_arguments + def PGOrderFetchPayment(self, x_api_version : Annotated[StrictStr, Field(..., description="API version to be used. Format is in YYYY-MM-DD")] = None, order_id : Annotated[StrictStr, Field(..., description="The id which uniquely identifies your order")] = None, cf_payment_id : Annotated[StrictStr, Field(..., description="The Cashfree payment or transaction ID.")] = None, x_request_id : Annotated[Optional[StrictStr], Field(description="Request id for the API call. Can be used to resolve tech issues. Communicate this in your tech related queries to cashfree")] = None, x_idempotency_key : Annotated[Optional[StrictStr], Field(description="Idempotency works by saving the resulting status code and body of the first request made for any given idempotency key, regardless of whether it succeeded or failed. Subsequent requests with the same key return the same result, including 500 errors. Currently supported on all POST calls that uses x-client-id & x-client-secret. To use enable, pass x-idempotency-key in the request header. The value of this header must be unique to each operation you are trying to do. One example can be to use the same order_id that you pass while creating orders ")] = None, **kwargs) -> ApiResponse: # noqa: E501 + """Get Payment by ID # noqa: E501 + + Use this API to view payment details of an order for a payment ID. # noqa: E501 + This method makes a synchronous HTTP request by default. To make an + asynchronous HTTP request, please pass async_req=True + + >>> thread = api.PGOrderFetchPayment_with_http_info(x_api_version, order_id, cf_payment_id, x_request_id, x_idempotency_key, async_req=True) + >>> result = thread.get() + + :param x_api_version: API version to be used. Format is in YYYY-MM-DD (required) + :type x_api_version: str + :param order_id: The id which uniquely identifies your order (required) + :type order_id: str + :param cf_payment_id: The Cashfree payment or transaction ID. (required) + :type cf_payment_id: str + :param x_request_id: Request id for the API call. Can be used to resolve tech issues. Communicate this in your tech related queries to cashfree + :type x_request_id: str + :param x_idempotency_key: Idempotency works by saving the resulting status code and body of the first request made for any given idempotency key, regardless of whether it succeeded or failed. Subsequent requests with the same key return the same result, including 500 errors. Currently supported on all POST calls that uses x-client-id & x-client-secret. To use enable, pass x-idempotency-key in the request header. The value of this header must be unique to each operation you are trying to do. One example can be to use the same order_id that you pass while creating orders + :type x_idempotency_key: str + :param async_req: Whether to execute the request asynchronously. + :type async_req: bool, optional + :param _preload_content: if False, the ApiResponse.data will + be set to none and raw_data will store the + HTTP response body without reading/decoding. + Default is True. + :type _preload_content: bool, optional + :param _return_http_data_only: response data instead of ApiResponse + object with status code, headers, etc + :type _return_http_data_only: bool, optional + :param _request_timeout: timeout setting for this request. If one + number provided, it will be total request + timeout. It can also be a pair (tuple) of + (connection, read) timeouts. + :param _request_auth: set to override the auth_settings for an a single + request; this effectively ignores the authentication + in the spec for a single request. + :type _request_auth: dict, optional + :type _content_type: string, optional: force content-type for the request + :return: Returns the result object. + If the method is called asynchronously, + returns the request thread. + :rtype: tuple(PaymentEntity, status_code(int), headers(HTTPHeaderDict)) + """ + + api_client = ApiClient.get_default() + host = "https://api.cashfree.com/pg" + if Cashfree.XEnvironment == CFEnvironment.SANDBOX: + host = "https://sandbox.cashfree.com/pg" + configuration = Configuration( + host = host + ) + configuration.api_key['XClientID'] = Cashfree.XClientId + configuration.api_key['XClientSecret'] = Cashfree.XClientSecret + configuration.api_key['XClientSignature'] = Cashfree.XClientSignature + configuration.api_key['XPartnerMerchantId'] = Cashfree.XPartnerMerchantId + configuration.api_key['XPartnerKey'] = Cashfree.XPartnerKey + api_client.configuration = configuration + _params = locals() + + _all_params = [ + 'x_api_version', + 'order_id', + 'cf_payment_id', + 'x_request_id', + 'x_idempotency_key' + ] + _all_params.extend( + [ + 'async_req', + '_return_http_data_only', + '_preload_content', + '_request_timeout', + '_request_auth', + '_content_type', + '_headers' + ] + ) + + # validate the arguments + for _key, _val in _params['kwargs'].items(): + if _key not in _all_params: + raise ApiTypeError( + "Got an unexpected keyword argument '%s'" + " to method PGOrderFetchPayment" % _key + ) + _params[_key] = _val + del _params['kwargs'] + + _collection_formats = {} + + # process the path parameters + _path_params = {} + if _params['order_id']: + _path_params['order_id'] = _params['order_id'] + + if _params['cf_payment_id']: + _path_params['cf_payment_id'] = _params['cf_payment_id'] + + + # process the query parameters + _query_params = [] + # process the header parameters + _header_params = dict(_params.get('_headers', {})) + if x_request_id: + _header_params["x-request-id"] = x_request_id + + if x_api_version: + _header_params["x-api-version"] = x_api_version + + if x_idempotency_key: + _header_params["x-idempotency-key"] = x_idempotency_key + _header_params["x-sdk-platform"] = "pythonsdk-3.0.1" + + # process the form parameters + _form_params = [] + _files = {} + # process the body parameter + _body_params = None + # set the HTTP header `Accept` + _header_params['Accept'] = api_client.select_header_accept( + ['application/json']) # noqa: E501 + + # authentication setting + _auth_settings = ['XPartnerAPIKey', 'XClientSecret', 'XPartnerMerchantID', 'XClientID', 'XClientSignatureHeader'] # noqa: E501 + + _response_types_map = { + '200': "PaymentEntity", + '400': "BadRequestError", + '401': "AuthenticationError", + '404': "ApiError404", + '409': "ApiError409", + '422': "IdempotencyError", + '429': "RateLimitError", + '500': "ApiError", + '502': "ApiError502", + } + + return api_client.call_api( + '/orders/{order_id}/payments/{cf_payment_id}', 'GET', + _path_params, + _query_params, + _header_params, + body=_body_params, + post_params=_form_params, + files=_files, + response_types_map=_response_types_map, + auth_settings=_auth_settings, + async_req=_params.get('async_req'), + _return_http_data_only=_params.get('_return_http_data_only'), # noqa: E501 + _preload_content=_params.get('_preload_content', True), + _request_timeout=_params.get('_request_timeout'), + collection_formats=_collection_formats, + _request_auth=_params.get('_request_auth')) + @validate_arguments + def PGOrderFetchPayments(self, x_api_version : Annotated[StrictStr, Field(..., description="API version to be used. Format is in YYYY-MM-DD")] = None, order_id : Annotated[StrictStr, Field(..., description="The id which uniquely identifies your order")] = None, x_request_id : Annotated[Optional[StrictStr], Field(description="Request id for the API call. Can be used to resolve tech issues. Communicate this in your tech related queries to cashfree")] = None, x_idempotency_key : Annotated[Optional[StrictStr], Field(description="Idempotency works by saving the resulting status code and body of the first request made for any given idempotency key, regardless of whether it succeeded or failed. Subsequent requests with the same key return the same result, including 500 errors. Currently supported on all POST calls that uses x-client-id & x-client-secret. To use enable, pass x-idempotency-key in the request header. The value of this header must be unique to each operation you are trying to do. One example can be to use the same order_id that you pass while creating orders ")] = None, **kwargs) -> ApiResponse: # noqa: E501 + """Get Payments for an Order # noqa: E501 + + Use this API to view all payment details for an order. # noqa: E501 + This method makes a synchronous HTTP request by default. To make an + asynchronous HTTP request, please pass async_req=True + + >>> thread = api.PGOrderFetchPayments_with_http_info(x_api_version, order_id, x_request_id, x_idempotency_key, async_req=True) + >>> result = thread.get() + + :param x_api_version: API version to be used. Format is in YYYY-MM-DD (required) + :type x_api_version: str + :param order_id: The id which uniquely identifies your order (required) + :type order_id: str + :param x_request_id: Request id for the API call. Can be used to resolve tech issues. Communicate this in your tech related queries to cashfree + :type x_request_id: str + :param x_idempotency_key: Idempotency works by saving the resulting status code and body of the first request made for any given idempotency key, regardless of whether it succeeded or failed. Subsequent requests with the same key return the same result, including 500 errors. Currently supported on all POST calls that uses x-client-id & x-client-secret. To use enable, pass x-idempotency-key in the request header. The value of this header must be unique to each operation you are trying to do. One example can be to use the same order_id that you pass while creating orders + :type x_idempotency_key: str + :param async_req: Whether to execute the request asynchronously. + :type async_req: bool, optional + :param _preload_content: if False, the ApiResponse.data will + be set to none and raw_data will store the + HTTP response body without reading/decoding. + Default is True. + :type _preload_content: bool, optional + :param _return_http_data_only: response data instead of ApiResponse + object with status code, headers, etc + :type _return_http_data_only: bool, optional + :param _request_timeout: timeout setting for this request. If one + number provided, it will be total request + timeout. It can also be a pair (tuple) of + (connection, read) timeouts. + :param _request_auth: set to override the auth_settings for an a single + request; this effectively ignores the authentication + in the spec for a single request. + :type _request_auth: dict, optional + :type _content_type: string, optional: force content-type for the request + :return: Returns the result object. + If the method is called asynchronously, + returns the request thread. + :rtype: tuple(List[PaymentEntity], status_code(int), headers(HTTPHeaderDict)) + """ + + api_client = ApiClient.get_default() + host = "https://api.cashfree.com/pg" + if Cashfree.XEnvironment == CFEnvironment.SANDBOX: + host = "https://sandbox.cashfree.com/pg" + configuration = Configuration( + host = host + ) + configuration.api_key['XClientID'] = Cashfree.XClientId + configuration.api_key['XClientSecret'] = Cashfree.XClientSecret + configuration.api_key['XClientSignature'] = Cashfree.XClientSignature + configuration.api_key['XPartnerMerchantId'] = Cashfree.XPartnerMerchantId + configuration.api_key['XPartnerKey'] = Cashfree.XPartnerKey + api_client.configuration = configuration + _params = locals() + + _all_params = [ + 'x_api_version', + 'order_id', + 'x_request_id', + 'x_idempotency_key' + ] + _all_params.extend( + [ + 'async_req', + '_return_http_data_only', + '_preload_content', + '_request_timeout', + '_request_auth', + '_content_type', + '_headers' + ] + ) + + # validate the arguments + for _key, _val in _params['kwargs'].items(): + if _key not in _all_params: + raise ApiTypeError( + "Got an unexpected keyword argument '%s'" + " to method PGOrderFetchPayments" % _key + ) + _params[_key] = _val + del _params['kwargs'] + + _collection_formats = {} + + # process the path parameters + _path_params = {} + if _params['order_id']: + _path_params['order_id'] = _params['order_id'] + + + # process the query parameters + _query_params = [] + # process the header parameters + _header_params = dict(_params.get('_headers', {})) + if x_request_id: + _header_params["x-request-id"] = x_request_id + + if x_api_version: + _header_params["x-api-version"] = x_api_version + + if x_idempotency_key: + _header_params["x-idempotency-key"] = x_idempotency_key + _header_params["x-sdk-platform"] = "pythonsdk-3.0.1" + + # process the form parameters + _form_params = [] + _files = {} + # process the body parameter + _body_params = None + # set the HTTP header `Accept` + _header_params['Accept'] = api_client.select_header_accept( + ['application/json']) # noqa: E501 + + # authentication setting + _auth_settings = ['XPartnerAPIKey', 'XClientSecret', 'XPartnerMerchantID', 'XClientID', 'XClientSignatureHeader'] # noqa: E501 + + _response_types_map = { + '200': "List[PaymentEntity]", + '400': "BadRequestError", + '401': "AuthenticationError", + '404': "ApiError404", + '409': "ApiError409", + '422': "IdempotencyError", + '429': "RateLimitError", + '500': "ApiError", + '502': "ApiError502", + } + + return api_client.call_api( + '/orders/{order_id}/payments', 'GET', + _path_params, + _query_params, + _header_params, + body=_body_params, + post_params=_form_params, + files=_files, + response_types_map=_response_types_map, + auth_settings=_auth_settings, + async_req=_params.get('async_req'), + _return_http_data_only=_params.get('_return_http_data_only'), # noqa: E501 + _preload_content=_params.get('_preload_content', True), + _request_timeout=_params.get('_request_timeout'), + collection_formats=_collection_formats, + _request_auth=_params.get('_request_auth')) + @validate_arguments + def PGPayOrder(self, x_api_version : Annotated[StrictStr, Field(..., description="API version to be used. Format is in YYYY-MM-DD")] = None, pay_order_request : Annotated[PayOrderRequest, Field(..., description="Request body to create a transaction at cashfree using `payment_session_id`")] = None, x_request_id : Annotated[Optional[StrictStr], Field(description="Request id for the API call. Can be used to resolve tech issues. Communicate this in your tech related queries to cashfree")] = None, x_idempotency_key : Annotated[Optional[StrictStr], Field(description="Idempotency works by saving the resulting status code and body of the first request made for any given idempotency key, regardless of whether it succeeded or failed. Subsequent requests with the same key return the same result, including 500 errors. Currently supported on all POST calls that uses x-client-id & x-client-secret. To use enable, pass x-idempotency-key in the request header. The value of this header must be unique to each operation you are trying to do. One example can be to use the same order_id that you pass while creating orders ")] = None, **kwargs) -> ApiResponse: # noqa: E501 + """Order Pay # noqa: E501 + + Use this API when you have already created the orders and want Cashfree to process the payment. To use this API S2S flag needs to be enabled from the backend. In case you want to use the cards payment option the PCI DSS flag is required, for more information send an email to \"care@cashfree.com\". # noqa: E501 + This method makes a synchronous HTTP request by default. To make an + asynchronous HTTP request, please pass async_req=True + + >>> thread = api.PGPayOrder_with_http_info(x_api_version, pay_order_request, x_request_id, x_idempotency_key, async_req=True) + >>> result = thread.get() + + :param x_api_version: API version to be used. Format is in YYYY-MM-DD (required) + :type x_api_version: str + :param pay_order_request: Request body to create a transaction at cashfree using `payment_session_id` (required) + :type pay_order_request: PayOrderRequest + :param x_request_id: Request id for the API call. Can be used to resolve tech issues. Communicate this in your tech related queries to cashfree + :type x_request_id: str + :param x_idempotency_key: Idempotency works by saving the resulting status code and body of the first request made for any given idempotency key, regardless of whether it succeeded or failed. Subsequent requests with the same key return the same result, including 500 errors. Currently supported on all POST calls that uses x-client-id & x-client-secret. To use enable, pass x-idempotency-key in the request header. The value of this header must be unique to each operation you are trying to do. One example can be to use the same order_id that you pass while creating orders + :type x_idempotency_key: str + :param async_req: Whether to execute the request asynchronously. + :type async_req: bool, optional + :param _preload_content: if False, the ApiResponse.data will + be set to none and raw_data will store the + HTTP response body without reading/decoding. + Default is True. + :type _preload_content: bool, optional + :param _return_http_data_only: response data instead of ApiResponse + object with status code, headers, etc + :type _return_http_data_only: bool, optional + :param _request_timeout: timeout setting for this request. If one + number provided, it will be total request + timeout. It can also be a pair (tuple) of + (connection, read) timeouts. + :param _request_auth: set to override the auth_settings for an a single + request; this effectively ignores the authentication + in the spec for a single request. + :type _request_auth: dict, optional + :type _content_type: string, optional: force content-type for the request + :return: Returns the result object. + If the method is called asynchronously, + returns the request thread. + :rtype: tuple(PayOrderEntity, status_code(int), headers(HTTPHeaderDict)) + """ + + api_client = ApiClient.get_default() + host = "https://api.cashfree.com/pg" + if Cashfree.XEnvironment == CFEnvironment.SANDBOX: + host = "https://sandbox.cashfree.com/pg" + configuration = Configuration( + host = host + ) + configuration.api_key['XClientID'] = Cashfree.XClientId + configuration.api_key['XClientSecret'] = Cashfree.XClientSecret + configuration.api_key['XClientSignature'] = Cashfree.XClientSignature + configuration.api_key['XPartnerMerchantId'] = Cashfree.XPartnerMerchantId + configuration.api_key['XPartnerKey'] = Cashfree.XPartnerKey + api_client.configuration = configuration + _params = locals() + + _all_params = [ + 'x_api_version', + 'pay_order_request', + 'x_request_id', + 'x_idempotency_key' + ] + _all_params.extend( + [ + 'async_req', + '_return_http_data_only', + '_preload_content', + '_request_timeout', + '_request_auth', + '_content_type', + '_headers' + ] + ) + + # validate the arguments + for _key, _val in _params['kwargs'].items(): + if _key not in _all_params: + raise ApiTypeError( + "Got an unexpected keyword argument '%s'" + " to method PGPayOrder" % _key + ) + _params[_key] = _val + del _params['kwargs'] + + _collection_formats = {} + + # process the path parameters + _path_params = {} + + # process the query parameters + _query_params = [] + # process the header parameters + _header_params = dict(_params.get('_headers', {})) + if x_request_id: + _header_params["x-request-id"] = x_request_id + + if x_api_version: + _header_params["x-api-version"] = x_api_version + + if x_idempotency_key: + _header_params["x-idempotency-key"] = x_idempotency_key + _header_params["x-sdk-platform"] = "pythonsdk-3.0.1" + + # process the form parameters + _form_params = [] + _files = {} + # process the body parameter + _body_params = None + if _params['pay_order_request'] is not None: + _body_params = _params['pay_order_request'] + + # set the HTTP header `Accept` + _header_params['Accept'] = api_client.select_header_accept( + ['application/json']) # noqa: E501 + + # set the HTTP header `Content-Type` + _content_types_list = _params.get('_content_type', + api_client.select_header_content_type( + ['application/json'])) + if _content_types_list: + _header_params['Content-Type'] = _content_types_list + + # authentication setting + _auth_settings = [] # noqa: E501 + + _response_types_map = { + '200': "PayOrderEntity", + '400': "BadRequestError", + '401': "AuthenticationError", + '404': "ApiError404", + '409': "ApiError409", + '422': "IdempotencyError", + '429': "RateLimitError", + '500': "ApiError", + '502': "ApiError502", + } + + return api_client.call_api( + '/orders/sessions', 'POST', + _path_params, + _query_params, + _header_params, + body=_body_params, + post_params=_form_params, + files=_files, + response_types_map=_response_types_map, + auth_settings=_auth_settings, + async_req=_params.get('async_req'), + _return_http_data_only=_params.get('_return_http_data_only'), # noqa: E501 + _preload_content=_params.get('_preload_content', True), + _request_timeout=_params.get('_request_timeout'), + collection_formats=_collection_formats, + _request_auth=_params.get('_request_auth')) + + @validate_arguments + def PGOrderCreateRefund(self, x_api_version : Annotated[StrictStr, Field(..., description="API version to be used. Format is in YYYY-MM-DD")] = None, order_id : Annotated[StrictStr, Field(..., description="The id which uniquely identifies your order")] = None, order_create_refund_request : Annotated[OrderCreateRefundRequest, Field(..., description="Request Body to Create Refunds")] = None, x_request_id : Annotated[Optional[StrictStr], Field(description="Request id for the API call. Can be used to resolve tech issues. Communicate this in your tech related queries to cashfree")] = None, x_idempotency_key : Annotated[Optional[StrictStr], Field(description="Idempotency works by saving the resulting status code and body of the first request made for any given idempotency key, regardless of whether it succeeded or failed. Subsequent requests with the same key return the same result, including 500 errors. Currently supported on all POST calls that uses x-client-id & x-client-secret. To use enable, pass x-idempotency-key in the request header. The value of this header must be unique to each operation you are trying to do. One example can be to use the same order_id that you pass while creating orders ")] = None, **kwargs) -> ApiResponse: # noqa: E501 + """Create Refund # noqa: E501 + + Use this API to initiate refunds. # noqa: E501 + This method makes a synchronous HTTP request by default. To make an + asynchronous HTTP request, please pass async_req=True + + >>> thread = api.PGOrderCreateRefund_with_http_info(x_api_version, order_id, order_create_refund_request, x_request_id, x_idempotency_key, async_req=True) + >>> result = thread.get() + + :param x_api_version: API version to be used. Format is in YYYY-MM-DD (required) + :type x_api_version: str + :param order_id: The id which uniquely identifies your order (required) + :type order_id: str + :param order_create_refund_request: Request Body to Create Refunds (required) + :type order_create_refund_request: OrderCreateRefundRequest + :param x_request_id: Request id for the API call. Can be used to resolve tech issues. Communicate this in your tech related queries to cashfree + :type x_request_id: str + :param x_idempotency_key: Idempotency works by saving the resulting status code and body of the first request made for any given idempotency key, regardless of whether it succeeded or failed. Subsequent requests with the same key return the same result, including 500 errors. Currently supported on all POST calls that uses x-client-id & x-client-secret. To use enable, pass x-idempotency-key in the request header. The value of this header must be unique to each operation you are trying to do. One example can be to use the same order_id that you pass while creating orders + :type x_idempotency_key: str + :param async_req: Whether to execute the request asynchronously. + :type async_req: bool, optional + :param _preload_content: if False, the ApiResponse.data will + be set to none and raw_data will store the + HTTP response body without reading/decoding. + Default is True. + :type _preload_content: bool, optional + :param _return_http_data_only: response data instead of ApiResponse + object with status code, headers, etc + :type _return_http_data_only: bool, optional + :param _request_timeout: timeout setting for this request. If one + number provided, it will be total request + timeout. It can also be a pair (tuple) of + (connection, read) timeouts. + :param _request_auth: set to override the auth_settings for an a single + request; this effectively ignores the authentication + in the spec for a single request. + :type _request_auth: dict, optional + :type _content_type: string, optional: force content-type for the request + :return: Returns the result object. + If the method is called asynchronously, + returns the request thread. + :rtype: tuple(RefundEntity, status_code(int), headers(HTTPHeaderDict)) + """ + + api_client = ApiClient.get_default() + host = "https://api.cashfree.com/pg" + if Cashfree.XEnvironment == CFEnvironment.SANDBOX: + host = "https://sandbox.cashfree.com/pg" + configuration = Configuration( + host = host + ) + configuration.api_key['XClientID'] = Cashfree.XClientId + configuration.api_key['XClientSecret'] = Cashfree.XClientSecret + configuration.api_key['XClientSignature'] = Cashfree.XClientSignature + configuration.api_key['XPartnerMerchantId'] = Cashfree.XPartnerMerchantId + configuration.api_key['XPartnerKey'] = Cashfree.XPartnerKey + api_client.configuration = configuration + _params = locals() + + _all_params = [ + 'x_api_version', + 'order_id', + 'order_create_refund_request', + 'x_request_id', + 'x_idempotency_key' + ] + _all_params.extend( + [ + 'async_req', + '_return_http_data_only', + '_preload_content', + '_request_timeout', + '_request_auth', + '_content_type', + '_headers' + ] + ) + + # validate the arguments + for _key, _val in _params['kwargs'].items(): + if _key not in _all_params: + raise ApiTypeError( + "Got an unexpected keyword argument '%s'" + " to method PGOrderCreateRefund" % _key + ) + _params[_key] = _val + del _params['kwargs'] + + _collection_formats = {} + + # process the path parameters + _path_params = {} + if _params['order_id']: + _path_params['order_id'] = _params['order_id'] + + + # process the query parameters + _query_params = [] + # process the header parameters + _header_params = dict(_params.get('_headers', {})) + if x_request_id: + _header_params["x-request-id"] = x_request_id + + if x_api_version: + _header_params["x-api-version"] = x_api_version + + if x_idempotency_key: + _header_params["x-idempotency-key"] = x_idempotency_key + _header_params["x-sdk-platform"] = "pythonsdk-3.0.1" + + # process the form parameters + _form_params = [] + _files = {} + # process the body parameter + _body_params = None + if _params['order_create_refund_request'] is not None: + _body_params = _params['order_create_refund_request'] + + # set the HTTP header `Accept` + _header_params['Accept'] = api_client.select_header_accept( + ['application/json']) # noqa: E501 + + # set the HTTP header `Content-Type` + _content_types_list = _params.get('_content_type', + api_client.select_header_content_type( + ['application/json'])) + if _content_types_list: + _header_params['Content-Type'] = _content_types_list + + # authentication setting + _auth_settings = ['XPartnerAPIKey', 'XClientSecret', 'XPartnerMerchantID', 'XClientID', 'XClientSignatureHeader'] # noqa: E501 + + _response_types_map = { + '200': "RefundEntity", + '400': "BadRequestError", + '401': "AuthenticationError", + '404': "ApiError404", + '409': "ApiError409", + '422': "IdempotencyError", + '429': "RateLimitError", + '500': "ApiError", + '502': "ApiError502", + } + + return api_client.call_api( + '/orders/{order_id}/refunds', 'POST', + _path_params, + _query_params, + _header_params, + body=_body_params, + post_params=_form_params, + files=_files, + response_types_map=_response_types_map, + auth_settings=_auth_settings, + async_req=_params.get('async_req'), + _return_http_data_only=_params.get('_return_http_data_only'), # noqa: E501 + _preload_content=_params.get('_preload_content', True), + _request_timeout=_params.get('_request_timeout'), + collection_formats=_collection_formats, + _request_auth=_params.get('_request_auth')) + @validate_arguments + def PGOrderFetchRefund(self, x_api_version : Annotated[StrictStr, Field(..., description="API version to be used. Format is in YYYY-MM-DD")] = None, order_id : Annotated[StrictStr, Field(..., description="The id which uniquely identifies your order")] = None, refund_id : Annotated[StrictStr, Field(..., description="Refund Id of the refund you want to fetch.")] = None, x_request_id : Annotated[Optional[StrictStr], Field(description="Request id for the API call. Can be used to resolve tech issues. Communicate this in your tech related queries to cashfree")] = None, x_idempotency_key : Annotated[Optional[StrictStr], Field(description="Idempotency works by saving the resulting status code and body of the first request made for any given idempotency key, regardless of whether it succeeded or failed. Subsequent requests with the same key return the same result, including 500 errors. Currently supported on all POST calls that uses x-client-id & x-client-secret. To use enable, pass x-idempotency-key in the request header. The value of this header must be unique to each operation you are trying to do. One example can be to use the same order_id that you pass while creating orders ")] = None, **kwargs) -> ApiResponse: # noqa: E501 + """Get Refund # noqa: E501 + + Use this API to fetch a specific refund processed on your Cashfree Account. # noqa: E501 + This method makes a synchronous HTTP request by default. To make an + asynchronous HTTP request, please pass async_req=True + + >>> thread = api.PGOrderFetchRefund_with_http_info(x_api_version, order_id, refund_id, x_request_id, x_idempotency_key, async_req=True) + >>> result = thread.get() + + :param x_api_version: API version to be used. Format is in YYYY-MM-DD (required) + :type x_api_version: str + :param order_id: The id which uniquely identifies your order (required) + :type order_id: str + :param refund_id: Refund Id of the refund you want to fetch. (required) + :type refund_id: str + :param x_request_id: Request id for the API call. Can be used to resolve tech issues. Communicate this in your tech related queries to cashfree + :type x_request_id: str + :param x_idempotency_key: Idempotency works by saving the resulting status code and body of the first request made for any given idempotency key, regardless of whether it succeeded or failed. Subsequent requests with the same key return the same result, including 500 errors. Currently supported on all POST calls that uses x-client-id & x-client-secret. To use enable, pass x-idempotency-key in the request header. The value of this header must be unique to each operation you are trying to do. One example can be to use the same order_id that you pass while creating orders + :type x_idempotency_key: str + :param async_req: Whether to execute the request asynchronously. + :type async_req: bool, optional + :param _preload_content: if False, the ApiResponse.data will + be set to none and raw_data will store the + HTTP response body without reading/decoding. + Default is True. + :type _preload_content: bool, optional + :param _return_http_data_only: response data instead of ApiResponse + object with status code, headers, etc + :type _return_http_data_only: bool, optional + :param _request_timeout: timeout setting for this request. If one + number provided, it will be total request + timeout. It can also be a pair (tuple) of + (connection, read) timeouts. + :param _request_auth: set to override the auth_settings for an a single + request; this effectively ignores the authentication + in the spec for a single request. + :type _request_auth: dict, optional + :type _content_type: string, optional: force content-type for the request + :return: Returns the result object. + If the method is called asynchronously, + returns the request thread. + :rtype: tuple(RefundEntity, status_code(int), headers(HTTPHeaderDict)) + """ + + api_client = ApiClient.get_default() + host = "https://api.cashfree.com/pg" + if Cashfree.XEnvironment == CFEnvironment.SANDBOX: + host = "https://sandbox.cashfree.com/pg" + configuration = Configuration( + host = host + ) + configuration.api_key['XClientID'] = Cashfree.XClientId + configuration.api_key['XClientSecret'] = Cashfree.XClientSecret + configuration.api_key['XClientSignature'] = Cashfree.XClientSignature + configuration.api_key['XPartnerMerchantId'] = Cashfree.XPartnerMerchantId + configuration.api_key['XPartnerKey'] = Cashfree.XPartnerKey + api_client.configuration = configuration + _params = locals() + + _all_params = [ + 'x_api_version', + 'order_id', + 'refund_id', + 'x_request_id', + 'x_idempotency_key' + ] + _all_params.extend( + [ + 'async_req', + '_return_http_data_only', + '_preload_content', + '_request_timeout', + '_request_auth', + '_content_type', + '_headers' + ] + ) + + # validate the arguments + for _key, _val in _params['kwargs'].items(): + if _key not in _all_params: + raise ApiTypeError( + "Got an unexpected keyword argument '%s'" + " to method PGOrderFetchRefund" % _key + ) + _params[_key] = _val + del _params['kwargs'] + + _collection_formats = {} + + # process the path parameters + _path_params = {} + if _params['order_id']: + _path_params['order_id'] = _params['order_id'] + + if _params['refund_id']: + _path_params['refund_id'] = _params['refund_id'] + + + # process the query parameters + _query_params = [] + # process the header parameters + _header_params = dict(_params.get('_headers', {})) + if x_request_id: + _header_params["x-request-id"] = x_request_id + + if x_api_version: + _header_params["x-api-version"] = x_api_version + + if x_idempotency_key: + _header_params["x-idempotency-key"] = x_idempotency_key + _header_params["x-sdk-platform"] = "pythonsdk-3.0.1" + + # process the form parameters + _form_params = [] + _files = {} + # process the body parameter + _body_params = None + # set the HTTP header `Accept` + _header_params['Accept'] = api_client.select_header_accept( + ['application/json']) # noqa: E501 + + # authentication setting + _auth_settings = ['XPartnerAPIKey', 'XClientSecret', 'XPartnerMerchantID', 'XClientID', 'XClientSignatureHeader'] # noqa: E501 + + _response_types_map = { + '200': "RefundEntity", + '400': "BadRequestError", + '401': "AuthenticationError", + '404': "ApiError404", + '409': "ApiError409", + '422': "IdempotencyError", + '429': "RateLimitError", + '500': "ApiError", + '502': "ApiError502", + } + + return api_client.call_api( + '/orders/{order_id}/refunds/{refund_id}', 'GET', + _path_params, + _query_params, + _header_params, + body=_body_params, + post_params=_form_params, + files=_files, + response_types_map=_response_types_map, + auth_settings=_auth_settings, + async_req=_params.get('async_req'), + _return_http_data_only=_params.get('_return_http_data_only'), # noqa: E501 + _preload_content=_params.get('_preload_content', True), + _request_timeout=_params.get('_request_timeout'), + collection_formats=_collection_formats, + _request_auth=_params.get('_request_auth')) + @validate_arguments + def PGOrderFetchRefunds(self, x_api_version : Annotated[StrictStr, Field(..., description="API version to be used. Format is in YYYY-MM-DD")] = None, order_id : Annotated[StrictStr, Field(..., description="The id which uniquely identifies your order")] = None, x_request_id : Annotated[Optional[StrictStr], Field(description="Request id for the API call. Can be used to resolve tech issues. Communicate this in your tech related queries to cashfree")] = None, x_idempotency_key : Annotated[Optional[StrictStr], Field(description="Idempotency works by saving the resulting status code and body of the first request made for any given idempotency key, regardless of whether it succeeded or failed. Subsequent requests with the same key return the same result, including 500 errors. Currently supported on all POST calls that uses x-client-id & x-client-secret. To use enable, pass x-idempotency-key in the request header. The value of this header must be unique to each operation you are trying to do. One example can be to use the same order_id that you pass while creating orders ")] = None, **kwargs) -> ApiResponse: # noqa: E501 + """Get All Refunds for an Order # noqa: E501 + + Use this API to fetch all refunds processed against an order. # noqa: E501 + This method makes a synchronous HTTP request by default. To make an + asynchronous HTTP request, please pass async_req=True + + >>> thread = api.PGOrderFetchRefunds_with_http_info(x_api_version, order_id, x_request_id, x_idempotency_key, async_req=True) + >>> result = thread.get() + + :param x_api_version: API version to be used. Format is in YYYY-MM-DD (required) + :type x_api_version: str + :param order_id: The id which uniquely identifies your order (required) + :type order_id: str + :param x_request_id: Request id for the API call. Can be used to resolve tech issues. Communicate this in your tech related queries to cashfree + :type x_request_id: str + :param x_idempotency_key: Idempotency works by saving the resulting status code and body of the first request made for any given idempotency key, regardless of whether it succeeded or failed. Subsequent requests with the same key return the same result, including 500 errors. Currently supported on all POST calls that uses x-client-id & x-client-secret. To use enable, pass x-idempotency-key in the request header. The value of this header must be unique to each operation you are trying to do. One example can be to use the same order_id that you pass while creating orders + :type x_idempotency_key: str + :param async_req: Whether to execute the request asynchronously. + :type async_req: bool, optional + :param _preload_content: if False, the ApiResponse.data will + be set to none and raw_data will store the + HTTP response body without reading/decoding. + Default is True. + :type _preload_content: bool, optional + :param _return_http_data_only: response data instead of ApiResponse + object with status code, headers, etc + :type _return_http_data_only: bool, optional + :param _request_timeout: timeout setting for this request. If one + number provided, it will be total request + timeout. It can also be a pair (tuple) of + (connection, read) timeouts. + :param _request_auth: set to override the auth_settings for an a single + request; this effectively ignores the authentication + in the spec for a single request. + :type _request_auth: dict, optional + :type _content_type: string, optional: force content-type for the request + :return: Returns the result object. + If the method is called asynchronously, + returns the request thread. + :rtype: tuple(List[RefundEntity], status_code(int), headers(HTTPHeaderDict)) + """ + + api_client = ApiClient.get_default() + host = "https://api.cashfree.com/pg" + if Cashfree.XEnvironment == CFEnvironment.SANDBOX: + host = "https://sandbox.cashfree.com/pg" + configuration = Configuration( + host = host + ) + configuration.api_key['XClientID'] = Cashfree.XClientId + configuration.api_key['XClientSecret'] = Cashfree.XClientSecret + configuration.api_key['XClientSignature'] = Cashfree.XClientSignature + configuration.api_key['XPartnerMerchantId'] = Cashfree.XPartnerMerchantId + configuration.api_key['XPartnerKey'] = Cashfree.XPartnerKey + api_client.configuration = configuration + _params = locals() + + _all_params = [ + 'x_api_version', + 'order_id', + 'x_request_id', + 'x_idempotency_key' + ] + _all_params.extend( + [ + 'async_req', + '_return_http_data_only', + '_preload_content', + '_request_timeout', + '_request_auth', + '_content_type', + '_headers' + ] + ) + + # validate the arguments + for _key, _val in _params['kwargs'].items(): + if _key not in _all_params: + raise ApiTypeError( + "Got an unexpected keyword argument '%s'" + " to method PGOrderFetchRefunds" % _key + ) + _params[_key] = _val + del _params['kwargs'] + + _collection_formats = {} + + # process the path parameters + _path_params = {} + if _params['order_id']: + _path_params['order_id'] = _params['order_id'] + + + # process the query parameters + _query_params = [] + # process the header parameters + _header_params = dict(_params.get('_headers', {})) + if x_request_id: + _header_params["x-request-id"] = x_request_id + + if x_api_version: + _header_params["x-api-version"] = x_api_version + + if x_idempotency_key: + _header_params["x-idempotency-key"] = x_idempotency_key + _header_params["x-sdk-platform"] = "pythonsdk-3.0.1" + + # process the form parameters + _form_params = [] + _files = {} + # process the body parameter + _body_params = None + # set the HTTP header `Accept` + _header_params['Accept'] = api_client.select_header_accept( + ['application/json']) # noqa: E501 + + # authentication setting + _auth_settings = ['XPartnerAPIKey', 'XClientSecret', 'XPartnerMerchantID', 'XClientID', 'XClientSignatureHeader'] # noqa: E501 + + _response_types_map = { + '200': "List[RefundEntity]", + '400': "BadRequestError", + '401': "AuthenticationError", + '404': "ApiError404", + '409': "ApiError409", + '422': "IdempotencyError", + '429': "RateLimitError", + '500': "ApiError", + } + + return api_client.call_api( + '/orders/{order_id}/refunds', 'GET', + _path_params, + _query_params, + _header_params, + body=_body_params, + post_params=_form_params, + files=_files, + response_types_map=_response_types_map, + auth_settings=_auth_settings, + async_req=_params.get('async_req'), + _return_http_data_only=_params.get('_return_http_data_only'), # noqa: E501 + _preload_content=_params.get('_preload_content', True), + _request_timeout=_params.get('_request_timeout'), + collection_formats=_collection_formats, + _request_auth=_params.get('_request_auth')) + + @validate_arguments + def PGFetchSettlements(self, x_api_version : Annotated[StrictStr, Field(..., description="API version to be used. Format is in YYYY-MM-DD")] = None, fetch_settlements_request : Annotated[FetchSettlementsRequest, Field(..., description="Request Body to get the settlements")] = None, content_type : Annotated[Optional[StrictStr], Field(description="application/json")] = None, x_request_id : Annotated[Optional[StrictStr], Field(description="Request id for the API call. Can be used to resolve tech issues. Communicate this in your tech related queries to cashfree")] = None, x_idempotency_key : Annotated[Optional[StrictStr], Field(description="Idempotency works by saving the resulting status code and body of the first request made for any given idempotency key, regardless of whether it succeeded or failed. Subsequent requests with the same key return the same result, including 500 errors. Currently supported on all POST calls that uses x-client-id & x-client-secret. To use enable, pass x-idempotency-key in the request header. The value of this header must be unique to each operation you are trying to do. One example can be to use the same order_id that you pass while creating orders ")] = None, accept : Annotated[Optional[StrictStr], Field(description="application/json")] = None, **kwargs) -> ApiResponse: # noqa: E501 + """Get All Settlements # noqa: E501 + + Use this API to get all settlement details by specifying the settlement ID, settlement UTR or date range. # noqa: E501 + This method makes a synchronous HTTP request by default. To make an + asynchronous HTTP request, please pass async_req=True + + >>> thread = api.PGFetchSettlements_with_http_info(x_api_version, fetch_settlements_request, content_type, x_request_id, x_idempotency_key, accept, async_req=True) + >>> result = thread.get() + + :param x_api_version: API version to be used. Format is in YYYY-MM-DD (required) + :type x_api_version: str + :param fetch_settlements_request: Request Body to get the settlements (required) + :type fetch_settlements_request: FetchSettlementsRequest + :param content_type: application/json + :type content_type: str + :param x_request_id: Request id for the API call. Can be used to resolve tech issues. Communicate this in your tech related queries to cashfree + :type x_request_id: str + :param x_idempotency_key: Idempotency works by saving the resulting status code and body of the first request made for any given idempotency key, regardless of whether it succeeded or failed. Subsequent requests with the same key return the same result, including 500 errors. Currently supported on all POST calls that uses x-client-id & x-client-secret. To use enable, pass x-idempotency-key in the request header. The value of this header must be unique to each operation you are trying to do. One example can be to use the same order_id that you pass while creating orders + :type x_idempotency_key: str + :param accept: application/json + :type accept: str + :param async_req: Whether to execute the request asynchronously. + :type async_req: bool, optional + :param _preload_content: if False, the ApiResponse.data will + be set to none and raw_data will store the + HTTP response body without reading/decoding. + Default is True. + :type _preload_content: bool, optional + :param _return_http_data_only: response data instead of ApiResponse + object with status code, headers, etc + :type _return_http_data_only: bool, optional + :param _request_timeout: timeout setting for this request. If one + number provided, it will be total request + timeout. It can also be a pair (tuple) of + (connection, read) timeouts. + :param _request_auth: set to override the auth_settings for an a single + request; this effectively ignores the authentication + in the spec for a single request. + :type _request_auth: dict, optional + :type _content_type: string, optional: force content-type for the request + :return: Returns the result object. + If the method is called asynchronously, + returns the request thread. + :rtype: tuple(SettlementEntity, status_code(int), headers(HTTPHeaderDict)) + """ + + api_client = ApiClient.get_default() + host = "https://api.cashfree.com/pg" + if Cashfree.XEnvironment == CFEnvironment.SANDBOX: + host = "https://sandbox.cashfree.com/pg" + configuration = Configuration( + host = host + ) + configuration.api_key['XClientID'] = Cashfree.XClientId + configuration.api_key['XClientSecret'] = Cashfree.XClientSecret + configuration.api_key['XClientSignature'] = Cashfree.XClientSignature + configuration.api_key['XPartnerMerchantId'] = Cashfree.XPartnerMerchantId + configuration.api_key['XPartnerKey'] = Cashfree.XPartnerKey + api_client.configuration = configuration + _params = locals() + + _all_params = [ + 'x_api_version', + 'fetch_settlements_request', + 'content_type', + 'x_request_id', + 'x_idempotency_key', + 'accept' + ] + _all_params.extend( + [ + 'async_req', + '_return_http_data_only', + '_preload_content', + '_request_timeout', + '_request_auth', + '_content_type', + '_headers' + ] + ) + + # validate the arguments + for _key, _val in _params['kwargs'].items(): + if _key not in _all_params: + raise ApiTypeError( + "Got an unexpected keyword argument '%s'" + " to method PGFetchSettlements" % _key + ) + _params[_key] = _val + del _params['kwargs'] + + _collection_formats = {} + + # process the path parameters + _path_params = {} + + # process the query parameters + _query_params = [] + # process the header parameters + _header_params = dict(_params.get('_headers', {})) + if x_request_id: + _header_params["x-request-id"] = x_request_id + + if x_api_version: + _header_params["x-api-version"] = x_api_version + + if x_idempotency_key: + _header_params["x-idempotency-key"] = x_idempotency_key + _header_params["x-sdk-platform"] = "pythonsdk-3.0.1" + + # process the form parameters + _form_params = [] + _files = {} + # process the body parameter + _body_params = None + if _params['fetch_settlements_request'] is not None: + _body_params = _params['fetch_settlements_request'] + + # set the HTTP header `Accept` + _header_params['Accept'] = api_client.select_header_accept( + ['application/json']) # noqa: E501 + + # set the HTTP header `Content-Type` + _content_types_list = _params.get('_content_type', + api_client.select_header_content_type( + ['application/json'])) + if _content_types_list: + _header_params['Content-Type'] = _content_types_list + + # authentication setting + _auth_settings = ['XPartnerAPIKey', 'XClientSecret', 'XPartnerMerchantID', 'XClientID', 'XClientSignatureHeader'] # noqa: E501 + + _response_types_map = { + '200': "SettlementEntity", + '400': "BadRequestError", + '401': "AuthenticationError", + '404': "ApiError404", + '409': "ApiError409", + '422': "IdempotencyError", + '429': "RateLimitError", + '500': "ApiError", + } + + return api_client.call_api( + '/settlements', 'POST', + _path_params, + _query_params, + _header_params, + body=_body_params, + post_params=_form_params, + files=_files, + response_types_map=_response_types_map, + auth_settings=_auth_settings, + async_req=_params.get('async_req'), + _return_http_data_only=_params.get('_return_http_data_only'), # noqa: E501 + _preload_content=_params.get('_preload_content', True), + _request_timeout=_params.get('_request_timeout'), + collection_formats=_collection_formats, + _request_auth=_params.get('_request_auth')) + @validate_arguments + def PGSettlementFetchRecon(self, x_api_version : Annotated[StrictStr, Field(..., description="API version to be used. Format is in YYYY-MM-DD")] = None, settlement_fetch_recon_request : Annotated[SettlementFetchReconRequest, Field(..., description="Request Body for the settlement reconciliation")] = None, content_type : Annotated[Optional[StrictStr], Field(description="application/json")] = None, x_request_id : Annotated[Optional[StrictStr], Field(description="Request id for the API call. Can be used to resolve tech issues. Communicate this in your tech related queries to cashfree")] = None, x_idempotency_key : Annotated[Optional[StrictStr], Field(description="Idempotency works by saving the resulting status code and body of the first request made for any given idempotency key, regardless of whether it succeeded or failed. Subsequent requests with the same key return the same result, including 500 errors. Currently supported on all POST calls that uses x-client-id & x-client-secret. To use enable, pass x-idempotency-key in the request header. The value of this header must be unique to each operation you are trying to do. One example can be to use the same order_id that you pass while creating orders ")] = None, accept : Annotated[Optional[StrictStr], Field(description="application/json")] = None, **kwargs) -> ApiResponse: # noqa: E501 + """Settlement Reconciliation # noqa: E501 + + - Use this API to get settlement reconciliation details using Settlement ID, settlement UTR or date range. - This API will return events for the settlement IDs you want # noqa: E501 + This method makes a synchronous HTTP request by default. To make an + asynchronous HTTP request, please pass async_req=True + + >>> thread = api.PGSettlementFetchRecon_with_http_info(x_api_version, settlement_fetch_recon_request, content_type, x_request_id, x_idempotency_key, accept, async_req=True) + >>> result = thread.get() + + :param x_api_version: API version to be used. Format is in YYYY-MM-DD (required) + :type x_api_version: str + :param settlement_fetch_recon_request: Request Body for the settlement reconciliation (required) + :type settlement_fetch_recon_request: SettlementFetchReconRequest + :param content_type: application/json + :type content_type: str + :param x_request_id: Request id for the API call. Can be used to resolve tech issues. Communicate this in your tech related queries to cashfree + :type x_request_id: str + :param x_idempotency_key: Idempotency works by saving the resulting status code and body of the first request made for any given idempotency key, regardless of whether it succeeded or failed. Subsequent requests with the same key return the same result, including 500 errors. Currently supported on all POST calls that uses x-client-id & x-client-secret. To use enable, pass x-idempotency-key in the request header. The value of this header must be unique to each operation you are trying to do. One example can be to use the same order_id that you pass while creating orders + :type x_idempotency_key: str + :param accept: application/json + :type accept: str + :param async_req: Whether to execute the request asynchronously. + :type async_req: bool, optional + :param _preload_content: if False, the ApiResponse.data will + be set to none and raw_data will store the + HTTP response body without reading/decoding. + Default is True. + :type _preload_content: bool, optional + :param _return_http_data_only: response data instead of ApiResponse + object with status code, headers, etc + :type _return_http_data_only: bool, optional + :param _request_timeout: timeout setting for this request. If one + number provided, it will be total request + timeout. It can also be a pair (tuple) of + (connection, read) timeouts. + :param _request_auth: set to override the auth_settings for an a single + request; this effectively ignores the authentication + in the spec for a single request. + :type _request_auth: dict, optional + :type _content_type: string, optional: force content-type for the request + :return: Returns the result object. + If the method is called asynchronously, + returns the request thread. + :rtype: tuple(SettlementReconEntity, status_code(int), headers(HTTPHeaderDict)) + """ + + api_client = ApiClient.get_default() + host = "https://api.cashfree.com/pg" + if Cashfree.XEnvironment == CFEnvironment.SANDBOX: + host = "https://sandbox.cashfree.com/pg" + configuration = Configuration( + host = host + ) + configuration.api_key['XClientID'] = Cashfree.XClientId + configuration.api_key['XClientSecret'] = Cashfree.XClientSecret + configuration.api_key['XClientSignature'] = Cashfree.XClientSignature + configuration.api_key['XPartnerMerchantId'] = Cashfree.XPartnerMerchantId + configuration.api_key['XPartnerKey'] = Cashfree.XPartnerKey + api_client.configuration = configuration + _params = locals() + + _all_params = [ + 'x_api_version', + 'settlement_fetch_recon_request', + 'content_type', + 'x_request_id', + 'x_idempotency_key', + 'accept' + ] + _all_params.extend( + [ + 'async_req', + '_return_http_data_only', + '_preload_content', + '_request_timeout', + '_request_auth', + '_content_type', + '_headers' + ] + ) + + # validate the arguments + for _key, _val in _params['kwargs'].items(): + if _key not in _all_params: + raise ApiTypeError( + "Got an unexpected keyword argument '%s'" + " to method PGSettlementFetchRecon" % _key + ) + _params[_key] = _val + del _params['kwargs'] + + _collection_formats = {} + + # process the path parameters + _path_params = {} + + # process the query parameters + _query_params = [] + # process the header parameters + _header_params = dict(_params.get('_headers', {})) + if x_request_id: + _header_params["x-request-id"] = x_request_id + + if x_api_version: + _header_params["x-api-version"] = x_api_version + + if x_idempotency_key: + _header_params["x-idempotency-key"] = x_idempotency_key + _header_params["x-sdk-platform"] = "pythonsdk-3.0.1" + + # process the form parameters + _form_params = [] + _files = {} + # process the body parameter + _body_params = None + if _params['settlement_fetch_recon_request'] is not None: + _body_params = _params['settlement_fetch_recon_request'] + + # set the HTTP header `Accept` + _header_params['Accept'] = api_client.select_header_accept( + ['application/json']) # noqa: E501 + + # set the HTTP header `Content-Type` + _content_types_list = _params.get('_content_type', + api_client.select_header_content_type( + ['application/json'])) + if _content_types_list: + _header_params['Content-Type'] = _content_types_list + + # authentication setting + _auth_settings = ['XPartnerAPIKey', 'XClientSecret', 'XPartnerMerchantID', 'XClientID', 'XClientSignatureHeader'] # noqa: E501 + + _response_types_map = { + '200': "SettlementReconEntity", + '400': "BadRequestError", + '401': "AuthenticationError", + '404': "ApiError404", + '409': "ApiError409", + '422': "IdempotencyError", + '429': "RateLimitError", + '500': "ApiError", + } + + return api_client.call_api( + '/settlement/recon', 'POST', + _path_params, + _query_params, + _header_params, + body=_body_params, + post_params=_form_params, + files=_files, + response_types_map=_response_types_map, + auth_settings=_auth_settings, + async_req=_params.get('async_req'), + _return_http_data_only=_params.get('_return_http_data_only'), # noqa: E501 + _preload_content=_params.get('_preload_content', True), + _request_timeout=_params.get('_request_timeout'), + collection_formats=_collection_formats, + _request_auth=_params.get('_request_auth')) + + @validate_arguments + def PGOrderFetchSettlement(self, x_api_version : Annotated[StrictStr, Field(..., description="API version to be used. Format is in YYYY-MM-DD")] = None, order_id : Annotated[StrictStr, Field(..., description="The id which uniquely identifies your order")] = None, x_request_id : Annotated[Optional[StrictStr], Field(description="Request id for the API call. Can be used to resolve tech issues. Communicate this in your tech related queries to cashfree")] = None, x_idempotency_key : Annotated[Optional[StrictStr], Field(description="Idempotency works by saving the resulting status code and body of the first request made for any given idempotency key, regardless of whether it succeeded or failed. Subsequent requests with the same key return the same result, including 500 errors. Currently supported on all POST calls that uses x-client-id & x-client-secret. To use enable, pass x-idempotency-key in the request header. The value of this header must be unique to each operation you are trying to do. One example can be to use the same order_id that you pass while creating orders ")] = None, **kwargs) -> ApiResponse: # noqa: E501 + """Get Settlements by Order ID # noqa: E501 + + Use this API to view all the settlements of a particular order. # noqa: E501 + This method makes a synchronous HTTP request by default. To make an + asynchronous HTTP request, please pass async_req=True + + >>> thread = api.PGOrderFetchSettlement_with_http_info(x_api_version, order_id, x_request_id, x_idempotency_key, async_req=True) + >>> result = thread.get() + + :param x_api_version: API version to be used. Format is in YYYY-MM-DD (required) + :type x_api_version: str + :param order_id: The id which uniquely identifies your order (required) + :type order_id: str + :param x_request_id: Request id for the API call. Can be used to resolve tech issues. Communicate this in your tech related queries to cashfree + :type x_request_id: str + :param x_idempotency_key: Idempotency works by saving the resulting status code and body of the first request made for any given idempotency key, regardless of whether it succeeded or failed. Subsequent requests with the same key return the same result, including 500 errors. Currently supported on all POST calls that uses x-client-id & x-client-secret. To use enable, pass x-idempotency-key in the request header. The value of this header must be unique to each operation you are trying to do. One example can be to use the same order_id that you pass while creating orders + :type x_idempotency_key: str + :param async_req: Whether to execute the request asynchronously. + :type async_req: bool, optional + :param _preload_content: if False, the ApiResponse.data will + be set to none and raw_data will store the + HTTP response body without reading/decoding. + Default is True. + :type _preload_content: bool, optional + :param _return_http_data_only: response data instead of ApiResponse + object with status code, headers, etc + :type _return_http_data_only: bool, optional + :param _request_timeout: timeout setting for this request. If one + number provided, it will be total request + timeout. It can also be a pair (tuple) of + (connection, read) timeouts. + :param _request_auth: set to override the auth_settings for an a single + request; this effectively ignores the authentication + in the spec for a single request. + :type _request_auth: dict, optional + :type _content_type: string, optional: force content-type for the request + :return: Returns the result object. + If the method is called asynchronously, + returns the request thread. + :rtype: tuple(SettlementEntity, status_code(int), headers(HTTPHeaderDict)) + """ + + api_client = ApiClient.get_default() + host = "https://api.cashfree.com/pg" + if Cashfree.XEnvironment == CFEnvironment.SANDBOX: + host = "https://sandbox.cashfree.com/pg" + configuration = Configuration( + host = host + ) + configuration.api_key['XClientID'] = Cashfree.XClientId + configuration.api_key['XClientSecret'] = Cashfree.XClientSecret + configuration.api_key['XClientSignature'] = Cashfree.XClientSignature + configuration.api_key['XPartnerMerchantId'] = Cashfree.XPartnerMerchantId + configuration.api_key['XPartnerKey'] = Cashfree.XPartnerKey + api_client.configuration = configuration + _params = locals() + + _all_params = [ + 'x_api_version', + 'order_id', + 'x_request_id', + 'x_idempotency_key' + ] + _all_params.extend( + [ + 'async_req', + '_return_http_data_only', + '_preload_content', + '_request_timeout', + '_request_auth', + '_content_type', + '_headers' + ] + ) + + # validate the arguments + for _key, _val in _params['kwargs'].items(): + if _key not in _all_params: + raise ApiTypeError( + "Got an unexpected keyword argument '%s'" + " to method PGOrderFetchSettlement" % _key + ) + _params[_key] = _val + del _params['kwargs'] + + _collection_formats = {} + + # process the path parameters + _path_params = {} + if _params['order_id']: + _path_params['order_id'] = _params['order_id'] + + + # process the query parameters + _query_params = [] + # process the header parameters + _header_params = dict(_params.get('_headers', {})) + if x_request_id: + _header_params["x-request-id"] = x_request_id + + if x_api_version: + _header_params["x-api-version"] = x_api_version + + if x_idempotency_key: + _header_params["x-idempotency-key"] = x_idempotency_key + _header_params["x-sdk-platform"] = "pythonsdk-3.0.1" + + # process the form parameters + _form_params = [] + _files = {} + # process the body parameter + _body_params = None + # set the HTTP header `Accept` + _header_params['Accept'] = api_client.select_header_accept( + ['application/json']) # noqa: E501 + + # authentication setting + _auth_settings = ['XPartnerAPIKey', 'XClientSecret', 'XPartnerMerchantID', 'XClientID', 'XClientSignatureHeader'] # noqa: E501 + + _response_types_map = { + '200': "SettlementEntity", + '400': "BadRequestError", + '401': "AuthenticationError", + '404': "ApiError404", + '409': "ApiError409", + '422': "IdempotencyError", + '429': "RateLimitError", + '500': "ApiError", + '502': "ApiError502", + } + + return api_client.call_api( + '/orders/{order_id}/settlements', 'GET', + _path_params, + _query_params, + _header_params, + body=_body_params, + post_params=_form_params, + files=_files, + response_types_map=_response_types_map, + auth_settings=_auth_settings, + async_req=_params.get('async_req'), + _return_http_data_only=_params.get('_return_http_data_only'), # noqa: E501 + _preload_content=_params.get('_preload_content', True), + _request_timeout=_params.get('_request_timeout'), + collection_formats=_collection_formats, + _request_auth=_params.get('_request_auth')) + + @validate_arguments + def PGCustomerDeleteInstrument(self, x_api_version : Annotated[StrictStr, Field(..., description="API version to be used. Format is in YYYY-MM-DD")] = None, customer_id : Annotated[StrictStr, Field(..., description="Your Customer ID that you had sent during create order API `POST/orders`")] = None, instrument_id : Annotated[StrictStr, Field(..., description="The instrument_id which needs to be deleted")] = None, x_request_id : Annotated[Optional[StrictStr], Field(description="Request id for the API call. Can be used to resolve tech issues. Communicate this in your tech related queries to cashfree")] = None, x_idempotency_key : Annotated[Optional[StrictStr], Field(description="Idempotency works by saving the resulting status code and body of the first request made for any given idempotency key, regardless of whether it succeeded or failed. Subsequent requests with the same key return the same result, including 500 errors. Currently supported on all POST calls that uses x-client-id & x-client-secret. To use enable, pass x-idempotency-key in the request header. The value of this header must be unique to each operation you are trying to do. One example can be to use the same order_id that you pass while creating orders ")] = None, **kwargs) -> ApiResponse: # noqa: E501 + """Delete Saved Card Instrument # noqa: E501 + + Use this API to delete a saved card instrument for a customer_id and instrument_id # noqa: E501 + This method makes a synchronous HTTP request by default. To make an + asynchronous HTTP request, please pass async_req=True + + >>> thread = api.PGCustomerDeleteInstrument_with_http_info(x_api_version, customer_id, instrument_id, x_request_id, x_idempotency_key, async_req=True) + >>> result = thread.get() + + :param x_api_version: API version to be used. Format is in YYYY-MM-DD (required) + :type x_api_version: str + :param customer_id: Your Customer ID that you had sent during create order API `POST/orders` (required) + :type customer_id: str + :param instrument_id: The instrument_id which needs to be deleted (required) + :type instrument_id: str + :param x_request_id: Request id for the API call. Can be used to resolve tech issues. Communicate this in your tech related queries to cashfree + :type x_request_id: str + :param x_idempotency_key: Idempotency works by saving the resulting status code and body of the first request made for any given idempotency key, regardless of whether it succeeded or failed. Subsequent requests with the same key return the same result, including 500 errors. Currently supported on all POST calls that uses x-client-id & x-client-secret. To use enable, pass x-idempotency-key in the request header. The value of this header must be unique to each operation you are trying to do. One example can be to use the same order_id that you pass while creating orders + :type x_idempotency_key: str + :param async_req: Whether to execute the request asynchronously. + :type async_req: bool, optional + :param _preload_content: if False, the ApiResponse.data will + be set to none and raw_data will store the + HTTP response body without reading/decoding. + Default is True. + :type _preload_content: bool, optional + :param _return_http_data_only: response data instead of ApiResponse + object with status code, headers, etc + :type _return_http_data_only: bool, optional + :param _request_timeout: timeout setting for this request. If one + number provided, it will be total request + timeout. It can also be a pair (tuple) of + (connection, read) timeouts. + :param _request_auth: set to override the auth_settings for an a single + request; this effectively ignores the authentication + in the spec for a single request. + :type _request_auth: dict, optional + :type _content_type: string, optional: force content-type for the request + :return: Returns the result object. + If the method is called asynchronously, + returns the request thread. + :rtype: tuple(InstrumentEntity, status_code(int), headers(HTTPHeaderDict)) + """ + + api_client = ApiClient.get_default() + host = "https://api.cashfree.com/pg" + if Cashfree.XEnvironment == CFEnvironment.SANDBOX: + host = "https://sandbox.cashfree.com/pg" + configuration = Configuration( + host = host + ) + configuration.api_key['XClientID'] = Cashfree.XClientId + configuration.api_key['XClientSecret'] = Cashfree.XClientSecret + configuration.api_key['XClientSignature'] = Cashfree.XClientSignature + configuration.api_key['XPartnerMerchantId'] = Cashfree.XPartnerMerchantId + configuration.api_key['XPartnerKey'] = Cashfree.XPartnerKey + api_client.configuration = configuration + _params = locals() + + _all_params = [ + 'x_api_version', + 'customer_id', + 'instrument_id', + 'x_request_id', + 'x_idempotency_key' + ] + _all_params.extend( + [ + 'async_req', + '_return_http_data_only', + '_preload_content', + '_request_timeout', + '_request_auth', + '_content_type', + '_headers' + ] + ) + + # validate the arguments + for _key, _val in _params['kwargs'].items(): + if _key not in _all_params: + raise ApiTypeError( + "Got an unexpected keyword argument '%s'" + " to method PGCustomerDeleteInstrument" % _key + ) + _params[_key] = _val + del _params['kwargs'] + + _collection_formats = {} + + # process the path parameters + _path_params = {} + if _params['customer_id']: + _path_params['customer_id'] = _params['customer_id'] + + if _params['instrument_id']: + _path_params['instrument_id'] = _params['instrument_id'] + + + # process the query parameters + _query_params = [] + # process the header parameters + _header_params = dict(_params.get('_headers', {})) + if x_request_id: + _header_params["x-request-id"] = x_request_id + + if x_api_version: + _header_params["x-api-version"] = x_api_version + + if x_idempotency_key: + _header_params["x-idempotency-key"] = x_idempotency_key + _header_params["x-sdk-platform"] = "pythonsdk-3.0.1" + + # process the form parameters + _form_params = [] + _files = {} + # process the body parameter + _body_params = None + # set the HTTP header `Accept` + _header_params['Accept'] = api_client.select_header_accept( + ['application/json']) # noqa: E501 + + # authentication setting + _auth_settings = ['XPartnerAPIKey', 'XClientSecret', 'XPartnerMerchantID', 'XClientID', 'XClientSignatureHeader'] # noqa: E501 + + _response_types_map = { + '200': "InstrumentEntity", + '400': "BadRequestError", + '401': "AuthenticationError", + '404': "ApiError404", + '409': "ApiError409", + '422': "IdempotencyError", + '429': "RateLimitError", + '500': "ApiError", + '502': "ApiError502", + } + + return api_client.call_api( + '/customers/{customer_id}/instruments/{instrument_id}', 'DELETE', + _path_params, + _query_params, + _header_params, + body=_body_params, + post_params=_form_params, + files=_files, + response_types_map=_response_types_map, + auth_settings=_auth_settings, + async_req=_params.get('async_req'), + _return_http_data_only=_params.get('_return_http_data_only'), # noqa: E501 + _preload_content=_params.get('_preload_content', True), + _request_timeout=_params.get('_request_timeout'), + collection_formats=_collection_formats, + _request_auth=_params.get('_request_auth')) + @validate_arguments + def PGCustomerFetchInstrument(self, x_api_version : Annotated[StrictStr, Field(..., description="API version to be used. Format is in YYYY-MM-DD")] = None, customer_id : Annotated[StrictStr, Field(..., description="Your Customer ID that you had sent during create order API `POST/orders`")] = None, instrument_id : Annotated[StrictStr, Field(..., description="The instrument_id of the saved instrument which needs to be queried")] = None, x_request_id : Annotated[Optional[StrictStr], Field(description="Request id for the API call. Can be used to resolve tech issues. Communicate this in your tech related queries to cashfree")] = None, x_idempotency_key : Annotated[Optional[StrictStr], Field(description="Idempotency works by saving the resulting status code and body of the first request made for any given idempotency key, regardless of whether it succeeded or failed. Subsequent requests with the same key return the same result, including 500 errors. Currently supported on all POST calls that uses x-client-id & x-client-secret. To use enable, pass x-idempotency-key in the request header. The value of this header must be unique to each operation you are trying to do. One example can be to use the same order_id that you pass while creating orders ")] = None, **kwargs) -> ApiResponse: # noqa: E501 + """Fetch Specific Saved Card Instrument # noqa: E501 + + Use this API to fetch a single specific saved card for a customer_id by it's instrument_id # noqa: E501 + This method makes a synchronous HTTP request by default. To make an + asynchronous HTTP request, please pass async_req=True + + >>> thread = api.PGCustomerFetchInstrument_with_http_info(x_api_version, customer_id, instrument_id, x_request_id, x_idempotency_key, async_req=True) + >>> result = thread.get() + + :param x_api_version: API version to be used. Format is in YYYY-MM-DD (required) + :type x_api_version: str + :param customer_id: Your Customer ID that you had sent during create order API `POST/orders` (required) + :type customer_id: str + :param instrument_id: The instrument_id of the saved instrument which needs to be queried (required) + :type instrument_id: str + :param x_request_id: Request id for the API call. Can be used to resolve tech issues. Communicate this in your tech related queries to cashfree + :type x_request_id: str + :param x_idempotency_key: Idempotency works by saving the resulting status code and body of the first request made for any given idempotency key, regardless of whether it succeeded or failed. Subsequent requests with the same key return the same result, including 500 errors. Currently supported on all POST calls that uses x-client-id & x-client-secret. To use enable, pass x-idempotency-key in the request header. The value of this header must be unique to each operation you are trying to do. One example can be to use the same order_id that you pass while creating orders + :type x_idempotency_key: str + :param async_req: Whether to execute the request asynchronously. + :type async_req: bool, optional + :param _preload_content: if False, the ApiResponse.data will + be set to none and raw_data will store the + HTTP response body without reading/decoding. + Default is True. + :type _preload_content: bool, optional + :param _return_http_data_only: response data instead of ApiResponse + object with status code, headers, etc + :type _return_http_data_only: bool, optional + :param _request_timeout: timeout setting for this request. If one + number provided, it will be total request + timeout. It can also be a pair (tuple) of + (connection, read) timeouts. + :param _request_auth: set to override the auth_settings for an a single + request; this effectively ignores the authentication + in the spec for a single request. + :type _request_auth: dict, optional + :type _content_type: string, optional: force content-type for the request + :return: Returns the result object. + If the method is called asynchronously, + returns the request thread. + :rtype: tuple(InstrumentEntity, status_code(int), headers(HTTPHeaderDict)) + """ + + api_client = ApiClient.get_default() + host = "https://api.cashfree.com/pg" + if Cashfree.XEnvironment == CFEnvironment.SANDBOX: + host = "https://sandbox.cashfree.com/pg" + configuration = Configuration( + host = host + ) + configuration.api_key['XClientID'] = Cashfree.XClientId + configuration.api_key['XClientSecret'] = Cashfree.XClientSecret + configuration.api_key['XClientSignature'] = Cashfree.XClientSignature + configuration.api_key['XPartnerMerchantId'] = Cashfree.XPartnerMerchantId + configuration.api_key['XPartnerKey'] = Cashfree.XPartnerKey + api_client.configuration = configuration + _params = locals() + + _all_params = [ + 'x_api_version', + 'customer_id', + 'instrument_id', + 'x_request_id', + 'x_idempotency_key' + ] + _all_params.extend( + [ + 'async_req', + '_return_http_data_only', + '_preload_content', + '_request_timeout', + '_request_auth', + '_content_type', + '_headers' + ] + ) + + # validate the arguments + for _key, _val in _params['kwargs'].items(): + if _key not in _all_params: + raise ApiTypeError( + "Got an unexpected keyword argument '%s'" + " to method PGCustomerFetchInstrument" % _key + ) + _params[_key] = _val + del _params['kwargs'] + + _collection_formats = {} + + # process the path parameters + _path_params = {} + if _params['customer_id']: + _path_params['customer_id'] = _params['customer_id'] + + if _params['instrument_id']: + _path_params['instrument_id'] = _params['instrument_id'] + + + # process the query parameters + _query_params = [] + # process the header parameters + _header_params = dict(_params.get('_headers', {})) + if x_request_id: + _header_params["x-request-id"] = x_request_id + + if x_api_version: + _header_params["x-api-version"] = x_api_version + + if x_idempotency_key: + _header_params["x-idempotency-key"] = x_idempotency_key + _header_params["x-sdk-platform"] = "pythonsdk-3.0.1" + + # process the form parameters + _form_params = [] + _files = {} + # process the body parameter + _body_params = None + # set the HTTP header `Accept` + _header_params['Accept'] = api_client.select_header_accept( + ['application/json']) # noqa: E501 + + # authentication setting + _auth_settings = ['XPartnerAPIKey', 'XClientSecret', 'XPartnerMerchantID', 'XClientID', 'XClientSignatureHeader'] # noqa: E501 + + _response_types_map = { + '200': "InstrumentEntity", + '400': "BadRequestError", + '401': "AuthenticationError", + '404': "ApiError404", + '409': "ApiError409", + '422': "IdempotencyError", + '429': "RateLimitError", + '500': "ApiError", + '502': "ApiError502", + } + + return api_client.call_api( + '/customers/{customer_id}/instruments/{instrument_id}', 'GET', + _path_params, + _query_params, + _header_params, + body=_body_params, + post_params=_form_params, + files=_files, + response_types_map=_response_types_map, + auth_settings=_auth_settings, + async_req=_params.get('async_req'), + _return_http_data_only=_params.get('_return_http_data_only'), # noqa: E501 + _preload_content=_params.get('_preload_content', True), + _request_timeout=_params.get('_request_timeout'), + collection_formats=_collection_formats, + _request_auth=_params.get('_request_auth')) + @validate_arguments + def PGCustomerFetchInstruments(self, x_api_version : Annotated[StrictStr, Field(..., description="API version to be used. Format is in YYYY-MM-DD")] = None, customer_id : Annotated[StrictStr, Field(..., description="Your Customer ID that you had sent during create order API `POST/orders`")] = None, instrument_type : Annotated[StrictStr, Field(..., description="Payment mode or type of saved instrument ")] = None, x_request_id : Annotated[Optional[StrictStr], Field(description="Request id for the API call. Can be used to resolve tech issues. Communicate this in your tech related queries to cashfree")] = None, x_idempotency_key : Annotated[Optional[StrictStr], Field(description="Idempotency works by saving the resulting status code and body of the first request made for any given idempotency key, regardless of whether it succeeded or failed. Subsequent requests with the same key return the same result, including 500 errors. Currently supported on all POST calls that uses x-client-id & x-client-secret. To use enable, pass x-idempotency-key in the request header. The value of this header must be unique to each operation you are trying to do. One example can be to use the same order_id that you pass while creating orders ")] = None, **kwargs) -> ApiResponse: # noqa: E501 + """Fetch All Saved Card Instrument # noqa: E501 + + Use this API to fetch saved cards for a customer_id # noqa: E501 + This method makes a synchronous HTTP request by default. To make an + asynchronous HTTP request, please pass async_req=True + + >>> thread = api.PGCustomerFetchInstruments_with_http_info(x_api_version, customer_id, instrument_type, x_request_id, x_idempotency_key, async_req=True) + >>> result = thread.get() + + :param x_api_version: API version to be used. Format is in YYYY-MM-DD (required) + :type x_api_version: str + :param customer_id: Your Customer ID that you had sent during create order API `POST/orders` (required) + :type customer_id: str + :param instrument_type: Payment mode or type of saved instrument (required) + :type instrument_type: str + :param x_request_id: Request id for the API call. Can be used to resolve tech issues. Communicate this in your tech related queries to cashfree + :type x_request_id: str + :param x_idempotency_key: Idempotency works by saving the resulting status code and body of the first request made for any given idempotency key, regardless of whether it succeeded or failed. Subsequent requests with the same key return the same result, including 500 errors. Currently supported on all POST calls that uses x-client-id & x-client-secret. To use enable, pass x-idempotency-key in the request header. The value of this header must be unique to each operation you are trying to do. One example can be to use the same order_id that you pass while creating orders + :type x_idempotency_key: str + :param async_req: Whether to execute the request asynchronously. + :type async_req: bool, optional + :param _preload_content: if False, the ApiResponse.data will + be set to none and raw_data will store the + HTTP response body without reading/decoding. + Default is True. + :type _preload_content: bool, optional + :param _return_http_data_only: response data instead of ApiResponse + object with status code, headers, etc + :type _return_http_data_only: bool, optional + :param _request_timeout: timeout setting for this request. If one + number provided, it will be total request + timeout. It can also be a pair (tuple) of + (connection, read) timeouts. + :param _request_auth: set to override the auth_settings for an a single + request; this effectively ignores the authentication + in the spec for a single request. + :type _request_auth: dict, optional + :type _content_type: string, optional: force content-type for the request + :return: Returns the result object. + If the method is called asynchronously, + returns the request thread. + :rtype: tuple(List[InstrumentEntity], status_code(int), headers(HTTPHeaderDict)) + """ + + api_client = ApiClient.get_default() + host = "https://api.cashfree.com/pg" + if Cashfree.XEnvironment == CFEnvironment.SANDBOX: + host = "https://sandbox.cashfree.com/pg" + configuration = Configuration( + host = host + ) + configuration.api_key['XClientID'] = Cashfree.XClientId + configuration.api_key['XClientSecret'] = Cashfree.XClientSecret + configuration.api_key['XClientSignature'] = Cashfree.XClientSignature + configuration.api_key['XPartnerMerchantId'] = Cashfree.XPartnerMerchantId + configuration.api_key['XPartnerKey'] = Cashfree.XPartnerKey + api_client.configuration = configuration + _params = locals() + + _all_params = [ + 'x_api_version', + 'customer_id', + 'instrument_type', + 'x_request_id', + 'x_idempotency_key' + ] + _all_params.extend( + [ + 'async_req', + '_return_http_data_only', + '_preload_content', + '_request_timeout', + '_request_auth', + '_content_type', + '_headers' + ] + ) + + # validate the arguments + for _key, _val in _params['kwargs'].items(): + if _key not in _all_params: + raise ApiTypeError( + "Got an unexpected keyword argument '%s'" + " to method PGCustomerFetchInstruments" % _key + ) + _params[_key] = _val + del _params['kwargs'] + + _collection_formats = {} + + # process the path parameters + _path_params = {} + if _params['customer_id']: + _path_params['customer_id'] = _params['customer_id'] + + + # process the query parameters + _query_params = [] + if _params.get('instrument_type') is not None: # noqa: E501 + _query_params.append(('instrument_type', _params['instrument_type'])) + + # process the header parameters + _header_params = dict(_params.get('_headers', {})) + if x_request_id: + _header_params["x-request-id"] = x_request_id + + if x_api_version: + _header_params["x-api-version"] = x_api_version + + if x_idempotency_key: + _header_params["x-idempotency-key"] = x_idempotency_key + _header_params["x-sdk-platform"] = "pythonsdk-3.0.1" + + # process the form parameters + _form_params = [] + _files = {} + # process the body parameter + _body_params = None + # set the HTTP header `Accept` + _header_params['Accept'] = api_client.select_header_accept( + ['application/json']) # noqa: E501 + + # authentication setting + _auth_settings = ['XPartnerAPIKey', 'XClientSecret', 'XPartnerMerchantID', 'XClientID', 'XClientSignatureHeader'] # noqa: E501 + + _response_types_map = { + '200': "List[InstrumentEntity]", + '400': "BadRequestError", + '401': "AuthenticationError", + '404': "ApiError404", + '409': "ApiError409", + '422': "IdempotencyError", + '429': "RateLimitError", + '500': "ApiError", + } + + return api_client.call_api( + '/customers/{customer_id}/instruments', 'GET', + _path_params, + _query_params, + _header_params, + body=_body_params, + post_params=_form_params, + files=_files, + response_types_map=_response_types_map, + auth_settings=_auth_settings, + async_req=_params.get('async_req'), + _return_http_data_only=_params.get('_return_http_data_only'), # noqa: E501 + _preload_content=_params.get('_preload_content', True), + _request_timeout=_params.get('_request_timeout'), + collection_formats=_collection_formats, + _request_auth=_params.get('_request_auth')) + @validate_arguments + def PGCustomerInstrumentsFetchCryptogram(self, x_api_version : Annotated[StrictStr, Field(..., description="API version to be used. Format is in YYYY-MM-DD")] = None, customer_id : Annotated[StrictStr, Field(..., description="Your Customer ID that you had sent during create order API `POST/orders`")] = None, instrument_id : Annotated[StrictStr, Field(..., description="The instrument_id of the saved card instrument which needs to be queried")] = None, x_request_id : Annotated[Optional[StrictStr], Field(description="Request id for the API call. Can be used to resolve tech issues. Communicate this in your tech related queries to cashfree")] = None, x_idempotency_key : Annotated[Optional[StrictStr], Field(description="Idempotency works by saving the resulting status code and body of the first request made for any given idempotency key, regardless of whether it succeeded or failed. Subsequent requests with the same key return the same result, including 500 errors. Currently supported on all POST calls that uses x-client-id & x-client-secret. To use enable, pass x-idempotency-key in the request header. The value of this header must be unique to each operation you are trying to do. One example can be to use the same order_id that you pass while creating orders ")] = None, **kwargs) -> ApiResponse: # noqa: E501 + """Fetch cryptogram for a saved card instrument # noqa: E501 + + Use this API To get the card network token, token expiry and cryptogram for a saved card instrument using instrument id # noqa: E501 + This method makes a synchronous HTTP request by default. To make an + asynchronous HTTP request, please pass async_req=True + + >>> thread = api.PGCustomerInstrumentsFetchCryptogram_with_http_info(x_api_version, customer_id, instrument_id, x_request_id, x_idempotency_key, async_req=True) + >>> result = thread.get() + + :param x_api_version: API version to be used. Format is in YYYY-MM-DD (required) + :type x_api_version: str + :param customer_id: Your Customer ID that you had sent during create order API `POST/orders` (required) + :type customer_id: str + :param instrument_id: The instrument_id of the saved card instrument which needs to be queried (required) + :type instrument_id: str + :param x_request_id: Request id for the API call. Can be used to resolve tech issues. Communicate this in your tech related queries to cashfree + :type x_request_id: str + :param x_idempotency_key: Idempotency works by saving the resulting status code and body of the first request made for any given idempotency key, regardless of whether it succeeded or failed. Subsequent requests with the same key return the same result, including 500 errors. Currently supported on all POST calls that uses x-client-id & x-client-secret. To use enable, pass x-idempotency-key in the request header. The value of this header must be unique to each operation you are trying to do. One example can be to use the same order_id that you pass while creating orders + :type x_idempotency_key: str + :param async_req: Whether to execute the request asynchronously. + :type async_req: bool, optional + :param _preload_content: if False, the ApiResponse.data will + be set to none and raw_data will store the + HTTP response body without reading/decoding. + Default is True. + :type _preload_content: bool, optional + :param _return_http_data_only: response data instead of ApiResponse + object with status code, headers, etc + :type _return_http_data_only: bool, optional + :param _request_timeout: timeout setting for this request. If one + number provided, it will be total request + timeout. It can also be a pair (tuple) of + (connection, read) timeouts. + :param _request_auth: set to override the auth_settings for an a single + request; this effectively ignores the authentication + in the spec for a single request. + :type _request_auth: dict, optional + :type _content_type: string, optional: force content-type for the request + :return: Returns the result object. + If the method is called asynchronously, + returns the request thread. + :rtype: tuple(CryptogramEntity, status_code(int), headers(HTTPHeaderDict)) + """ + + api_client = ApiClient.get_default() + host = "https://api.cashfree.com/pg" + if Cashfree.XEnvironment == CFEnvironment.SANDBOX: + host = "https://sandbox.cashfree.com/pg" + configuration = Configuration( + host = host + ) + configuration.api_key['XClientID'] = Cashfree.XClientId + configuration.api_key['XClientSecret'] = Cashfree.XClientSecret + configuration.api_key['XClientSignature'] = Cashfree.XClientSignature + configuration.api_key['XPartnerMerchantId'] = Cashfree.XPartnerMerchantId + configuration.api_key['XPartnerKey'] = Cashfree.XPartnerKey + api_client.configuration = configuration + _params = locals() + + _all_params = [ + 'x_api_version', + 'customer_id', + 'instrument_id', + 'x_request_id', + 'x_idempotency_key' + ] + _all_params.extend( + [ + 'async_req', + '_return_http_data_only', + '_preload_content', + '_request_timeout', + '_request_auth', + '_content_type', + '_headers' + ] + ) + + # validate the arguments + for _key, _val in _params['kwargs'].items(): + if _key not in _all_params: + raise ApiTypeError( + "Got an unexpected keyword argument '%s'" + " to method PGCustomerInstrumentsFetchCryptogram" % _key + ) + _params[_key] = _val + del _params['kwargs'] + + _collection_formats = {} + + # process the path parameters + _path_params = {} + if _params['customer_id']: + _path_params['customer_id'] = _params['customer_id'] + + if _params['instrument_id']: + _path_params['instrument_id'] = _params['instrument_id'] + + + # process the query parameters + _query_params = [] + # process the header parameters + _header_params = dict(_params.get('_headers', {})) + if x_request_id: + _header_params["x-request-id"] = x_request_id + + if x_api_version: + _header_params["x-api-version"] = x_api_version + + if x_idempotency_key: + _header_params["x-idempotency-key"] = x_idempotency_key + _header_params["x-sdk-platform"] = "pythonsdk-3.0.1" + + # process the form parameters + _form_params = [] + _files = {} + # process the body parameter + _body_params = None + # set the HTTP header `Accept` + _header_params['Accept'] = api_client.select_header_accept( + ['application/json']) # noqa: E501 + + # authentication setting + _auth_settings = ['XPartnerAPIKey', 'XClientSecret', 'XPartnerMerchantID', 'XClientID', 'XClientSignatureHeader'] # noqa: E501 + + _response_types_map = { + '200': "CryptogramEntity", + '400': "BadRequestError", + '401': "AuthenticationError", + '404': "ApiError404", + '409': "ApiError409", + '422': "IdempotencyError", + '429': "RateLimitError", + '500': "ApiError", + '502': "ApiError502", + } + + return api_client.call_api( + '/customers/{customer_id}/instruments/{instrument_id}/cryptogram', 'GET', + _path_params, + _query_params, + _header_params, + body=_body_params, + post_params=_form_params, + files=_files, + response_types_map=_response_types_map, + auth_settings=_auth_settings, + async_req=_params.get('async_req'), + _return_http_data_only=_params.get('_return_http_data_only'), # noqa: E501 + _preload_content=_params.get('_preload_content', True), + _request_timeout=_params.get('_request_timeout'), + collection_formats=_collection_formats, + _request_auth=_params.get('_request_auth')) + + @validate_arguments + def SposCreateTerminal(self, x_api_version : Annotated[StrictStr, Field(..., description="API version to be used. Format is in YYYY-MM-DD")] = None, create_terminal_request : Annotated[CreateTerminalRequest, Field(..., description="Request Body to Create Terminal for SPOS")] = None, x_request_id : Annotated[Optional[StrictStr], Field(description="Request id for the API call. Can be used to resolve tech issues. Communicate this in your tech related queries to cashfree")] = None, x_idempotency_key : Annotated[Optional[StrictStr], Field(description="Idempotency works by saving the resulting status code and body of the first request made for any given idempotency key, regardless of whether it succeeded or failed. Subsequent requests with the same key return the same result, including 500 errors. Currently supported on all POST calls that uses x-client-id & x-client-secret. To use enable, pass x-idempotency-key in the request header. The value of this header must be unique to each operation you are trying to do. One example can be to use the same order_id that you pass while creating orders ")] = None, **kwargs) -> ApiResponse: # noqa: E501 + """Create Terminal # noqa: E501 + + Use this API to create new terminals to use softPOS. # noqa: E501 + This method makes a synchronous HTTP request by default. To make an + asynchronous HTTP request, please pass async_req=True + + >>> thread = api.SposCreateTerminal_with_http_info(x_api_version, create_terminal_request, x_request_id, x_idempotency_key, async_req=True) + >>> result = thread.get() + + :param x_api_version: API version to be used. Format is in YYYY-MM-DD (required) + :type x_api_version: str + :param create_terminal_request: Request Body to Create Terminal for SPOS (required) + :type create_terminal_request: CreateTerminalRequest + :param x_request_id: Request id for the API call. Can be used to resolve tech issues. Communicate this in your tech related queries to cashfree + :type x_request_id: str + :param x_idempotency_key: Idempotency works by saving the resulting status code and body of the first request made for any given idempotency key, regardless of whether it succeeded or failed. Subsequent requests with the same key return the same result, including 500 errors. Currently supported on all POST calls that uses x-client-id & x-client-secret. To use enable, pass x-idempotency-key in the request header. The value of this header must be unique to each operation you are trying to do. One example can be to use the same order_id that you pass while creating orders + :type x_idempotency_key: str + :param async_req: Whether to execute the request asynchronously. + :type async_req: bool, optional + :param _preload_content: if False, the ApiResponse.data will + be set to none and raw_data will store the + HTTP response body without reading/decoding. + Default is True. + :type _preload_content: bool, optional + :param _return_http_data_only: response data instead of ApiResponse + object with status code, headers, etc + :type _return_http_data_only: bool, optional + :param _request_timeout: timeout setting for this request. If one + number provided, it will be total request + timeout. It can also be a pair (tuple) of + (connection, read) timeouts. + :param _request_auth: set to override the auth_settings for an a single + request; this effectively ignores the authentication + in the spec for a single request. + :type _request_auth: dict, optional + :type _content_type: string, optional: force content-type for the request + :return: Returns the result object. + If the method is called asynchronously, + returns the request thread. + :rtype: tuple(TerminalEntity, status_code(int), headers(HTTPHeaderDict)) + """ + + api_client = ApiClient.get_default() + host = "https://api.cashfree.com/pg" + if Cashfree.XEnvironment == CFEnvironment.SANDBOX: + host = "https://sandbox.cashfree.com/pg" + configuration = Configuration( + host = host + ) + configuration.api_key['XClientID'] = Cashfree.XClientId + configuration.api_key['XClientSecret'] = Cashfree.XClientSecret + configuration.api_key['XClientSignature'] = Cashfree.XClientSignature + configuration.api_key['XPartnerMerchantId'] = Cashfree.XPartnerMerchantId + configuration.api_key['XPartnerKey'] = Cashfree.XPartnerKey + api_client.configuration = configuration + _params = locals() + + _all_params = [ + 'x_api_version', + 'create_terminal_request', + 'x_request_id', + 'x_idempotency_key' + ] + _all_params.extend( + [ + 'async_req', + '_return_http_data_only', + '_preload_content', + '_request_timeout', + '_request_auth', + '_content_type', + '_headers' + ] + ) + + # validate the arguments + for _key, _val in _params['kwargs'].items(): + if _key not in _all_params: + raise ApiTypeError( + "Got an unexpected keyword argument '%s'" + " to method SposCreateTerminal" % _key + ) + _params[_key] = _val + del _params['kwargs'] + + _collection_formats = {} + + # process the path parameters + _path_params = {} + + # process the query parameters + _query_params = [] + # process the header parameters + _header_params = dict(_params.get('_headers', {})) + if x_request_id: + _header_params["x-request-id"] = x_request_id + + if x_api_version: + _header_params["x-api-version"] = x_api_version + + if x_idempotency_key: + _header_params["x-idempotency-key"] = x_idempotency_key + _header_params["x-sdk-platform"] = "pythonsdk-3.0.1" + + # process the form parameters + _form_params = [] + _files = {} + # process the body parameter + _body_params = None + if _params['create_terminal_request'] is not None: + _body_params = _params['create_terminal_request'] + + # set the HTTP header `Accept` + _header_params['Accept'] = api_client.select_header_accept( + ['application/json']) # noqa: E501 + + # set the HTTP header `Content-Type` + _content_types_list = _params.get('_content_type', + api_client.select_header_content_type( + ['application/json'])) + if _content_types_list: + _header_params['Content-Type'] = _content_types_list + + # authentication setting + _auth_settings = ['XPartnerAPIKey', 'XClientSecret', 'XPartnerMerchantID', 'XClientID', 'XClientSignatureHeader'] # noqa: E501 + + _response_types_map = { + '200': "TerminalEntity", + '400': "BadRequestError", + '401': "AuthenticationError", + '404': "ApiError404", + '409': "ApiError409", + '422': "IdempotencyError", + '429': "RateLimitError", + '500': "ApiError", + } + + return api_client.call_api( + '/terminal', 'POST', + _path_params, + _query_params, + _header_params, + body=_body_params, + post_params=_form_params, + files=_files, + response_types_map=_response_types_map, + auth_settings=_auth_settings, + async_req=_params.get('async_req'), + _return_http_data_only=_params.get('_return_http_data_only'), # noqa: E501 + _preload_content=_params.get('_preload_content', True), + _request_timeout=_params.get('_request_timeout'), + collection_formats=_collection_formats, + _request_auth=_params.get('_request_auth')) + @validate_arguments + def SposCreateTerminalTransaction(self, x_api_version : Annotated[StrictStr, Field(..., description="API version to be used. Format is in YYYY-MM-DD")] = None, create_terminal_transaction_request : Annotated[CreateTerminalTransactionRequest, Field(..., description="Request body to create a terminal transaction")] = None, x_request_id : Annotated[Optional[StrictStr], Field(description="Request id for the API call. Can be used to resolve tech issues. Communicate this in your tech related queries to cashfree")] = None, x_idempotency_key : Annotated[Optional[StrictStr], Field(description="Idempotency works by saving the resulting status code and body of the first request made for any given idempotency key, regardless of whether it succeeded or failed. Subsequent requests with the same key return the same result, including 500 errors. Currently supported on all POST calls that uses x-client-id & x-client-secret. To use enable, pass x-idempotency-key in the request header. The value of this header must be unique to each operation you are trying to do. One example can be to use the same order_id that you pass while creating orders ")] = None, **kwargs) -> ApiResponse: # noqa: E501 + """Create Terminal # noqa: E501 + + Use this API to create a new terminal transaction. To use this API you should first create an order using the Create Order API. Also, you need to enter the terminal details while creating the order and pass the same terminal information while creating a transaction using the below mentioned API. # noqa: E501 + This method makes a synchronous HTTP request by default. To make an + asynchronous HTTP request, please pass async_req=True + + >>> thread = api.SposCreateTerminalTransaction_with_http_info(x_api_version, create_terminal_transaction_request, x_request_id, x_idempotency_key, async_req=True) + >>> result = thread.get() + + :param x_api_version: API version to be used. Format is in YYYY-MM-DD (required) + :type x_api_version: str + :param create_terminal_transaction_request: Request body to create a terminal transaction (required) + :type create_terminal_transaction_request: CreateTerminalTransactionRequest + :param x_request_id: Request id for the API call. Can be used to resolve tech issues. Communicate this in your tech related queries to cashfree + :type x_request_id: str + :param x_idempotency_key: Idempotency works by saving the resulting status code and body of the first request made for any given idempotency key, regardless of whether it succeeded or failed. Subsequent requests with the same key return the same result, including 500 errors. Currently supported on all POST calls that uses x-client-id & x-client-secret. To use enable, pass x-idempotency-key in the request header. The value of this header must be unique to each operation you are trying to do. One example can be to use the same order_id that you pass while creating orders + :type x_idempotency_key: str + :param async_req: Whether to execute the request asynchronously. + :type async_req: bool, optional + :param _preload_content: if False, the ApiResponse.data will + be set to none and raw_data will store the + HTTP response body without reading/decoding. + Default is True. + :type _preload_content: bool, optional + :param _return_http_data_only: response data instead of ApiResponse + object with status code, headers, etc + :type _return_http_data_only: bool, optional + :param _request_timeout: timeout setting for this request. If one + number provided, it will be total request + timeout. It can also be a pair (tuple) of + (connection, read) timeouts. + :param _request_auth: set to override the auth_settings for an a single + request; this effectively ignores the authentication + in the spec for a single request. + :type _request_auth: dict, optional + :type _content_type: string, optional: force content-type for the request + :return: Returns the result object. + If the method is called asynchronously, + returns the request thread. + :rtype: tuple(TerminalTransactionEntity, status_code(int), headers(HTTPHeaderDict)) + """ + + api_client = ApiClient.get_default() + host = "https://api.cashfree.com/pg" + if Cashfree.XEnvironment == CFEnvironment.SANDBOX: + host = "https://sandbox.cashfree.com/pg" + configuration = Configuration( + host = host + ) + configuration.api_key['XClientID'] = Cashfree.XClientId + configuration.api_key['XClientSecret'] = Cashfree.XClientSecret + configuration.api_key['XClientSignature'] = Cashfree.XClientSignature + configuration.api_key['XPartnerMerchantId'] = Cashfree.XPartnerMerchantId + configuration.api_key['XPartnerKey'] = Cashfree.XPartnerKey + api_client.configuration = configuration + _params = locals() + + _all_params = [ + 'x_api_version', + 'create_terminal_transaction_request', + 'x_request_id', + 'x_idempotency_key' + ] + _all_params.extend( + [ + 'async_req', + '_return_http_data_only', + '_preload_content', + '_request_timeout', + '_request_auth', + '_content_type', + '_headers' + ] + ) + + # validate the arguments + for _key, _val in _params['kwargs'].items(): + if _key not in _all_params: + raise ApiTypeError( + "Got an unexpected keyword argument '%s'" + " to method SposCreateTerminalTransaction" % _key + ) + _params[_key] = _val + del _params['kwargs'] + + _collection_formats = {} + + # process the path parameters + _path_params = {} + + # process the query parameters + _query_params = [] + # process the header parameters + _header_params = dict(_params.get('_headers', {})) + if x_request_id: + _header_params["x-request-id"] = x_request_id + + if x_api_version: + _header_params["x-api-version"] = x_api_version + + if x_idempotency_key: + _header_params["x-idempotency-key"] = x_idempotency_key + _header_params["x-sdk-platform"] = "pythonsdk-3.0.1" + + # process the form parameters + _form_params = [] + _files = {} + # process the body parameter + _body_params = None + if _params['create_terminal_transaction_request'] is not None: + _body_params = _params['create_terminal_transaction_request'] + + # set the HTTP header `Accept` + _header_params['Accept'] = api_client.select_header_accept( + ['application/json']) # noqa: E501 + + # set the HTTP header `Content-Type` + _content_types_list = _params.get('_content_type', + api_client.select_header_content_type( + ['application/json'])) + if _content_types_list: + _header_params['Content-Type'] = _content_types_list + + # authentication setting + _auth_settings = ['XPartnerAPIKey', 'XClientSecret', 'XPartnerMerchantID', 'XClientID', 'XClientSignatureHeader'] # noqa: E501 + + _response_types_map = { + '200': "TerminalTransactionEntity", + '400': "BadRequestError", + '401': "AuthenticationError", + '404': "ApiError404", + '409': "ApiError409", + '422': "IdempotencyError", + '429': "RateLimitError", + '500': "ApiError", + } + + return api_client.call_api( + '/terminal/transactions', 'POST', + _path_params, + _query_params, + _header_params, + body=_body_params, + post_params=_form_params, + files=_files, + response_types_map=_response_types_map, + auth_settings=_auth_settings, + async_req=_params.get('async_req'), + _return_http_data_only=_params.get('_return_http_data_only'), # noqa: E501 + _preload_content=_params.get('_preload_content', True), + _request_timeout=_params.get('_request_timeout'), + collection_formats=_collection_formats, + _request_auth=_params.get('_request_auth')) + @validate_arguments + def SposFetchTerminal(self, x_api_version : Annotated[StrictStr, Field(..., description="API version to be used. Format is in YYYY-MM-DD")] = None, terminal_phone_no : Annotated[StrictStr, Field(..., description="The terminal for which you want to view the order details.")] = None, x_request_id : Annotated[Optional[StrictStr], Field(description="Request id for the API call. Can be used to resolve tech issues. Communicate this in your tech related queries to cashfree")] = None, x_idempotency_key : Annotated[Optional[StrictStr], Field(description="Idempotency works by saving the resulting status code and body of the first request made for any given idempotency key, regardless of whether it succeeded or failed. Subsequent requests with the same key return the same result, including 500 errors. Currently supported on all POST calls that uses x-client-id & x-client-secret. To use enable, pass x-idempotency-key in the request header. The value of this header must be unique to each operation you are trying to do. One example can be to use the same order_id that you pass while creating orders ")] = None, **kwargs) -> ApiResponse: # noqa: E501 + """Get terminal status using phone number # noqa: E501 + + Use this API to view all details of a terminal. # noqa: E501 + This method makes a synchronous HTTP request by default. To make an + asynchronous HTTP request, please pass async_req=True + + >>> thread = api.SposFetchTerminal_with_http_info(x_api_version, terminal_phone_no, x_request_id, x_idempotency_key, async_req=True) + >>> result = thread.get() + + :param x_api_version: API version to be used. Format is in YYYY-MM-DD (required) + :type x_api_version: str + :param terminal_phone_no: The terminal for which you want to view the order details. (required) + :type terminal_phone_no: str + :param x_request_id: Request id for the API call. Can be used to resolve tech issues. Communicate this in your tech related queries to cashfree + :type x_request_id: str + :param x_idempotency_key: Idempotency works by saving the resulting status code and body of the first request made for any given idempotency key, regardless of whether it succeeded or failed. Subsequent requests with the same key return the same result, including 500 errors. Currently supported on all POST calls that uses x-client-id & x-client-secret. To use enable, pass x-idempotency-key in the request header. The value of this header must be unique to each operation you are trying to do. One example can be to use the same order_id that you pass while creating orders + :type x_idempotency_key: str + :param async_req: Whether to execute the request asynchronously. + :type async_req: bool, optional + :param _preload_content: if False, the ApiResponse.data will + be set to none and raw_data will store the + HTTP response body without reading/decoding. + Default is True. + :type _preload_content: bool, optional + :param _return_http_data_only: response data instead of ApiResponse + object with status code, headers, etc + :type _return_http_data_only: bool, optional + :param _request_timeout: timeout setting for this request. If one + number provided, it will be total request + timeout. It can also be a pair (tuple) of + (connection, read) timeouts. + :param _request_auth: set to override the auth_settings for an a single + request; this effectively ignores the authentication + in the spec for a single request. + :type _request_auth: dict, optional + :type _content_type: string, optional: force content-type for the request + :return: Returns the result object. + If the method is called asynchronously, + returns the request thread. + :rtype: tuple(TerminalEntity, status_code(int), headers(HTTPHeaderDict)) + """ + + api_client = ApiClient.get_default() + host = "https://api.cashfree.com/pg" + if Cashfree.XEnvironment == CFEnvironment.SANDBOX: + host = "https://sandbox.cashfree.com/pg" + configuration = Configuration( + host = host + ) + configuration.api_key['XClientID'] = Cashfree.XClientId + configuration.api_key['XClientSecret'] = Cashfree.XClientSecret + configuration.api_key['XClientSignature'] = Cashfree.XClientSignature + configuration.api_key['XPartnerMerchantId'] = Cashfree.XPartnerMerchantId + configuration.api_key['XPartnerKey'] = Cashfree.XPartnerKey + api_client.configuration = configuration + _params = locals() + + _all_params = [ + 'x_api_version', + 'terminal_phone_no', + 'x_request_id', + 'x_idempotency_key' + ] + _all_params.extend( + [ + 'async_req', + '_return_http_data_only', + '_preload_content', + '_request_timeout', + '_request_auth', + '_content_type', + '_headers' + ] + ) + + # validate the arguments + for _key, _val in _params['kwargs'].items(): + if _key not in _all_params: + raise ApiTypeError( + "Got an unexpected keyword argument '%s'" + " to method SposFetchTerminal" % _key + ) + _params[_key] = _val + del _params['kwargs'] + + _collection_formats = {} + + # process the path parameters + _path_params = {} + if _params['terminal_phone_no']: + _path_params['terminal_phone_no'] = _params['terminal_phone_no'] + + + # process the query parameters + _query_params = [] + # process the header parameters + _header_params = dict(_params.get('_headers', {})) + if x_request_id: + _header_params["x-request-id"] = x_request_id + + if x_api_version: + _header_params["x-api-version"] = x_api_version + + if x_idempotency_key: + _header_params["x-idempotency-key"] = x_idempotency_key + _header_params["x-sdk-platform"] = "pythonsdk-3.0.1" + + # process the form parameters + _form_params = [] + _files = {} + # process the body parameter + _body_params = None + # set the HTTP header `Accept` + _header_params['Accept'] = api_client.select_header_accept( + ['application/json']) # noqa: E501 + + # authentication setting + _auth_settings = ['XPartnerAPIKey', 'XClientSecret', 'XPartnerMerchantID', 'XClientID', 'XClientSignatureHeader'] # noqa: E501 + + _response_types_map = { + '200': "TerminalEntity", + '400': "BadRequestError", + '401': "AuthenticationError", + '404': "ApiError404", + '409': "ApiError409", + '422': "IdempotencyError", + '429': "RateLimitError", + '500': "ApiError", + } + + return api_client.call_api( + '/terminal/{terminal_phone_no}', 'GET', + _path_params, + _query_params, + _header_params, + body=_body_params, + post_params=_form_params, + files=_files, + response_types_map=_response_types_map, + auth_settings=_auth_settings, + async_req=_params.get('async_req'), + _return_http_data_only=_params.get('_return_http_data_only'), # noqa: E501 + _preload_content=_params.get('_preload_content', True), + _request_timeout=_params.get('_request_timeout'), + collection_formats=_collection_formats, + _request_auth=_params.get('_request_auth')) + @validate_arguments + def SposFetchTerminalQrCodes(self, x_api_version : Annotated[StrictStr, Field(..., description="API version to be used. Format is in YYYY-MM-DD")] = None, terminal_phone_no : Annotated[StrictStr, Field(..., description="Phone number assigned to the terminal. Required if you are not providing the cf_terminal_id in the request.")] = None, cf_terminal_id : Annotated[StrictStr, Field(..., description="Cashfree terminal id for which you want to get staticQRs. Required if you are not providing the terminal_phone_number in the request.")] = None, x_request_id : Annotated[Optional[StrictStr], Field(description="Request id for the API call. Can be used to resolve tech issues. Communicate this in your tech related queries to cashfree")] = None, x_idempotency_key : Annotated[Optional[StrictStr], Field(description="Idempotency works by saving the resulting status code and body of the first request made for any given idempotency key, regardless of whether it succeeded or failed. Subsequent requests with the same key return the same result, including 500 errors. Currently supported on all POST calls that uses x-client-id & x-client-secret. To use enable, pass x-idempotency-key in the request header. The value of this header must be unique to each operation you are trying to do. One example can be to use the same order_id that you pass while creating orders ")] = None, **kwargs) -> ApiResponse: # noqa: E501 + """Fetch Terminal QR Codes # noqa: E501 + + You can fetch all the StaticQRs corresponding to given terminal id or phone number. Provide either the terminal_phone_no or terminal_id in the request. # noqa: E501 + This method makes a synchronous HTTP request by default. To make an + asynchronous HTTP request, please pass async_req=True + + >>> thread = api.SposFetchTerminalQrCodes_with_http_info(x_api_version, terminal_phone_no, cf_terminal_id, x_request_id, x_idempotency_key, async_req=True) + >>> result = thread.get() + + :param x_api_version: API version to be used. Format is in YYYY-MM-DD (required) + :type x_api_version: str + :param terminal_phone_no: Phone number assigned to the terminal. Required if you are not providing the cf_terminal_id in the request. (required) + :type terminal_phone_no: str + :param cf_terminal_id: Cashfree terminal id for which you want to get staticQRs. Required if you are not providing the terminal_phone_number in the request. (required) + :type cf_terminal_id: str + :param x_request_id: Request id for the API call. Can be used to resolve tech issues. Communicate this in your tech related queries to cashfree + :type x_request_id: str + :param x_idempotency_key: Idempotency works by saving the resulting status code and body of the first request made for any given idempotency key, regardless of whether it succeeded or failed. Subsequent requests with the same key return the same result, including 500 errors. Currently supported on all POST calls that uses x-client-id & x-client-secret. To use enable, pass x-idempotency-key in the request header. The value of this header must be unique to each operation you are trying to do. One example can be to use the same order_id that you pass while creating orders + :type x_idempotency_key: str + :param async_req: Whether to execute the request asynchronously. + :type async_req: bool, optional + :param _preload_content: if False, the ApiResponse.data will + be set to none and raw_data will store the + HTTP response body without reading/decoding. + Default is True. + :type _preload_content: bool, optional + :param _return_http_data_only: response data instead of ApiResponse + object with status code, headers, etc + :type _return_http_data_only: bool, optional + :param _request_timeout: timeout setting for this request. If one + number provided, it will be total request + timeout. It can also be a pair (tuple) of + (connection, read) timeouts. + :param _request_auth: set to override the auth_settings for an a single + request; this effectively ignores the authentication + in the spec for a single request. + :type _request_auth: dict, optional + :type _content_type: string, optional: force content-type for the request + :return: Returns the result object. + If the method is called asynchronously, + returns the request thread. + :rtype: tuple(List[FetchTerminalQRCodesEntity], status_code(int), headers(HTTPHeaderDict)) + """ + + api_client = ApiClient.get_default() + host = "https://api.cashfree.com/pg" + if Cashfree.XEnvironment == CFEnvironment.SANDBOX: + host = "https://sandbox.cashfree.com/pg" + configuration = Configuration( + host = host + ) + configuration.api_key['XClientID'] = Cashfree.XClientId + configuration.api_key['XClientSecret'] = Cashfree.XClientSecret + configuration.api_key['XClientSignature'] = Cashfree.XClientSignature + configuration.api_key['XPartnerMerchantId'] = Cashfree.XPartnerMerchantId + configuration.api_key['XPartnerKey'] = Cashfree.XPartnerKey + api_client.configuration = configuration + _params = locals() + + _all_params = [ + 'x_api_version', + 'terminal_phone_no', + 'cf_terminal_id', + 'x_request_id', + 'x_idempotency_key' + ] + _all_params.extend( + [ + 'async_req', + '_return_http_data_only', + '_preload_content', + '_request_timeout', + '_request_auth', + '_content_type', + '_headers' + ] + ) + + # validate the arguments + for _key, _val in _params['kwargs'].items(): + if _key not in _all_params: + raise ApiTypeError( + "Got an unexpected keyword argument '%s'" + " to method SposFetchTerminalQrCodes" % _key + ) + _params[_key] = _val + del _params['kwargs'] + + _collection_formats = {} + + # process the path parameters + _path_params = {} + + # process the query parameters + _query_params = [] + if _params.get('terminal_phone_no') is not None: # noqa: E501 + _query_params.append(('terminal_phone_no', _params['terminal_phone_no'])) + + if _params.get('cf_terminal_id') is not None: # noqa: E501 + _query_params.append(('cf_terminal_id', _params['cf_terminal_id'])) + + # process the header parameters + _header_params = dict(_params.get('_headers', {})) + if x_request_id: + _header_params["x-request-id"] = x_request_id + + if x_api_version: + _header_params["x-api-version"] = x_api_version + + if x_idempotency_key: + _header_params["x-idempotency-key"] = x_idempotency_key + _header_params["x-sdk-platform"] = "pythonsdk-3.0.1" + + # process the form parameters + _form_params = [] + _files = {} + # process the body parameter + _body_params = None + # set the HTTP header `Accept` + _header_params['Accept'] = api_client.select_header_accept( + ['application/json']) # noqa: E501 + + # authentication setting + _auth_settings = ['XPartnerAPIKey', 'XClientSecret', 'XPartnerMerchantID', 'XClientID', 'XClientSignatureHeader'] # noqa: E501 + + _response_types_map = { + '200': "List[FetchTerminalQRCodesEntity]", + '400': "BadRequestError", + '401': "AuthenticationError", + '404': "ApiError404", + '409': "ApiError409", + '422': "IdempotencyError", + '429': "RateLimitError", + '500': "ApiError", + } + + return api_client.call_api( + '/terminal/qrcodes', 'GET', + _path_params, + _query_params, + _header_params, + body=_body_params, + post_params=_form_params, + files=_files, + response_types_map=_response_types_map, + auth_settings=_auth_settings, + async_req=_params.get('async_req'), + _return_http_data_only=_params.get('_return_http_data_only'), # noqa: E501 + _preload_content=_params.get('_preload_content', True), + _request_timeout=_params.get('_request_timeout'), + collection_formats=_collection_formats, + _request_auth=_params.get('_request_auth')) + + + +class ApiClient(object): + """Generic API client for OpenAPI client library builds. + + OpenAPI generic API client. This client handles the client- + server communication, and is invariant across implementations. Specifics of + the methods and models for each application are generated from the OpenAPI + templates. + + :param configuration: .Configuration object for this client + :param header_name: a header to pass when making calls to the API. + :param header_value: a header value to pass when making calls to + the API. + :param cookie: a cookie to include in the header when making calls + to the API + :param pool_threads: The number of threads to use for async requests + to the API. More threads means more concurrent API requests. + """ + + PRIMITIVE_TYPES = (float, bool, bytes, str, int) + NATIVE_TYPES_MAPPING = { + 'int': int, + 'long': int, # TODO remove as only py3 is supported? + 'float': float, + 'str': str, + 'bool': bool, + 'date': dt.date, + 'datetime': dt.datetime, + 'object': object, + } + _pool = None + + def __init__(self, configuration=None, header_name=None, header_value=None, + cookie=None, pool_threads=1): + # use default configuration if none is provided + if configuration is None: + configuration = Configuration.get_default() + self.configuration = configuration + self.pool_threads = pool_threads + + self.rest_client = rest.RESTClientObject(configuration) + self.default_headers = {} + if header_name is not None: + self.default_headers[header_name] = header_value + self.cookie = cookie + # Set default User-Agent. + self.user_agent = 'OpenAPI-Generator/3.0.1/python' + self.client_side_validation = configuration.client_side_validation + + def __enter__(self): + return self + + def __exit__(self, exc_type, exc_value, traceback): + self.close() + + def close(self): + if self._pool: + self._pool.close() + self._pool.join() + self._pool = None + if hasattr(atexit, 'unregister'): + atexit.unregister(self.close) + + @property + def pool(self): + """Create thread pool on first request + avoids instantiating unused threadpool for blocking clients. + """ + if self._pool is None: + atexit.register(self.close) + self._pool = ThreadPool(self.pool_threads) + return self._pool + + @property + def user_agent(self): + """User agent for this API client""" + return self.default_headers['User-Agent'] + + @user_agent.setter + def user_agent(self, value): + self.default_headers['User-Agent'] = value + + def set_default_header(self, header_name, header_value): + self.default_headers[header_name] = header_value + + + _default = None + + @classmethod + def get_default(cls): + """Return new instance of ApiClient. + + This method returns newly created, based on default constructor, + object of ApiClient class or returns a copy of default + ApiClient. + + :return: The ApiClient object. + """ + if cls._default is None: + cls._default = ApiClient() + return cls._default + + @classmethod + def set_default(cls, default): + """Set default instance of ApiClient. + + It stores default ApiClient. + + :param default: object of ApiClient. + """ + cls._default = default + + def __call_api( + self, resource_path, method, path_params=None, + query_params=None, header_params=None, body=None, post_params=None, + files=None, response_types_map=None, auth_settings=None, + _return_http_data_only=None, collection_formats=None, + _preload_content=True, _request_timeout=None, _host=None, + _request_auth=None): + + config = self.configuration + + # header parameters + header_params = header_params or {} + header_params.update(self.default_headers) + if self.cookie: + header_params['Cookie'] = self.cookie + if header_params: + header_params = self.sanitize_for_serialization(header_params) + header_params = dict(self.parameters_to_tuples(header_params, + collection_formats)) + + # path parameters + if path_params: + path_params = self.sanitize_for_serialization(path_params) + path_params = self.parameters_to_tuples(path_params, + collection_formats) + for k, v in path_params: + # specified safe chars, encode everything + resource_path = resource_path.replace( + '{%s}' % k, + quote(str(v), safe=config.safe_chars_for_path_param) + ) + + # post parameters + if post_params or files: + post_params = post_params if post_params else [] + post_params = self.sanitize_for_serialization(post_params) + post_params = self.parameters_to_tuples(post_params, + collection_formats) + post_params.extend(self.files_parameters(files)) + + # auth setting + self.update_params_for_auth( + header_params, query_params, auth_settings, + resource_path, method, body, + request_auth=_request_auth) + + # body + if body: + body = self.sanitize_for_serialization(body) + + # request url + if _host is None: + url = self.configuration.host + resource_path + else: + # use server/host defined in path or operation instead + url = _host + resource_path + + # query parameters + if query_params: + query_params = self.sanitize_for_serialization(query_params) + url_query = self.parameters_to_url_query(query_params, + collection_formats) + url += "?" + url_query + + try: + # perform request and return response + response_data = self.request( + method, url, + query_params=query_params, + headers=header_params, + post_params=post_params, body=body, + _preload_content=_preload_content, + _request_timeout=_request_timeout) + except ApiException as e: + if e.body: + e.body = e.body.decode('utf-8') + raise e + + self.last_response = response_data + + return_data = None # assuming derialization is not needed + # data needs deserialization or returns HTTP data (deserialized) only + if _preload_content or _return_http_data_only: + response_type = response_types_map.get(str(response_data.status), None) + + if response_type == "bytearray": + response_data.data = response_data.data + else: + match = None + content_type = response_data.getheader('content-type') + if content_type is not None: + match = re.search(r"charset=([a-zA-Z\-\d]+)[\s;]?", content_type) + encoding = match.group(1) if match else "utf-8" + response_data.data = response_data.data.decode(encoding) + + # deserialize response data + if response_type == "bytearray": + return_data = response_data.data + elif response_type: + return_data = self.deserialize(response_data, response_type) + else: + return_data = None + + if _return_http_data_only: + return return_data + else: + return ApiResponse(status_code = response_data.status, + data = return_data, + headers = response_data.getheaders(), + raw_data = response_data.data) + + def sanitize_for_serialization(self, obj): + """Builds a JSON POST object. + + If obj is None, return None. + If obj is str, int, long, float, bool, return directly. + If obj is datetime.datetime, datetime.date + convert to string in iso8601 format. + If obj is list, sanitize each element in the list. + If obj is dict, return the dict. + If obj is OpenAPI model, return the properties dict. + + :param obj: The data to serialize. + :return: The serialized form of data. + """ + if obj is None: + return None + elif isinstance(obj, self.PRIMITIVE_TYPES): + return obj + elif isinstance(obj, list): + return [self.sanitize_for_serialization(sub_obj) + for sub_obj in obj] + elif isinstance(obj, tuple): + return tuple(self.sanitize_for_serialization(sub_obj) + for sub_obj in obj) + elif isinstance(obj, (dt.datetime, dt.date)): + return obj.isoformat() + + if isinstance(obj, dict): + obj_dict = obj + else: + # Convert model obj to dict except + # attributes `openapi_types`, `attribute_map` + # and attributes which value is not None. + # Convert attribute name to json key in + # model definition for request. + obj_dict = obj.to_dict() + + return {key: self.sanitize_for_serialization(val) + for key, val in obj_dict.items()} + + def deserialize(self, response, response_type): + """Deserializes response into an object. + + :param response: RESTResponse object to be deserialized. + :param response_type: class literal for + deserialized object, or string of class name. + + :return: deserialized object. + """ + # handle file downloading + # save response body into a tmp file and return the instance + if response_type == "file": + return self.__deserialize_file(response) + + # fetch data from response object + try: + data = json.loads(response.data) + except ValueError: + data = response.data + + return self.__deserialize(data, response_type) + + def __deserialize(self, data, klass): + """Deserializes dict, list, str into an object. + + :param data: dict, list or str. + :param klass: class literal, or string of class name. + + :return: object. + """ + if data is None: + return None + + if type(klass) == str: + if klass.startswith('List['): + sub_kls = re.match(r'List\[(.*)]', klass).group(1) + return [self.__deserialize(sub_data, sub_kls) + for sub_data in data] + + if klass.startswith('Dict['): + sub_kls = re.match(r'Dict\[([^,]*), (.*)]', klass).group(2) + return {k: self.__deserialize(v, sub_kls) + for k, v in data.items()} + + # convert str to class + if klass in self.NATIVE_TYPES_MAPPING: + klass = self.NATIVE_TYPES_MAPPING[klass] + else: + klass = getattr(cashfree_pg.models, klass) + + if klass in self.PRIMITIVE_TYPES: + return self.__deserialize_primitive(data, klass) + elif klass == object: + return self.__deserialize_object(data) + elif klass == dt.date: + return self.__deserialize_date(data) + elif klass == dt.datetime: + return self.__deserialize_datetime(data) + else: + return self.__deserialize_model(data, klass) + + def call_api(self, resource_path, method, + path_params=None, query_params=None, header_params=None, + body=None, post_params=None, files=None, + response_types_map=None, auth_settings=None, + async_req=None, _return_http_data_only=None, + collection_formats=None, _preload_content=True, + _request_timeout=None, _host=None, _request_auth=None): + """Makes the HTTP request (synchronous) and returns deserialized data. + + To make an async_req request, set the async_req parameter. + + :param resource_path: Path to method endpoint. + :param method: Method to call. + :param path_params: Path parameters in the url. + :param query_params: Query parameters in the url. + :param header_params: Header parameters to be + placed in the request header. + :param body: Request body. + :param post_params dict: Request post form parameters, + for `application/x-www-form-urlencoded`, `multipart/form-data`. + :param auth_settings list: Auth Settings names for the request. + :param response: Response data type. + :param files dict: key -> filename, value -> filepath, + for `multipart/form-data`. + :param async_req bool: execute request asynchronously + :param _return_http_data_only: response data instead of ApiResponse + object with status code, headers, etc + :param _preload_content: if False, the ApiResponse.data will + be set to none and raw_data will store the + HTTP response body without reading/decoding. + Default is True. + :param collection_formats: dict of collection formats for path, query, + header, and post parameters. + :param _request_timeout: timeout setting for this request. If one + number provided, it will be total request + timeout. It can also be a pair (tuple) of + (connection, read) timeouts. + :param _request_auth: set to override the auth_settings for an a single + request; this effectively ignores the authentication + in the spec for a single request. + :type _request_token: dict, optional + :return: + If async_req parameter is True, + the request will be called asynchronously. + The method will return the request thread. + If parameter async_req is False or missing, + then the method will return the response directly. + """ + if not async_req: + return self.__call_api(resource_path, method, + path_params, query_params, header_params, + body, post_params, files, + response_types_map, auth_settings, + _return_http_data_only, collection_formats, + _preload_content, _request_timeout, _host, + _request_auth) + + return self.pool.apply_async(self.__call_api, (resource_path, + method, path_params, + query_params, + header_params, body, + post_params, files, + response_types_map, + auth_settings, + _return_http_data_only, + collection_formats, + _preload_content, + _request_timeout, + _host, _request_auth)) + + def request(self, method, url, query_params=None, headers=None, + post_params=None, body=None, _preload_content=True, + _request_timeout=None): + """Makes the HTTP request using RESTClient.""" + if method == "GET": + return self.rest_client.get_request(url, + query_params=query_params, + _preload_content=_preload_content, + _request_timeout=_request_timeout, + headers=headers) + elif method == "HEAD": + return self.rest_client.head_request(url, + query_params=query_params, + _preload_content=_preload_content, + _request_timeout=_request_timeout, + headers=headers) + elif method == "OPTIONS": + return self.rest_client.options_request(url, + query_params=query_params, + headers=headers, + _preload_content=_preload_content, + _request_timeout=_request_timeout) + elif method == "POST": + return self.rest_client.post_request(url, + query_params=query_params, + headers=headers, + post_params=post_params, + _preload_content=_preload_content, + _request_timeout=_request_timeout, + body=body) + elif method == "PUT": + return self.rest_client.put_request(url, + query_params=query_params, + headers=headers, + post_params=post_params, + _preload_content=_preload_content, + _request_timeout=_request_timeout, + body=body) + elif method == "PATCH": + return self.rest_client.patch_request(url, + query_params=query_params, + headers=headers, + post_params=post_params, + _preload_content=_preload_content, + _request_timeout=_request_timeout, + body=body) + elif method == "DELETE": + return self.rest_client.delete_request(url, + query_params=query_params, + headers=headers, + _preload_content=_preload_content, + _request_timeout=_request_timeout, + body=body) + else: + raise ApiValueError( + "http method must be `GET`, `HEAD`, `OPTIONS`," + " `POST`, `PATCH`, `PUT` or `DELETE`." + ) + + def parameters_to_tuples(self, params, collection_formats): + """Get parameters as list of tuples, formatting collections. + + :param params: Parameters as dict or list of two-tuples + :param dict collection_formats: Parameter collection formats + :return: Parameters as list of tuples, collections formatted + """ + new_params = [] + if collection_formats is None: + collection_formats = {} + for k, v in params.items() if isinstance(params, dict) else params: # noqa: E501 + if k in collection_formats: + collection_format = collection_formats[k] + if collection_format == 'multi': + new_params.extend((k, value) for value in v) + else: + if collection_format == 'ssv': + delimiter = ' ' + elif collection_format == 'tsv': + delimiter = '\t' + elif collection_format == 'pipes': + delimiter = '|' + else: # csv is the default + delimiter = ',' + new_params.append( + (k, delimiter.join(str(value) for value in v))) + else: + new_params.append((k, v)) + return new_params + + def parameters_to_url_query(self, params, collection_formats): + """Get parameters as list of tuples, formatting collections. + + :param params: Parameters as dict or list of two-tuples + :param dict collection_formats: Parameter collection formats + :return: URL query string (e.g. a=Hello%20World&b=123) + """ + new_params = [] + if collection_formats is None: + collection_formats = {} + for k, v in params.items() if isinstance(params, dict) else params: # noqa: E501 + if isinstance(v, (int, float)): + v = str(v) + if isinstance(v, bool): + v = str(v).lower() + if isinstance(v, dict): + v = json.dumps(v) + + if k in collection_formats: + collection_format = collection_formats[k] + if collection_format == 'multi': + new_params.extend((k, value) for value in v) + else: + if collection_format == 'ssv': + delimiter = ' ' + elif collection_format == 'tsv': + delimiter = '\t' + elif collection_format == 'pipes': + delimiter = '|' + else: # csv is the default + delimiter = ',' + new_params.append( + (k, delimiter.join(quote(str(value)) for value in v))) + else: + new_params.append((k, quote(str(v)))) + + return "&".join(["=".join(item) for item in new_params]) + + def files_parameters(self, files=None): + """Builds form parameters. + + :param files: File parameters. + :return: Form parameters with files. + """ + params = [] + + if files: + for k, v in files.items(): + if not v: + continue + file_names = v if type(v) is list else [v] + for n in file_names: + with open(n, 'rb') as f: + filename = os.path.basename(f.name) + filedata = f.read() + mimetype = (mimetypes.guess_type(filename)[0] or + 'application/octet-stream') + params.append( + tuple([k, tuple([filename, filedata, mimetype])])) + + return params + + def select_header_accept(self, accepts): + """Returns `Accept` based on an array of accepts provided. + + :param accepts: List of headers. + :return: Accept (e.g. application/json). + """ + if not accepts: + return + + for accept in accepts: + if re.search('json', accept, re.IGNORECASE): + return accept + + return accepts[0] + + def select_header_content_type(self, content_types): + """Returns `Content-Type` based on an array of content_types provided. + + :param content_types: List of content-types. + :return: Content-Type (e.g. application/json). + """ + if not content_types: + return None + + for content_type in content_types: + if re.search('json', content_type, re.IGNORECASE): + return content_type + + return content_types[0] + + def update_params_for_auth(self, headers, queries, auth_settings, + resource_path, method, body, + request_auth=None): + """Updates header and query params based on authentication setting. + + :param headers: Header parameters dict to be updated. + :param queries: Query parameters tuple list to be updated. + :param auth_settings: Authentication setting identifiers list. + :resource_path: A string representation of the HTTP request resource path. + :method: A string representation of the HTTP request method. + :body: A object representing the body of the HTTP request. + The object type is the return value of sanitize_for_serialization(). + :param request_auth: if set, the provided settings will + override the token in the configuration. + """ + if not auth_settings: + return + + if request_auth: + self._apply_auth_params(headers, queries, + resource_path, method, body, + request_auth) + return + + for auth in auth_settings: + auth_setting = self.configuration.auth_settings().get(auth) + if auth_setting: + self._apply_auth_params(headers, queries, + resource_path, method, body, + auth_setting) + + def _apply_auth_params(self, headers, queries, + resource_path, method, body, + auth_setting): + """Updates the request parameters based on a single auth_setting + + :param headers: Header parameters dict to be updated. + :param queries: Query parameters tuple list to be updated. + :resource_path: A string representation of the HTTP request resource path. + :method: A string representation of the HTTP request method. + :body: A object representing the body of the HTTP request. + The object type is the return value of sanitize_for_serialization(). + :param auth_setting: auth settings for the endpoint + """ + if auth_setting['in'] == 'cookie': + headers['Cookie'] = auth_setting['value'] + elif auth_setting['in'] == 'header': + if auth_setting['type'] != 'http-signature': + headers[auth_setting['key']] = auth_setting['value'] + elif auth_setting['in'] == 'query': + queries.append((auth_setting['key'], auth_setting['value'])) + else: + raise ApiValueError( + 'Authentication token must be in `query` or `header`' + ) + + def __deserialize_file(self, response): + """Deserializes body to file + + Saves response body into a file in a temporary folder, + using the filename from the `Content-Disposition` header if provided. + + :param response: RESTResponse. + :return: file path. + """ + fd, path = tempfile.mkstemp(dir=self.configuration.temp_folder_path) + os.close(fd) + os.remove(path) + + content_disposition = response.getheader("Content-Disposition") + if content_disposition: + filename = re.search(r'filename=[\'"]?([^\'"\s]+)[\'"]?', + content_disposition).group(1) + path = os.path.join(os.path.dirname(path), filename) + + with open(path, "wb") as f: + f.write(response.data) + + return path + + def __deserialize_primitive(self, data, klass): + """Deserializes string to primitive type. + + :param data: str. + :param klass: class literal. + + :return: int, long, float, str, bool. + """ + try: + return klass(data) + except UnicodeEncodeError: + return str(data) + except TypeError: + return data + + def __deserialize_object(self, value): + """Return an original value. + + :return: object. + """ + return value + + def __deserialize_date(self, string): + """Deserializes string to date. + + :param string: str. + :return: date. + """ + try: + return parse(string).date() + except ImportError: + return string + except ValueError: + raise rest.ApiException( + status=0, + reason="Failed to parse `{0}` as date object".format(string) + ) + + def __deserialize_datetime(self, string): + """Deserializes string to datetime. + + The string should be in iso8601 datetime format. + + :param string: str. + :return: datetime. + """ + try: + return parse(string) + except ImportError: + return string + except ValueError: + raise rest.ApiException( + status=0, + reason=( + "Failed to parse `{0}` as datetime object" + .format(string) + ) + ) + + def __deserialize_model(self, data, klass): + """Deserializes list or dict to model. + + :param data: dict, list. + :param klass: class literal. + :return: model object. + """ + + return klass.from_dict(data) diff --git a/api_response.py b/api_response.py new file mode 100644 index 0000000..d81c2ff --- /dev/null +++ b/api_response.py @@ -0,0 +1,25 @@ +"""API response object.""" + +from __future__ import annotations +from typing import Any, Dict, Optional +from pydantic import Field, StrictInt, StrictStr + +class ApiResponse: + """ + API response object + """ + + status_code: Optional[StrictInt] = Field(None, description="HTTP status code") + headers: Optional[Dict[StrictStr, StrictStr]] = Field(None, description="HTTP headers") + data: Optional[Any] = Field(None, description="Deserialized data given the data type") + raw_data: Optional[Any] = Field(None, description="Raw data (HTTP response body)") + + def __init__(self, + status_code=None, + headers=None, + data=None, + raw_data=None): + self.status_code = status_code + self.headers = headers + self.data = data + self.raw_data = raw_data diff --git a/cashfree_pg/__init__.py b/cashfree_pg/__init__.py index 173cfd8..3609e92 100644 --- a/cashfree_pg/__init__.py +++ b/cashfree_pg/__init__.py @@ -15,7 +15,7 @@ """ # noqa: E501 -__version__ = "3.0.1" +__version__ = "3.0.3" # import apis into sdk package # import ApiClient diff --git a/cashfree_pg/api_client.py b/cashfree_pg/api_client.py index 65b2cf4..34b59f5 100644 --- a/cashfree_pg/api_client.py +++ b/cashfree_pg/api_client.py @@ -305,7 +305,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.0.1" + _header_params["x-sdk-platform"] = "pythonsdk-3.0.3" # process the form parameters _form_params = [] @@ -461,7 +461,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.0.1" + _header_params["x-sdk-platform"] = "pythonsdk-3.0.3" # process the form parameters _form_params = [] @@ -616,7 +616,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.0.1" + _header_params["x-sdk-platform"] = "pythonsdk-3.0.3" # process the form parameters _form_params = [] @@ -772,7 +772,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.0.1" + _header_params["x-sdk-platform"] = "pythonsdk-3.0.3" # process the form parameters _form_params = [] @@ -929,7 +929,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.0.1" + _header_params["x-sdk-platform"] = "pythonsdk-3.0.3" # process the form parameters _form_params = [] @@ -1087,7 +1087,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.0.1" + _header_params["x-sdk-platform"] = "pythonsdk-3.0.3" # process the form parameters _form_params = [] @@ -1233,7 +1233,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.0.1" + _header_params["x-sdk-platform"] = "pythonsdk-3.0.3" # process the form parameters _form_params = [] @@ -1391,7 +1391,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.0.1" + _header_params["x-sdk-platform"] = "pythonsdk-3.0.3" # process the form parameters _form_params = [] @@ -1543,7 +1543,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.0.1" + _header_params["x-sdk-platform"] = "pythonsdk-3.0.3" # process the form parameters _form_params = [] @@ -1702,7 +1702,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.0.1" + _header_params["x-sdk-platform"] = "pythonsdk-3.0.3" # process the form parameters _form_params = [] @@ -1847,7 +1847,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.0.1" + _header_params["x-sdk-platform"] = "pythonsdk-3.0.3" # process the form parameters _form_params = [] @@ -2005,7 +2005,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.0.1" + _header_params["x-sdk-platform"] = "pythonsdk-3.0.3" # process the form parameters _form_params = [] @@ -2154,7 +2154,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.0.1" + _header_params["x-sdk-platform"] = "pythonsdk-3.0.3" # process the form parameters _form_params = [] @@ -2306,7 +2306,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.0.1" + _header_params["x-sdk-platform"] = "pythonsdk-3.0.3" # process the form parameters _form_params = [] @@ -2468,7 +2468,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.0.1" + _header_params["x-sdk-platform"] = "pythonsdk-3.0.3" # process the form parameters _form_params = [] @@ -2633,7 +2633,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.0.1" + _header_params["x-sdk-platform"] = "pythonsdk-3.0.3" # process the form parameters _form_params = [] @@ -2782,7 +2782,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.0.1" + _header_params["x-sdk-platform"] = "pythonsdk-3.0.3" # process the form parameters _form_params = [] @@ -2928,7 +2928,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.0.1" + _header_params["x-sdk-platform"] = "pythonsdk-3.0.3" # process the form parameters _form_params = [] @@ -3091,7 +3091,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.0.1" + _header_params["x-sdk-platform"] = "pythonsdk-3.0.3" # process the form parameters _form_params = [] @@ -3256,7 +3256,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.0.1" + _header_params["x-sdk-platform"] = "pythonsdk-3.0.3" # process the form parameters _form_params = [] @@ -3405,7 +3405,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.0.1" + _header_params["x-sdk-platform"] = "pythonsdk-3.0.3" # process the form parameters _form_params = [] @@ -3557,7 +3557,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.0.1" + _header_params["x-sdk-platform"] = "pythonsdk-3.0.3" # process the form parameters _form_params = [] @@ -3718,7 +3718,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.0.1" + _header_params["x-sdk-platform"] = "pythonsdk-3.0.3" # process the form parameters _form_params = [] @@ -3877,7 +3877,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.0.1" + _header_params["x-sdk-platform"] = "pythonsdk-3.0.3" # process the form parameters _form_params = [] @@ -4033,7 +4033,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.0.1" + _header_params["x-sdk-platform"] = "pythonsdk-3.0.3" # process the form parameters _form_params = [] @@ -4188,7 +4188,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.0.1" + _header_params["x-sdk-platform"] = "pythonsdk-3.0.3" # process the form parameters _form_params = [] @@ -4343,7 +4343,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.0.1" + _header_params["x-sdk-platform"] = "pythonsdk-3.0.3" # process the form parameters _form_params = [] @@ -4497,7 +4497,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.0.1" + _header_params["x-sdk-platform"] = "pythonsdk-3.0.3" # process the form parameters _form_params = [] @@ -4644,7 +4644,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.0.1" + _header_params["x-sdk-platform"] = "pythonsdk-3.0.3" # process the form parameters _form_params = [] @@ -4799,7 +4799,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.0.1" + _header_params["x-sdk-platform"] = "pythonsdk-3.0.3" # process the form parameters _form_params = [] @@ -4957,7 +4957,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.0.1" + _header_params["x-sdk-platform"] = "pythonsdk-3.0.3" # process the form parameters _form_params = [] @@ -5111,7 +5111,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.0.1" + _header_params["x-sdk-platform"] = "pythonsdk-3.0.3" # process the form parameters _form_params = [] @@ -5200,7 +5200,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.0.1/python' + self.user_agent = 'OpenAPI-Generator/3.0.3/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 68565e8..70d7658 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.0.1".\ + "SDK Package Version: 3.0.3".\ format(env=sys.platform, pyversion=sys.version) def get_host_settings(self): diff --git a/configuration.py b/configuration.py new file mode 100644 index 0000000..68565e8 --- /dev/null +++ b/configuration.py @@ -0,0 +1,504 @@ +# coding: utf-8 + +""" + Cashfree Payment Gateway APIs + + Cashfree's Payment Gateway APIs provide developers with a streamlined pathway to integrate advanced payment processing capabilities into their applications, platforms and websites. + + The version of the OpenAPI document: 2022-09-01 + Contact: developers@cashfree.com + Generated by OpenAPI Generator (https://openapi-generator.tech) + + Do not edit the class manually. +""" # noqa: E501 + + +import copy +import logging +import multiprocessing +import sys +import urllib3 + +import http.client as httplib +from cashfree_pg.exceptions import ApiValueError + +JSON_SCHEMA_VALIDATION_KEYWORDS = { + 'multipleOf', 'maximum', 'exclusiveMaximum', + 'minimum', 'exclusiveMinimum', 'maxLength', + 'minLength', 'pattern', 'maxItems', 'minItems' +} + +class Configuration(object): + """This class contains various settings of the API client. + + :param host: Base url. + :param api_key: Dict to store API key(s). + Each entry in the dict specifies an API key. + The dict key is the name of the security scheme in the OAS specification. + The dict value is the API key secret. + :param api_key_prefix: Dict to store API prefix (e.g. Bearer). + The dict key is the name of the security scheme in the OAS specification. + The dict value is an API key prefix when generating the auth data. + :param username: Username for HTTP basic authentication. + :param password: Password for HTTP basic authentication. + :param access_token: Access token. + :param server_index: Index to servers configuration. + :param server_variables: Mapping with string values to replace variables in + templated server configuration. The validation of enums is performed for + variables with defined enum values before. + :param server_operation_index: Mapping from operation ID to an index to server + configuration. + :param server_operation_variables: Mapping from operation ID to a mapping with + string values to replace variables in templated server configuration. + The validation of enums is performed for variables with defined enum values before. + :param ssl_ca_cert: str - the path to a file of concatenated CA certificates + in PEM format. + + :Example: + + API Key Authentication Example. + Given the following security scheme in the OpenAPI specification: + components: + securitySchemes: + cookieAuth: # name for the security scheme + type: apiKey + in: cookie + name: JSESSIONID # cookie name + + You can programmatically set the cookie: + +conf = cashfree_pg.Configuration( + api_key={'cookieAuth': 'abc123'} + api_key_prefix={'cookieAuth': 'JSESSIONID'} +) + + The following cookie will be added to the HTTP request: + Cookie: JSESSIONID abc123 + """ + + _default = None + + def __init__(self, host=None, + api_key=None, api_key_prefix=None, + username=None, password=None, + access_token=None, + server_index=None, server_variables=None, + server_operation_index=None, server_operation_variables=None, + ssl_ca_cert=None, + ): + """Constructor + """ + self._base_path = "https://sandbox.cashfree.com/pg" if host is None else host + """Default Base url + """ + self.server_index = 0 if server_index is None and host is None else server_index + self.server_operation_index = server_operation_index or {} + """Default server index + """ + self.server_variables = server_variables or {} + self.server_operation_variables = server_operation_variables or {} + """Default server variables + """ + self.temp_folder_path = None + """Temp file folder for downloading files + """ + # Authentication Settings + self.api_key = {} + if api_key: + self.api_key = api_key + """dict to store API key(s) + """ + self.api_key_prefix = {} + if api_key_prefix: + self.api_key_prefix = api_key_prefix + """dict to store API prefix (e.g. Bearer) + """ + self.refresh_api_key_hook = None + """function hook to refresh API key if expired + """ + self.username = username + """Username for HTTP basic authentication + """ + self.password = password + """Password for HTTP basic authentication + """ + self.access_token = access_token + """Access token + """ + self.logger = {} + """Logging Settings + """ + self.logger["package_logger"] = logging.getLogger("cashfree_pg") + self.logger["urllib3_logger"] = logging.getLogger("urllib3") + self.logger_format = '%(asctime)s %(levelname)s %(message)s' + """Log format + """ + self.logger_stream_handler = None + """Log stream handler + """ + self.logger_file_handler = None + """Log file handler + """ + self.logger_file = None + """Debug file location + """ + self.debug = False + """Debug switch + """ + + self.verify_ssl = True + """SSL/TLS verification + Set this to false to skip verifying SSL certificate when calling API + from https server. + """ + self.ssl_ca_cert = ssl_ca_cert + """Set this to customize the certificate file to verify the peer. + """ + self.cert_file = None + """client certificate file + """ + self.key_file = None + """client key file + """ + self.assert_hostname = None + """Set this to True/False to enable/disable SSL hostname verification. + """ + self.tls_server_name = None + """SSL/TLS Server Name Indication (SNI) + Set this to the SNI value expected by the server. + """ + + self.connection_pool_maxsize = multiprocessing.cpu_count() * 5 + """urllib3 connection pool's maximum number of connections saved + per pool. urllib3 uses 1 connection as default value, but this is + not the best value when you are making a lot of possibly parallel + requests to the same host, which is often the case here. + cpu_count * 5 is used as default value to increase performance. + """ + + self.proxy = None + """Proxy URL + """ + self.proxy_headers = None + """Proxy headers + """ + self.safe_chars_for_path_param = '' + """Safe chars for path_param + """ + self.retries = None + """Adding retries to override urllib3 default value 3 + """ + # Enable client side validation + self.client_side_validation = True + + self.socket_options = None + """Options to pass down to the underlying urllib3 socket + """ + + self.datetime_format = "%Y-%m-%dT%H:%M:%S.%f%z" + """datetime format + """ + + self.date_format = "%Y-%m-%d" + """date format + """ + + def __deepcopy__(self, memo): + cls = self.__class__ + result = cls.__new__(cls) + memo[id(self)] = result + for k, v in self.__dict__.items(): + if k not in ('logger', 'logger_file_handler'): + setattr(result, k, copy.deepcopy(v, memo)) + # shallow copy of loggers + result.logger = copy.copy(self.logger) + # use setters to configure loggers + result.logger_file = self.logger_file + result.debug = self.debug + return result + + def __setattr__(self, name, value): + object.__setattr__(self, name, value) + + @classmethod + def set_default(cls, default): + """Set default instance of configuration. + + It stores default configuration, which can be + returned by get_default_copy method. + + :param default: object of Configuration + """ + cls._default = default + + @classmethod + def get_default_copy(cls): + """Deprecated. Please use `get_default` instead. + + Deprecated. Please use `get_default` instead. + + :return: The configuration object. + """ + return cls.get_default() + + @classmethod + def get_default(cls): + """Return the default configuration. + + This method returns newly created, based on default constructor, + object of Configuration class or returns a copy of default + configuration. + + :return: The configuration object. + """ + if cls._default is None: + cls._default = Configuration() + return cls._default + + @property + def logger_file(self): + """The logger file. + + If the logger_file is None, then add stream handler and remove file + handler. Otherwise, add file handler and remove stream handler. + + :param value: The logger_file path. + :type: str + """ + return self.__logger_file + + @logger_file.setter + def logger_file(self, value): + """The logger file. + + If the logger_file is None, then add stream handler and remove file + handler. Otherwise, add file handler and remove stream handler. + + :param value: The logger_file path. + :type: str + """ + self.__logger_file = value + if self.__logger_file: + # If set logging file, + # then add file handler and remove stream handler. + self.logger_file_handler = logging.FileHandler(self.__logger_file) + self.logger_file_handler.setFormatter(self.logger_formatter) + for _, logger in self.logger.items(): + logger.addHandler(self.logger_file_handler) + + @property + def debug(self): + """Debug status + + :param value: The debug status, True or False. + :type: bool + """ + return self.__debug + + @debug.setter + def debug(self, value): + """Debug status + + :param value: The debug status, True or False. + :type: bool + """ + self.__debug = value + if self.__debug: + # if debug status is True, turn on debug logging + for _, logger in self.logger.items(): + logger.setLevel(logging.DEBUG) + # turn on httplib debug + httplib.HTTPConnection.debuglevel = 1 + else: + # if debug status is False, turn off debug logging, + # setting log level to default `logging.WARNING` + for _, logger in self.logger.items(): + logger.setLevel(logging.WARNING) + # turn off httplib debug + httplib.HTTPConnection.debuglevel = 0 + + @property + def logger_format(self): + """The logger format. + + The logger_formatter will be updated when sets logger_format. + + :param value: The format string. + :type: str + """ + return self.__logger_format + + @logger_format.setter + def logger_format(self, value): + """The logger format. + + The logger_formatter will be updated when sets logger_format. + + :param value: The format string. + :type: str + """ + self.__logger_format = value + self.logger_formatter = logging.Formatter(self.__logger_format) + + def get_api_key_with_prefix(self, identifier, alias=None): + """Gets API key (with prefix if set). + + :param identifier: The identifier of apiKey. + :param alias: The alternative identifier of apiKey. + :return: The token for api key authentication. + """ + if self.refresh_api_key_hook is not None: + self.refresh_api_key_hook(self) + key = self.api_key.get(identifier, self.api_key.get(alias) if alias is not None else None) + if key: + prefix = self.api_key_prefix.get(identifier) + if prefix: + return "%s %s" % (prefix, key) + else: + return key + + def get_basic_auth_token(self): + """Gets HTTP basic authentication header (string). + + :return: The token for basic HTTP authentication. + """ + username = "" + if self.username is not None: + username = self.username + password = "" + if self.password is not None: + password = self.password + return urllib3.util.make_headers( + basic_auth=username + ':' + password + ).get('authorization') + + def auth_settings(self): + """Gets Auth Settings dict for api client. + + :return: The Auth Settings information dict. + """ + auth = {} + if 'XClientID' in self.api_key: + auth['XClientID'] = { + 'type': 'api_key', + 'in': 'header', + 'key': 'x-client-id', + 'value': self.get_api_key_with_prefix( + 'XClientID', + ), + } + if 'XClientSecret' in self.api_key: + auth['XClientSecret'] = { + 'type': 'api_key', + 'in': 'header', + 'key': 'x-client-secret', + 'value': self.get_api_key_with_prefix( + 'XClientSecret', + ), + } + if 'XClientSignatureHeader' in self.api_key: + auth['XClientSignatureHeader'] = { + 'type': 'api_key', + 'in': 'header', + 'key': 'x-client-signature', + 'value': self.get_api_key_with_prefix( + 'XClientSignatureHeader', + ), + } + if 'XPartnerAPIKey' in self.api_key: + auth['XPartnerAPIKey'] = { + 'type': 'api_key', + 'in': 'header', + 'key': 'x-partner-apikey', + 'value': self.get_api_key_with_prefix( + 'XPartnerAPIKey', + ), + } + if 'XPartnerMerchantID' in self.api_key: + auth['XPartnerMerchantID'] = { + 'type': 'api_key', + 'in': 'header', + 'key': 'x-partner-merchantid', + 'value': self.get_api_key_with_prefix( + 'XPartnerMerchantID', + ), + } + return auth + + def to_debug_report(self): + """Gets the essential information for debugging. + + :return: The report for debugging. + """ + return "Python SDK Debug Report:\n"\ + "OS: {env}\n"\ + "Python Version: {pyversion}\n"\ + "Version of the API: 2022-09-01\n"\ + "SDK Package Version: 3.0.1".\ + format(env=sys.platform, pyversion=sys.version) + + def get_host_settings(self): + """Gets an array of host settings + + :return: An array of host settings + """ + return [ + { + 'url': "https://sandbox.cashfree.com/pg", + 'description': "Sandbox server", + }, + { + 'url': "https://api.cashfree.com/pg", + 'description': "Production server", + } + ] + + def get_host_from_settings(self, index, variables=None, servers=None): + """Gets host URL based on the index and variables + :param index: array index of the host settings + :param variables: hash of variable and the corresponding value + :param servers: an array of host settings or None + :return: URL based on host settings + """ + if index is None: + return self._base_path + + variables = {} if variables is None else variables + servers = self.get_host_settings() if servers is None else servers + + try: + server = servers[index] + except IndexError: + raise ValueError( + "Invalid index {0} when selecting the host settings. " + "Must be less than {1}".format(index, len(servers))) + + url = server['url'] + + # go through variables and replace placeholders + for variable_name, variable in server.get('variables', {}).items(): + used_value = variables.get( + variable_name, variable['default_value']) + + if 'enum_values' in variable \ + and used_value not in variable['enum_values']: + raise ValueError( + "The variable `{0}` in the host URL has invalid value " + "{1}. Must be {2}.".format( + variable_name, variables[variable_name], + variable['enum_values'])) + + url = url.replace("{" + variable_name + "}", used_value) + + return url + + @property + def host(self): + """Return generated host.""" + return self.get_host_from_settings(self.server_index, variables=self.server_variables) + + @host.setter + def host(self, value): + """Fix base path.""" + self._base_path = value + self.server_index = None diff --git a/exceptions.py b/exceptions.py new file mode 100644 index 0000000..a74e28e --- /dev/null +++ b/exceptions.py @@ -0,0 +1,167 @@ +# coding: utf-8 + +""" + Cashfree Payment Gateway APIs + + Cashfree's Payment Gateway APIs provide developers with a streamlined pathway to integrate advanced payment processing capabilities into their applications, platforms and websites. + + The version of the OpenAPI document: 2022-09-01 + Contact: developers@cashfree.com + Generated by OpenAPI Generator (https://openapi-generator.tech) + + Do not edit the class manually. +""" # noqa: E501 + + +class OpenApiException(Exception): + """The base exception class for all OpenAPIExceptions""" + + +class ApiTypeError(OpenApiException, TypeError): + def __init__(self, msg, path_to_item=None, valid_classes=None, + key_type=None): + """ Raises an exception for TypeErrors + + Args: + msg (str): the exception message + + Keyword Args: + path_to_item (list): a list of keys an indices to get to the + current_item + None if unset + valid_classes (tuple): the primitive classes that current item + should be an instance of + None if unset + key_type (bool): False if our value is a value in a dict + True if it is a key in a dict + False if our item is an item in a list + None if unset + """ + self.path_to_item = path_to_item + self.valid_classes = valid_classes + self.key_type = key_type + full_msg = msg + if path_to_item: + full_msg = "{0} at {1}".format(msg, render_path(path_to_item)) + super(ApiTypeError, self).__init__(full_msg) + + +class ApiValueError(OpenApiException, ValueError): + def __init__(self, msg, path_to_item=None): + """ + Args: + msg (str): the exception message + + Keyword Args: + path_to_item (list) the path to the exception in the + received_data dict. None if unset + """ + + self.path_to_item = path_to_item + full_msg = msg + if path_to_item: + full_msg = "{0} at {1}".format(msg, render_path(path_to_item)) + super(ApiValueError, self).__init__(full_msg) + + +class ApiAttributeError(OpenApiException, AttributeError): + def __init__(self, msg, path_to_item=None): + """ + Raised when an attribute reference or assignment fails. + + Args: + msg (str): the exception message + + Keyword Args: + path_to_item (None/list) the path to the exception in the + received_data dict + """ + self.path_to_item = path_to_item + full_msg = msg + if path_to_item: + full_msg = "{0} at {1}".format(msg, render_path(path_to_item)) + super(ApiAttributeError, self).__init__(full_msg) + + +class ApiKeyError(OpenApiException, KeyError): + def __init__(self, msg, path_to_item=None): + """ + Args: + msg (str): the exception message + + Keyword Args: + path_to_item (None/list) the path to the exception in the + received_data dict + """ + self.path_to_item = path_to_item + full_msg = msg + if path_to_item: + full_msg = "{0} at {1}".format(msg, render_path(path_to_item)) + super(ApiKeyError, self).__init__(full_msg) + + +class ApiException(OpenApiException): + + def __init__(self, status=None, reason=None, http_resp=None): + if http_resp: + self.status = http_resp.status + self.reason = http_resp.reason + self.body = http_resp.data + self.headers = http_resp.getheaders() + else: + self.status = status + self.reason = reason + self.body = None + self.headers = None + + def __str__(self): + """Custom error messages for exception""" + error_message = "({0})\n"\ + "Reason: {1}\n".format(self.status, self.reason) + if self.headers: + error_message += "HTTP response headers: {0}\n".format( + self.headers) + + if self.body: + error_message += "HTTP response body: {0}\n".format(self.body) + + return error_message + +class BadRequestException(ApiException): + + def __init__(self, status=None, reason=None, http_resp=None): + super(BadRequestException, self).__init__(status, reason, http_resp) + +class NotFoundException(ApiException): + + def __init__(self, status=None, reason=None, http_resp=None): + super(NotFoundException, self).__init__(status, reason, http_resp) + + +class UnauthorizedException(ApiException): + + def __init__(self, status=None, reason=None, http_resp=None): + super(UnauthorizedException, self).__init__(status, reason, http_resp) + + +class ForbiddenException(ApiException): + + def __init__(self, status=None, reason=None, http_resp=None): + super(ForbiddenException, self).__init__(status, reason, http_resp) + + +class ServiceException(ApiException): + + def __init__(self, status=None, reason=None, http_resp=None): + super(ServiceException, self).__init__(status, reason, http_resp) + + +def render_path(path_to_item): + """Returns a string representation of a path""" + result = "" + for pth in path_to_item: + if isinstance(pth, int): + result += "[{0}]".format(pth) + else: + result += "['{0}']".format(pth) + return result diff --git a/models/__init__.py b/models/__init__.py new file mode 100644 index 0000000..c15e883 --- /dev/null +++ b/models/__init__.py @@ -0,0 +1,144 @@ +# coding: utf-8 + +# flake8: noqa +""" + Cashfree Payment Gateway APIs + + Cashfree's Payment Gateway APIs provide developers with a streamlined pathway to integrate advanced payment processing capabilities into their applications, platforms and websites. + + The version of the OpenAPI document: 2022-09-01 + Contact: developers@cashfree.com + Generated by OpenAPI Generator (https://openapi-generator.tech) + + Do not edit the class manually. +""" # noqa: E501 + + +# import models into model package +from cashfree_pg.models.api_error import ApiError +from cashfree_pg.models.api_error404 import ApiError404 +from cashfree_pg.models.api_error409 import ApiError409 +from cashfree_pg.models.api_error502 import ApiError502 +from cashfree_pg.models.app import App +from cashfree_pg.models.app_payment_method import AppPaymentMethod +from cashfree_pg.models.authentication_error import AuthenticationError +from cashfree_pg.models.authorization_in_payments_entity import AuthorizationInPaymentsEntity +from cashfree_pg.models.authorize_order_request import AuthorizeOrderRequest +from cashfree_pg.models.bad_request_error import BadRequestError +from cashfree_pg.models.card import Card +from cashfree_pg.models.card_emi import CardEMI +from cashfree_pg.models.card_emi_payment_method import CardEMIPaymentMethod +from cashfree_pg.models.card_offer import CardOffer +from cashfree_pg.models.card_payment_method import CardPaymentMethod +from cashfree_pg.models.cardless_emi import CardlessEMI +from cashfree_pg.models.cardless_emi_entity import CardlessEMIEntity +from cashfree_pg.models.cardless_emi_payment_method import CardlessEMIPaymentMethod +from cashfree_pg.models.cardless_emi_queries import CardlessEMIQueries +from cashfree_pg.models.cashback_details import CashbackDetails +from cashfree_pg.models.create_link_request import CreateLinkRequest +from cashfree_pg.models.create_offer_request import CreateOfferRequest +from cashfree_pg.models.create_order_request import CreateOrderRequest +from cashfree_pg.models.create_order_request_order_meta import CreateOrderRequestOrderMeta +from cashfree_pg.models.create_order_request_terminal import CreateOrderRequestTerminal +from cashfree_pg.models.create_terminal_request import CreateTerminalRequest +from cashfree_pg.models.create_terminal_request_terminal_meta import CreateTerminalRequestTerminalMeta +from cashfree_pg.models.create_terminal_transaction_request import CreateTerminalTransactionRequest +from cashfree_pg.models.cryptogram_entity import CryptogramEntity +from cashfree_pg.models.customer_details import CustomerDetails +from cashfree_pg.models.customer_details_cardless_emi import CustomerDetailsCardlessEMI +from cashfree_pg.models.discount_details import DiscountDetails +from cashfree_pg.models.emi_offer import EMIOffer +from cashfree_pg.models.emi_plans_array import EMIPlansArray +from cashfree_pg.models.eligibility_cardless_emi_entity import EligibilityCardlessEMIEntity +from cashfree_pg.models.eligibility_fetch_cardless_emi_request import EligibilityFetchCardlessEMIRequest +from cashfree_pg.models.eligibility_fetch_offers_request import EligibilityFetchOffersRequest +from cashfree_pg.models.eligibility_fetch_paylater_request import EligibilityFetchPaylaterRequest +from cashfree_pg.models.eligibility_fetch_payment_methods_request import EligibilityFetchPaymentMethodsRequest +from cashfree_pg.models.eligibility_offer_entity import EligibilityOfferEntity +from cashfree_pg.models.eligibility_paylater_entity import EligibilityPaylaterEntity +from cashfree_pg.models.eligibility_payment_methods_entity import EligibilityPaymentMethodsEntity +from cashfree_pg.models.eligibility_payment_methods_entity_entity_details import EligibilityPaymentMethodsEntityEntityDetails +from cashfree_pg.models.error_details_in_payments_entity import ErrorDetailsInPaymentsEntity +from cashfree_pg.models.fetch_recon_request import FetchReconRequest +from cashfree_pg.models.fetch_recon_request_filters import FetchReconRequestFilters +from cashfree_pg.models.fetch_recon_request_pagination import FetchReconRequestPagination +from cashfree_pg.models.fetch_settlements_request import FetchSettlementsRequest +from cashfree_pg.models.fetch_settlements_request_filters import FetchSettlementsRequestFilters +from cashfree_pg.models.fetch_settlements_request_pagination import FetchSettlementsRequestPagination +from cashfree_pg.models.fetch_terminal_qr_codes_entity import FetchTerminalQRCodesEntity +from cashfree_pg.models.idempotency_error import IdempotencyError +from cashfree_pg.models.instrument_entity import InstrumentEntity +from cashfree_pg.models.link_customer_details_entity import LinkCustomerDetailsEntity +from cashfree_pg.models.link_entity import LinkEntity +from cashfree_pg.models.link_meta_entity import LinkMetaEntity +from cashfree_pg.models.link_notify_entity import LinkNotifyEntity +from cashfree_pg.models.net_banking_payment_method import NetBankingPaymentMethod +from cashfree_pg.models.netbanking import Netbanking +from cashfree_pg.models.offer_all import OfferAll +from cashfree_pg.models.offer_card import OfferCard +from cashfree_pg.models.offer_details import OfferDetails +from cashfree_pg.models.offer_emi import OfferEMI +from cashfree_pg.models.offer_entity import OfferEntity +from cashfree_pg.models.offer_filters import OfferFilters +from cashfree_pg.models.offer_meta import OfferMeta +from cashfree_pg.models.offer_nb import OfferNB +from cashfree_pg.models.offer_nb_netbanking import OfferNBNetbanking +from cashfree_pg.models.offer_paylater import OfferPaylater +from cashfree_pg.models.offer_queries import OfferQueries +from cashfree_pg.models.offer_tnc import OfferTnc +from cashfree_pg.models.offer_type import OfferType +from cashfree_pg.models.offer_upi import OfferUPI +from cashfree_pg.models.offer_validations import OfferValidations +from cashfree_pg.models.offer_validations_payment_method import OfferValidationsPaymentMethod +from cashfree_pg.models.offer_wallet import OfferWallet +from cashfree_pg.models.order_authenticate_entity import OrderAuthenticateEntity +from cashfree_pg.models.order_authenticate_payment_request import OrderAuthenticatePaymentRequest +from cashfree_pg.models.order_create_refund_request import OrderCreateRefundRequest +from cashfree_pg.models.order_entity import OrderEntity +from cashfree_pg.models.order_meta import OrderMeta +from cashfree_pg.models.order_pay_data import OrderPayData +from cashfree_pg.models.pay_order_entity import PayOrderEntity +from cashfree_pg.models.pay_order_request import PayOrderRequest +from cashfree_pg.models.pay_order_request_payment_method import PayOrderRequestPaymentMethod +from cashfree_pg.models.paylater import Paylater +from cashfree_pg.models.paylater_entity import PaylaterEntity +from cashfree_pg.models.paylater_offer import PaylaterOffer +from cashfree_pg.models.paylater_payment_method import PaylaterPaymentMethod +from cashfree_pg.models.payment_entity import PaymentEntity +from cashfree_pg.models.payment_method_app_in_payments_entity import PaymentMethodAppInPaymentsEntity +from cashfree_pg.models.payment_method_card_in_payments_entity import PaymentMethodCardInPaymentsEntity +from cashfree_pg.models.payment_method_cardless_emiin_payments_entity import PaymentMethodCardlessEMIInPaymentsEntity +from cashfree_pg.models.payment_method_in_payments_entity import PaymentMethodInPaymentsEntity +from cashfree_pg.models.payment_method_in_payments_entity_payment_method import PaymentMethodInPaymentsEntityPaymentMethod +from cashfree_pg.models.payment_method_net_banking_in_payments_entity import PaymentMethodNetBankingInPaymentsEntity +from cashfree_pg.models.payment_method_paylater_in_payments_entity import PaymentMethodPaylaterInPaymentsEntity +from cashfree_pg.models.payment_method_upiin_payments_entity import PaymentMethodUPIInPaymentsEntity +from cashfree_pg.models.payment_methods_filters import PaymentMethodsFilters +from cashfree_pg.models.payment_methods_queries import PaymentMethodsQueries +from cashfree_pg.models.payment_mode_details import PaymentModeDetails +from cashfree_pg.models.payment_success_webhook import PaymentSuccessWebhook +from cashfree_pg.models.payment_url_object import PaymentURLObject +from cashfree_pg.models.rate_limit_error import RateLimitError +from cashfree_pg.models.recon_entity import ReconEntity +from cashfree_pg.models.recon_entity_data_inner import ReconEntityDataInner +from cashfree_pg.models.refund_entity import RefundEntity +from cashfree_pg.models.refund_speed import RefundSpeed +from cashfree_pg.models.refund_url_object import RefundURLObject +from cashfree_pg.models.saved_instrument_meta import SavedInstrumentMeta +from cashfree_pg.models.settlement_entity import SettlementEntity +from cashfree_pg.models.settlement_fetch_recon_request import SettlementFetchReconRequest +from cashfree_pg.models.settlement_fetch_recon_request_filters import SettlementFetchReconRequestFilters +from cashfree_pg.models.settlement_recon_entity import SettlementReconEntity +from cashfree_pg.models.settlement_recon_entity_data_inner import SettlementReconEntityDataInner +from cashfree_pg.models.settlement_url_object import SettlementURLObject +from cashfree_pg.models.terminal_details import TerminalDetails +from cashfree_pg.models.terminal_entity import TerminalEntity +from cashfree_pg.models.terminal_transaction_entity import TerminalTransactionEntity +from cashfree_pg.models.upi_authorize_details import UPIAuthorizeDetails +from cashfree_pg.models.upi_payment_method import UPIPaymentMethod +from cashfree_pg.models.upi import Upi +from cashfree_pg.models.vendor_split import VendorSplit +from cashfree_pg.models.w_hcustomer_details import WHcustomerDetails +from cashfree_pg.models.w_hdata import WHdata +from cashfree_pg.models.w_horder import WHorder +from cashfree_pg.models.wallet_offer import WalletOffer diff --git a/models/api_error.py b/models/api_error.py new file mode 100644 index 0000000..dd07226 --- /dev/null +++ b/models/api_error.py @@ -0,0 +1,86 @@ +# coding: utf-8 + +""" + Cashfree Payment Gateway APIs + + Cashfree's Payment Gateway APIs provide developers with a streamlined pathway to integrate advanced payment processing capabilities into their applications, platforms and websites. + + The version of the OpenAPI document: 2022-09-01 + Contact: developers@cashfree.com + Generated by OpenAPI Generator (https://openapi-generator.tech) + + Do not edit the class manually. +""" # noqa: E501 + + +from __future__ import annotations +import pprint +import re # noqa: F401 +import json + + +from typing import Optional +from pydantic import BaseModel, Field, StrictStr, validator + +class ApiError(BaseModel): + """ + Error at cashfree's server + """ + message: Optional[StrictStr] = None + code: Optional[StrictStr] = None + type: Optional[StrictStr] = Field(None, description="api_error") + __properties = ["message", "code", "type"] + + @validator('type') + def type_validate_enum(cls, value): + """Validates the enum""" + if value is None: + return value + + if value not in ('api_error'): + raise ValueError("must be one of enum values ('api_error')") + return value + + class Config: + """Pydantic configuration""" + allow_population_by_field_name = True + validate_assignment = True + + def to_str(self) -> str: + """Returns the string representation of the model using alias""" + return pprint.pformat(self.dict(by_alias=True)) + + def to_json(self) -> str: + """Returns the JSON representation of the model using alias""" + return json.dumps(self.to_dict()) + + @classmethod + 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)) + + def to_dict(self): + """Returns the dictionary representation of the model using alias""" + _dict = self.dict(by_alias=True, + exclude={ + }, + exclude_none=True) + return _dict + + @classmethod + def from_dict(cls, obj: dict) -> ApiError: + """Create an instance of ApiError from a dict""" + if obj is None: + return None + + if not isinstance(obj, dict): + return ApiError.parse_obj(obj) + + _obj = ApiError.parse_obj({ + "message": obj.get("message"), + "code": obj.get("code"), + "type": obj.get("type") + }) + return _obj + + diff --git a/models/api_error404.py b/models/api_error404.py new file mode 100644 index 0000000..d978491 --- /dev/null +++ b/models/api_error404.py @@ -0,0 +1,86 @@ +# coding: utf-8 + +""" + Cashfree Payment Gateway APIs + + Cashfree's Payment Gateway APIs provide developers with a streamlined pathway to integrate advanced payment processing capabilities into their applications, platforms and websites. + + The version of the OpenAPI document: 2022-09-01 + Contact: developers@cashfree.com + Generated by OpenAPI Generator (https://openapi-generator.tech) + + Do not edit the class manually. +""" # noqa: E501 + + +from __future__ import annotations +import pprint +import re # noqa: F401 +import json + + +from typing import Optional +from pydantic import BaseModel, Field, StrictStr, validator + +class ApiError404(BaseModel): + """ + Error when resource requested is not found + """ + message: Optional[StrictStr] = None + code: Optional[StrictStr] = None + type: Optional[StrictStr] = Field(None, description="invalid_request_error") + __properties = ["message", "code", "type"] + + @validator('type') + def type_validate_enum(cls, value): + """Validates the enum""" + if value is None: + return value + + if value not in ('invalid_request_error'): + raise ValueError("must be one of enum values ('invalid_request_error')") + return value + + class Config: + """Pydantic configuration""" + allow_population_by_field_name = True + validate_assignment = True + + def to_str(self) -> str: + """Returns the string representation of the model using alias""" + return pprint.pformat(self.dict(by_alias=True)) + + def to_json(self) -> str: + """Returns the JSON representation of the model using alias""" + return json.dumps(self.to_dict()) + + @classmethod + 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)) + + def to_dict(self): + """Returns the dictionary representation of the model using alias""" + _dict = self.dict(by_alias=True, + exclude={ + }, + exclude_none=True) + return _dict + + @classmethod + def from_dict(cls, obj: dict) -> ApiError404: + """Create an instance of ApiError404 from a dict""" + if obj is None: + return None + + if not isinstance(obj, dict): + return ApiError404.parse_obj(obj) + + _obj = ApiError404.parse_obj({ + "message": obj.get("message"), + "code": obj.get("code"), + "type": obj.get("type") + }) + return _obj + + diff --git a/models/api_error409.py b/models/api_error409.py new file mode 100644 index 0000000..c2aca5c --- /dev/null +++ b/models/api_error409.py @@ -0,0 +1,86 @@ +# coding: utf-8 + +""" + Cashfree Payment Gateway APIs + + Cashfree's Payment Gateway APIs provide developers with a streamlined pathway to integrate advanced payment processing capabilities into their applications, platforms and websites. + + The version of the OpenAPI document: 2022-09-01 + Contact: developers@cashfree.com + Generated by OpenAPI Generator (https://openapi-generator.tech) + + Do not edit the class manually. +""" # noqa: E501 + + +from __future__ import annotations +import pprint +import re # noqa: F401 +import json + + +from typing import Optional +from pydantic import BaseModel, Field, StrictStr, validator + +class ApiError409(BaseModel): + """ + duplicate request + """ + message: Optional[StrictStr] = None + code: Optional[StrictStr] = None + type: Optional[StrictStr] = Field(None, description="invalid_request_error") + __properties = ["message", "code", "type"] + + @validator('type') + def type_validate_enum(cls, value): + """Validates the enum""" + if value is None: + return value + + if value not in ('invalid_request_error'): + raise ValueError("must be one of enum values ('invalid_request_error')") + return value + + class Config: + """Pydantic configuration""" + allow_population_by_field_name = True + validate_assignment = True + + def to_str(self) -> str: + """Returns the string representation of the model using alias""" + return pprint.pformat(self.dict(by_alias=True)) + + def to_json(self) -> str: + """Returns the JSON representation of the model using alias""" + return json.dumps(self.to_dict()) + + @classmethod + 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)) + + def to_dict(self): + """Returns the dictionary representation of the model using alias""" + _dict = self.dict(by_alias=True, + exclude={ + }, + exclude_none=True) + return _dict + + @classmethod + def from_dict(cls, obj: dict) -> ApiError409: + """Create an instance of ApiError409 from a dict""" + if obj is None: + return None + + if not isinstance(obj, dict): + return ApiError409.parse_obj(obj) + + _obj = ApiError409.parse_obj({ + "message": obj.get("message"), + "code": obj.get("code"), + "type": obj.get("type") + }) + return _obj + + diff --git a/models/api_error502.py b/models/api_error502.py new file mode 100644 index 0000000..4ddf3b4 --- /dev/null +++ b/models/api_error502.py @@ -0,0 +1,86 @@ +# coding: utf-8 + +""" + Cashfree Payment Gateway APIs + + Cashfree's Payment Gateway APIs provide developers with a streamlined pathway to integrate advanced payment processing capabilities into their applications, platforms and websites. + + The version of the OpenAPI document: 2022-09-01 + Contact: developers@cashfree.com + Generated by OpenAPI Generator (https://openapi-generator.tech) + + Do not edit the class manually. +""" # noqa: E501 + + +from __future__ import annotations +import pprint +import re # noqa: F401 +import json + + +from typing import Optional +from pydantic import BaseModel, Field, StrictStr, validator + +class ApiError502(BaseModel): + """ + Error when there is error at partner bank + """ + message: Optional[StrictStr] = None + code: Optional[StrictStr] = Field(None, description="`bank_processing_failure` will be returned here to denote failure at bank. ") + type: Optional[StrictStr] = Field(None, description="api_error") + __properties = ["message", "code", "type"] + + @validator('type') + def type_validate_enum(cls, value): + """Validates the enum""" + if value is None: + return value + + if value not in ('api_error'): + raise ValueError("must be one of enum values ('api_error')") + return value + + class Config: + """Pydantic configuration""" + allow_population_by_field_name = True + validate_assignment = True + + def to_str(self) -> str: + """Returns the string representation of the model using alias""" + return pprint.pformat(self.dict(by_alias=True)) + + def to_json(self) -> str: + """Returns the JSON representation of the model using alias""" + return json.dumps(self.to_dict()) + + @classmethod + 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)) + + def to_dict(self): + """Returns the dictionary representation of the model using alias""" + _dict = self.dict(by_alias=True, + exclude={ + }, + exclude_none=True) + return _dict + + @classmethod + def from_dict(cls, obj: dict) -> ApiError502: + """Create an instance of ApiError502 from a dict""" + if obj is None: + return None + + if not isinstance(obj, dict): + return ApiError502.parse_obj(obj) + + _obj = ApiError502.parse_obj({ + "message": obj.get("message"), + "code": obj.get("code"), + "type": obj.get("type") + }) + return _obj + + diff --git a/models/app.py b/models/app.py new file mode 100644 index 0000000..d5518d6 --- /dev/null +++ b/models/app.py @@ -0,0 +1,83 @@ +# coding: utf-8 + +""" + Cashfree Payment Gateway APIs + + Cashfree's Payment Gateway APIs provide developers with a streamlined pathway to integrate advanced payment processing capabilities into their applications, platforms and websites. + + The version of the OpenAPI document: 2022-09-01 + Contact: developers@cashfree.com + Generated by OpenAPI Generator (https://openapi-generator.tech) + + Do not edit the class manually. +""" # noqa: E501 + + +from __future__ import annotations +import pprint +import re # noqa: F401 +import json + + + +from pydantic import BaseModel, Field, StrictStr, validator + +class App(BaseModel): + """ + App payment method + """ + channel: StrictStr = Field(..., description="Specify the channel through which the payment must be processed.") + provider: StrictStr = Field(..., description="Specify the provider through which the payment must be processed.") + phone: StrictStr = Field(..., description="Customer phone number associated with a wallet for payment.") + __properties = ["channel", "provider", "phone"] + + @validator('provider') + def provider_validate_enum(cls, value): + """Validates the enum""" + if value not in ('gpay', 'phonepe', 'ola', 'paytm', 'amazon', 'airtel', 'freecharge', 'mobikwik', 'jio'): + raise ValueError("must be one of enum values ('gpay', 'phonepe', 'ola', 'paytm', 'amazon', 'airtel', 'freecharge', 'mobikwik', 'jio')") + return value + + class Config: + """Pydantic configuration""" + allow_population_by_field_name = True + validate_assignment = True + + def to_str(self) -> str: + """Returns the string representation of the model using alias""" + return pprint.pformat(self.dict(by_alias=True)) + + def to_json(self) -> str: + """Returns the JSON representation of the model using alias""" + return json.dumps(self.to_dict()) + + @classmethod + 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)) + + def to_dict(self): + """Returns the dictionary representation of the model using alias""" + _dict = self.dict(by_alias=True, + exclude={ + }, + exclude_none=True) + return _dict + + @classmethod + def from_dict(cls, obj: dict) -> App: + """Create an instance of App from a dict""" + if obj is None: + return None + + if not isinstance(obj, dict): + return App.parse_obj(obj) + + _obj = App.parse_obj({ + "channel": obj.get("channel"), + "provider": obj.get("provider"), + "phone": obj.get("phone") + }) + return _obj + + diff --git a/models/app_payment_method.py b/models/app_payment_method.py new file mode 100644 index 0000000..533c421 --- /dev/null +++ b/models/app_payment_method.py @@ -0,0 +1,76 @@ +# coding: utf-8 + +""" + Cashfree Payment Gateway APIs + + Cashfree's Payment Gateway APIs provide developers with a streamlined pathway to integrate advanced payment processing capabilities into their applications, platforms and websites. + + The version of the OpenAPI document: 2022-09-01 + Contact: developers@cashfree.com + Generated by OpenAPI Generator (https://openapi-generator.tech) + + Do not edit the class manually. +""" # noqa: E501 + + +from __future__ import annotations +import pprint +import re # noqa: F401 +import json + + + +from pydantic import BaseModel, Field +from cashfree_pg.models.app import App + +class AppPaymentMethod(BaseModel): + """ + App payment method + """ + app: App = Field(...) + __properties = ["app"] + + class Config: + """Pydantic configuration""" + allow_population_by_field_name = True + validate_assignment = True + + def to_str(self) -> str: + """Returns the string representation of the model using alias""" + return pprint.pformat(self.dict(by_alias=True)) + + def to_json(self) -> str: + """Returns the JSON representation of the model using alias""" + return json.dumps(self.to_dict()) + + @classmethod + 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)) + + def to_dict(self): + """Returns the dictionary representation of the model using alias""" + _dict = self.dict(by_alias=True, + exclude={ + }, + exclude_none=True) + # override the default output from pydantic by calling `to_dict()` of app + if self.app: + _dict['app'] = self.app.to_dict() + return _dict + + @classmethod + def from_dict(cls, obj: dict) -> AppPaymentMethod: + """Create an instance of AppPaymentMethod from a dict""" + if obj is None: + return None + + if not isinstance(obj, dict): + return AppPaymentMethod.parse_obj(obj) + + _obj = AppPaymentMethod.parse_obj({ + "app": App.from_dict(obj.get("app")) if obj.get("app") is not None else None + }) + return _obj + + diff --git a/models/authentication_error.py b/models/authentication_error.py new file mode 100644 index 0000000..f414236 --- /dev/null +++ b/models/authentication_error.py @@ -0,0 +1,76 @@ +# coding: utf-8 + +""" + Cashfree Payment Gateway APIs + + Cashfree's Payment Gateway APIs provide developers with a streamlined pathway to integrate advanced payment processing capabilities into their applications, platforms and websites. + + The version of the OpenAPI document: 2022-09-01 + Contact: developers@cashfree.com + Generated by OpenAPI Generator (https://openapi-generator.tech) + + Do not edit the class manually. +""" # noqa: E501 + + +from __future__ import annotations +import pprint +import re # noqa: F401 +import json + + +from typing import Optional +from pydantic import BaseModel, Field, StrictStr + +class AuthenticationError(BaseModel): + """ + Error if api keys are wrong + """ + message: Optional[StrictStr] = None + code: Optional[StrictStr] = None + type: Optional[StrictStr] = Field(None, description="authentication_error") + __properties = ["message", "code", "type"] + + class Config: + """Pydantic configuration""" + allow_population_by_field_name = True + validate_assignment = True + + def to_str(self) -> str: + """Returns the string representation of the model using alias""" + return pprint.pformat(self.dict(by_alias=True)) + + def to_json(self) -> str: + """Returns the JSON representation of the model using alias""" + return json.dumps(self.to_dict()) + + @classmethod + 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)) + + def to_dict(self): + """Returns the dictionary representation of the model using alias""" + _dict = self.dict(by_alias=True, + exclude={ + }, + exclude_none=True) + return _dict + + @classmethod + def from_dict(cls, obj: dict) -> AuthenticationError: + """Create an instance of AuthenticationError from a dict""" + if obj is None: + return None + + if not isinstance(obj, dict): + return AuthenticationError.parse_obj(obj) + + _obj = AuthenticationError.parse_obj({ + "message": obj.get("message"), + "code": obj.get("code"), + "type": obj.get("type") + }) + return _obj + + diff --git a/models/authorization_in_payments_entity.py b/models/authorization_in_payments_entity.py new file mode 100644 index 0000000..04a0360 --- /dev/null +++ b/models/authorization_in_payments_entity.py @@ -0,0 +1,106 @@ +# coding: utf-8 + +""" + Cashfree Payment Gateway APIs + + Cashfree's Payment Gateway APIs provide developers with a streamlined pathway to integrate advanced payment processing capabilities into their applications, platforms and websites. + + The version of the OpenAPI document: 2022-09-01 + Contact: developers@cashfree.com + Generated by OpenAPI Generator (https://openapi-generator.tech) + + Do not edit the class manually. +""" # noqa: E501 + + +from __future__ import annotations +import pprint +import re # noqa: F401 +import json + + +from typing import Optional, Union +from pydantic import BaseModel, Field, StrictFloat, StrictInt, StrictStr, validator + +class AuthorizationInPaymentsEntity(BaseModel): + """ + If preauth enabled for account you will get this body + """ + action: Optional[StrictStr] = Field(None, description="One of CAPTURE or VOID") + status: Optional[StrictStr] = Field(None, description="One of SUCCESS or PENDING") + captured_amount: Optional[Union[StrictFloat, StrictInt]] = Field(None, description="The captured amount for this authorization request") + start_time: Optional[StrictStr] = Field(None, description="Start time of this authorization hold (only for UPI)") + end_time: Optional[StrictStr] = Field(None, description="End time of this authorization hold (only for UPI)") + approve_by: Optional[StrictStr] = Field(None, description="Approve by time as passed in the authorization request (only for UPI)") + action_reference: Optional[StrictStr] = Field(None, description="CAPTURE or VOID reference number based on action ") + action_time: Optional[StrictStr] = Field(None, description="Time of action (CAPTURE or VOID)") + __properties = ["action", "status", "captured_amount", "start_time", "end_time", "approve_by", "action_reference", "action_time"] + + @validator('action') + def action_validate_enum(cls, value): + """Validates the enum""" + if value is None: + return value + + if value not in ('CAPTURE', 'VOID'): + raise ValueError("must be one of enum values ('CAPTURE', 'VOID')") + return value + + @validator('status') + def status_validate_enum(cls, value): + """Validates the enum""" + if value is None: + return value + + if value not in ('SUCCESS', 'PENDING'): + raise ValueError("must be one of enum values ('SUCCESS', 'PENDING')") + return value + + class Config: + """Pydantic configuration""" + allow_population_by_field_name = True + validate_assignment = True + + def to_str(self) -> str: + """Returns the string representation of the model using alias""" + return pprint.pformat(self.dict(by_alias=True)) + + def to_json(self) -> str: + """Returns the JSON representation of the model using alias""" + return json.dumps(self.to_dict()) + + @classmethod + 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)) + + def to_dict(self): + """Returns the dictionary representation of the model using alias""" + _dict = self.dict(by_alias=True, + exclude={ + }, + exclude_none=True) + return _dict + + @classmethod + def from_dict(cls, obj: dict) -> AuthorizationInPaymentsEntity: + """Create an instance of AuthorizationInPaymentsEntity from a dict""" + if obj is None: + return None + + if not isinstance(obj, dict): + return AuthorizationInPaymentsEntity.parse_obj(obj) + + _obj = AuthorizationInPaymentsEntity.parse_obj({ + "action": obj.get("action"), + "status": obj.get("status"), + "captured_amount": obj.get("captured_amount"), + "start_time": obj.get("start_time"), + "end_time": obj.get("end_time"), + "approve_by": obj.get("approve_by"), + "action_reference": obj.get("action_reference"), + "action_time": obj.get("action_time") + }) + return _obj + + diff --git a/models/authorize_order_request.py b/models/authorize_order_request.py new file mode 100644 index 0000000..4bd4e17 --- /dev/null +++ b/models/authorize_order_request.py @@ -0,0 +1,84 @@ +# coding: utf-8 + +""" + Cashfree Payment Gateway APIs + + Cashfree's Payment Gateway APIs provide developers with a streamlined pathway to integrate advanced payment processing capabilities into their applications, platforms and websites. + + The version of the OpenAPI document: 2022-09-01 + Contact: developers@cashfree.com + Generated by OpenAPI Generator (https://openapi-generator.tech) + + Do not edit the class manually. +""" # noqa: E501 + + +from __future__ import annotations +import pprint +import re # noqa: F401 +import json + + +from typing import Optional, Union +from pydantic import BaseModel, Field, StrictFloat, StrictInt, StrictStr, validator + +class AuthorizeOrderRequest(BaseModel): + """ + Request to capture or void transaction + """ + action: Optional[StrictStr] = Field(None, description="Type of authorization to run. Can be one of 'CAPTURE' , 'VOID'") + amount: Optional[Union[StrictFloat, StrictInt]] = Field(None, description="The amount if you are running a 'CAPTURE'") + __properties = ["action", "amount"] + + @validator('action') + def action_validate_enum(cls, value): + """Validates the enum""" + if value is None: + return value + + if value not in ('CAPTURE', 'VOID'): + raise ValueError("must be one of enum values ('CAPTURE', 'VOID')") + return value + + class Config: + """Pydantic configuration""" + allow_population_by_field_name = True + validate_assignment = True + + def to_str(self) -> str: + """Returns the string representation of the model using alias""" + return pprint.pformat(self.dict(by_alias=True)) + + def to_json(self) -> str: + """Returns the JSON representation of the model using alias""" + return json.dumps(self.to_dict()) + + @classmethod + 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)) + + def to_dict(self): + """Returns the dictionary representation of the model using alias""" + _dict = self.dict(by_alias=True, + exclude={ + }, + exclude_none=True) + return _dict + + @classmethod + def from_dict(cls, obj: dict) -> AuthorizeOrderRequest: + """Create an instance of AuthorizeOrderRequest from a dict""" + if obj is None: + return None + + if not isinstance(obj, dict): + return AuthorizeOrderRequest.parse_obj(obj) + + _obj = AuthorizeOrderRequest.parse_obj({ + "action": obj.get("action"), + "amount": obj.get("amount") + }) + return _obj + + diff --git a/models/bad_request_error.py b/models/bad_request_error.py new file mode 100644 index 0000000..e2e6ba7 --- /dev/null +++ b/models/bad_request_error.py @@ -0,0 +1,86 @@ +# coding: utf-8 + +""" + Cashfree Payment Gateway APIs + + Cashfree's Payment Gateway APIs provide developers with a streamlined pathway to integrate advanced payment processing capabilities into their applications, platforms and websites. + + The version of the OpenAPI document: 2022-09-01 + Contact: developers@cashfree.com + Generated by OpenAPI Generator (https://openapi-generator.tech) + + Do not edit the class manually. +""" # noqa: E501 + + +from __future__ import annotations +import pprint +import re # noqa: F401 +import json + + +from typing import Optional +from pydantic import BaseModel, StrictStr, validator + +class BadRequestError(BaseModel): + """ + Invalid request received from client + """ + message: Optional[StrictStr] = None + code: Optional[StrictStr] = None + type: Optional[StrictStr] = None + __properties = ["message", "code", "type"] + + @validator('type') + def type_validate_enum(cls, value): + """Validates the enum""" + if value is None: + return value + + if value not in ('invalid_request_error'): + raise ValueError("must be one of enum values ('invalid_request_error')") + return value + + class Config: + """Pydantic configuration""" + allow_population_by_field_name = True + validate_assignment = True + + def to_str(self) -> str: + """Returns the string representation of the model using alias""" + return pprint.pformat(self.dict(by_alias=True)) + + def to_json(self) -> str: + """Returns the JSON representation of the model using alias""" + return json.dumps(self.to_dict()) + + @classmethod + 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)) + + def to_dict(self): + """Returns the dictionary representation of the model using alias""" + _dict = self.dict(by_alias=True, + exclude={ + }, + exclude_none=True) + return _dict + + @classmethod + def from_dict(cls, obj: dict) -> BadRequestError: + """Create an instance of BadRequestError from a dict""" + if obj is None: + return None + + if not isinstance(obj, dict): + return BadRequestError.parse_obj(obj) + + _obj = BadRequestError.parse_obj({ + "message": obj.get("message"), + "code": obj.get("code"), + "type": obj.get("type") + }) + return _obj + + diff --git a/models/card.py b/models/card.py new file mode 100644 index 0000000..64418f1 --- /dev/null +++ b/models/card.py @@ -0,0 +1,128 @@ +# coding: utf-8 + +""" + Cashfree Payment Gateway APIs + + Cashfree's Payment Gateway APIs provide developers with a streamlined pathway to integrate advanced payment processing capabilities into their applications, platforms and websites. + + The version of the OpenAPI document: 2022-09-01 + Contact: developers@cashfree.com + Generated by OpenAPI Generator (https://openapi-generator.tech) + + Do not edit the class manually. +""" # noqa: E501 + + +from __future__ import annotations +import pprint +import re # noqa: F401 +import json + + +from typing import Optional +from pydantic import BaseModel, Field, StrictInt, StrictStr, validator + +class Card(BaseModel): + """ + Card Payment method + """ + channel: Optional[StrictStr] = Field(None, description="The channel for card payments can be \"link\" or \"post\". Post is used for seamless OTP payments where merchant captures OTP on their own page.") + card_number: Optional[StrictStr] = Field(None, description="Customer card number for plain card transactions. Token pan number for tokenized card transactions.") + card_holder_name: Optional[StrictStr] = Field(None, description="Customer name mentioned on the card.") + card_expiry_mm: Optional[StrictStr] = Field(None, description="Card expiry month for plain card transactions. Token expiry month for tokenized card transactions.") + card_expiry_yy: Optional[StrictStr] = Field(None, description="Card expiry year for plain card transactions. Token expiry year for tokenized card transactions.") + card_cvv: Optional[StrictStr] = Field(None, description="CVV mentioned on the card.") + instrument_id: Optional[StrictStr] = Field(None, description="instrument id of saved card. Required only to make payment using saved instrument.") + cryptogram: Optional[StrictStr] = Field(None, description="cryptogram received from card network. Required only for tokenized card transactions.") + token_requestor_id: Optional[StrictStr] = Field(None, description="TRID issued by card networks. Required only for tokenized card transactions.") + token_type: Optional[StrictStr] = None + card_display: Optional[StrictStr] = Field(None, description="last 4 digits of original card number. Required only for tokenized card transactions.") + card_alias: Optional[StrictStr] = Field(None, description="Card alias as returned by Cashfree Vault API.") + card_bank_name: Optional[StrictStr] = Field(None, description="One of [\"Kotak\", \"ICICI\", \"RBL\", \"BOB\", \"Standard Chartered\"]. Card bank name, required for EMI payments. This is the bank user has selected for EMI") + emi_tenure: Optional[StrictInt] = Field(None, description="EMI tenure selected by the user") + __properties = ["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"] + + @validator('channel') + def channel_validate_enum(cls, value): + """Validates the enum""" + if value is None: + return value + + if value not in ('link', 'post'): + raise ValueError("must be one of enum values ('link', 'post')") + return value + + @validator('token_type') + def token_type_validate_enum(cls, value): + """Validates the enum""" + if value is None: + return value + + if value not in ('ISSUER_TOKEN', 'NETWORK_GC_TOKEN', 'ISSUER_GC_TOKEN'): + raise ValueError("must be one of enum values ('ISSUER_TOKEN', 'NETWORK_GC_TOKEN', 'ISSUER_GC_TOKEN')") + return value + + @validator('card_bank_name') + def card_bank_name_validate_enum(cls, value): + """Validates the enum""" + if value is None: + return value + + if value not in ('Kotak', 'ICICI', 'RBL', 'BOB', 'Standard Chartered'): + raise ValueError("must be one of enum values ('Kotak', 'ICICI', 'RBL', 'BOB', 'Standard Chartered')") + return value + + class Config: + """Pydantic configuration""" + allow_population_by_field_name = True + validate_assignment = True + + def to_str(self) -> str: + """Returns the string representation of the model using alias""" + return pprint.pformat(self.dict(by_alias=True)) + + def to_json(self) -> str: + """Returns the JSON representation of the model using alias""" + return json.dumps(self.to_dict()) + + @classmethod + 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)) + + def to_dict(self): + """Returns the dictionary representation of the model using alias""" + _dict = self.dict(by_alias=True, + exclude={ + }, + exclude_none=True) + return _dict + + @classmethod + def from_dict(cls, obj: dict) -> Card: + """Create an instance of Card from a dict""" + if obj is None: + return None + + if not isinstance(obj, dict): + return Card.parse_obj(obj) + + _obj = Card.parse_obj({ + "channel": obj.get("channel"), + "card_number": obj.get("card_number"), + "card_holder_name": obj.get("card_holder_name"), + "card_expiry_mm": obj.get("card_expiry_mm"), + "card_expiry_yy": obj.get("card_expiry_yy"), + "card_cvv": obj.get("card_cvv"), + "instrument_id": obj.get("instrument_id"), + "cryptogram": obj.get("cryptogram"), + "token_requestor_id": obj.get("token_requestor_id"), + "token_type": obj.get("token_type"), + "card_display": obj.get("card_display"), + "card_alias": obj.get("card_alias"), + "card_bank_name": obj.get("card_bank_name"), + "emi_tenure": obj.get("emi_tenure") + }) + return _obj + + diff --git a/models/card_emi.py b/models/card_emi.py new file mode 100644 index 0000000..240f51e --- /dev/null +++ b/models/card_emi.py @@ -0,0 +1,98 @@ +# coding: utf-8 + +""" + Cashfree Payment Gateway APIs + + Cashfree's Payment Gateway APIs provide developers with a streamlined pathway to integrate advanced payment processing capabilities into their applications, platforms and websites. + + The version of the OpenAPI document: 2022-09-01 + Contact: developers@cashfree.com + Generated by OpenAPI Generator (https://openapi-generator.tech) + + Do not edit the class manually. +""" # noqa: E501 + + +from __future__ import annotations +import pprint +import re # noqa: F401 +import json + + +from typing import Optional +from pydantic import BaseModel, Field, StrictInt, StrictStr, validator + +class CardEMI(BaseModel): + """ + Payment method for card emi + """ + channel: Optional[StrictStr] = Field(None, description="The channel for card payments will always be \"link\"") + card_number: Optional[StrictStr] = Field(None, description="Customer card number.") + card_holder_name: Optional[StrictStr] = Field(None, description="Customer name mentioned on the card.") + card_expiry_mm: Optional[StrictStr] = Field(None, description="Card expiry month.") + card_expiry_yy: Optional[StrictStr] = Field(None, description="Card expiry year.") + card_cvv: Optional[StrictStr] = Field(None, description="CVV mentioned on the card.") + card_alias: Optional[StrictStr] = Field(None, description="Card alias as returned by Cashfree Vault API") + card_bank_name: Optional[StrictStr] = Field(None, description="Card bank name, required for EMI payments. This is the bank user has selected for EMI. One of [\"hdfc, \"kotak\", \"icici\", \"rbl\", \"bob\", \"standard chartered\", \"axis\", \"au\", \"yes\", \"sbi\", \"fed\", \"hsbc\", \"citi\", \"amex\"]") + emi_tenure: Optional[StrictInt] = Field(None, description="EMI tenure selected by the user") + __properties = ["channel", "card_number", "card_holder_name", "card_expiry_mm", "card_expiry_yy", "card_cvv", "card_alias", "card_bank_name", "emi_tenure"] + + @validator('card_bank_name') + def card_bank_name_validate_enum(cls, value): + """Validates the enum""" + if value is None: + return value + + if value not in ('hdfc', 'kotak', 'icici', 'rbl', 'bob', 'standard chartered', 'axis', 'au', 'yes', 'sbi', 'fed', 'hsbc', 'citi', 'amex'): + raise ValueError("must be one of enum values ('hdfc', 'kotak', 'icici', 'rbl', 'bob', 'standard chartered', 'axis', 'au', 'yes', 'sbi', 'fed', 'hsbc', 'citi', 'amex')") + return value + + class Config: + """Pydantic configuration""" + allow_population_by_field_name = True + validate_assignment = True + + def to_str(self) -> str: + """Returns the string representation of the model using alias""" + return pprint.pformat(self.dict(by_alias=True)) + + def to_json(self) -> str: + """Returns the JSON representation of the model using alias""" + return json.dumps(self.to_dict()) + + @classmethod + 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)) + + def to_dict(self): + """Returns the dictionary representation of the model using alias""" + _dict = self.dict(by_alias=True, + exclude={ + }, + exclude_none=True) + return _dict + + @classmethod + def from_dict(cls, obj: dict) -> CardEMI: + """Create an instance of CardEMI from a dict""" + if obj is None: + return None + + if not isinstance(obj, dict): + return CardEMI.parse_obj(obj) + + _obj = CardEMI.parse_obj({ + "channel": obj.get("channel"), + "card_number": obj.get("card_number"), + "card_holder_name": obj.get("card_holder_name"), + "card_expiry_mm": obj.get("card_expiry_mm"), + "card_expiry_yy": obj.get("card_expiry_yy"), + "card_cvv": obj.get("card_cvv"), + "card_alias": obj.get("card_alias"), + "card_bank_name": obj.get("card_bank_name"), + "emi_tenure": obj.get("emi_tenure") + }) + return _obj + + diff --git a/models/card_emi_payment_method.py b/models/card_emi_payment_method.py new file mode 100644 index 0000000..891a556 --- /dev/null +++ b/models/card_emi_payment_method.py @@ -0,0 +1,76 @@ +# coding: utf-8 + +""" + Cashfree Payment Gateway APIs + + Cashfree's Payment Gateway APIs provide developers with a streamlined pathway to integrate advanced payment processing capabilities into their applications, platforms and websites. + + The version of the OpenAPI document: 2022-09-01 + Contact: developers@cashfree.com + Generated by OpenAPI Generator (https://openapi-generator.tech) + + Do not edit the class manually. +""" # noqa: E501 + + +from __future__ import annotations +import pprint +import re # noqa: F401 +import json + + + +from pydantic import BaseModel, Field +from cashfree_pg.models.card_emi import CardEMI + +class CardEMIPaymentMethod(BaseModel): + """ + Complete card emi payment method + """ + emi: CardEMI = Field(...) + __properties = ["emi"] + + class Config: + """Pydantic configuration""" + allow_population_by_field_name = True + validate_assignment = True + + def to_str(self) -> str: + """Returns the string representation of the model using alias""" + return pprint.pformat(self.dict(by_alias=True)) + + def to_json(self) -> str: + """Returns the JSON representation of the model using alias""" + return json.dumps(self.to_dict()) + + @classmethod + 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)) + + def to_dict(self): + """Returns the dictionary representation of the model using alias""" + _dict = self.dict(by_alias=True, + exclude={ + }, + exclude_none=True) + # override the default output from pydantic by calling `to_dict()` of emi + if self.emi: + _dict['emi'] = self.emi.to_dict() + return _dict + + @classmethod + def from_dict(cls, obj: dict) -> CardEMIPaymentMethod: + """Create an instance of CardEMIPaymentMethod from a dict""" + if obj is None: + return None + + if not isinstance(obj, dict): + return CardEMIPaymentMethod.parse_obj(obj) + + _obj = CardEMIPaymentMethod.parse_obj({ + "emi": CardEMI.from_dict(obj.get("emi")) if obj.get("emi") is not None else None + }) + return _obj + + diff --git a/models/card_offer.py b/models/card_offer.py new file mode 100644 index 0000000..c827360 --- /dev/null +++ b/models/card_offer.py @@ -0,0 +1,76 @@ +# coding: utf-8 + +""" + Cashfree Payment Gateway APIs + + Cashfree's Payment Gateway APIs provide developers with a streamlined pathway to integrate advanced payment processing capabilities into their applications, platforms and websites. + + The version of the OpenAPI document: 2022-09-01 + Contact: developers@cashfree.com + Generated by OpenAPI Generator (https://openapi-generator.tech) + + Do not edit the class manually. +""" # noqa: E501 + + +from __future__ import annotations +import pprint +import re # noqa: F401 +import json + + +from typing import List +from pydantic import BaseModel, Field, StrictStr, conlist, constr + +class CardOffer(BaseModel): + """ + CardOffer + """ + type: conlist(StrictStr) = Field(...) + bank_name: constr(strict=True, max_length=100, min_length=3) = Field(..., description="Bank Name of Card.") + scheme_name: conlist(StrictStr) = Field(...) + __properties = ["type", "bank_name", "scheme_name"] + + class Config: + """Pydantic configuration""" + allow_population_by_field_name = True + validate_assignment = True + + def to_str(self) -> str: + """Returns the string representation of the model using alias""" + return pprint.pformat(self.dict(by_alias=True)) + + def to_json(self) -> str: + """Returns the JSON representation of the model using alias""" + return json.dumps(self.to_dict()) + + @classmethod + 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)) + + def to_dict(self): + """Returns the dictionary representation of the model using alias""" + _dict = self.dict(by_alias=True, + exclude={ + }, + exclude_none=True) + return _dict + + @classmethod + def from_dict(cls, obj: dict) -> CardOffer: + """Create an instance of CardOffer from a dict""" + if obj is None: + return None + + if not isinstance(obj, dict): + return CardOffer.parse_obj(obj) + + _obj = CardOffer.parse_obj({ + "type": obj.get("type"), + "bank_name": obj.get("bank_name"), + "scheme_name": obj.get("scheme_name") + }) + return _obj + + diff --git a/models/card_payment_method.py b/models/card_payment_method.py new file mode 100644 index 0000000..9d3b382 --- /dev/null +++ b/models/card_payment_method.py @@ -0,0 +1,76 @@ +# coding: utf-8 + +""" + Cashfree Payment Gateway APIs + + Cashfree's Payment Gateway APIs provide developers with a streamlined pathway to integrate advanced payment processing capabilities into their applications, platforms and websites. + + The version of the OpenAPI document: 2022-09-01 + Contact: developers@cashfree.com + Generated by OpenAPI Generator (https://openapi-generator.tech) + + Do not edit the class manually. +""" # noqa: E501 + + +from __future__ import annotations +import pprint +import re # noqa: F401 +import json + + + +from pydantic import BaseModel, Field +from cashfree_pg.models.card import Card + +class CardPaymentMethod(BaseModel): + """ + The card payment object is used to make payment using either plain card number, saved card instrument id or using cryptogram + """ + card: Card = Field(...) + __properties = ["card"] + + class Config: + """Pydantic configuration""" + allow_population_by_field_name = True + validate_assignment = True + + def to_str(self) -> str: + """Returns the string representation of the model using alias""" + return pprint.pformat(self.dict(by_alias=True)) + + def to_json(self) -> str: + """Returns the JSON representation of the model using alias""" + return json.dumps(self.to_dict()) + + @classmethod + 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)) + + def to_dict(self): + """Returns the dictionary representation of the model using alias""" + _dict = self.dict(by_alias=True, + exclude={ + }, + exclude_none=True) + # override the default output from pydantic by calling `to_dict()` of card + if self.card: + _dict['card'] = self.card.to_dict() + return _dict + + @classmethod + def from_dict(cls, obj: dict) -> CardPaymentMethod: + """Create an instance of CardPaymentMethod from a dict""" + if obj is None: + return None + + if not isinstance(obj, dict): + return CardPaymentMethod.parse_obj(obj) + + _obj = CardPaymentMethod.parse_obj({ + "card": Card.from_dict(obj.get("card")) if obj.get("card") is not None else None + }) + return _obj + + diff --git a/models/cardless_emi.py b/models/cardless_emi.py new file mode 100644 index 0000000..cfb9255 --- /dev/null +++ b/models/cardless_emi.py @@ -0,0 +1,88 @@ +# coding: utf-8 + +""" + Cashfree Payment Gateway APIs + + Cashfree's Payment Gateway APIs provide developers with a streamlined pathway to integrate advanced payment processing capabilities into their applications, platforms and websites. + + The version of the OpenAPI document: 2022-09-01 + Contact: developers@cashfree.com + Generated by OpenAPI Generator (https://openapi-generator.tech) + + Do not edit the class manually. +""" # noqa: E501 + + +from __future__ import annotations +import pprint +import re # noqa: F401 +import json + + +from typing import Optional +from pydantic import BaseModel, Field, StrictInt, StrictStr, validator + +class CardlessEMI(BaseModel): + """ + Request body for cardless emi payment method + """ + channel: Optional[StrictStr] = Field(None, description="The channel for cardless EMI is always `link`") + provider: Optional[StrictStr] = Field(None, description="One of [`flexmoney`, `zestmoney`, `hdfc`, `icici`, `cashe`, `idfc`, `kotak`]") + phone: Optional[StrictStr] = Field(None, description="Customers phone number for this payment instrument. If the customer is not eligible you will receive a 400 error with type as 'invalid_request_error' and code as 'invalid_request_error'") + emi_tenure: Optional[StrictInt] = Field(None, description="EMI tenure for the selected provider. This is mandatory when provider is one of [`hdfc`, `icici`, `cashe`, `idfc`, `kotak`]") + __properties = ["channel", "provider", "phone", "emi_tenure"] + + @validator('provider') + def provider_validate_enum(cls, value): + """Validates the enum""" + if value is None: + return value + + if value not in ('flexmoney', 'zestmoney', 'hdfc', 'icici', 'cashe', 'idfc', 'kotak'): + raise ValueError("must be one of enum values ('flexmoney', 'zestmoney', 'hdfc', 'icici', 'cashe', 'idfc', 'kotak')") + return value + + class Config: + """Pydantic configuration""" + allow_population_by_field_name = True + validate_assignment = True + + def to_str(self) -> str: + """Returns the string representation of the model using alias""" + return pprint.pformat(self.dict(by_alias=True)) + + def to_json(self) -> str: + """Returns the JSON representation of the model using alias""" + return json.dumps(self.to_dict()) + + @classmethod + 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)) + + def to_dict(self): + """Returns the dictionary representation of the model using alias""" + _dict = self.dict(by_alias=True, + exclude={ + }, + exclude_none=True) + return _dict + + @classmethod + def from_dict(cls, obj: dict) -> CardlessEMI: + """Create an instance of CardlessEMI from a dict""" + if obj is None: + return None + + if not isinstance(obj, dict): + return CardlessEMI.parse_obj(obj) + + _obj = CardlessEMI.parse_obj({ + "channel": obj.get("channel"), + "provider": obj.get("provider"), + "phone": obj.get("phone"), + "emi_tenure": obj.get("emi_tenure") + }) + return _obj + + diff --git a/models/cardless_emi_entity.py b/models/cardless_emi_entity.py new file mode 100644 index 0000000..0840cb1 --- /dev/null +++ b/models/cardless_emi_entity.py @@ -0,0 +1,82 @@ +# coding: utf-8 + +""" + Cashfree Payment Gateway APIs + + Cashfree's Payment Gateway APIs provide developers with a streamlined pathway to integrate advanced payment processing capabilities into their applications, platforms and websites. + + The version of the OpenAPI document: 2022-09-01 + Contact: developers@cashfree.com + Generated by OpenAPI Generator (https://openapi-generator.tech) + + Do not edit the class manually. +""" # noqa: E501 + + +from __future__ import annotations +import pprint +import re # noqa: F401 +import json + + +from typing import List, Optional +from pydantic import BaseModel, conlist, constr +from cashfree_pg.models.emi_plans_array import EMIPlansArray + +class CardlessEMIEntity(BaseModel): + """ + cardless EMI object + """ + payment_method: Optional[constr(strict=True, max_length=50, min_length=3)] = None + emi_plans: Optional[conlist(EMIPlansArray)] = None + __properties = ["payment_method", "emi_plans"] + + class Config: + """Pydantic configuration""" + allow_population_by_field_name = True + validate_assignment = True + + def to_str(self) -> str: + """Returns the string representation of the model using alias""" + return pprint.pformat(self.dict(by_alias=True)) + + def to_json(self) -> str: + """Returns the JSON representation of the model using alias""" + return json.dumps(self.to_dict()) + + @classmethod + 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)) + + def to_dict(self): + """Returns the dictionary representation of the model using alias""" + _dict = self.dict(by_alias=True, + exclude={ + }, + exclude_none=True) + # override the default output from pydantic by calling `to_dict()` of each item in emi_plans (list) + _items = [] + if self.emi_plans: + for _item in self.emi_plans: + if _item: + _items.append(_item.to_dict()) + _dict['emi_plans'] = _items + return _dict + + @classmethod + def from_dict(cls, obj: dict) -> CardlessEMIEntity: + """Create an instance of CardlessEMIEntity from a dict""" + if obj is None: + return None + + if not isinstance(obj, dict): + return CardlessEMIEntity.parse_obj(obj) + + _obj = CardlessEMIEntity.parse_obj({ + "payment_method": obj.get("payment_method"), + "emi_plans": [EMIPlansArray.from_dict(_item) for _item in obj.get("emi_plans")] if obj.get("emi_plans") is not None else None + }) + return _obj + + diff --git a/models/cardless_emi_payment_method.py b/models/cardless_emi_payment_method.py new file mode 100644 index 0000000..594dabd --- /dev/null +++ b/models/cardless_emi_payment_method.py @@ -0,0 +1,76 @@ +# coding: utf-8 + +""" + Cashfree Payment Gateway APIs + + Cashfree's Payment Gateway APIs provide developers with a streamlined pathway to integrate advanced payment processing capabilities into their applications, platforms and websites. + + The version of the OpenAPI document: 2022-09-01 + Contact: developers@cashfree.com + Generated by OpenAPI Generator (https://openapi-generator.tech) + + Do not edit the class manually. +""" # noqa: E501 + + +from __future__ import annotations +import pprint +import re # noqa: F401 +import json + + +from typing import Optional +from pydantic import BaseModel +from cashfree_pg.models.cardless_emi import CardlessEMI + +class CardlessEMIPaymentMethod(BaseModel): + """ + cardless EMI payment method object + """ + cardless_emi: Optional[CardlessEMI] = None + __properties = ["cardless_emi"] + + class Config: + """Pydantic configuration""" + allow_population_by_field_name = True + validate_assignment = True + + def to_str(self) -> str: + """Returns the string representation of the model using alias""" + return pprint.pformat(self.dict(by_alias=True)) + + def to_json(self) -> str: + """Returns the JSON representation of the model using alias""" + return json.dumps(self.to_dict()) + + @classmethod + 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)) + + def to_dict(self): + """Returns the dictionary representation of the model using alias""" + _dict = self.dict(by_alias=True, + exclude={ + }, + exclude_none=True) + # override the default output from pydantic by calling `to_dict()` of cardless_emi + if self.cardless_emi: + _dict['cardless_emi'] = self.cardless_emi.to_dict() + return _dict + + @classmethod + def from_dict(cls, obj: dict) -> CardlessEMIPaymentMethod: + """Create an instance of CardlessEMIPaymentMethod from a dict""" + if obj is None: + return None + + if not isinstance(obj, dict): + return CardlessEMIPaymentMethod.parse_obj(obj) + + _obj = CardlessEMIPaymentMethod.parse_obj({ + "cardless_emi": CardlessEMI.from_dict(obj.get("cardless_emi")) if obj.get("cardless_emi") is not None else None + }) + return _obj + + diff --git a/models/cardless_emi_queries.py b/models/cardless_emi_queries.py new file mode 100644 index 0000000..572cb4e --- /dev/null +++ b/models/cardless_emi_queries.py @@ -0,0 +1,80 @@ +# coding: utf-8 + +""" + Cashfree Payment Gateway APIs + + Cashfree's Payment Gateway APIs provide developers with a streamlined pathway to integrate advanced payment processing capabilities into their applications, platforms and websites. + + The version of the OpenAPI document: 2022-09-01 + Contact: developers@cashfree.com + Generated by OpenAPI Generator (https://openapi-generator.tech) + + Do not edit the class manually. +""" # noqa: E501 + + +from __future__ import annotations +import pprint +import re # noqa: F401 +import json + + +from typing import Optional, Union +from pydantic import BaseModel, Field, confloat, conint, constr +from cashfree_pg.models.customer_details_cardless_emi import CustomerDetailsCardlessEMI + +class CardlessEMIQueries(BaseModel): + """ + cardless EMI query object + """ + order_id: Optional[constr(strict=True, max_length=50, min_length=3)] = Field(None, description="OrderId of the order. Either of `order_id` or `amount` is mandatory.") + amount: Optional[Union[confloat(ge=1, strict=True), conint(ge=1, strict=True)]] = Field(None, description="Amount of the order. OrderId of the order. Either of `order_id` or `amount` is mandatory.") + customer_details: Optional[CustomerDetailsCardlessEMI] = None + __properties = ["order_id", "amount", "customer_details"] + + class Config: + """Pydantic configuration""" + allow_population_by_field_name = True + validate_assignment = True + + def to_str(self) -> str: + """Returns the string representation of the model using alias""" + return pprint.pformat(self.dict(by_alias=True)) + + def to_json(self) -> str: + """Returns the JSON representation of the model using alias""" + return json.dumps(self.to_dict()) + + @classmethod + 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)) + + def to_dict(self): + """Returns the dictionary representation of the model using alias""" + _dict = self.dict(by_alias=True, + exclude={ + }, + exclude_none=True) + # override the default output from pydantic by calling `to_dict()` of customer_details + if self.customer_details: + _dict['customer_details'] = self.customer_details.to_dict() + return _dict + + @classmethod + def from_dict(cls, obj: dict) -> CardlessEMIQueries: + """Create an instance of CardlessEMIQueries from a dict""" + if obj is None: + return None + + if not isinstance(obj, dict): + return CardlessEMIQueries.parse_obj(obj) + + _obj = CardlessEMIQueries.parse_obj({ + "order_id": obj.get("order_id"), + "amount": obj.get("amount"), + "customer_details": CustomerDetailsCardlessEMI.from_dict(obj.get("customer_details")) if obj.get("customer_details") is not None else None + }) + return _obj + + diff --git a/models/cashback_details.py b/models/cashback_details.py new file mode 100644 index 0000000..b15122c --- /dev/null +++ b/models/cashback_details.py @@ -0,0 +1,83 @@ +# coding: utf-8 + +""" + Cashfree Payment Gateway APIs + + Cashfree's Payment Gateway APIs provide developers with a streamlined pathway to integrate advanced payment processing capabilities into their applications, platforms and websites. + + The version of the OpenAPI document: 2022-09-01 + Contact: developers@cashfree.com + Generated by OpenAPI Generator (https://openapi-generator.tech) + + Do not edit the class manually. +""" # noqa: E501 + + +from __future__ import annotations +import pprint +import re # noqa: F401 +import json + + + +from pydantic import BaseModel, Field, constr, validator + +class CashbackDetails(BaseModel): + """ + Cashback detail boject + """ + cashback_type: constr(strict=True, max_length=50, min_length=1) = Field(..., description="Type of discount") + cashback_value: constr(strict=True, max_length=100, min_length=1) = Field(..., description="Value of Discount.") + max_cashback_amount: constr(strict=True, max_length=100, min_length=1) = Field(..., description="Maximum Value of Cashback allowed.") + __properties = ["cashback_type", "cashback_value", "max_cashback_amount"] + + @validator('cashback_type') + def cashback_type_validate_enum(cls, value): + """Validates the enum""" + if value not in ('flat', 'percentage'): + raise ValueError("must be one of enum values ('flat', 'percentage')") + return value + + class Config: + """Pydantic configuration""" + allow_population_by_field_name = True + validate_assignment = True + + def to_str(self) -> str: + """Returns the string representation of the model using alias""" + return pprint.pformat(self.dict(by_alias=True)) + + def to_json(self) -> str: + """Returns the JSON representation of the model using alias""" + return json.dumps(self.to_dict()) + + @classmethod + 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)) + + def to_dict(self): + """Returns the dictionary representation of the model using alias""" + _dict = self.dict(by_alias=True, + exclude={ + }, + exclude_none=True) + return _dict + + @classmethod + def from_dict(cls, obj: dict) -> CashbackDetails: + """Create an instance of CashbackDetails from a dict""" + if obj is None: + return None + + if not isinstance(obj, dict): + return CashbackDetails.parse_obj(obj) + + _obj = CashbackDetails.parse_obj({ + "cashback_type": obj.get("cashback_type"), + "cashback_value": obj.get("cashback_value"), + "max_cashback_amount": obj.get("max_cashback_amount") + }) + return _obj + + diff --git a/models/create_link_request.py b/models/create_link_request.py new file mode 100644 index 0000000..a12b4be --- /dev/null +++ b/models/create_link_request.py @@ -0,0 +1,106 @@ +# coding: utf-8 + +""" + Cashfree Payment Gateway APIs + + Cashfree's Payment Gateway APIs provide developers with a streamlined pathway to integrate advanced payment processing capabilities into their applications, platforms and websites. + + The version of the OpenAPI document: 2022-09-01 + Contact: developers@cashfree.com + Generated by OpenAPI Generator (https://openapi-generator.tech) + + Do not edit the class manually. +""" # noqa: E501 + + +from __future__ import annotations +import pprint +import re # noqa: F401 +import json + + +from typing import Dict, Optional, Union +from pydantic import BaseModel, Field, StrictBool, StrictFloat, StrictInt, StrictStr, constr +from cashfree_pg.models.link_customer_details_entity import LinkCustomerDetailsEntity +from cashfree_pg.models.link_meta_entity import LinkMetaEntity +from cashfree_pg.models.link_notify_entity import LinkNotifyEntity + +class CreateLinkRequest(BaseModel): + """ + Request paramenters for link creation + """ + link_id: constr(strict=True, max_length=50) = Field(..., description="Unique Identifier (provided by merchant) for the Link. Alphanumeric and only - and _ allowed (50 character limit). Use this for other link-related APIs.") + link_amount: Union[StrictFloat, StrictInt] = Field(..., description="Amount to be collected using this link. Provide upto two decimals for paise.") + link_currency: constr(strict=True) = Field(..., description="Currency for the payment link. Default is INR. Contact care@cashfree.com to enable new currencies.") + link_purpose: constr(strict=True, max_length=500) = Field(..., description="A brief description for which payment must be collected. This is shown to the customer.") + customer_details: LinkCustomerDetailsEntity = Field(...) + link_partial_payments: Optional[StrictBool] = Field(None, description="If \"true\", customer can make partial payments for the link.") + link_minimum_partial_amount: Optional[Union[StrictFloat, StrictInt]] = Field(None, description="Minimum amount in first installment that needs to be paid by the customer if partial payments are enabled. This should be less than the link_amount.") + link_expiry_time: Optional[StrictStr] = Field(None, description="Time after which the link expires. Customers will not be able to make the payment beyond the time specified here. You can provide them in a valid ISO 8601 time format. Default is 30 days.") + link_notify: Optional[LinkNotifyEntity] = None + link_auto_reminders: Optional[StrictBool] = Field(None, description="If \"true\", reminders will be sent to customers for collecting payments.") + link_notes: Optional[Dict[str, StrictStr]] = Field(None, description="Key-value pair that can be used to store additional information about the entity. Maximum 5 key-value pairs") + link_meta: Optional[LinkMetaEntity] = None + __properties = ["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"] + + class Config: + """Pydantic configuration""" + allow_population_by_field_name = True + validate_assignment = True + + def to_str(self) -> str: + """Returns the string representation of the model using alias""" + return pprint.pformat(self.dict(by_alias=True)) + + def to_json(self) -> str: + """Returns the JSON representation of the model using alias""" + return json.dumps(self.to_dict()) + + @classmethod + 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)) + + def to_dict(self): + """Returns the dictionary representation of the model using alias""" + _dict = self.dict(by_alias=True, + exclude={ + }, + exclude_none=True) + # override the default output from pydantic by calling `to_dict()` of customer_details + if self.customer_details: + _dict['customer_details'] = self.customer_details.to_dict() + # override the default output from pydantic by calling `to_dict()` of link_notify + if self.link_notify: + _dict['link_notify'] = self.link_notify.to_dict() + # override the default output from pydantic by calling `to_dict()` of link_meta + if self.link_meta: + _dict['link_meta'] = self.link_meta.to_dict() + return _dict + + @classmethod + def from_dict(cls, obj: dict) -> CreateLinkRequest: + """Create an instance of CreateLinkRequest from a dict""" + if obj is None: + return None + + if not isinstance(obj, dict): + return CreateLinkRequest.parse_obj(obj) + + _obj = CreateLinkRequest.parse_obj({ + "link_id": obj.get("link_id"), + "link_amount": obj.get("link_amount"), + "link_currency": obj.get("link_currency"), + "link_purpose": obj.get("link_purpose"), + "customer_details": LinkCustomerDetailsEntity.from_dict(obj.get("customer_details")) if obj.get("customer_details") is not None else None, + "link_partial_payments": obj.get("link_partial_payments"), + "link_minimum_partial_amount": obj.get("link_minimum_partial_amount"), + "link_expiry_time": obj.get("link_expiry_time"), + "link_notify": LinkNotifyEntity.from_dict(obj.get("link_notify")) if obj.get("link_notify") is not None else None, + "link_auto_reminders": obj.get("link_auto_reminders"), + "link_notes": obj.get("link_notes"), + "link_meta": LinkMetaEntity.from_dict(obj.get("link_meta")) if obj.get("link_meta") is not None else None + }) + return _obj + + diff --git a/models/create_offer_request.py b/models/create_offer_request.py new file mode 100644 index 0000000..4144fb2 --- /dev/null +++ b/models/create_offer_request.py @@ -0,0 +1,94 @@ +# coding: utf-8 + +""" + Cashfree Payment Gateway APIs + + Cashfree's Payment Gateway APIs provide developers with a streamlined pathway to integrate advanced payment processing capabilities into their applications, platforms and websites. + + The version of the OpenAPI document: 2022-09-01 + Contact: developers@cashfree.com + Generated by OpenAPI Generator (https://openapi-generator.tech) + + Do not edit the class manually. +""" # noqa: E501 + + +from __future__ import annotations +import pprint +import re # noqa: F401 +import json + + + +from pydantic import BaseModel, Field +from cashfree_pg.models.offer_details import OfferDetails +from cashfree_pg.models.offer_meta import OfferMeta +from cashfree_pg.models.offer_tnc import OfferTnc +from cashfree_pg.models.offer_validations import OfferValidations + +class CreateOfferRequest(BaseModel): + """ + create offer backend request object + """ + offer_meta: OfferMeta = Field(...) + offer_tnc: OfferTnc = Field(...) + offer_details: OfferDetails = Field(...) + offer_validations: OfferValidations = Field(...) + __properties = ["offer_meta", "offer_tnc", "offer_details", "offer_validations"] + + class Config: + """Pydantic configuration""" + allow_population_by_field_name = True + validate_assignment = True + + def to_str(self) -> str: + """Returns the string representation of the model using alias""" + return pprint.pformat(self.dict(by_alias=True)) + + def to_json(self) -> str: + """Returns the JSON representation of the model using alias""" + return json.dumps(self.to_dict()) + + @classmethod + 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)) + + def to_dict(self): + """Returns the dictionary representation of the model using alias""" + _dict = self.dict(by_alias=True, + exclude={ + }, + exclude_none=True) + # override the default output from pydantic by calling `to_dict()` of offer_meta + if self.offer_meta: + _dict['offer_meta'] = self.offer_meta.to_dict() + # override the default output from pydantic by calling `to_dict()` of offer_tnc + if self.offer_tnc: + _dict['offer_tnc'] = self.offer_tnc.to_dict() + # override the default output from pydantic by calling `to_dict()` of offer_details + if self.offer_details: + _dict['offer_details'] = self.offer_details.to_dict() + # override the default output from pydantic by calling `to_dict()` of offer_validations + if self.offer_validations: + _dict['offer_validations'] = self.offer_validations.to_dict() + return _dict + + @classmethod + def from_dict(cls, obj: dict) -> CreateOfferRequest: + """Create an instance of CreateOfferRequest from a dict""" + if obj is None: + return None + + if not isinstance(obj, dict): + return CreateOfferRequest.parse_obj(obj) + + _obj = CreateOfferRequest.parse_obj({ + "offer_meta": OfferMeta.from_dict(obj.get("offer_meta")) if obj.get("offer_meta") is not None else None, + "offer_tnc": OfferTnc.from_dict(obj.get("offer_tnc")) if obj.get("offer_tnc") is not None else None, + "offer_details": OfferDetails.from_dict(obj.get("offer_details")) if obj.get("offer_details") is not None else None, + "offer_validations": OfferValidations.from_dict(obj.get("offer_validations")) if obj.get("offer_validations") is not None else None + }) + return _obj + + diff --git a/models/create_order_request.py b/models/create_order_request.py new file mode 100644 index 0000000..77513c4 --- /dev/null +++ b/models/create_order_request.py @@ -0,0 +1,140 @@ +# coding: utf-8 + +""" + Cashfree Payment Gateway APIs + + Cashfree's Payment Gateway APIs provide developers with a streamlined pathway to integrate advanced payment processing capabilities into their applications, platforms and websites. + + The version of the OpenAPI document: 2022-09-01 + Contact: developers@cashfree.com + Generated by OpenAPI Generator (https://openapi-generator.tech) + + Do not edit the class manually. +""" # noqa: E501 + + +from __future__ import annotations +import pprint +import re # noqa: F401 +import json + + +from typing import Dict, List, Optional, Union +from pydantic import BaseModel, Field, StrictStr, confloat, conint, conlist, constr +from cashfree_pg.models.create_order_request_order_meta import CreateOrderRequestOrderMeta +from cashfree_pg.models.create_order_request_terminal import CreateOrderRequestTerminal +from cashfree_pg.models.customer_details import CustomerDetails +from cashfree_pg.models.vendor_split import VendorSplit + +class CreateOrderRequest(BaseModel): + """ + Request body to create an order at cashfree + """ + order_id: Optional[constr(strict=True, max_length=45, min_length=3)] = Field(None, description="Order identifier present in your system. Alphanumeric, '_' and '-' only") + order_amount: Union[confloat(ge=1, strict=True), conint(ge=1, strict=True)] = Field(..., description="Bill amount for the order. Provide upto two decimals. 10.15 means Rs 10 and 15 paisa") + order_currency: StrictStr = Field(..., description="Currency for the order. INR if left empty. Contact care@cashfree.com to enable new currencies.") + customer_details: CustomerDetails = Field(...) + terminal: Optional[CreateOrderRequestTerminal] = None + order_meta: Optional[CreateOrderRequestOrderMeta] = None + order_expiry_time: Optional[StrictStr] = Field(None, description="Time after which the order expires. Customers will not be able to make the payment beyond the time specified here. We store timestamps in IST, but you can provide them in a valid ISO 8601 time format. Example 2021-07-02T10:20:12+05:30 for IST, 2021-07-02T10:20:12Z for UTC") + order_note: Optional[constr(strict=True, max_length=200, min_length=3)] = Field(None, description="Order note for reference.") + order_tags: Optional[Dict[str, constr(strict=True, max_length=255, min_length=1)]] = Field(None, description="Custom Tags in thr form of {\"key\":\"value\"} which can be passed for an order. A maximum of 10 tags can be added") + order_splits: Optional[conlist(VendorSplit)] = Field(None, description="If you have Easy split enabled in your Cashfree account then you can use this option to split the order amount.") + __properties = ["order_id", "order_amount", "order_currency", "customer_details", "terminal", "order_meta", "order_expiry_time", "order_note", "order_tags", "order_splits"] + + class Config: + """Pydantic configuration""" + allow_population_by_field_name = True + validate_assignment = True + + def to_str(self) -> str: + """Returns the string representation of the model using alias""" + return pprint.pformat(self.dict(by_alias=True)) + + def to_json(self) -> str: + """Returns the JSON representation of the model using alias""" + return json.dumps(self.to_dict()) + + @classmethod + 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)) + + def to_dict(self): + """Returns the dictionary representation of the model using alias""" + _dict = self.dict(by_alias=True, + exclude={ + }, + exclude_none=True) + # override the default output from pydantic by calling `to_dict()` of customer_details + if self.customer_details: + _dict['customer_details'] = self.customer_details.to_dict() + # override the default output from pydantic by calling `to_dict()` of terminal + if self.terminal: + _dict['terminal'] = self.terminal.to_dict() + # override the default output from pydantic by calling `to_dict()` of order_meta + if self.order_meta: + _dict['order_meta'] = self.order_meta.to_dict() + # override the default output from pydantic by calling `to_dict()` of each item in order_splits (list) + _items = [] + if self.order_splits: + for _item in self.order_splits: + if _item: + _items.append(_item.to_dict()) + _dict['order_splits'] = _items + # set to None if order_id (nullable) is None + # and __fields_set__ contains the field + if self.order_id is None and "order_id" in self.__fields_set__: + _dict['order_id'] = None + + # set to None if terminal (nullable) is None + # and __fields_set__ contains the field + if self.terminal is None and "terminal" in self.__fields_set__: + _dict['terminal'] = None + + # set to None if order_meta (nullable) is None + # and __fields_set__ contains the field + if self.order_meta is None and "order_meta" in self.__fields_set__: + _dict['order_meta'] = None + + # set to None if order_note (nullable) is None + # and __fields_set__ contains the field + if self.order_note is None and "order_note" in self.__fields_set__: + _dict['order_note'] = None + + # set to None if order_tags (nullable) is None + # and __fields_set__ contains the field + if self.order_tags is None and "order_tags" in self.__fields_set__: + _dict['order_tags'] = None + + # set to None if order_splits (nullable) is None + # and __fields_set__ contains the field + if self.order_splits is None and "order_splits" in self.__fields_set__: + _dict['order_splits'] = None + + return _dict + + @classmethod + def from_dict(cls, obj: dict) -> CreateOrderRequest: + """Create an instance of CreateOrderRequest from a dict""" + if obj is None: + return None + + if not isinstance(obj, dict): + return CreateOrderRequest.parse_obj(obj) + + _obj = CreateOrderRequest.parse_obj({ + "order_id": obj.get("order_id"), + "order_amount": obj.get("order_amount"), + "order_currency": obj.get("order_currency"), + "customer_details": CustomerDetails.from_dict(obj.get("customer_details")) if obj.get("customer_details") is not None else None, + "terminal": CreateOrderRequestTerminal.from_dict(obj.get("terminal")) if obj.get("terminal") is not None else None, + "order_meta": CreateOrderRequestOrderMeta.from_dict(obj.get("order_meta")) if obj.get("order_meta") is not None else None, + "order_expiry_time": obj.get("order_expiry_time"), + "order_note": obj.get("order_note"), + "order_tags": obj.get("order_tags"), + "order_splits": [VendorSplit.from_dict(_item) for _item in obj.get("order_splits")] if obj.get("order_splits") is not None else None + }) + return _obj + + diff --git a/models/create_order_request_order_meta.py b/models/create_order_request_order_meta.py new file mode 100644 index 0000000..d749d06 --- /dev/null +++ b/models/create_order_request_order_meta.py @@ -0,0 +1,91 @@ +# coding: utf-8 + +""" + Cashfree Payment Gateway APIs + + Cashfree's Payment Gateway APIs provide developers with a streamlined pathway to integrate advanced payment processing capabilities into their applications, platforms and websites. + + The version of the OpenAPI document: 2022-09-01 + Contact: developers@cashfree.com + Generated by OpenAPI Generator (https://openapi-generator.tech) + + Do not edit the class manually. +""" # noqa: E501 + + +from __future__ import annotations +import pprint +import re # noqa: F401 +import json + + +from typing import Any, Optional +from pydantic import BaseModel, Field, StrictStr + +class CreateOrderRequestOrderMeta(BaseModel): + """ + CreateOrderRequestOrderMeta + """ + return_url: Optional[StrictStr] = Field(None, description="The URL to which user will be redirected to after the payment on bank OTP page. Maximum length: 250. The return_url must contain placeholder {order_id}. When redirecting the customer back to the return url from the bank’s OTP page, Cashfree will replace this placeholder with the actual value for that order.") + notify_url: Optional[StrictStr] = Field(None, description="Notification URL for server-server communication. Useful when user's connection drops while re-directing. NotifyUrl should be an https URL. Maximum length: 250.") + payment_methods: Optional[Any] = Field(None, description="Allowed payment modes for this order. Pass comma-separated values among following options - \"cc\", \"dc\", \"ccc\", \"ppc\",\"nb\",\"upi\",\"paypal\",\"app\",\"paylater\",\"cardlessemi\",\"dcemi\",\"ccemi\",\"banktransfer\". Leave it blank to show all available payment methods") + __properties = ["return_url", "notify_url", "payment_methods"] + + class Config: + """Pydantic configuration""" + allow_population_by_field_name = True + validate_assignment = True + + def to_str(self) -> str: + """Returns the string representation of the model using alias""" + return pprint.pformat(self.dict(by_alias=True)) + + def to_json(self) -> str: + """Returns the JSON representation of the model using alias""" + return json.dumps(self.to_dict()) + + @classmethod + def from_json(cls, json_str: str) -> CreateOrderRequestOrderMeta: + """Create an instance of CreateOrderRequestOrderMeta from a JSON string""" + return cls.from_dict(json.loads(json_str)) + + def to_dict(self): + """Returns the dictionary representation of the model using alias""" + _dict = self.dict(by_alias=True, + exclude={ + }, + exclude_none=True) + # set to None if return_url (nullable) is None + # and __fields_set__ contains the field + if self.return_url is None and "return_url" in self.__fields_set__: + _dict['return_url'] = None + + # set to None if notify_url (nullable) is None + # and __fields_set__ contains the field + if self.notify_url is None and "notify_url" in self.__fields_set__: + _dict['notify_url'] = None + + # set to None if payment_methods (nullable) is None + # and __fields_set__ contains the field + if self.payment_methods is None and "payment_methods" in self.__fields_set__: + _dict['payment_methods'] = None + + return _dict + + @classmethod + def from_dict(cls, obj: dict) -> CreateOrderRequestOrderMeta: + """Create an instance of CreateOrderRequestOrderMeta from a dict""" + if obj is None: + return None + + if not isinstance(obj, dict): + return CreateOrderRequestOrderMeta.parse_obj(obj) + + _obj = CreateOrderRequestOrderMeta.parse_obj({ + "return_url": obj.get("return_url"), + "notify_url": obj.get("notify_url"), + "payment_methods": obj.get("payment_methods") + }) + return _obj + + diff --git a/models/create_order_request_terminal.py b/models/create_order_request_terminal.py new file mode 100644 index 0000000..5b46792 --- /dev/null +++ b/models/create_order_request_terminal.py @@ -0,0 +1,90 @@ +# coding: utf-8 + +""" + Cashfree Payment Gateway APIs + + Cashfree's Payment Gateway APIs provide developers with a streamlined pathway to integrate advanced payment processing capabilities into their applications, platforms and websites. + + The version of the OpenAPI document: 2022-09-01 + Contact: developers@cashfree.com + Generated by OpenAPI Generator (https://openapi-generator.tech) + + Do not edit the class manually. +""" # noqa: E501 + + +from __future__ import annotations +import pprint +import re # noqa: F401 +import json + + +from typing import Optional +from pydantic import BaseModel, Field, StrictInt, StrictStr, constr + +class CreateOrderRequestTerminal(BaseModel): + """ + CreateOrderRequestTerminal + """ + added_on: Optional[StrictStr] = Field(None, description="date time at which terminal is added") + cf_terminal_id: Optional[StrictInt] = Field(None, description="cashfree terminal id") + last_updated_on: Optional[StrictStr] = Field(None, description="last instant when this terminal was updated") + terminal_address: Optional[StrictStr] = Field(None, description="location of terminal") + terminal_id: constr(strict=True, max_length=100, min_length=3) = Field(..., description="terminal id for merchant reference") + terminal_name: Optional[StrictStr] = Field(None, description="name of terminal/agent/storefront") + terminal_note: Optional[StrictStr] = Field(None, description="note given by merchant while creating the terminal") + terminal_phone_no: StrictStr = Field(..., description="mobile num of the terminal/agent/storefront") + terminal_status: Optional[StrictStr] = Field(None, description="status of terminal active/inactive") + terminal_type: constr(strict=True, max_length=10, min_length=4) = Field(..., description="To identify the type of terminal product in use, in this case it is SPOS.") + __properties = ["added_on", "cf_terminal_id", "last_updated_on", "terminal_address", "terminal_id", "terminal_name", "terminal_note", "terminal_phone_no", "terminal_status", "terminal_type"] + + class Config: + """Pydantic configuration""" + allow_population_by_field_name = True + validate_assignment = True + + def to_str(self) -> str: + """Returns the string representation of the model using alias""" + return pprint.pformat(self.dict(by_alias=True)) + + def to_json(self) -> str: + """Returns the JSON representation of the model using alias""" + return json.dumps(self.to_dict()) + + @classmethod + def from_json(cls, json_str: str) -> CreateOrderRequestTerminal: + """Create an instance of CreateOrderRequestTerminal from a JSON string""" + return cls.from_dict(json.loads(json_str)) + + def to_dict(self): + """Returns the dictionary representation of the model using alias""" + _dict = self.dict(by_alias=True, + exclude={ + }, + exclude_none=True) + return _dict + + @classmethod + def from_dict(cls, obj: dict) -> CreateOrderRequestTerminal: + """Create an instance of CreateOrderRequestTerminal from a dict""" + if obj is None: + return None + + if not isinstance(obj, dict): + return CreateOrderRequestTerminal.parse_obj(obj) + + _obj = CreateOrderRequestTerminal.parse_obj({ + "added_on": obj.get("added_on"), + "cf_terminal_id": obj.get("cf_terminal_id"), + "last_updated_on": obj.get("last_updated_on"), + "terminal_address": obj.get("terminal_address"), + "terminal_id": obj.get("terminal_id"), + "terminal_name": obj.get("terminal_name"), + "terminal_note": obj.get("terminal_note"), + "terminal_phone_no": obj.get("terminal_phone_no"), + "terminal_status": obj.get("terminal_status"), + "terminal_type": obj.get("terminal_type") + }) + return _obj + + diff --git a/models/create_terminal_request.py b/models/create_terminal_request.py new file mode 100644 index 0000000..fb6e66c --- /dev/null +++ b/models/create_terminal_request.py @@ -0,0 +1,90 @@ +# coding: utf-8 + +""" + Cashfree Payment Gateway APIs + + Cashfree's Payment Gateway APIs provide developers with a streamlined pathway to integrate advanced payment processing capabilities into their applications, platforms and websites. + + The version of the OpenAPI document: 2022-09-01 + Contact: developers@cashfree.com + Generated by OpenAPI Generator (https://openapi-generator.tech) + + Do not edit the class manually. +""" # noqa: E501 + + +from __future__ import annotations +import pprint +import re # noqa: F401 +import json + + +from typing import Optional +from pydantic import BaseModel, Field, constr +from cashfree_pg.models.create_terminal_request_terminal_meta import CreateTerminalRequestTerminalMeta + +class CreateTerminalRequest(BaseModel): + """ + Request body to create a terminal + """ + terminal_id: constr(strict=True, max_length=100, min_length=3) = Field(..., description="merchant’s internal terminal id") + terminal_phone_no: constr(strict=True, max_length=10, min_length=10) = Field(..., description="phone number assigned to the terminal") + terminal_name: constr(strict=True, max_length=100, min_length=3) = Field(..., description="terminal name to be assigned by merchants") + terminal_address: Optional[constr(strict=True, max_length=100, min_length=1)] = Field(None, description="address of the terminal. required for STOREFRONT") + terminal_email: constr(strict=True, max_length=100, min_length=1) = Field(..., description="terminal email ID of the AGENT/STOREFRONT assigned by merchants.") + terminal_note: Optional[constr(strict=True, max_length=100, min_length=1)] = Field(None, description="additional note for terminal") + terminal_type: constr(strict=True, max_length=100, min_length=1) = Field(..., description="mention the terminal type. possible values - AGENT, STOREFRONT.") + terminal_meta: Optional[CreateTerminalRequestTerminalMeta] = None + __properties = ["terminal_id", "terminal_phone_no", "terminal_name", "terminal_address", "terminal_email", "terminal_note", "terminal_type", "terminal_meta"] + + class Config: + """Pydantic configuration""" + allow_population_by_field_name = True + validate_assignment = True + + def to_str(self) -> str: + """Returns the string representation of the model using alias""" + return pprint.pformat(self.dict(by_alias=True)) + + def to_json(self) -> str: + """Returns the JSON representation of the model using alias""" + return json.dumps(self.to_dict()) + + @classmethod + 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)) + + def to_dict(self): + """Returns the dictionary representation of the model using alias""" + _dict = self.dict(by_alias=True, + exclude={ + }, + exclude_none=True) + # override the default output from pydantic by calling `to_dict()` of terminal_meta + if self.terminal_meta: + _dict['terminal_meta'] = self.terminal_meta.to_dict() + return _dict + + @classmethod + def from_dict(cls, obj: dict) -> CreateTerminalRequest: + """Create an instance of CreateTerminalRequest from a dict""" + if obj is None: + return None + + if not isinstance(obj, dict): + return CreateTerminalRequest.parse_obj(obj) + + _obj = CreateTerminalRequest.parse_obj({ + "terminal_id": obj.get("terminal_id"), + "terminal_phone_no": obj.get("terminal_phone_no"), + "terminal_name": obj.get("terminal_name"), + "terminal_address": obj.get("terminal_address"), + "terminal_email": obj.get("terminal_email"), + "terminal_note": obj.get("terminal_note"), + "terminal_type": obj.get("terminal_type"), + "terminal_meta": CreateTerminalRequestTerminalMeta.from_dict(obj.get("terminal_meta")) if obj.get("terminal_meta") is not None else None + }) + return _obj + + diff --git a/models/create_terminal_request_terminal_meta.py b/models/create_terminal_request_terminal_meta.py new file mode 100644 index 0000000..174348b --- /dev/null +++ b/models/create_terminal_request_terminal_meta.py @@ -0,0 +1,72 @@ +# coding: utf-8 + +""" + Cashfree Payment Gateway APIs + + Cashfree's Payment Gateway APIs provide developers with a streamlined pathway to integrate advanced payment processing capabilities into their applications, platforms and websites. + + The version of the OpenAPI document: 2022-09-01 + Contact: developers@cashfree.com + Generated by OpenAPI Generator (https://openapi-generator.tech) + + Do not edit the class manually. +""" # noqa: E501 + + +from __future__ import annotations +import pprint +import re # noqa: F401 +import json + + +from typing import Optional +from pydantic import BaseModel, Field, StrictStr + +class CreateTerminalRequestTerminalMeta(BaseModel): + """ + terminal metadata. required field for storefront. + """ + terminal_operator: Optional[StrictStr] = Field(None, description="name of the STOREFRONT operator.") + __properties = ["terminal_operator"] + + class Config: + """Pydantic configuration""" + allow_population_by_field_name = True + validate_assignment = True + + def to_str(self) -> str: + """Returns the string representation of the model using alias""" + return pprint.pformat(self.dict(by_alias=True)) + + def to_json(self) -> str: + """Returns the JSON representation of the model using alias""" + return json.dumps(self.to_dict()) + + @classmethod + 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)) + + def to_dict(self): + """Returns the dictionary representation of the model using alias""" + _dict = self.dict(by_alias=True, + exclude={ + }, + exclude_none=True) + return _dict + + @classmethod + def from_dict(cls, obj: dict) -> CreateTerminalRequestTerminalMeta: + """Create an instance of CreateTerminalRequestTerminalMeta from a dict""" + if obj is None: + return None + + if not isinstance(obj, dict): + return CreateTerminalRequestTerminalMeta.parse_obj(obj) + + _obj = CreateTerminalRequestTerminalMeta.parse_obj({ + "terminal_operator": obj.get("terminal_operator") + }) + return _obj + + diff --git a/models/create_terminal_transaction_request.py b/models/create_terminal_transaction_request.py new file mode 100644 index 0000000..58d6681 --- /dev/null +++ b/models/create_terminal_transaction_request.py @@ -0,0 +1,78 @@ +# coding: utf-8 + +""" + Cashfree Payment Gateway APIs + + Cashfree's Payment Gateway APIs provide developers with a streamlined pathway to integrate advanced payment processing capabilities into their applications, platforms and websites. + + The version of the OpenAPI document: 2022-09-01 + Contact: developers@cashfree.com + Generated by OpenAPI Generator (https://openapi-generator.tech) + + Do not edit the class manually. +""" # noqa: E501 + + +from __future__ import annotations +import pprint +import re # noqa: F401 +import json + + +from typing import Optional +from pydantic import BaseModel, Field, StrictInt, constr + +class CreateTerminalTransactionRequest(BaseModel): + """ + Request body to create a terminal transaction + """ + cf_order_id: StrictInt = Field(..., description="cashfree order ID that was returned while creating an order.") + cf_terminal_id: Optional[StrictInt] = Field(None, description="cashfree terminal id. this is a required parameter when you do not provide the terminal phone number.") + payment_method: constr(strict=True, max_length=100, min_length=3) = Field(..., description="mention the payment method used for the transaction. possible values - QR_CODE, LINK.") + terminal_phone_no: Optional[constr(strict=True, max_length=10, min_length=10)] = Field(None, description="agent mobile number assigned to the terminal. this is a required parameter when you do not provide the cf_terminal_id.") + __properties = ["cf_order_id", "cf_terminal_id", "payment_method", "terminal_phone_no"] + + class Config: + """Pydantic configuration""" + allow_population_by_field_name = True + validate_assignment = True + + def to_str(self) -> str: + """Returns the string representation of the model using alias""" + return pprint.pformat(self.dict(by_alias=True)) + + def to_json(self) -> str: + """Returns the JSON representation of the model using alias""" + return json.dumps(self.to_dict()) + + @classmethod + 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)) + + def to_dict(self): + """Returns the dictionary representation of the model using alias""" + _dict = self.dict(by_alias=True, + exclude={ + }, + exclude_none=True) + return _dict + + @classmethod + def from_dict(cls, obj: dict) -> CreateTerminalTransactionRequest: + """Create an instance of CreateTerminalTransactionRequest from a dict""" + if obj is None: + return None + + if not isinstance(obj, dict): + return CreateTerminalTransactionRequest.parse_obj(obj) + + _obj = CreateTerminalTransactionRequest.parse_obj({ + "cf_order_id": obj.get("cf_order_id"), + "cf_terminal_id": obj.get("cf_terminal_id"), + "payment_method": obj.get("payment_method"), + "terminal_phone_no": obj.get("terminal_phone_no") + }) + return _obj + + diff --git a/models/cryptogram_entity.py b/models/cryptogram_entity.py new file mode 100644 index 0000000..62d05ae --- /dev/null +++ b/models/cryptogram_entity.py @@ -0,0 +1,84 @@ +# coding: utf-8 + +""" + Cashfree Payment Gateway APIs + + Cashfree's Payment Gateway APIs provide developers with a streamlined pathway to integrate advanced payment processing capabilities into their applications, platforms and websites. + + The version of the OpenAPI document: 2022-09-01 + Contact: developers@cashfree.com + Generated by OpenAPI Generator (https://openapi-generator.tech) + + Do not edit the class manually. +""" # noqa: E501 + + +from __future__ import annotations +import pprint +import re # noqa: F401 +import json + + +from typing import Optional +from pydantic import BaseModel, Field, StrictStr + +class CryptogramEntity(BaseModel): + """ + Crytogram Card object + """ + instrument_id: Optional[StrictStr] = Field(None, description="instrument_id of saved instrument") + token_requestor_id: Optional[StrictStr] = Field(None, description="TRID issued by card networks") + card_number: Optional[StrictStr] = Field(None, description="token pan number") + card_expiry_mm: Optional[StrictStr] = Field(None, description="token pan expiry month") + card_expiry_yy: Optional[StrictStr] = Field(None, description="token pan expiry year") + cryptogram: Optional[StrictStr] = Field(None, description="cryptogram") + card_display: Optional[StrictStr] = Field(None, description="last 4 digits of original card number") + __properties = ["instrument_id", "token_requestor_id", "card_number", "card_expiry_mm", "card_expiry_yy", "cryptogram", "card_display"] + + class Config: + """Pydantic configuration""" + allow_population_by_field_name = True + validate_assignment = True + + def to_str(self) -> str: + """Returns the string representation of the model using alias""" + return pprint.pformat(self.dict(by_alias=True)) + + def to_json(self) -> str: + """Returns the JSON representation of the model using alias""" + return json.dumps(self.to_dict()) + + @classmethod + 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)) + + def to_dict(self): + """Returns the dictionary representation of the model using alias""" + _dict = self.dict(by_alias=True, + exclude={ + }, + exclude_none=True) + return _dict + + @classmethod + def from_dict(cls, obj: dict) -> CryptogramEntity: + """Create an instance of CryptogramEntity from a dict""" + if obj is None: + return None + + if not isinstance(obj, dict): + return CryptogramEntity.parse_obj(obj) + + _obj = CryptogramEntity.parse_obj({ + "instrument_id": obj.get("instrument_id"), + "token_requestor_id": obj.get("token_requestor_id"), + "card_number": obj.get("card_number"), + "card_expiry_mm": obj.get("card_expiry_mm"), + "card_expiry_yy": obj.get("card_expiry_yy"), + "cryptogram": obj.get("cryptogram"), + "card_display": obj.get("card_display") + }) + return _obj + + diff --git a/models/customer_details.py b/models/customer_details.py new file mode 100644 index 0000000..0d83b10 --- /dev/null +++ b/models/customer_details.py @@ -0,0 +1,109 @@ +# coding: utf-8 + +""" + Cashfree Payment Gateway APIs + + Cashfree's Payment Gateway APIs provide developers with a streamlined pathway to integrate advanced payment processing capabilities into their applications, platforms and websites. + + The version of the OpenAPI document: 2022-09-01 + Contact: developers@cashfree.com + Generated by OpenAPI Generator (https://openapi-generator.tech) + + Do not edit the class manually. +""" # noqa: E501 + + +from __future__ import annotations +import pprint +import re # noqa: F401 +import json + + +from typing import Optional, Union +from pydantic import BaseModel, Field, StrictFloat, StrictInt, StrictStr, constr + +class CustomerDetails(BaseModel): + """ + The customer details that are necessary. Note that you can pass dummy details if your use case does not require the customer details. + """ + customer_id: constr(strict=True, max_length=50, min_length=3) = Field(..., description="A unique identifier for the customer. Use alphanumeric values only.") + customer_email: Optional[constr(strict=True, max_length=100, min_length=3)] = Field(None, description="Customer email address.") + customer_phone: constr(strict=True, max_length=10, min_length=10) = Field(..., description="Customer phone number.") + customer_name: Optional[constr(strict=True, max_length=100, min_length=3)] = Field(None, description="Name of the customer.") + customer_bank_account_number: Optional[constr(strict=True, max_length=20, min_length=3)] = Field(None, description="Customer bank account. Required if you want to do a bank account check (TPV)") + customer_bank_ifsc: Optional[StrictStr] = Field(None, description="Customer bank IFSC. Required if you want to do a bank account check (TPV)") + customer_bank_code: Optional[Union[StrictFloat, StrictInt]] = Field(None, description="Customer bank code. Required for net banking payments, if you want to do a bank account check (TPV)") + __properties = ["customer_id", "customer_email", "customer_phone", "customer_name", "customer_bank_account_number", "customer_bank_ifsc", "customer_bank_code"] + + class Config: + """Pydantic configuration""" + allow_population_by_field_name = True + validate_assignment = True + + def to_str(self) -> str: + """Returns the string representation of the model using alias""" + return pprint.pformat(self.dict(by_alias=True)) + + def to_json(self) -> str: + """Returns the JSON representation of the model using alias""" + return json.dumps(self.to_dict()) + + @classmethod + 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)) + + def to_dict(self): + """Returns the dictionary representation of the model using alias""" + _dict = self.dict(by_alias=True, + exclude={ + }, + exclude_none=True) + # set to None if customer_email (nullable) is None + # and __fields_set__ contains the field + if self.customer_email is None and "customer_email" in self.__fields_set__: + _dict['customer_email'] = None + + # set to None if customer_name (nullable) is None + # and __fields_set__ contains the field + if self.customer_name is None and "customer_name" in self.__fields_set__: + _dict['customer_name'] = None + + # set to None if customer_bank_account_number (nullable) is None + # and __fields_set__ contains the field + if self.customer_bank_account_number is None and "customer_bank_account_number" in self.__fields_set__: + _dict['customer_bank_account_number'] = None + + # set to None if customer_bank_ifsc (nullable) is None + # and __fields_set__ contains the field + if self.customer_bank_ifsc is None and "customer_bank_ifsc" in self.__fields_set__: + _dict['customer_bank_ifsc'] = None + + # set to None if customer_bank_code (nullable) is None + # and __fields_set__ contains the field + if self.customer_bank_code is None and "customer_bank_code" in self.__fields_set__: + _dict['customer_bank_code'] = None + + return _dict + + @classmethod + def from_dict(cls, obj: dict) -> CustomerDetails: + """Create an instance of CustomerDetails from a dict""" + if obj is None: + return None + + if not isinstance(obj, dict): + return CustomerDetails.parse_obj(obj) + + _obj = CustomerDetails.parse_obj({ + "customer_id": obj.get("customer_id"), + "customer_email": obj.get("customer_email"), + "customer_phone": obj.get("customer_phone"), + "customer_name": obj.get("customer_name"), + "customer_bank_account_number": obj.get("customer_bank_account_number"), + "customer_bank_ifsc": obj.get("customer_bank_ifsc"), + "customer_bank_code": obj.get("customer_bank_code") + }) + return _obj + + diff --git a/models/customer_details_cardless_emi.py b/models/customer_details_cardless_emi.py new file mode 100644 index 0000000..6e26378 --- /dev/null +++ b/models/customer_details_cardless_emi.py @@ -0,0 +1,72 @@ +# coding: utf-8 + +""" + Cashfree Payment Gateway APIs + + Cashfree's Payment Gateway APIs provide developers with a streamlined pathway to integrate advanced payment processing capabilities into their applications, platforms and websites. + + The version of the OpenAPI document: 2022-09-01 + Contact: developers@cashfree.com + Generated by OpenAPI Generator (https://openapi-generator.tech) + + Do not edit the class manually. +""" # noqa: E501 + + +from __future__ import annotations +import pprint +import re # noqa: F401 +import json + + + +from pydantic import BaseModel, Field, constr + +class CustomerDetailsCardlessEMI(BaseModel): + """ + Details of the customer for whom eligibility is being checked. + """ + customer_phone: constr(strict=True, max_length=50, min_length=3) = Field(..., description="Phone Number of the customer") + __properties = ["customer_phone"] + + class Config: + """Pydantic configuration""" + allow_population_by_field_name = True + validate_assignment = True + + def to_str(self) -> str: + """Returns the string representation of the model using alias""" + return pprint.pformat(self.dict(by_alias=True)) + + def to_json(self) -> str: + """Returns the JSON representation of the model using alias""" + return json.dumps(self.to_dict()) + + @classmethod + 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)) + + def to_dict(self): + """Returns the dictionary representation of the model using alias""" + _dict = self.dict(by_alias=True, + exclude={ + }, + exclude_none=True) + return _dict + + @classmethod + def from_dict(cls, obj: dict) -> CustomerDetailsCardlessEMI: + """Create an instance of CustomerDetailsCardlessEMI from a dict""" + if obj is None: + return None + + if not isinstance(obj, dict): + return CustomerDetailsCardlessEMI.parse_obj(obj) + + _obj = CustomerDetailsCardlessEMI.parse_obj({ + "customer_phone": obj.get("customer_phone") + }) + return _obj + + diff --git a/models/discount_details.py b/models/discount_details.py new file mode 100644 index 0000000..6d3ad63 --- /dev/null +++ b/models/discount_details.py @@ -0,0 +1,83 @@ +# coding: utf-8 + +""" + Cashfree Payment Gateway APIs + + Cashfree's Payment Gateway APIs provide developers with a streamlined pathway to integrate advanced payment processing capabilities into their applications, platforms and websites. + + The version of the OpenAPI document: 2022-09-01 + Contact: developers@cashfree.com + Generated by OpenAPI Generator (https://openapi-generator.tech) + + Do not edit the class manually. +""" # noqa: E501 + + +from __future__ import annotations +import pprint +import re # noqa: F401 +import json + + + +from pydantic import BaseModel, Field, constr, validator + +class DiscountDetails(BaseModel): + """ + detils of the discount object of offer + """ + discount_type: constr(strict=True, max_length=50, min_length=3) = Field(..., description="Type of discount") + discount_value: constr(strict=True, max_length=100, min_length=1) = Field(..., description="Value of Discount.") + max_discount_amount: constr(strict=True, max_length=100, min_length=1) = Field(..., description="Maximum Value of Discount allowed.") + __properties = ["discount_type", "discount_value", "max_discount_amount"] + + @validator('discount_type') + def discount_type_validate_enum(cls, value): + """Validates the enum""" + if value not in ('flat', 'percentage'): + raise ValueError("must be one of enum values ('flat', 'percentage')") + return value + + class Config: + """Pydantic configuration""" + allow_population_by_field_name = True + validate_assignment = True + + def to_str(self) -> str: + """Returns the string representation of the model using alias""" + return pprint.pformat(self.dict(by_alias=True)) + + def to_json(self) -> str: + """Returns the JSON representation of the model using alias""" + return json.dumps(self.to_dict()) + + @classmethod + 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)) + + def to_dict(self): + """Returns the dictionary representation of the model using alias""" + _dict = self.dict(by_alias=True, + exclude={ + }, + exclude_none=True) + return _dict + + @classmethod + def from_dict(cls, obj: dict) -> DiscountDetails: + """Create an instance of DiscountDetails from a dict""" + if obj is None: + return None + + if not isinstance(obj, dict): + return DiscountDetails.parse_obj(obj) + + _obj = DiscountDetails.parse_obj({ + "discount_type": obj.get("discount_type"), + "discount_value": obj.get("discount_value"), + "max_discount_amount": obj.get("max_discount_amount") + }) + return _obj + + diff --git a/models/eligibility_cardless_emi_entity.py b/models/eligibility_cardless_emi_entity.py new file mode 100644 index 0000000..498511a --- /dev/null +++ b/models/eligibility_cardless_emi_entity.py @@ -0,0 +1,82 @@ +# coding: utf-8 + +""" + Cashfree Payment Gateway APIs + + Cashfree's Payment Gateway APIs provide developers with a streamlined pathway to integrate advanced payment processing capabilities into their applications, platforms and websites. + + The version of the OpenAPI document: 2022-09-01 + Contact: developers@cashfree.com + Generated by OpenAPI Generator (https://openapi-generator.tech) + + Do not edit the class manually. +""" # noqa: E501 + + +from __future__ import annotations +import pprint +import re # noqa: F401 +import json + + +from typing import Optional +from pydantic import BaseModel, StrictBool, StrictStr +from cashfree_pg.models.cardless_emi_entity import CardlessEMIEntity + +class EligibilityCardlessEMIEntity(BaseModel): + """ + Carless EMI eligible entity + """ + eligibility: Optional[StrictBool] = None + entity_type: Optional[StrictStr] = None + entity_value: Optional[StrictStr] = None + entity_details: Optional[CardlessEMIEntity] = None + __properties = ["eligibility", "entity_type", "entity_value", "entity_details"] + + class Config: + """Pydantic configuration""" + allow_population_by_field_name = True + validate_assignment = True + + def to_str(self) -> str: + """Returns the string representation of the model using alias""" + return pprint.pformat(self.dict(by_alias=True)) + + def to_json(self) -> str: + """Returns the JSON representation of the model using alias""" + return json.dumps(self.to_dict()) + + @classmethod + 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)) + + def to_dict(self): + """Returns the dictionary representation of the model using alias""" + _dict = self.dict(by_alias=True, + exclude={ + }, + exclude_none=True) + # override the default output from pydantic by calling `to_dict()` of entity_details + if self.entity_details: + _dict['entity_details'] = self.entity_details.to_dict() + return _dict + + @classmethod + def from_dict(cls, obj: dict) -> EligibilityCardlessEMIEntity: + """Create an instance of EligibilityCardlessEMIEntity from a dict""" + if obj is None: + return None + + if not isinstance(obj, dict): + return EligibilityCardlessEMIEntity.parse_obj(obj) + + _obj = EligibilityCardlessEMIEntity.parse_obj({ + "eligibility": obj.get("eligibility"), + "entity_type": obj.get("entity_type"), + "entity_value": obj.get("entity_value"), + "entity_details": CardlessEMIEntity.from_dict(obj.get("entity_details")) if obj.get("entity_details") is not None else None + }) + return _obj + + diff --git a/models/eligibility_fetch_cardless_emi_request.py b/models/eligibility_fetch_cardless_emi_request.py new file mode 100644 index 0000000..dd43110 --- /dev/null +++ b/models/eligibility_fetch_cardless_emi_request.py @@ -0,0 +1,76 @@ +# coding: utf-8 + +""" + Cashfree Payment Gateway APIs + + Cashfree's Payment Gateway APIs provide developers with a streamlined pathway to integrate advanced payment processing capabilities into their applications, platforms and websites. + + The version of the OpenAPI document: 2022-09-01 + Contact: developers@cashfree.com + Generated by OpenAPI Generator (https://openapi-generator.tech) + + Do not edit the class manually. +""" # noqa: E501 + + +from __future__ import annotations +import pprint +import re # noqa: F401 +import json + + + +from pydantic import BaseModel, Field +from cashfree_pg.models.cardless_emi_queries import CardlessEMIQueries + +class EligibilityFetchCardlessEMIRequest(BaseModel): + """ + eligibilty request for cardless + """ + queries: CardlessEMIQueries = Field(...) + __properties = ["queries"] + + class Config: + """Pydantic configuration""" + allow_population_by_field_name = True + validate_assignment = True + + def to_str(self) -> str: + """Returns the string representation of the model using alias""" + return pprint.pformat(self.dict(by_alias=True)) + + def to_json(self) -> str: + """Returns the JSON representation of the model using alias""" + return json.dumps(self.to_dict()) + + @classmethod + 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)) + + def to_dict(self): + """Returns the dictionary representation of the model using alias""" + _dict = self.dict(by_alias=True, + exclude={ + }, + exclude_none=True) + # override the default output from pydantic by calling `to_dict()` of queries + if self.queries: + _dict['queries'] = self.queries.to_dict() + return _dict + + @classmethod + def from_dict(cls, obj: dict) -> EligibilityFetchCardlessEMIRequest: + """Create an instance of EligibilityFetchCardlessEMIRequest from a dict""" + if obj is None: + return None + + if not isinstance(obj, dict): + return EligibilityFetchCardlessEMIRequest.parse_obj(obj) + + _obj = EligibilityFetchCardlessEMIRequest.parse_obj({ + "queries": CardlessEMIQueries.from_dict(obj.get("queries")) if obj.get("queries") is not None else None + }) + return _obj + + diff --git a/models/eligibility_fetch_offers_request.py b/models/eligibility_fetch_offers_request.py new file mode 100644 index 0000000..9718c93 --- /dev/null +++ b/models/eligibility_fetch_offers_request.py @@ -0,0 +1,82 @@ +# coding: utf-8 + +""" + Cashfree Payment Gateway APIs + + Cashfree's Payment Gateway APIs provide developers with a streamlined pathway to integrate advanced payment processing capabilities into their applications, platforms and websites. + + The version of the OpenAPI document: 2022-09-01 + Contact: developers@cashfree.com + Generated by OpenAPI Generator (https://openapi-generator.tech) + + Do not edit the class manually. +""" # noqa: E501 + + +from __future__ import annotations +import pprint +import re # noqa: F401 +import json + + +from typing import Optional +from pydantic import BaseModel, Field +from cashfree_pg.models.offer_filters import OfferFilters +from cashfree_pg.models.offer_queries import OfferQueries + +class EligibilityFetchOffersRequest(BaseModel): + """ + Eligiblty API request + """ + queries: OfferQueries = Field(...) + filters: Optional[OfferFilters] = None + __properties = ["queries", "filters"] + + class Config: + """Pydantic configuration""" + allow_population_by_field_name = True + validate_assignment = True + + def to_str(self) -> str: + """Returns the string representation of the model using alias""" + return pprint.pformat(self.dict(by_alias=True)) + + def to_json(self) -> str: + """Returns the JSON representation of the model using alias""" + return json.dumps(self.to_dict()) + + @classmethod + 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)) + + def to_dict(self): + """Returns the dictionary representation of the model using alias""" + _dict = self.dict(by_alias=True, + exclude={ + }, + exclude_none=True) + # override the default output from pydantic by calling `to_dict()` of queries + if self.queries: + _dict['queries'] = self.queries.to_dict() + # override the default output from pydantic by calling `to_dict()` of filters + if self.filters: + _dict['filters'] = self.filters.to_dict() + return _dict + + @classmethod + def from_dict(cls, obj: dict) -> EligibilityFetchOffersRequest: + """Create an instance of EligibilityFetchOffersRequest from a dict""" + if obj is None: + return None + + if not isinstance(obj, dict): + return EligibilityFetchOffersRequest.parse_obj(obj) + + _obj = EligibilityFetchOffersRequest.parse_obj({ + "queries": OfferQueries.from_dict(obj.get("queries")) if obj.get("queries") is not None else None, + "filters": OfferFilters.from_dict(obj.get("filters")) if obj.get("filters") is not None else None + }) + return _obj + + diff --git a/models/eligibility_fetch_paylater_request.py b/models/eligibility_fetch_paylater_request.py new file mode 100644 index 0000000..f035663 --- /dev/null +++ b/models/eligibility_fetch_paylater_request.py @@ -0,0 +1,76 @@ +# coding: utf-8 + +""" + Cashfree Payment Gateway APIs + + Cashfree's Payment Gateway APIs provide developers with a streamlined pathway to integrate advanced payment processing capabilities into their applications, platforms and websites. + + The version of the OpenAPI document: 2022-09-01 + Contact: developers@cashfree.com + Generated by OpenAPI Generator (https://openapi-generator.tech) + + Do not edit the class manually. +""" # noqa: E501 + + +from __future__ import annotations +import pprint +import re # noqa: F401 +import json + + + +from pydantic import BaseModel, Field +from cashfree_pg.models.cardless_emi_queries import CardlessEMIQueries + +class EligibilityFetchPaylaterRequest(BaseModel): + """ + Request to get eligible paylater payment methods + """ + queries: CardlessEMIQueries = Field(...) + __properties = ["queries"] + + class Config: + """Pydantic configuration""" + allow_population_by_field_name = True + validate_assignment = True + + def to_str(self) -> str: + """Returns the string representation of the model using alias""" + return pprint.pformat(self.dict(by_alias=True)) + + def to_json(self) -> str: + """Returns the JSON representation of the model using alias""" + return json.dumps(self.to_dict()) + + @classmethod + 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)) + + def to_dict(self): + """Returns the dictionary representation of the model using alias""" + _dict = self.dict(by_alias=True, + exclude={ + }, + exclude_none=True) + # override the default output from pydantic by calling `to_dict()` of queries + if self.queries: + _dict['queries'] = self.queries.to_dict() + return _dict + + @classmethod + def from_dict(cls, obj: dict) -> EligibilityFetchPaylaterRequest: + """Create an instance of EligibilityFetchPaylaterRequest from a dict""" + if obj is None: + return None + + if not isinstance(obj, dict): + return EligibilityFetchPaylaterRequest.parse_obj(obj) + + _obj = EligibilityFetchPaylaterRequest.parse_obj({ + "queries": CardlessEMIQueries.from_dict(obj.get("queries")) if obj.get("queries") is not None else None + }) + return _obj + + diff --git a/models/eligibility_fetch_payment_methods_request.py b/models/eligibility_fetch_payment_methods_request.py new file mode 100644 index 0000000..ad564ab --- /dev/null +++ b/models/eligibility_fetch_payment_methods_request.py @@ -0,0 +1,82 @@ +# coding: utf-8 + +""" + Cashfree Payment Gateway APIs + + Cashfree's Payment Gateway APIs provide developers with a streamlined pathway to integrate advanced payment processing capabilities into their applications, platforms and websites. + + The version of the OpenAPI document: 2022-09-01 + Contact: developers@cashfree.com + Generated by OpenAPI Generator (https://openapi-generator.tech) + + Do not edit the class manually. +""" # noqa: E501 + + +from __future__ import annotations +import pprint +import re # noqa: F401 +import json + + +from typing import Optional +from pydantic import BaseModel, Field +from cashfree_pg.models.payment_methods_filters import PaymentMethodsFilters +from cashfree_pg.models.payment_methods_queries import PaymentMethodsQueries + +class EligibilityFetchPaymentMethodsRequest(BaseModel): + """ + eligibilty request to find eligible payment method + """ + queries: PaymentMethodsQueries = Field(...) + filters: Optional[PaymentMethodsFilters] = None + __properties = ["queries", "filters"] + + class Config: + """Pydantic configuration""" + allow_population_by_field_name = True + validate_assignment = True + + def to_str(self) -> str: + """Returns the string representation of the model using alias""" + return pprint.pformat(self.dict(by_alias=True)) + + def to_json(self) -> str: + """Returns the JSON representation of the model using alias""" + return json.dumps(self.to_dict()) + + @classmethod + 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)) + + def to_dict(self): + """Returns the dictionary representation of the model using alias""" + _dict = self.dict(by_alias=True, + exclude={ + }, + exclude_none=True) + # override the default output from pydantic by calling `to_dict()` of queries + if self.queries: + _dict['queries'] = self.queries.to_dict() + # override the default output from pydantic by calling `to_dict()` of filters + if self.filters: + _dict['filters'] = self.filters.to_dict() + return _dict + + @classmethod + def from_dict(cls, obj: dict) -> EligibilityFetchPaymentMethodsRequest: + """Create an instance of EligibilityFetchPaymentMethodsRequest from a dict""" + if obj is None: + return None + + if not isinstance(obj, dict): + return EligibilityFetchPaymentMethodsRequest.parse_obj(obj) + + _obj = EligibilityFetchPaymentMethodsRequest.parse_obj({ + "queries": PaymentMethodsQueries.from_dict(obj.get("queries")) if obj.get("queries") is not None else None, + "filters": PaymentMethodsFilters.from_dict(obj.get("filters")) if obj.get("filters") is not None else None + }) + return _obj + + diff --git a/models/eligibility_offer_entity.py b/models/eligibility_offer_entity.py new file mode 100644 index 0000000..3bdab9e --- /dev/null +++ b/models/eligibility_offer_entity.py @@ -0,0 +1,82 @@ +# coding: utf-8 + +""" + Cashfree Payment Gateway APIs + + Cashfree's Payment Gateway APIs provide developers with a streamlined pathway to integrate advanced payment processing capabilities into their applications, platforms and websites. + + The version of the OpenAPI document: 2022-09-01 + Contact: developers@cashfree.com + Generated by OpenAPI Generator (https://openapi-generator.tech) + + Do not edit the class manually. +""" # noqa: E501 + + +from __future__ import annotations +import pprint +import re # noqa: F401 +import json + + +from typing import Optional +from pydantic import BaseModel, StrictBool, StrictStr +from cashfree_pg.models.offer_entity import OfferEntity + +class EligibilityOfferEntity(BaseModel): + """ + Eligible offer object + """ + eligibility: Optional[StrictBool] = None + entity_type: Optional[StrictStr] = None + entity_value: Optional[StrictStr] = None + entity_details: Optional[OfferEntity] = None + __properties = ["eligibility", "entity_type", "entity_value", "entity_details"] + + class Config: + """Pydantic configuration""" + allow_population_by_field_name = True + validate_assignment = True + + def to_str(self) -> str: + """Returns the string representation of the model using alias""" + return pprint.pformat(self.dict(by_alias=True)) + + def to_json(self) -> str: + """Returns the JSON representation of the model using alias""" + return json.dumps(self.to_dict()) + + @classmethod + 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)) + + def to_dict(self): + """Returns the dictionary representation of the model using alias""" + _dict = self.dict(by_alias=True, + exclude={ + }, + exclude_none=True) + # override the default output from pydantic by calling `to_dict()` of entity_details + if self.entity_details: + _dict['entity_details'] = self.entity_details.to_dict() + return _dict + + @classmethod + def from_dict(cls, obj: dict) -> EligibilityOfferEntity: + """Create an instance of EligibilityOfferEntity from a dict""" + if obj is None: + return None + + if not isinstance(obj, dict): + return EligibilityOfferEntity.parse_obj(obj) + + _obj = EligibilityOfferEntity.parse_obj({ + "eligibility": obj.get("eligibility"), + "entity_type": obj.get("entity_type"), + "entity_value": obj.get("entity_value"), + "entity_details": OfferEntity.from_dict(obj.get("entity_details")) if obj.get("entity_details") is not None else None + }) + return _obj + + diff --git a/models/eligibility_paylater_entity.py b/models/eligibility_paylater_entity.py new file mode 100644 index 0000000..c95d6d7 --- /dev/null +++ b/models/eligibility_paylater_entity.py @@ -0,0 +1,82 @@ +# coding: utf-8 + +""" + Cashfree Payment Gateway APIs + + Cashfree's Payment Gateway APIs provide developers with a streamlined pathway to integrate advanced payment processing capabilities into their applications, platforms and websites. + + The version of the OpenAPI document: 2022-09-01 + Contact: developers@cashfree.com + Generated by OpenAPI Generator (https://openapi-generator.tech) + + Do not edit the class manually. +""" # noqa: E501 + + +from __future__ import annotations +import pprint +import re # noqa: F401 +import json + + +from typing import Optional +from pydantic import BaseModel, StrictBool, StrictStr +from cashfree_pg.models.paylater_entity import PaylaterEntity + +class EligibilityPaylaterEntity(BaseModel): + """ + Eligible paylater payment method + """ + eligibility: Optional[StrictBool] = None + entity_type: Optional[StrictStr] = None + entity_value: Optional[StrictStr] = None + entity_details: Optional[PaylaterEntity] = None + __properties = ["eligibility", "entity_type", "entity_value", "entity_details"] + + class Config: + """Pydantic configuration""" + allow_population_by_field_name = True + validate_assignment = True + + def to_str(self) -> str: + """Returns the string representation of the model using alias""" + return pprint.pformat(self.dict(by_alias=True)) + + def to_json(self) -> str: + """Returns the JSON representation of the model using alias""" + return json.dumps(self.to_dict()) + + @classmethod + 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)) + + def to_dict(self): + """Returns the dictionary representation of the model using alias""" + _dict = self.dict(by_alias=True, + exclude={ + }, + exclude_none=True) + # override the default output from pydantic by calling `to_dict()` of entity_details + if self.entity_details: + _dict['entity_details'] = self.entity_details.to_dict() + return _dict + + @classmethod + def from_dict(cls, obj: dict) -> EligibilityPaylaterEntity: + """Create an instance of EligibilityPaylaterEntity from a dict""" + if obj is None: + return None + + if not isinstance(obj, dict): + return EligibilityPaylaterEntity.parse_obj(obj) + + _obj = EligibilityPaylaterEntity.parse_obj({ + "eligibility": obj.get("eligibility"), + "entity_type": obj.get("entity_type"), + "entity_value": obj.get("entity_value"), + "entity_details": PaylaterEntity.from_dict(obj.get("entity_details")) if obj.get("entity_details") is not None else None + }) + return _obj + + diff --git a/models/eligibility_payment_methods_entity.py b/models/eligibility_payment_methods_entity.py new file mode 100644 index 0000000..5faaff0 --- /dev/null +++ b/models/eligibility_payment_methods_entity.py @@ -0,0 +1,82 @@ +# coding: utf-8 + +""" + Cashfree Payment Gateway APIs + + Cashfree's Payment Gateway APIs provide developers with a streamlined pathway to integrate advanced payment processing capabilities into their applications, platforms and websites. + + The version of the OpenAPI document: 2022-09-01 + Contact: developers@cashfree.com + Generated by OpenAPI Generator (https://openapi-generator.tech) + + Do not edit the class manually. +""" # noqa: E501 + + +from __future__ import annotations +import pprint +import re # noqa: F401 +import json + + +from typing import Optional +from pydantic import BaseModel, StrictBool, StrictStr +from cashfree_pg.models.eligibility_payment_methods_entity_entity_details import EligibilityPaymentMethodsEntityEntityDetails + +class EligibilityPaymentMethodsEntity(BaseModel): + """ + Eligible payment methods details + """ + eligibility: Optional[StrictBool] = None + entity_type: Optional[StrictStr] = None + entity_value: Optional[StrictStr] = None + entity_details: Optional[EligibilityPaymentMethodsEntityEntityDetails] = None + __properties = ["eligibility", "entity_type", "entity_value", "entity_details"] + + class Config: + """Pydantic configuration""" + allow_population_by_field_name = True + validate_assignment = True + + def to_str(self) -> str: + """Returns the string representation of the model using alias""" + return pprint.pformat(self.dict(by_alias=True)) + + def to_json(self) -> str: + """Returns the JSON representation of the model using alias""" + return json.dumps(self.to_dict()) + + @classmethod + 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)) + + def to_dict(self): + """Returns the dictionary representation of the model using alias""" + _dict = self.dict(by_alias=True, + exclude={ + }, + exclude_none=True) + # override the default output from pydantic by calling `to_dict()` of entity_details + if self.entity_details: + _dict['entity_details'] = self.entity_details.to_dict() + return _dict + + @classmethod + def from_dict(cls, obj: dict) -> EligibilityPaymentMethodsEntity: + """Create an instance of EligibilityPaymentMethodsEntity from a dict""" + if obj is None: + return None + + if not isinstance(obj, dict): + return EligibilityPaymentMethodsEntity.parse_obj(obj) + + _obj = EligibilityPaymentMethodsEntity.parse_obj({ + "eligibility": obj.get("eligibility"), + "entity_type": obj.get("entity_type"), + "entity_value": obj.get("entity_value"), + "entity_details": EligibilityPaymentMethodsEntityEntityDetails.from_dict(obj.get("entity_details")) if obj.get("entity_details") is not None else None + }) + return _obj + + diff --git a/models/eligibility_payment_methods_entity_entity_details.py b/models/eligibility_payment_methods_entity_entity_details.py new file mode 100644 index 0000000..6aeae8e --- /dev/null +++ b/models/eligibility_payment_methods_entity_entity_details.py @@ -0,0 +1,80 @@ +# coding: utf-8 + +""" + Cashfree Payment Gateway APIs + + Cashfree's Payment Gateway APIs provide developers with a streamlined pathway to integrate advanced payment processing capabilities into their applications, platforms and websites. + + The version of the OpenAPI document: 2022-09-01 + Contact: developers@cashfree.com + Generated by OpenAPI Generator (https://openapi-generator.tech) + + Do not edit the class manually. +""" # noqa: E501 + + +from __future__ import annotations +import pprint +import re # noqa: F401 +import json + + +from typing import List, Optional +from pydantic import BaseModel, conlist +from cashfree_pg.models.payment_mode_details import PaymentModeDetails + +class EligibilityPaymentMethodsEntityEntityDetails(BaseModel): + """ + EligibilityPaymentMethodsEntityEntityDetails + """ + payment_method_details: Optional[conlist(PaymentModeDetails)] = None + __properties = ["payment_method_details"] + + class Config: + """Pydantic configuration""" + allow_population_by_field_name = True + validate_assignment = True + + def to_str(self) -> str: + """Returns the string representation of the model using alias""" + return pprint.pformat(self.dict(by_alias=True)) + + def to_json(self) -> str: + """Returns the JSON representation of the model using alias""" + return json.dumps(self.to_dict()) + + @classmethod + 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)) + + def to_dict(self): + """Returns the dictionary representation of the model using alias""" + _dict = self.dict(by_alias=True, + exclude={ + }, + exclude_none=True) + # override the default output from pydantic by calling `to_dict()` of each item in payment_method_details (list) + _items = [] + if self.payment_method_details: + for _item in self.payment_method_details: + if _item: + _items.append(_item.to_dict()) + _dict['payment_method_details'] = _items + return _dict + + @classmethod + def from_dict(cls, obj: dict) -> EligibilityPaymentMethodsEntityEntityDetails: + """Create an instance of EligibilityPaymentMethodsEntityEntityDetails from a dict""" + if obj is None: + return None + + if not isinstance(obj, dict): + return EligibilityPaymentMethodsEntityEntityDetails.parse_obj(obj) + + _obj = EligibilityPaymentMethodsEntityEntityDetails.parse_obj({ + "payment_method_details": [PaymentModeDetails.from_dict(_item) for _item in obj.get("payment_method_details")] if obj.get("payment_method_details") is not None else None + }) + return _obj + + diff --git a/models/emi_offer.py b/models/emi_offer.py new file mode 100644 index 0000000..32d2b50 --- /dev/null +++ b/models/emi_offer.py @@ -0,0 +1,76 @@ +# coding: utf-8 + +""" + Cashfree Payment Gateway APIs + + Cashfree's Payment Gateway APIs provide developers with a streamlined pathway to integrate advanced payment processing capabilities into their applications, platforms and websites. + + The version of the OpenAPI document: 2022-09-01 + Contact: developers@cashfree.com + Generated by OpenAPI Generator (https://openapi-generator.tech) + + Do not edit the class manually. +""" # noqa: E501 + + +from __future__ import annotations +import pprint +import re # noqa: F401 +import json + + +from typing import List +from pydantic import BaseModel, Field, StrictInt, conlist, constr + +class EMIOffer(BaseModel): + """ + EMIOffer + """ + type: constr(strict=True, max_length=100, min_length=3) = Field(..., description="Type of emi offer. Possible values are `credit_card_emi`, `debit_card_emi`, `cardless_emi`") + issuer: constr(strict=True, max_length=100, min_length=3) = Field(..., description="Bank Name") + tenures: conlist(StrictInt) = Field(...) + __properties = ["type", "issuer", "tenures"] + + class Config: + """Pydantic configuration""" + allow_population_by_field_name = True + validate_assignment = True + + def to_str(self) -> str: + """Returns the string representation of the model using alias""" + return pprint.pformat(self.dict(by_alias=True)) + + def to_json(self) -> str: + """Returns the JSON representation of the model using alias""" + return json.dumps(self.to_dict()) + + @classmethod + 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)) + + def to_dict(self): + """Returns the dictionary representation of the model using alias""" + _dict = self.dict(by_alias=True, + exclude={ + }, + exclude_none=True) + return _dict + + @classmethod + def from_dict(cls, obj: dict) -> EMIOffer: + """Create an instance of EMIOffer from a dict""" + if obj is None: + return None + + if not isinstance(obj, dict): + return EMIOffer.parse_obj(obj) + + _obj = EMIOffer.parse_obj({ + "type": obj.get("type"), + "issuer": obj.get("issuer"), + "tenures": obj.get("tenures") + }) + return _obj + + diff --git a/models/emi_plans_array.py b/models/emi_plans_array.py new file mode 100644 index 0000000..fbaff18 --- /dev/null +++ b/models/emi_plans_array.py @@ -0,0 +1,82 @@ +# coding: utf-8 + +""" + Cashfree Payment Gateway APIs + + Cashfree's Payment Gateway APIs provide developers with a streamlined pathway to integrate advanced payment processing capabilities into their applications, platforms and websites. + + The version of the OpenAPI document: 2022-09-01 + Contact: developers@cashfree.com + Generated by OpenAPI Generator (https://openapi-generator.tech) + + Do not edit the class manually. +""" # noqa: E501 + + +from __future__ import annotations +import pprint +import re # noqa: F401 +import json + + +from typing import Optional, Union +from pydantic import BaseModel, StrictFloat, StrictInt, constr + +class EMIPlansArray(BaseModel): + """ + Single EMI object + """ + tenure: Optional[StrictInt] = None + interest_rate: Optional[Union[StrictFloat, StrictInt]] = None + currency: Optional[constr(strict=True, max_length=50, min_length=3)] = None + emi: Optional[StrictInt] = None + total_interest: Optional[StrictInt] = None + total_amount: Optional[StrictInt] = None + __properties = ["tenure", "interest_rate", "currency", "emi", "total_interest", "total_amount"] + + class Config: + """Pydantic configuration""" + allow_population_by_field_name = True + validate_assignment = True + + def to_str(self) -> str: + """Returns the string representation of the model using alias""" + return pprint.pformat(self.dict(by_alias=True)) + + def to_json(self) -> str: + """Returns the JSON representation of the model using alias""" + return json.dumps(self.to_dict()) + + @classmethod + 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)) + + def to_dict(self): + """Returns the dictionary representation of the model using alias""" + _dict = self.dict(by_alias=True, + exclude={ + }, + exclude_none=True) + return _dict + + @classmethod + def from_dict(cls, obj: dict) -> EMIPlansArray: + """Create an instance of EMIPlansArray from a dict""" + if obj is None: + return None + + if not isinstance(obj, dict): + return EMIPlansArray.parse_obj(obj) + + _obj = EMIPlansArray.parse_obj({ + "tenure": obj.get("tenure"), + "interest_rate": obj.get("interest_rate"), + "currency": obj.get("currency"), + "emi": obj.get("emi"), + "total_interest": obj.get("total_interest"), + "total_amount": obj.get("total_amount") + }) + return _obj + + diff --git a/models/error_details_in_payments_entity.py b/models/error_details_in_payments_entity.py new file mode 100644 index 0000000..d3f9166 --- /dev/null +++ b/models/error_details_in_payments_entity.py @@ -0,0 +1,84 @@ +# coding: utf-8 + +""" + Cashfree Payment Gateway APIs + + Cashfree's Payment Gateway APIs provide developers with a streamlined pathway to integrate advanced payment processing capabilities into their applications, platforms and websites. + + The version of the OpenAPI document: 2022-09-01 + Contact: developers@cashfree.com + Generated by OpenAPI Generator (https://openapi-generator.tech) + + Do not edit the class manually. +""" # noqa: E501 + + +from __future__ import annotations +import pprint +import re # noqa: F401 +import json + + +from typing import Optional +from pydantic import BaseModel, StrictStr + +class ErrorDetailsInPaymentsEntity(BaseModel): + """ + The error details are present only for failed payments + """ + error_code: Optional[StrictStr] = None + error_description: Optional[StrictStr] = None + error_reason: Optional[StrictStr] = None + error_source: Optional[StrictStr] = None + error_code_raw: Optional[StrictStr] = None + error_description_raw: Optional[StrictStr] = None + error_subcode_raw: Optional[StrictStr] = None + __properties = ["error_code", "error_description", "error_reason", "error_source", "error_code_raw", "error_description_raw", "error_subcode_raw"] + + class Config: + """Pydantic configuration""" + allow_population_by_field_name = True + validate_assignment = True + + def to_str(self) -> str: + """Returns the string representation of the model using alias""" + return pprint.pformat(self.dict(by_alias=True)) + + def to_json(self) -> str: + """Returns the JSON representation of the model using alias""" + return json.dumps(self.to_dict()) + + @classmethod + 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)) + + def to_dict(self): + """Returns the dictionary representation of the model using alias""" + _dict = self.dict(by_alias=True, + exclude={ + }, + exclude_none=True) + return _dict + + @classmethod + def from_dict(cls, obj: dict) -> ErrorDetailsInPaymentsEntity: + """Create an instance of ErrorDetailsInPaymentsEntity from a dict""" + if obj is None: + return None + + if not isinstance(obj, dict): + return ErrorDetailsInPaymentsEntity.parse_obj(obj) + + _obj = ErrorDetailsInPaymentsEntity.parse_obj({ + "error_code": obj.get("error_code"), + "error_description": obj.get("error_description"), + "error_reason": obj.get("error_reason"), + "error_source": obj.get("error_source"), + "error_code_raw": obj.get("error_code_raw"), + "error_description_raw": obj.get("error_description_raw"), + "error_subcode_raw": obj.get("error_subcode_raw") + }) + return _obj + + diff --git a/models/fetch_recon_request.py b/models/fetch_recon_request.py new file mode 100644 index 0000000..41adc51 --- /dev/null +++ b/models/fetch_recon_request.py @@ -0,0 +1,82 @@ +# coding: utf-8 + +""" + Cashfree Payment Gateway APIs + + Cashfree's Payment Gateway APIs provide developers with a streamlined pathway to integrate advanced payment processing capabilities into their applications, platforms and websites. + + The version of the OpenAPI document: 2022-09-01 + Contact: developers@cashfree.com + Generated by OpenAPI Generator (https://openapi-generator.tech) + + Do not edit the class manually. +""" # noqa: E501 + + +from __future__ import annotations +import pprint +import re # noqa: F401 +import json + + + +from pydantic import BaseModel, Field +from cashfree_pg.models.fetch_recon_request_filters import FetchReconRequestFilters +from cashfree_pg.models.fetch_recon_request_pagination import FetchReconRequestPagination + +class FetchReconRequest(BaseModel): + """ + Recon object + """ + pagination: FetchReconRequestPagination = Field(...) + filters: FetchReconRequestFilters = Field(...) + __properties = ["pagination", "filters"] + + class Config: + """Pydantic configuration""" + allow_population_by_field_name = True + validate_assignment = True + + def to_str(self) -> str: + """Returns the string representation of the model using alias""" + return pprint.pformat(self.dict(by_alias=True)) + + def to_json(self) -> str: + """Returns the JSON representation of the model using alias""" + return json.dumps(self.to_dict()) + + @classmethod + 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)) + + def to_dict(self): + """Returns the dictionary representation of the model using alias""" + _dict = self.dict(by_alias=True, + exclude={ + }, + exclude_none=True) + # override the default output from pydantic by calling `to_dict()` of pagination + if self.pagination: + _dict['pagination'] = self.pagination.to_dict() + # override the default output from pydantic by calling `to_dict()` of filters + if self.filters: + _dict['filters'] = self.filters.to_dict() + return _dict + + @classmethod + def from_dict(cls, obj: dict) -> FetchReconRequest: + """Create an instance of FetchReconRequest from a dict""" + if obj is None: + return None + + if not isinstance(obj, dict): + return FetchReconRequest.parse_obj(obj) + + _obj = FetchReconRequest.parse_obj({ + "pagination": FetchReconRequestPagination.from_dict(obj.get("pagination")) if obj.get("pagination") is not None else None, + "filters": FetchReconRequestFilters.from_dict(obj.get("filters")) if obj.get("filters") is not None else None + }) + return _obj + + diff --git a/models/fetch_recon_request_filters.py b/models/fetch_recon_request_filters.py new file mode 100644 index 0000000..b9efa37 --- /dev/null +++ b/models/fetch_recon_request_filters.py @@ -0,0 +1,74 @@ +# coding: utf-8 + +""" + Cashfree Payment Gateway APIs + + Cashfree's Payment Gateway APIs provide developers with a streamlined pathway to integrate advanced payment processing capabilities into their applications, platforms and websites. + + The version of the OpenAPI document: 2022-09-01 + Contact: developers@cashfree.com + Generated by OpenAPI Generator (https://openapi-generator.tech) + + Do not edit the class manually. +""" # noqa: E501 + + +from __future__ import annotations +import pprint +import re # noqa: F401 +import json + + + +from pydantic import BaseModel, Field, StrictStr + +class FetchReconRequestFilters(BaseModel): + """ + FetchReconRequestFilters + """ + start_date: StrictStr = Field(..., description="Specify the start date from when you want the settlement reconciliation details.") + end_date: StrictStr = Field(..., description="Specify the end date till when you want the settlement reconciliation details.") + __properties = ["start_date", "end_date"] + + class Config: + """Pydantic configuration""" + allow_population_by_field_name = True + validate_assignment = True + + def to_str(self) -> str: + """Returns the string representation of the model using alias""" + return pprint.pformat(self.dict(by_alias=True)) + + def to_json(self) -> str: + """Returns the JSON representation of the model using alias""" + return json.dumps(self.to_dict()) + + @classmethod + 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)) + + def to_dict(self): + """Returns the dictionary representation of the model using alias""" + _dict = self.dict(by_alias=True, + exclude={ + }, + exclude_none=True) + return _dict + + @classmethod + def from_dict(cls, obj: dict) -> FetchReconRequestFilters: + """Create an instance of FetchReconRequestFilters from a dict""" + if obj is None: + return None + + if not isinstance(obj, dict): + return FetchReconRequestFilters.parse_obj(obj) + + _obj = FetchReconRequestFilters.parse_obj({ + "start_date": obj.get("start_date"), + "end_date": obj.get("end_date") + }) + return _obj + + diff --git a/models/fetch_recon_request_pagination.py b/models/fetch_recon_request_pagination.py new file mode 100644 index 0000000..8b8ec67 --- /dev/null +++ b/models/fetch_recon_request_pagination.py @@ -0,0 +1,79 @@ +# coding: utf-8 + +""" + Cashfree Payment Gateway APIs + + Cashfree's Payment Gateway APIs provide developers with a streamlined pathway to integrate advanced payment processing capabilities into their applications, platforms and websites. + + The version of the OpenAPI document: 2022-09-01 + Contact: developers@cashfree.com + Generated by OpenAPI Generator (https://openapi-generator.tech) + + Do not edit the class manually. +""" # noqa: E501 + + +from __future__ import annotations +import pprint +import re # noqa: F401 +import json + + +from typing import Optional +from pydantic import BaseModel, Field, StrictInt, StrictStr + +class FetchReconRequestPagination(BaseModel): + """ + To fetch the next set of settlements, pass the cursor received in the response to the next API call. To receive the data for the first time, pass the cursor as null. Limit would be number of settlements that you want to receive. + """ + limit: StrictInt = Field(..., description="Number of settlements you want to fetch in the next iteration. Maximum limit is 1000, default value is 10.") + cursor: Optional[StrictStr] = Field(None, description="Specifies from where the next set of settlement details should be fetched.") + __properties = ["limit", "cursor"] + + class Config: + """Pydantic configuration""" + allow_population_by_field_name = True + validate_assignment = True + + def to_str(self) -> str: + """Returns the string representation of the model using alias""" + return pprint.pformat(self.dict(by_alias=True)) + + def to_json(self) -> str: + """Returns the JSON representation of the model using alias""" + return json.dumps(self.to_dict()) + + @classmethod + 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)) + + def to_dict(self): + """Returns the dictionary representation of the model using alias""" + _dict = self.dict(by_alias=True, + exclude={ + }, + exclude_none=True) + # set to None if cursor (nullable) is None + # and __fields_set__ contains the field + if self.cursor is None and "cursor" in self.__fields_set__: + _dict['cursor'] = None + + return _dict + + @classmethod + def from_dict(cls, obj: dict) -> FetchReconRequestPagination: + """Create an instance of FetchReconRequestPagination from a dict""" + if obj is None: + return None + + if not isinstance(obj, dict): + return FetchReconRequestPagination.parse_obj(obj) + + _obj = FetchReconRequestPagination.parse_obj({ + "limit": obj.get("limit"), + "cursor": obj.get("cursor") + }) + return _obj + + diff --git a/models/fetch_settlements_request.py b/models/fetch_settlements_request.py new file mode 100644 index 0000000..ba17dac --- /dev/null +++ b/models/fetch_settlements_request.py @@ -0,0 +1,82 @@ +# coding: utf-8 + +""" + Cashfree Payment Gateway APIs + + Cashfree's Payment Gateway APIs provide developers with a streamlined pathway to integrate advanced payment processing capabilities into their applications, platforms and websites. + + The version of the OpenAPI document: 2022-09-01 + Contact: developers@cashfree.com + Generated by OpenAPI Generator (https://openapi-generator.tech) + + Do not edit the class manually. +""" # noqa: E501 + + +from __future__ import annotations +import pprint +import re # noqa: F401 +import json + + + +from pydantic import BaseModel, Field +from cashfree_pg.models.fetch_settlements_request_filters import FetchSettlementsRequestFilters +from cashfree_pg.models.fetch_settlements_request_pagination import FetchSettlementsRequestPagination + +class FetchSettlementsRequest(BaseModel): + """ + Request to fetch settlement + """ + pagination: FetchSettlementsRequestPagination = Field(...) + filters: FetchSettlementsRequestFilters = Field(...) + __properties = ["pagination", "filters"] + + class Config: + """Pydantic configuration""" + allow_population_by_field_name = True + validate_assignment = True + + def to_str(self) -> str: + """Returns the string representation of the model using alias""" + return pprint.pformat(self.dict(by_alias=True)) + + def to_json(self) -> str: + """Returns the JSON representation of the model using alias""" + return json.dumps(self.to_dict()) + + @classmethod + 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)) + + def to_dict(self): + """Returns the dictionary representation of the model using alias""" + _dict = self.dict(by_alias=True, + exclude={ + }, + exclude_none=True) + # override the default output from pydantic by calling `to_dict()` of pagination + if self.pagination: + _dict['pagination'] = self.pagination.to_dict() + # override the default output from pydantic by calling `to_dict()` of filters + if self.filters: + _dict['filters'] = self.filters.to_dict() + return _dict + + @classmethod + def from_dict(cls, obj: dict) -> FetchSettlementsRequest: + """Create an instance of FetchSettlementsRequest from a dict""" + if obj is None: + return None + + if not isinstance(obj, dict): + return FetchSettlementsRequest.parse_obj(obj) + + _obj = FetchSettlementsRequest.parse_obj({ + "pagination": FetchSettlementsRequestPagination.from_dict(obj.get("pagination")) if obj.get("pagination") is not None else None, + "filters": FetchSettlementsRequestFilters.from_dict(obj.get("filters")) if obj.get("filters") is not None else None + }) + return _obj + + diff --git a/models/fetch_settlements_request_filters.py b/models/fetch_settlements_request_filters.py new file mode 100644 index 0000000..069ad76 --- /dev/null +++ b/models/fetch_settlements_request_filters.py @@ -0,0 +1,78 @@ +# coding: utf-8 + +""" + Cashfree Payment Gateway APIs + + Cashfree's Payment Gateway APIs provide developers with a streamlined pathway to integrate advanced payment processing capabilities into their applications, platforms and websites. + + The version of the OpenAPI document: 2022-09-01 + Contact: developers@cashfree.com + Generated by OpenAPI Generator (https://openapi-generator.tech) + + Do not edit the class manually. +""" # noqa: E501 + + +from __future__ import annotations +import pprint +import re # noqa: F401 +import json + + +from typing import List, Optional +from pydantic import BaseModel, Field, StrictInt, StrictStr, conlist + +class FetchSettlementsRequestFilters(BaseModel): + """ + Specify either the Settlement ID, Settlement UTR, or start date and end date to fetch the settlement details. + """ + cf_settlement_ids: Optional[conlist(StrictInt)] = Field(None, description="List of settlement IDs for which you want the settlement reconciliation details.") + settlement_utrs: Optional[conlist(StrictStr)] = Field(None, description="List of settlement UTRs for which you want the settlement reconciliation details.") + start_date: Optional[StrictStr] = Field(None, description="Specify the start date from when you want the settlement reconciliation details.") + end_date: Optional[StrictStr] = Field(None, description="Specify the end date till when you want the settlement reconciliation details.") + __properties = ["cf_settlement_ids", "settlement_utrs", "start_date", "end_date"] + + class Config: + """Pydantic configuration""" + allow_population_by_field_name = True + validate_assignment = True + + def to_str(self) -> str: + """Returns the string representation of the model using alias""" + return pprint.pformat(self.dict(by_alias=True)) + + def to_json(self) -> str: + """Returns the JSON representation of the model using alias""" + return json.dumps(self.to_dict()) + + @classmethod + 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)) + + def to_dict(self): + """Returns the dictionary representation of the model using alias""" + _dict = self.dict(by_alias=True, + exclude={ + }, + exclude_none=True) + return _dict + + @classmethod + def from_dict(cls, obj: dict) -> FetchSettlementsRequestFilters: + """Create an instance of FetchSettlementsRequestFilters from a dict""" + if obj is None: + return None + + if not isinstance(obj, dict): + return FetchSettlementsRequestFilters.parse_obj(obj) + + _obj = FetchSettlementsRequestFilters.parse_obj({ + "cf_settlement_ids": obj.get("cf_settlement_ids"), + "settlement_utrs": obj.get("settlement_utrs"), + "start_date": obj.get("start_date"), + "end_date": obj.get("end_date") + }) + return _obj + + diff --git a/models/fetch_settlements_request_pagination.py b/models/fetch_settlements_request_pagination.py new file mode 100644 index 0000000..01882c4 --- /dev/null +++ b/models/fetch_settlements_request_pagination.py @@ -0,0 +1,74 @@ +# coding: utf-8 + +""" + Cashfree Payment Gateway APIs + + Cashfree's Payment Gateway APIs provide developers with a streamlined pathway to integrate advanced payment processing capabilities into their applications, platforms and websites. + + The version of the OpenAPI document: 2022-09-01 + Contact: developers@cashfree.com + Generated by OpenAPI Generator (https://openapi-generator.tech) + + Do not edit the class manually. +""" # noqa: E501 + + +from __future__ import annotations +import pprint +import re # noqa: F401 +import json + + +from typing import Optional +from pydantic import BaseModel, Field, StrictInt, StrictStr + +class FetchSettlementsRequestPagination(BaseModel): + """ + To fetch the next set of settlements, pass the cursor received in the response to the next API call. To receive the data for the first time, pass the cursor as null. Limit would be number of settlements that you want to receive. + """ + limit: StrictInt = Field(..., description="The number of settlements you want to fetch. Maximum limit is 1000, default value is 10.") + cursor: Optional[StrictStr] = Field(None, description="Specifies from where the next set of settlement details should be fetched.") + __properties = ["limit", "cursor"] + + class Config: + """Pydantic configuration""" + allow_population_by_field_name = True + validate_assignment = True + + def to_str(self) -> str: + """Returns the string representation of the model using alias""" + return pprint.pformat(self.dict(by_alias=True)) + + def to_json(self) -> str: + """Returns the JSON representation of the model using alias""" + return json.dumps(self.to_dict()) + + @classmethod + 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)) + + def to_dict(self): + """Returns the dictionary representation of the model using alias""" + _dict = self.dict(by_alias=True, + exclude={ + }, + exclude_none=True) + return _dict + + @classmethod + def from_dict(cls, obj: dict) -> FetchSettlementsRequestPagination: + """Create an instance of FetchSettlementsRequestPagination from a dict""" + if obj is None: + return None + + if not isinstance(obj, dict): + return FetchSettlementsRequestPagination.parse_obj(obj) + + _obj = FetchSettlementsRequestPagination.parse_obj({ + "limit": obj.get("limit"), + "cursor": obj.get("cursor") + }) + return _obj + + diff --git a/models/fetch_terminal_qr_codes_entity.py b/models/fetch_terminal_qr_codes_entity.py new file mode 100644 index 0000000..ac40972 --- /dev/null +++ b/models/fetch_terminal_qr_codes_entity.py @@ -0,0 +1,78 @@ +# coding: utf-8 + +""" + Cashfree Payment Gateway APIs + + Cashfree's Payment Gateway APIs provide developers with a streamlined pathway to integrate advanced payment processing capabilities into their applications, platforms and websites. + + The version of the OpenAPI document: 2022-09-01 + Contact: developers@cashfree.com + Generated by OpenAPI Generator (https://openapi-generator.tech) + + Do not edit the class manually. +""" # noqa: E501 + + +from __future__ import annotations +import pprint +import re # noqa: F401 +import json + + +from typing import Optional +from pydantic import BaseModel, Field, StrictStr + +class FetchTerminalQRCodesEntity(BaseModel): + """ + Fetch Static QR Codes using terminal ID or phone number + """ + bank: Optional[StrictStr] = Field(None, description="Name of the bank that is linked to the Static QR.") + qr_code: Optional[StrictStr] = Field(None, alias="qrCode", description="Base-64 Encoded QR Code URL") + qr_code_url: Optional[StrictStr] = Field(None, alias="qrCodeUrl", description="URL of the qr Code.") + status: Optional[StrictStr] = Field(None, description="Status of the static QR.") + __properties = ["bank", "qrCode", "qrCodeUrl", "status"] + + class Config: + """Pydantic configuration""" + allow_population_by_field_name = True + validate_assignment = True + + def to_str(self) -> str: + """Returns the string representation of the model using alias""" + return pprint.pformat(self.dict(by_alias=True)) + + def to_json(self) -> str: + """Returns the JSON representation of the model using alias""" + return json.dumps(self.to_dict()) + + @classmethod + 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)) + + def to_dict(self): + """Returns the dictionary representation of the model using alias""" + _dict = self.dict(by_alias=True, + exclude={ + }, + exclude_none=True) + return _dict + + @classmethod + def from_dict(cls, obj: dict) -> FetchTerminalQRCodesEntity: + """Create an instance of FetchTerminalQRCodesEntity from a dict""" + if obj is None: + return None + + if not isinstance(obj, dict): + return FetchTerminalQRCodesEntity.parse_obj(obj) + + _obj = FetchTerminalQRCodesEntity.parse_obj({ + "bank": obj.get("bank"), + "qr_code": obj.get("qrCode"), + "qr_code_url": obj.get("qrCodeUrl"), + "status": obj.get("status") + }) + return _obj + + diff --git a/models/idempotency_error.py b/models/idempotency_error.py new file mode 100644 index 0000000..ac10570 --- /dev/null +++ b/models/idempotency_error.py @@ -0,0 +1,86 @@ +# coding: utf-8 + +""" + Cashfree Payment Gateway APIs + + Cashfree's Payment Gateway APIs provide developers with a streamlined pathway to integrate advanced payment processing capabilities into their applications, platforms and websites. + + The version of the OpenAPI document: 2022-09-01 + Contact: developers@cashfree.com + Generated by OpenAPI Generator (https://openapi-generator.tech) + + Do not edit the class manually. +""" # noqa: E501 + + +from __future__ import annotations +import pprint +import re # noqa: F401 +import json + + +from typing import Optional +from pydantic import BaseModel, Field, StrictStr, validator + +class IdempotencyError(BaseModel): + """ + Error when idempotency fails. Different request body with the same idempotent key + """ + message: Optional[StrictStr] = None + code: Optional[StrictStr] = None + type: Optional[StrictStr] = Field(None, description="idempotency_error") + __properties = ["message", "code", "type"] + + @validator('type') + def type_validate_enum(cls, value): + """Validates the enum""" + if value is None: + return value + + if value not in ('idempotency_error'): + raise ValueError("must be one of enum values ('idempotency_error')") + return value + + class Config: + """Pydantic configuration""" + allow_population_by_field_name = True + validate_assignment = True + + def to_str(self) -> str: + """Returns the string representation of the model using alias""" + return pprint.pformat(self.dict(by_alias=True)) + + def to_json(self) -> str: + """Returns the JSON representation of the model using alias""" + return json.dumps(self.to_dict()) + + @classmethod + 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)) + + def to_dict(self): + """Returns the dictionary representation of the model using alias""" + _dict = self.dict(by_alias=True, + exclude={ + }, + exclude_none=True) + return _dict + + @classmethod + def from_dict(cls, obj: dict) -> IdempotencyError: + """Create an instance of IdempotencyError from a dict""" + if obj is None: + return None + + if not isinstance(obj, dict): + return IdempotencyError.parse_obj(obj) + + _obj = IdempotencyError.parse_obj({ + "message": obj.get("message"), + "code": obj.get("code"), + "type": obj.get("type") + }) + return _obj + + diff --git a/models/instrument_entity.py b/models/instrument_entity.py new file mode 100644 index 0000000..bffecc5 --- /dev/null +++ b/models/instrument_entity.py @@ -0,0 +1,112 @@ +# coding: utf-8 + +""" + Cashfree Payment Gateway APIs + + Cashfree's Payment Gateway APIs provide developers with a streamlined pathway to integrate advanced payment processing capabilities into their applications, platforms and websites. + + The version of the OpenAPI document: 2022-09-01 + Contact: developers@cashfree.com + Generated by OpenAPI Generator (https://openapi-generator.tech) + + Do not edit the class manually. +""" # noqa: E501 + + +from __future__ import annotations +import pprint +import re # noqa: F401 +import json + + +from typing import Optional +from pydantic import BaseModel, Field, StrictStr, validator +from cashfree_pg.models.saved_instrument_meta import SavedInstrumentMeta + +class InstrumentEntity(BaseModel): + """ + Saved card instrument object + """ + customer_id: Optional[StrictStr] = Field(None, description="customer_id for which the instrument was saved") + afa_reference: Optional[StrictStr] = Field(None, description="cf_payment_id of the successful transaction done while saving instrument") + instrument_id: Optional[StrictStr] = Field(None, description="saved instrument id") + instrument_type: Optional[StrictStr] = Field(None, description="Type of the saved instrument") + instrument_uid: Optional[StrictStr] = Field(None, description="Unique id for the saved instrument") + instrument_display: Optional[StrictStr] = Field(None, description="masked card number displayed to the customer") + instrument_status: Optional[StrictStr] = Field(None, description="Status of the saved instrument.") + created_at: Optional[StrictStr] = Field(None, description="Timestamp at which instrument was saved.") + instrument_meta: Optional[SavedInstrumentMeta] = None + __properties = ["customer_id", "afa_reference", "instrument_id", "instrument_type", "instrument_uid", "instrument_display", "instrument_status", "created_at", "instrument_meta"] + + @validator('instrument_type') + def instrument_type_validate_enum(cls, value): + """Validates the enum""" + if value is None: + return value + + if value not in ('card'): + raise ValueError("must be one of enum values ('card')") + return value + + @validator('instrument_status') + def instrument_status_validate_enum(cls, value): + """Validates the enum""" + if value is None: + return value + + if value not in ('ACTIVE', 'INACTIVE'): + raise ValueError("must be one of enum values ('ACTIVE', 'INACTIVE')") + return value + + class Config: + """Pydantic configuration""" + allow_population_by_field_name = True + validate_assignment = True + + def to_str(self) -> str: + """Returns the string representation of the model using alias""" + return pprint.pformat(self.dict(by_alias=True)) + + def to_json(self) -> str: + """Returns the JSON representation of the model using alias""" + return json.dumps(self.to_dict()) + + @classmethod + 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)) + + def to_dict(self): + """Returns the dictionary representation of the model using alias""" + _dict = self.dict(by_alias=True, + exclude={ + }, + exclude_none=True) + # override the default output from pydantic by calling `to_dict()` of instrument_meta + if self.instrument_meta: + _dict['instrument_meta'] = self.instrument_meta.to_dict() + return _dict + + @classmethod + def from_dict(cls, obj: dict) -> InstrumentEntity: + """Create an instance of InstrumentEntity from a dict""" + if obj is None: + return None + + if not isinstance(obj, dict): + return InstrumentEntity.parse_obj(obj) + + _obj = InstrumentEntity.parse_obj({ + "customer_id": obj.get("customer_id"), + "afa_reference": obj.get("afa_reference"), + "instrument_id": obj.get("instrument_id"), + "instrument_type": obj.get("instrument_type"), + "instrument_uid": obj.get("instrument_uid"), + "instrument_display": obj.get("instrument_display"), + "instrument_status": obj.get("instrument_status"), + "created_at": obj.get("created_at"), + "instrument_meta": SavedInstrumentMeta.from_dict(obj.get("instrument_meta")) if obj.get("instrument_meta") is not None else None + }) + return _obj + + diff --git a/models/link_customer_details_entity.py b/models/link_customer_details_entity.py new file mode 100644 index 0000000..edede7a --- /dev/null +++ b/models/link_customer_details_entity.py @@ -0,0 +1,76 @@ +# coding: utf-8 + +""" + Cashfree Payment Gateway APIs + + Cashfree's Payment Gateway APIs provide developers with a streamlined pathway to integrate advanced payment processing capabilities into their applications, platforms and websites. + + The version of the OpenAPI document: 2022-09-01 + Contact: developers@cashfree.com + Generated by OpenAPI Generator (https://openapi-generator.tech) + + Do not edit the class manually. +""" # noqa: E501 + + +from __future__ import annotations +import pprint +import re # noqa: F401 +import json + + +from typing import Optional +from pydantic import BaseModel, Field, StrictStr + +class LinkCustomerDetailsEntity(BaseModel): + """ + Payment link customer entity + """ + customer_phone: StrictStr = Field(..., description="Customer phone number") + customer_email: Optional[StrictStr] = Field(None, description="Customer email address") + customer_name: Optional[StrictStr] = Field(None, description="Customer name") + __properties = ["customer_phone", "customer_email", "customer_name"] + + class Config: + """Pydantic configuration""" + allow_population_by_field_name = True + validate_assignment = True + + def to_str(self) -> str: + """Returns the string representation of the model using alias""" + return pprint.pformat(self.dict(by_alias=True)) + + def to_json(self) -> str: + """Returns the JSON representation of the model using alias""" + return json.dumps(self.to_dict()) + + @classmethod + 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)) + + def to_dict(self): + """Returns the dictionary representation of the model using alias""" + _dict = self.dict(by_alias=True, + exclude={ + }, + exclude_none=True) + return _dict + + @classmethod + def from_dict(cls, obj: dict) -> LinkCustomerDetailsEntity: + """Create an instance of LinkCustomerDetailsEntity from a dict""" + if obj is None: + return None + + if not isinstance(obj, dict): + return LinkCustomerDetailsEntity.parse_obj(obj) + + _obj = LinkCustomerDetailsEntity.parse_obj({ + "customer_phone": obj.get("customer_phone"), + "customer_email": obj.get("customer_email"), + "customer_name": obj.get("customer_name") + }) + return _obj + + diff --git a/models/link_entity.py b/models/link_entity.py new file mode 100644 index 0000000..f5c5a05 --- /dev/null +++ b/models/link_entity.py @@ -0,0 +1,116 @@ +# coding: utf-8 + +""" + Cashfree Payment Gateway APIs + + Cashfree's Payment Gateway APIs provide developers with a streamlined pathway to integrate advanced payment processing capabilities into their applications, platforms and websites. + + The version of the OpenAPI document: 2022-09-01 + Contact: developers@cashfree.com + Generated by OpenAPI Generator (https://openapi-generator.tech) + + Do not edit the class manually. +""" # noqa: E501 + + +from __future__ import annotations +import pprint +import re # noqa: F401 +import json + + +from typing import Dict, Optional, Union +from pydantic import BaseModel, Field, StrictBool, StrictFloat, StrictInt, StrictStr +from cashfree_pg.models.link_customer_details_entity import LinkCustomerDetailsEntity +from cashfree_pg.models.link_meta_entity import LinkMetaEntity +from cashfree_pg.models.link_notify_entity import LinkNotifyEntity + +class LinkEntity(BaseModel): + """ + Payment link success creation response object + """ + cf_link_id: Optional[StrictInt] = None + link_id: Optional[StrictStr] = None + link_status: Optional[StrictStr] = None + link_currency: Optional[StrictStr] = None + link_amount: Optional[Union[StrictFloat, StrictInt]] = None + link_amount_paid: Optional[Union[StrictFloat, StrictInt]] = None + link_partial_payments: Optional[StrictBool] = None + link_minimum_partial_amount: Optional[Union[StrictFloat, StrictInt]] = None + link_purpose: Optional[StrictStr] = None + link_created_at: Optional[StrictStr] = None + customer_details: Optional[LinkCustomerDetailsEntity] = None + link_meta: Optional[LinkMetaEntity] = None + link_url: Optional[StrictStr] = None + link_expiry_time: Optional[StrictStr] = None + link_notes: Optional[Dict[str, StrictStr]] = Field(None, description="Key-value pair that can be used to store additional information about the entity. Maximum 5 key-value pairs") + link_auto_reminders: Optional[StrictBool] = None + link_notify: Optional[LinkNotifyEntity] = None + __properties = ["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"] + + class Config: + """Pydantic configuration""" + allow_population_by_field_name = True + validate_assignment = True + + def to_str(self) -> str: + """Returns the string representation of the model using alias""" + return pprint.pformat(self.dict(by_alias=True)) + + def to_json(self) -> str: + """Returns the JSON representation of the model using alias""" + return json.dumps(self.to_dict()) + + @classmethod + 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)) + + def to_dict(self): + """Returns the dictionary representation of the model using alias""" + _dict = self.dict(by_alias=True, + exclude={ + }, + exclude_none=True) + # override the default output from pydantic by calling `to_dict()` of customer_details + if self.customer_details: + _dict['customer_details'] = self.customer_details.to_dict() + # override the default output from pydantic by calling `to_dict()` of link_meta + if self.link_meta: + _dict['link_meta'] = self.link_meta.to_dict() + # override the default output from pydantic by calling `to_dict()` of link_notify + if self.link_notify: + _dict['link_notify'] = self.link_notify.to_dict() + return _dict + + @classmethod + def from_dict(cls, obj: dict) -> LinkEntity: + """Create an instance of LinkEntity from a dict""" + if obj is None: + return None + + if not isinstance(obj, dict): + return LinkEntity.parse_obj(obj) + + _obj = LinkEntity.parse_obj({ + "cf_link_id": obj.get("cf_link_id"), + "link_id": obj.get("link_id"), + "link_status": obj.get("link_status"), + "link_currency": obj.get("link_currency"), + "link_amount": obj.get("link_amount"), + "link_amount_paid": obj.get("link_amount_paid"), + "link_partial_payments": obj.get("link_partial_payments"), + "link_minimum_partial_amount": obj.get("link_minimum_partial_amount"), + "link_purpose": obj.get("link_purpose"), + "link_created_at": obj.get("link_created_at"), + "customer_details": LinkCustomerDetailsEntity.from_dict(obj.get("customer_details")) if obj.get("customer_details") is not None else None, + "link_meta": LinkMetaEntity.from_dict(obj.get("link_meta")) if obj.get("link_meta") is not None else None, + "link_url": obj.get("link_url"), + "link_expiry_time": obj.get("link_expiry_time"), + "link_notes": obj.get("link_notes"), + "link_auto_reminders": obj.get("link_auto_reminders"), + "link_notify": LinkNotifyEntity.from_dict(obj.get("link_notify")) if obj.get("link_notify") is not None else None + }) + return _obj + + diff --git a/models/link_meta_entity.py b/models/link_meta_entity.py new file mode 100644 index 0000000..49b48c0 --- /dev/null +++ b/models/link_meta_entity.py @@ -0,0 +1,78 @@ +# coding: utf-8 + +""" + Cashfree Payment Gateway APIs + + Cashfree's Payment Gateway APIs provide developers with a streamlined pathway to integrate advanced payment processing capabilities into their applications, platforms and websites. + + The version of the OpenAPI document: 2022-09-01 + Contact: developers@cashfree.com + Generated by OpenAPI Generator (https://openapi-generator.tech) + + Do not edit the class manually. +""" # noqa: E501 + + +from __future__ import annotations +import pprint +import re # noqa: F401 +import json + + +from typing import Optional +from pydantic import BaseModel, Field, StrictBool, StrictStr + +class LinkMetaEntity(BaseModel): + """ + Payment link meta information object + """ + notify_url: Optional[StrictStr] = Field(None, description="Notification URL for server-server communication. It should be an https URL.") + upi_intent: Optional[StrictBool] = Field(None, description="If \"true\", link will directly open UPI Intent flow on mobile, and normal link flow elsewhere") + return_url: Optional[StrictStr] = Field(None, description="The URL to which user will be redirected to after the payment is done on the link. Maximum length: 250.") + payment_methods: Optional[StrictStr] = Field(None, description="Allowed payment modes for this link. Pass comma-separated values among following options - \"cc\", \"dc\", \"ccc\", \"ppc\", \"nb\", \"upi\", \"paypal\", \"app\". Leave it blank to show all available payment methods") + __properties = ["notify_url", "upi_intent", "return_url", "payment_methods"] + + class Config: + """Pydantic configuration""" + allow_population_by_field_name = True + validate_assignment = True + + def to_str(self) -> str: + """Returns the string representation of the model using alias""" + return pprint.pformat(self.dict(by_alias=True)) + + def to_json(self) -> str: + """Returns the JSON representation of the model using alias""" + return json.dumps(self.to_dict()) + + @classmethod + 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)) + + def to_dict(self): + """Returns the dictionary representation of the model using alias""" + _dict = self.dict(by_alias=True, + exclude={ + }, + exclude_none=True) + return _dict + + @classmethod + def from_dict(cls, obj: dict) -> LinkMetaEntity: + """Create an instance of LinkMetaEntity from a dict""" + if obj is None: + return None + + if not isinstance(obj, dict): + return LinkMetaEntity.parse_obj(obj) + + _obj = LinkMetaEntity.parse_obj({ + "notify_url": obj.get("notify_url"), + "upi_intent": obj.get("upi_intent"), + "return_url": obj.get("return_url"), + "payment_methods": obj.get("payment_methods") + }) + return _obj + + diff --git a/models/link_notify_entity.py b/models/link_notify_entity.py new file mode 100644 index 0000000..8ea4e5d --- /dev/null +++ b/models/link_notify_entity.py @@ -0,0 +1,74 @@ +# coding: utf-8 + +""" + Cashfree Payment Gateway APIs + + Cashfree's Payment Gateway APIs provide developers with a streamlined pathway to integrate advanced payment processing capabilities into their applications, platforms and websites. + + The version of the OpenAPI document: 2022-09-01 + Contact: developers@cashfree.com + Generated by OpenAPI Generator (https://openapi-generator.tech) + + Do not edit the class manually. +""" # noqa: E501 + + +from __future__ import annotations +import pprint +import re # noqa: F401 +import json + + +from typing import Optional +from pydantic import BaseModel, Field, StrictBool + +class LinkNotifyEntity(BaseModel): + """ + Payment link Notify Object for SMS and Email + """ + send_sms: Optional[StrictBool] = Field(None, description="If \"true\", Cashfree will send sms on customer_phone") + send_email: Optional[StrictBool] = Field(None, description="If \"true\", Cashfree will send email on customer_email") + __properties = ["send_sms", "send_email"] + + class Config: + """Pydantic configuration""" + allow_population_by_field_name = True + validate_assignment = True + + def to_str(self) -> str: + """Returns the string representation of the model using alias""" + return pprint.pformat(self.dict(by_alias=True)) + + def to_json(self) -> str: + """Returns the JSON representation of the model using alias""" + return json.dumps(self.to_dict()) + + @classmethod + 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)) + + def to_dict(self): + """Returns the dictionary representation of the model using alias""" + _dict = self.dict(by_alias=True, + exclude={ + }, + exclude_none=True) + return _dict + + @classmethod + def from_dict(cls, obj: dict) -> LinkNotifyEntity: + """Create an instance of LinkNotifyEntity from a dict""" + if obj is None: + return None + + if not isinstance(obj, dict): + return LinkNotifyEntity.parse_obj(obj) + + _obj = LinkNotifyEntity.parse_obj({ + "send_sms": obj.get("send_sms"), + "send_email": obj.get("send_email") + }) + return _obj + + diff --git a/models/net_banking_payment_method.py b/models/net_banking_payment_method.py new file mode 100644 index 0000000..6be2f15 --- /dev/null +++ b/models/net_banking_payment_method.py @@ -0,0 +1,81 @@ +# coding: utf-8 + +""" + Cashfree Payment Gateway APIs + + Cashfree's Payment Gateway APIs provide developers with a streamlined pathway to integrate advanced payment processing capabilities into their applications, platforms and websites. + + The version of the OpenAPI document: 2022-09-01 + Contact: developers@cashfree.com + Generated by OpenAPI Generator (https://openapi-generator.tech) + + Do not edit the class manually. +""" # noqa: E501 + + +from __future__ import annotations +import pprint +import re # noqa: F401 +import json + + +from typing import Optional +from pydantic import BaseModel, Field +from cashfree_pg.models.netbanking import Netbanking + +class NetBankingPaymentMethod(BaseModel): + """ + Payment method for netbanking object + """ + netbanking: Optional[Netbanking] = Field(...) + __properties = ["netbanking"] + + class Config: + """Pydantic configuration""" + allow_population_by_field_name = True + validate_assignment = True + + def to_str(self) -> str: + """Returns the string representation of the model using alias""" + return pprint.pformat(self.dict(by_alias=True)) + + def to_json(self) -> str: + """Returns the JSON representation of the model using alias""" + return json.dumps(self.to_dict()) + + @classmethod + 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)) + + def to_dict(self): + """Returns the dictionary representation of the model using alias""" + _dict = self.dict(by_alias=True, + exclude={ + }, + exclude_none=True) + # override the default output from pydantic by calling `to_dict()` of netbanking + if self.netbanking: + _dict['netbanking'] = self.netbanking.to_dict() + # set to None if netbanking (nullable) is None + # and __fields_set__ contains the field + if self.netbanking is None and "netbanking" in self.__fields_set__: + _dict['netbanking'] = None + + return _dict + + @classmethod + def from_dict(cls, obj: dict) -> NetBankingPaymentMethod: + """Create an instance of NetBankingPaymentMethod from a dict""" + if obj is None: + return None + + if not isinstance(obj, dict): + return NetBankingPaymentMethod.parse_obj(obj) + + _obj = NetBankingPaymentMethod.parse_obj({ + "netbanking": Netbanking.from_dict(obj.get("netbanking")) if obj.get("netbanking") is not None else None + }) + return _obj + + diff --git a/models/netbanking.py b/models/netbanking.py new file mode 100644 index 0000000..bed5c3e --- /dev/null +++ b/models/netbanking.py @@ -0,0 +1,83 @@ +# coding: utf-8 + +""" + Cashfree Payment Gateway APIs + + Cashfree's Payment Gateway APIs provide developers with a streamlined pathway to integrate advanced payment processing capabilities into their applications, platforms and websites. + + The version of the OpenAPI document: 2022-09-01 + Contact: developers@cashfree.com + Generated by OpenAPI Generator (https://openapi-generator.tech) + + Do not edit the class manually. +""" # noqa: E501 + + +from __future__ import annotations +import pprint +import re # noqa: F401 +import json + + +from typing import Optional +from pydantic import BaseModel, Field, StrictStr, conint, constr, validator + +class Netbanking(BaseModel): + """ + Netbanking payment method request body + """ + channel: StrictStr = Field(..., description="The channel for netbanking will always be `link`") + netbanking_bank_code: Optional[conint(strict=True)] = Field(None, description="Bank code") + netbanking_bank_name: Optional[constr(strict=True)] = Field(None, description="String code for bank") + __properties = [] + + @validator('netbanking_bank_name') + def netbanking_bank_name_validate_regular_expression(cls, value): + """Validates the regular expression""" + if value is None: + return value + + if not re.match(r"^[A-Z]{4}$", value): + raise ValueError(r"must validate the regular expression /^[A-Z]{4}$/") + return value + + class Config: + """Pydantic configuration""" + allow_population_by_field_name = True + validate_assignment = True + + def to_str(self) -> str: + """Returns the string representation of the model using alias""" + return pprint.pformat(self.dict(by_alias=True)) + + def to_json(self) -> str: + """Returns the JSON representation of the model using alias""" + return json.dumps(self.to_dict()) + + @classmethod + 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)) + + def to_dict(self): + """Returns the dictionary representation of the model using alias""" + _dict = self.dict(by_alias=True, + exclude={ + }, + exclude_none=True) + return _dict + + @classmethod + def from_dict(cls, obj: dict) -> Netbanking: + """Create an instance of Netbanking from a dict""" + if obj is None: + return None + + if not isinstance(obj, dict): + return Netbanking.parse_obj(obj) + + _obj = Netbanking.parse_obj({ + }) + return _obj + + diff --git a/models/offer_all.py b/models/offer_all.py new file mode 100644 index 0000000..f042b7e --- /dev/null +++ b/models/offer_all.py @@ -0,0 +1,72 @@ +# coding: utf-8 + +""" + Cashfree Payment Gateway APIs + + Cashfree's Payment Gateway APIs provide developers with a streamlined pathway to integrate advanced payment processing capabilities into their applications, platforms and websites. + + The version of the OpenAPI document: 2022-09-01 + Contact: developers@cashfree.com + Generated by OpenAPI Generator (https://openapi-generator.tech) + + Do not edit the class manually. +""" # noqa: E501 + + +from __future__ import annotations +import pprint +import re # noqa: F401 +import json + + +from typing import Any, Dict +from pydantic import BaseModel, Field + +class OfferAll(BaseModel): + """ + returns all offers + """ + all: Dict[str, Any] = Field(..., description="All offers applicable") + __properties = ["all"] + + class Config: + """Pydantic configuration""" + allow_population_by_field_name = True + validate_assignment = True + + def to_str(self) -> str: + """Returns the string representation of the model using alias""" + return pprint.pformat(self.dict(by_alias=True)) + + def to_json(self) -> str: + """Returns the JSON representation of the model using alias""" + return json.dumps(self.to_dict()) + + @classmethod + 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)) + + def to_dict(self): + """Returns the dictionary representation of the model using alias""" + _dict = self.dict(by_alias=True, + exclude={ + }, + exclude_none=True) + return _dict + + @classmethod + def from_dict(cls, obj: dict) -> OfferAll: + """Create an instance of OfferAll from a dict""" + if obj is None: + return None + + if not isinstance(obj, dict): + return OfferAll.parse_obj(obj) + + _obj = OfferAll.parse_obj({ + "all": obj.get("all") + }) + return _obj + + diff --git a/models/offer_card.py b/models/offer_card.py new file mode 100644 index 0000000..e181049 --- /dev/null +++ b/models/offer_card.py @@ -0,0 +1,76 @@ +# coding: utf-8 + +""" + Cashfree Payment Gateway APIs + + Cashfree's Payment Gateway APIs provide developers with a streamlined pathway to integrate advanced payment processing capabilities into their applications, platforms and websites. + + The version of the OpenAPI document: 2022-09-01 + Contact: developers@cashfree.com + Generated by OpenAPI Generator (https://openapi-generator.tech) + + Do not edit the class manually. +""" # noqa: E501 + + +from __future__ import annotations +import pprint +import re # noqa: F401 +import json + + + +from pydantic import BaseModel, Field +from cashfree_pg.models.card_offer import CardOffer + +class OfferCard(BaseModel): + """ + Offers related to cards + """ + card: CardOffer = Field(...) + __properties = ["card"] + + class Config: + """Pydantic configuration""" + allow_population_by_field_name = True + validate_assignment = True + + def to_str(self) -> str: + """Returns the string representation of the model using alias""" + return pprint.pformat(self.dict(by_alias=True)) + + def to_json(self) -> str: + """Returns the JSON representation of the model using alias""" + return json.dumps(self.to_dict()) + + @classmethod + 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)) + + def to_dict(self): + """Returns the dictionary representation of the model using alias""" + _dict = self.dict(by_alias=True, + exclude={ + }, + exclude_none=True) + # override the default output from pydantic by calling `to_dict()` of card + if self.card: + _dict['card'] = self.card.to_dict() + return _dict + + @classmethod + def from_dict(cls, obj: dict) -> OfferCard: + """Create an instance of OfferCard from a dict""" + if obj is None: + return None + + if not isinstance(obj, dict): + return OfferCard.parse_obj(obj) + + _obj = OfferCard.parse_obj({ + "card": CardOffer.from_dict(obj.get("card")) if obj.get("card") is not None else None + }) + return _obj + + diff --git a/models/offer_details.py b/models/offer_details.py new file mode 100644 index 0000000..6d6440f --- /dev/null +++ b/models/offer_details.py @@ -0,0 +1,91 @@ +# coding: utf-8 + +""" + Cashfree Payment Gateway APIs + + Cashfree's Payment Gateway APIs provide developers with a streamlined pathway to integrate advanced payment processing capabilities into their applications, platforms and websites. + + The version of the OpenAPI document: 2022-09-01 + Contact: developers@cashfree.com + Generated by OpenAPI Generator (https://openapi-generator.tech) + + Do not edit the class manually. +""" # noqa: E501 + + +from __future__ import annotations +import pprint +import re # noqa: F401 +import json + + +from typing import Optional +from pydantic import BaseModel, Field, constr, validator +from cashfree_pg.models.cashback_details import CashbackDetails +from cashfree_pg.models.discount_details import DiscountDetails + +class OfferDetails(BaseModel): + """ + Offer details and type + """ + offer_type: constr(strict=True, max_length=50, min_length=3) = Field(..., description="Offer Type for the Offer.") + discount_details: Optional[DiscountDetails] = None + cashback_details: Optional[CashbackDetails] = None + __properties = ["offer_type", "discount_details", "cashback_details"] + + @validator('offer_type') + def offer_type_validate_enum(cls, value): + """Validates the enum""" + if value not in ('DISCOUNT', 'CASHBACK', 'DISCOUNT_AND_CASHBACK', 'NO_COST_EMI'): + raise ValueError("must be one of enum values ('DISCOUNT', 'CASHBACK', 'DISCOUNT_AND_CASHBACK', 'NO_COST_EMI')") + return value + + class Config: + """Pydantic configuration""" + allow_population_by_field_name = True + validate_assignment = True + + def to_str(self) -> str: + """Returns the string representation of the model using alias""" + return pprint.pformat(self.dict(by_alias=True)) + + def to_json(self) -> str: + """Returns the JSON representation of the model using alias""" + return json.dumps(self.to_dict()) + + @classmethod + 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)) + + def to_dict(self): + """Returns the dictionary representation of the model using alias""" + _dict = self.dict(by_alias=True, + exclude={ + }, + exclude_none=True) + # override the default output from pydantic by calling `to_dict()` of discount_details + if self.discount_details: + _dict['discount_details'] = self.discount_details.to_dict() + # override the default output from pydantic by calling `to_dict()` of cashback_details + if self.cashback_details: + _dict['cashback_details'] = self.cashback_details.to_dict() + return _dict + + @classmethod + def from_dict(cls, obj: dict) -> OfferDetails: + """Create an instance of OfferDetails from a dict""" + if obj is None: + return None + + if not isinstance(obj, dict): + return OfferDetails.parse_obj(obj) + + _obj = OfferDetails.parse_obj({ + "offer_type": obj.get("offer_type"), + "discount_details": DiscountDetails.from_dict(obj.get("discount_details")) if obj.get("discount_details") is not None else None, + "cashback_details": CashbackDetails.from_dict(obj.get("cashback_details")) if obj.get("cashback_details") is not None else None + }) + return _obj + + diff --git a/models/offer_emi.py b/models/offer_emi.py new file mode 100644 index 0000000..9b308a4 --- /dev/null +++ b/models/offer_emi.py @@ -0,0 +1,76 @@ +# coding: utf-8 + +""" + Cashfree Payment Gateway APIs + + Cashfree's Payment Gateway APIs provide developers with a streamlined pathway to integrate advanced payment processing capabilities into their applications, platforms and websites. + + The version of the OpenAPI document: 2022-09-01 + Contact: developers@cashfree.com + Generated by OpenAPI Generator (https://openapi-generator.tech) + + Do not edit the class manually. +""" # noqa: E501 + + +from __future__ import annotations +import pprint +import re # noqa: F401 +import json + + + +from pydantic import BaseModel, Field +from cashfree_pg.models.emi_offer import EMIOffer + +class OfferEMI(BaseModel): + """ + EMI offer object + """ + emi: EMIOffer = Field(...) + __properties = ["emi"] + + class Config: + """Pydantic configuration""" + allow_population_by_field_name = True + validate_assignment = True + + def to_str(self) -> str: + """Returns the string representation of the model using alias""" + return pprint.pformat(self.dict(by_alias=True)) + + def to_json(self) -> str: + """Returns the JSON representation of the model using alias""" + return json.dumps(self.to_dict()) + + @classmethod + 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)) + + def to_dict(self): + """Returns the dictionary representation of the model using alias""" + _dict = self.dict(by_alias=True, + exclude={ + }, + exclude_none=True) + # override the default output from pydantic by calling `to_dict()` of emi + if self.emi: + _dict['emi'] = self.emi.to_dict() + return _dict + + @classmethod + def from_dict(cls, obj: dict) -> OfferEMI: + """Create an instance of OfferEMI from a dict""" + if obj is None: + return None + + if not isinstance(obj, dict): + return OfferEMI.parse_obj(obj) + + _obj = OfferEMI.parse_obj({ + "emi": EMIOffer.from_dict(obj.get("emi")) if obj.get("emi") is not None else None + }) + return _obj + + diff --git a/models/offer_entity.py b/models/offer_entity.py new file mode 100644 index 0000000..3d476d5 --- /dev/null +++ b/models/offer_entity.py @@ -0,0 +1,98 @@ +# coding: utf-8 + +""" + Cashfree Payment Gateway APIs + + Cashfree's Payment Gateway APIs provide developers with a streamlined pathway to integrate advanced payment processing capabilities into their applications, platforms and websites. + + The version of the OpenAPI document: 2022-09-01 + Contact: developers@cashfree.com + Generated by OpenAPI Generator (https://openapi-generator.tech) + + Do not edit the class manually. +""" # noqa: E501 + + +from __future__ import annotations +import pprint +import re # noqa: F401 +import json + + +from typing import Optional +from pydantic import BaseModel, StrictStr +from cashfree_pg.models.offer_details import OfferDetails +from cashfree_pg.models.offer_meta import OfferMeta +from cashfree_pg.models.offer_tnc import OfferTnc +from cashfree_pg.models.offer_validations import OfferValidations + +class OfferEntity(BaseModel): + """ + Offer entity object + """ + offer_id: Optional[StrictStr] = None + offer_status: Optional[StrictStr] = None + offer_meta: Optional[OfferMeta] = None + offer_tnc: Optional[OfferTnc] = None + offer_details: Optional[OfferDetails] = None + offer_validations: Optional[OfferValidations] = None + __properties = ["offer_id", "offer_status", "offer_meta", "offer_tnc", "offer_details", "offer_validations"] + + class Config: + """Pydantic configuration""" + allow_population_by_field_name = True + validate_assignment = True + + def to_str(self) -> str: + """Returns the string representation of the model using alias""" + return pprint.pformat(self.dict(by_alias=True)) + + def to_json(self) -> str: + """Returns the JSON representation of the model using alias""" + return json.dumps(self.to_dict()) + + @classmethod + 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)) + + def to_dict(self): + """Returns the dictionary representation of the model using alias""" + _dict = self.dict(by_alias=True, + exclude={ + }, + exclude_none=True) + # override the default output from pydantic by calling `to_dict()` of offer_meta + if self.offer_meta: + _dict['offer_meta'] = self.offer_meta.to_dict() + # override the default output from pydantic by calling `to_dict()` of offer_tnc + if self.offer_tnc: + _dict['offer_tnc'] = self.offer_tnc.to_dict() + # override the default output from pydantic by calling `to_dict()` of offer_details + if self.offer_details: + _dict['offer_details'] = self.offer_details.to_dict() + # override the default output from pydantic by calling `to_dict()` of offer_validations + if self.offer_validations: + _dict['offer_validations'] = self.offer_validations.to_dict() + return _dict + + @classmethod + def from_dict(cls, obj: dict) -> OfferEntity: + """Create an instance of OfferEntity from a dict""" + if obj is None: + return None + + if not isinstance(obj, dict): + return OfferEntity.parse_obj(obj) + + _obj = OfferEntity.parse_obj({ + "offer_id": obj.get("offer_id"), + "offer_status": obj.get("offer_status"), + "offer_meta": OfferMeta.from_dict(obj.get("offer_meta")) if obj.get("offer_meta") is not None else None, + "offer_tnc": OfferTnc.from_dict(obj.get("offer_tnc")) if obj.get("offer_tnc") is not None else None, + "offer_details": OfferDetails.from_dict(obj.get("offer_details")) if obj.get("offer_details") is not None else None, + "offer_validations": OfferValidations.from_dict(obj.get("offer_validations")) if obj.get("offer_validations") is not None else None + }) + return _obj + + diff --git a/models/offer_filters.py b/models/offer_filters.py new file mode 100644 index 0000000..b207c42 --- /dev/null +++ b/models/offer_filters.py @@ -0,0 +1,73 @@ +# coding: utf-8 + +""" + Cashfree Payment Gateway APIs + + Cashfree's Payment Gateway APIs provide developers with a streamlined pathway to integrate advanced payment processing capabilities into their applications, platforms and websites. + + The version of the OpenAPI document: 2022-09-01 + Contact: developers@cashfree.com + Generated by OpenAPI Generator (https://openapi-generator.tech) + + Do not edit the class manually. +""" # noqa: E501 + + +from __future__ import annotations +import pprint +import re # noqa: F401 +import json + + +from typing import List, Optional +from pydantic import BaseModel, Field, conlist +from cashfree_pg.models.offer_type import OfferType + +class OfferFilters(BaseModel): + """ + Filter for offers + """ + offer_type: Optional[conlist(OfferType)] = Field(None, description="Array of offer_type to be filtered.") + __properties = ["offer_type"] + + class Config: + """Pydantic configuration""" + allow_population_by_field_name = True + validate_assignment = True + + def to_str(self) -> str: + """Returns the string representation of the model using alias""" + return pprint.pformat(self.dict(by_alias=True)) + + def to_json(self) -> str: + """Returns the JSON representation of the model using alias""" + return json.dumps(self.to_dict()) + + @classmethod + 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)) + + def to_dict(self): + """Returns the dictionary representation of the model using alias""" + _dict = self.dict(by_alias=True, + exclude={ + }, + exclude_none=True) + return _dict + + @classmethod + def from_dict(cls, obj: dict) -> OfferFilters: + """Create an instance of OfferFilters from a dict""" + if obj is None: + return None + + if not isinstance(obj, dict): + return OfferFilters.parse_obj(obj) + + _obj = OfferFilters.parse_obj({ + "offer_type": obj.get("offer_type") + }) + return _obj + + diff --git a/models/offer_meta.py b/models/offer_meta.py new file mode 100644 index 0000000..8aa37f1 --- /dev/null +++ b/models/offer_meta.py @@ -0,0 +1,80 @@ +# coding: utf-8 + +""" + Cashfree Payment Gateway APIs + + Cashfree's Payment Gateway APIs provide developers with a streamlined pathway to integrate advanced payment processing capabilities into their applications, platforms and websites. + + The version of the OpenAPI document: 2022-09-01 + Contact: developers@cashfree.com + Generated by OpenAPI Generator (https://openapi-generator.tech) + + Do not edit the class manually. +""" # noqa: E501 + + +from __future__ import annotations +import pprint +import re # noqa: F401 +import json + + + +from pydantic import BaseModel, Field, StrictStr, constr + +class OfferMeta(BaseModel): + """ + Offer meta details object + """ + offer_title: constr(strict=True, max_length=50, min_length=3) = Field(..., description="Title for the Offer.") + offer_description: constr(strict=True, max_length=100, min_length=3) = Field(..., description="Description for the Offer.") + offer_code: constr(strict=True, max_length=45, min_length=1) = Field(..., description="Unique identifier for the Offer.") + offer_start_time: constr(strict=True, max_length=20, min_length=3) = Field(..., description="Start Time for the Offer") + offer_end_time: StrictStr = Field(..., description="Expiry Time for the Offer") + __properties = ["offer_title", "offer_description", "offer_code", "offer_start_time", "offer_end_time"] + + class Config: + """Pydantic configuration""" + allow_population_by_field_name = True + validate_assignment = True + + def to_str(self) -> str: + """Returns the string representation of the model using alias""" + return pprint.pformat(self.dict(by_alias=True)) + + def to_json(self) -> str: + """Returns the JSON representation of the model using alias""" + return json.dumps(self.to_dict()) + + @classmethod + 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)) + + def to_dict(self): + """Returns the dictionary representation of the model using alias""" + _dict = self.dict(by_alias=True, + exclude={ + }, + exclude_none=True) + return _dict + + @classmethod + def from_dict(cls, obj: dict) -> OfferMeta: + """Create an instance of OfferMeta from a dict""" + if obj is None: + return None + + if not isinstance(obj, dict): + return OfferMeta.parse_obj(obj) + + _obj = OfferMeta.parse_obj({ + "offer_title": obj.get("offer_title"), + "offer_description": obj.get("offer_description"), + "offer_code": obj.get("offer_code"), + "offer_start_time": obj.get("offer_start_time"), + "offer_end_time": obj.get("offer_end_time") + }) + return _obj + + diff --git a/models/offer_nb.py b/models/offer_nb.py new file mode 100644 index 0000000..72f73e5 --- /dev/null +++ b/models/offer_nb.py @@ -0,0 +1,76 @@ +# coding: utf-8 + +""" + Cashfree Payment Gateway APIs + + Cashfree's Payment Gateway APIs provide developers with a streamlined pathway to integrate advanced payment processing capabilities into their applications, platforms and websites. + + The version of the OpenAPI document: 2022-09-01 + Contact: developers@cashfree.com + Generated by OpenAPI Generator (https://openapi-generator.tech) + + Do not edit the class manually. +""" # noqa: E501 + + +from __future__ import annotations +import pprint +import re # noqa: F401 +import json + + + +from pydantic import BaseModel, Field +from cashfree_pg.models.offer_nb_netbanking import OfferNBNetbanking + +class OfferNB(BaseModel): + """ + Offer object ofr NetBanking + """ + netbanking: OfferNBNetbanking = Field(...) + __properties = ["netbanking"] + + class Config: + """Pydantic configuration""" + allow_population_by_field_name = True + validate_assignment = True + + def to_str(self) -> str: + """Returns the string representation of the model using alias""" + return pprint.pformat(self.dict(by_alias=True)) + + def to_json(self) -> str: + """Returns the JSON representation of the model using alias""" + return json.dumps(self.to_dict()) + + @classmethod + 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)) + + def to_dict(self): + """Returns the dictionary representation of the model using alias""" + _dict = self.dict(by_alias=True, + exclude={ + }, + exclude_none=True) + # override the default output from pydantic by calling `to_dict()` of netbanking + if self.netbanking: + _dict['netbanking'] = self.netbanking.to_dict() + return _dict + + @classmethod + def from_dict(cls, obj: dict) -> OfferNB: + """Create an instance of OfferNB from a dict""" + if obj is None: + return None + + if not isinstance(obj, dict): + return OfferNB.parse_obj(obj) + + _obj = OfferNB.parse_obj({ + "netbanking": OfferNBNetbanking.from_dict(obj.get("netbanking")) if obj.get("netbanking") is not None else None + }) + return _obj + + diff --git a/models/offer_nb_netbanking.py b/models/offer_nb_netbanking.py new file mode 100644 index 0000000..81e0eca --- /dev/null +++ b/models/offer_nb_netbanking.py @@ -0,0 +1,72 @@ +# coding: utf-8 + +""" + Cashfree Payment Gateway APIs + + Cashfree's Payment Gateway APIs provide developers with a streamlined pathway to integrate advanced payment processing capabilities into their applications, platforms and websites. + + The version of the OpenAPI document: 2022-09-01 + Contact: developers@cashfree.com + Generated by OpenAPI Generator (https://openapi-generator.tech) + + Do not edit the class manually. +""" # noqa: E501 + + +from __future__ import annotations +import pprint +import re # noqa: F401 +import json + + +from typing import Optional +from pydantic import BaseModel, StrictStr + +class OfferNBNetbanking(BaseModel): + """ + OfferNBNetbanking + """ + bank_name: Optional[StrictStr] = None + __properties = ["bank_name"] + + class Config: + """Pydantic configuration""" + allow_population_by_field_name = True + validate_assignment = True + + def to_str(self) -> str: + """Returns the string representation of the model using alias""" + return pprint.pformat(self.dict(by_alias=True)) + + def to_json(self) -> str: + """Returns the JSON representation of the model using alias""" + return json.dumps(self.to_dict()) + + @classmethod + 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)) + + def to_dict(self): + """Returns the dictionary representation of the model using alias""" + _dict = self.dict(by_alias=True, + exclude={ + }, + exclude_none=True) + return _dict + + @classmethod + def from_dict(cls, obj: dict) -> OfferNBNetbanking: + """Create an instance of OfferNBNetbanking from a dict""" + if obj is None: + return None + + if not isinstance(obj, dict): + return OfferNBNetbanking.parse_obj(obj) + + _obj = OfferNBNetbanking.parse_obj({ + "bank_name": obj.get("bank_name") + }) + return _obj + + diff --git a/models/offer_paylater.py b/models/offer_paylater.py new file mode 100644 index 0000000..aa7eba9 --- /dev/null +++ b/models/offer_paylater.py @@ -0,0 +1,76 @@ +# coding: utf-8 + +""" + Cashfree Payment Gateway APIs + + Cashfree's Payment Gateway APIs provide developers with a streamlined pathway to integrate advanced payment processing capabilities into their applications, platforms and websites. + + The version of the OpenAPI document: 2022-09-01 + Contact: developers@cashfree.com + Generated by OpenAPI Generator (https://openapi-generator.tech) + + Do not edit the class manually. +""" # noqa: E501 + + +from __future__ import annotations +import pprint +import re # noqa: F401 +import json + + + +from pydantic import BaseModel, Field +from cashfree_pg.models.paylater_offer import PaylaterOffer + +class OfferPaylater(BaseModel): + """ + Offer object for paylater + """ + paylater: PaylaterOffer = Field(...) + __properties = ["paylater"] + + class Config: + """Pydantic configuration""" + allow_population_by_field_name = True + validate_assignment = True + + def to_str(self) -> str: + """Returns the string representation of the model using alias""" + return pprint.pformat(self.dict(by_alias=True)) + + def to_json(self) -> str: + """Returns the JSON representation of the model using alias""" + return json.dumps(self.to_dict()) + + @classmethod + 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)) + + def to_dict(self): + """Returns the dictionary representation of the model using alias""" + _dict = self.dict(by_alias=True, + exclude={ + }, + exclude_none=True) + # override the default output from pydantic by calling `to_dict()` of paylater + if self.paylater: + _dict['paylater'] = self.paylater.to_dict() + return _dict + + @classmethod + def from_dict(cls, obj: dict) -> OfferPaylater: + """Create an instance of OfferPaylater from a dict""" + if obj is None: + return None + + if not isinstance(obj, dict): + return OfferPaylater.parse_obj(obj) + + _obj = OfferPaylater.parse_obj({ + "paylater": PaylaterOffer.from_dict(obj.get("paylater")) if obj.get("paylater") is not None else None + }) + return _obj + + diff --git a/models/offer_queries.py b/models/offer_queries.py new file mode 100644 index 0000000..103eabc --- /dev/null +++ b/models/offer_queries.py @@ -0,0 +1,74 @@ +# coding: utf-8 + +""" + Cashfree Payment Gateway APIs + + Cashfree's Payment Gateway APIs provide developers with a streamlined pathway to integrate advanced payment processing capabilities into their applications, platforms and websites. + + The version of the OpenAPI document: 2022-09-01 + Contact: developers@cashfree.com + Generated by OpenAPI Generator (https://openapi-generator.tech) + + Do not edit the class manually. +""" # noqa: E501 + + +from __future__ import annotations +import pprint +import re # noqa: F401 +import json + + +from typing import Optional, Union +from pydantic import BaseModel, Field, confloat, conint, constr + +class OfferQueries(BaseModel): + """ + Offer Query Object + """ + order_id: Optional[constr(strict=True, max_length=50, min_length=3)] = Field(None, description="OrderId of the order. Either of `order_id` or `order_amount` is mandatory.") + amount: Optional[Union[confloat(ge=1, strict=True), conint(ge=1, strict=True)]] = Field(None, description="Amount of the order. OrderId of the order. Either of `order_id` or `order_amount` is mandatory.") + __properties = ["order_id", "amount"] + + class Config: + """Pydantic configuration""" + allow_population_by_field_name = True + validate_assignment = True + + def to_str(self) -> str: + """Returns the string representation of the model using alias""" + return pprint.pformat(self.dict(by_alias=True)) + + def to_json(self) -> str: + """Returns the JSON representation of the model using alias""" + return json.dumps(self.to_dict()) + + @classmethod + 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)) + + def to_dict(self): + """Returns the dictionary representation of the model using alias""" + _dict = self.dict(by_alias=True, + exclude={ + }, + exclude_none=True) + return _dict + + @classmethod + def from_dict(cls, obj: dict) -> OfferQueries: + """Create an instance of OfferQueries from a dict""" + if obj is None: + return None + + if not isinstance(obj, dict): + return OfferQueries.parse_obj(obj) + + _obj = OfferQueries.parse_obj({ + "order_id": obj.get("order_id"), + "amount": obj.get("amount") + }) + return _obj + + diff --git a/models/offer_tnc.py b/models/offer_tnc.py new file mode 100644 index 0000000..9b7911a --- /dev/null +++ b/models/offer_tnc.py @@ -0,0 +1,81 @@ +# coding: utf-8 + +""" + Cashfree Payment Gateway APIs + + Cashfree's Payment Gateway APIs provide developers with a streamlined pathway to integrate advanced payment processing capabilities into their applications, platforms and websites. + + The version of the OpenAPI document: 2022-09-01 + Contact: developers@cashfree.com + Generated by OpenAPI Generator (https://openapi-generator.tech) + + Do not edit the class manually. +""" # noqa: E501 + + +from __future__ import annotations +import pprint +import re # noqa: F401 +import json + + + +from pydantic import BaseModel, Field, constr, validator + +class OfferTnc(BaseModel): + """ + Offer terms and condition object + """ + offer_tnc_type: constr(strict=True, max_length=50, min_length=3) = Field(..., description="TnC Type for the Offer. It can be either `text` or `link`") + offer_tnc_value: constr(strict=True, max_length=100, min_length=3) = Field(..., description="TnC for the Offer.") + __properties = ["offer_tnc_type", "offer_tnc_value"] + + @validator('offer_tnc_type') + def offer_tnc_type_validate_enum(cls, value): + """Validates the enum""" + if value not in ('text', 'link'): + raise ValueError("must be one of enum values ('text', 'link')") + return value + + class Config: + """Pydantic configuration""" + allow_population_by_field_name = True + validate_assignment = True + + def to_str(self) -> str: + """Returns the string representation of the model using alias""" + return pprint.pformat(self.dict(by_alias=True)) + + def to_json(self) -> str: + """Returns the JSON representation of the model using alias""" + return json.dumps(self.to_dict()) + + @classmethod + 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)) + + def to_dict(self): + """Returns the dictionary representation of the model using alias""" + _dict = self.dict(by_alias=True, + exclude={ + }, + exclude_none=True) + return _dict + + @classmethod + def from_dict(cls, obj: dict) -> OfferTnc: + """Create an instance of OfferTnc from a dict""" + if obj is None: + return None + + if not isinstance(obj, dict): + return OfferTnc.parse_obj(obj) + + _obj = OfferTnc.parse_obj({ + "offer_tnc_type": obj.get("offer_tnc_type"), + "offer_tnc_value": obj.get("offer_tnc_value") + }) + return _obj + + diff --git a/models/offer_type.py b/models/offer_type.py new file mode 100644 index 0000000..a648e4d --- /dev/null +++ b/models/offer_type.py @@ -0,0 +1,43 @@ +# coding: utf-8 + +""" + Cashfree Payment Gateway APIs + + Cashfree's Payment Gateway APIs provide developers with a streamlined pathway to integrate advanced payment processing capabilities into their applications, platforms and websites. + + The version of the OpenAPI document: 2022-09-01 + Contact: developers@cashfree.com + Generated by OpenAPI Generator (https://openapi-generator.tech) + + Do not edit the class manually. +""" # noqa: E501 + + +import json +import pprint +import re # noqa: F401 +from aenum import Enum, no_arg + + + + + +class OfferType(str, Enum): + """ + Offer Type Object + """ + + """ + allowed enum values + """ + DISCOUNT = 'DISCOUNT' + CASHBACK = 'CASHBACK' + DISCOUNT_AND_CASHBACK = 'DISCOUNT_AND_CASHBACK' + NO_COST_EMI = 'NO_COST_EMI' + + @classmethod + def from_json(cls, json_str: str) -> OfferType: + """Create an instance of OfferType from a JSON string""" + return OfferType(json.loads(json_str)) + + diff --git a/models/offer_upi.py b/models/offer_upi.py new file mode 100644 index 0000000..4cea112 --- /dev/null +++ b/models/offer_upi.py @@ -0,0 +1,72 @@ +# coding: utf-8 + +""" + Cashfree Payment Gateway APIs + + Cashfree's Payment Gateway APIs provide developers with a streamlined pathway to integrate advanced payment processing capabilities into their applications, platforms and websites. + + The version of the OpenAPI document: 2022-09-01 + Contact: developers@cashfree.com + Generated by OpenAPI Generator (https://openapi-generator.tech) + + Do not edit the class manually. +""" # noqa: E501 + + +from __future__ import annotations +import pprint +import re # noqa: F401 +import json + + +from typing import Any, Dict +from pydantic import BaseModel, Field + +class OfferUPI(BaseModel): + """ + Offer object for UPI + """ + upi: Dict[str, Any] = Field(...) + __properties = ["upi"] + + class Config: + """Pydantic configuration""" + allow_population_by_field_name = True + validate_assignment = True + + def to_str(self) -> str: + """Returns the string representation of the model using alias""" + return pprint.pformat(self.dict(by_alias=True)) + + def to_json(self) -> str: + """Returns the JSON representation of the model using alias""" + return json.dumps(self.to_dict()) + + @classmethod + 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)) + + def to_dict(self): + """Returns the dictionary representation of the model using alias""" + _dict = self.dict(by_alias=True, + exclude={ + }, + exclude_none=True) + return _dict + + @classmethod + def from_dict(cls, obj: dict) -> OfferUPI: + """Create an instance of OfferUPI from a dict""" + if obj is None: + return None + + if not isinstance(obj, dict): + return OfferUPI.parse_obj(obj) + + _obj = OfferUPI.parse_obj({ + "upi": obj.get("upi") + }) + return _obj + + diff --git a/models/offer_validations.py b/models/offer_validations.py new file mode 100644 index 0000000..1d5eb20 --- /dev/null +++ b/models/offer_validations.py @@ -0,0 +1,80 @@ +# coding: utf-8 + +""" + Cashfree Payment Gateway APIs + + Cashfree's Payment Gateway APIs provide developers with a streamlined pathway to integrate advanced payment processing capabilities into their applications, platforms and websites. + + The version of the OpenAPI document: 2022-09-01 + Contact: developers@cashfree.com + Generated by OpenAPI Generator (https://openapi-generator.tech) + + Do not edit the class manually. +""" # noqa: E501 + + +from __future__ import annotations +import pprint +import re # noqa: F401 +import json + + +from typing import Optional, Union +from pydantic import BaseModel, Field, confloat, conint +from cashfree_pg.models.offer_validations_payment_method import OfferValidationsPaymentMethod + +class OfferValidations(BaseModel): + """ + Offer validation object + """ + min_amount: Optional[Union[confloat(ge=1, strict=True), conint(ge=1, strict=True)]] = Field(None, description="Minimum Amount for Offer to be Applicable") + payment_method: OfferValidationsPaymentMethod = Field(...) + max_allowed: Union[confloat(ge=1, strict=True), conint(ge=1, strict=True)] = Field(..., description="Maximum amount of Offer that can be availed.") + __properties = ["min_amount", "payment_method", "max_allowed"] + + class Config: + """Pydantic configuration""" + allow_population_by_field_name = True + validate_assignment = True + + def to_str(self) -> str: + """Returns the string representation of the model using alias""" + return pprint.pformat(self.dict(by_alias=True)) + + def to_json(self) -> str: + """Returns the JSON representation of the model using alias""" + return json.dumps(self.to_dict()) + + @classmethod + 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)) + + def to_dict(self): + """Returns the dictionary representation of the model using alias""" + _dict = self.dict(by_alias=True, + exclude={ + }, + exclude_none=True) + # override the default output from pydantic by calling `to_dict()` of payment_method + if self.payment_method: + _dict['payment_method'] = self.payment_method.to_dict() + return _dict + + @classmethod + def from_dict(cls, obj: dict) -> OfferValidations: + """Create an instance of OfferValidations from a dict""" + if obj is None: + return None + + if not isinstance(obj, dict): + return OfferValidations.parse_obj(obj) + + _obj = OfferValidations.parse_obj({ + "min_amount": obj.get("min_amount"), + "payment_method": OfferValidationsPaymentMethod.from_dict(obj.get("payment_method")) if obj.get("payment_method") is not None else None, + "max_allowed": obj.get("max_allowed") + }) + return _obj + + diff --git a/models/offer_validations_payment_method.py b/models/offer_validations_payment_method.py new file mode 100644 index 0000000..0aed44a --- /dev/null +++ b/models/offer_validations_payment_method.py @@ -0,0 +1,212 @@ +# coding: utf-8 + +""" + Cashfree Payment Gateway APIs + + Cashfree's Payment Gateway APIs provide developers with a streamlined pathway to integrate advanced payment processing capabilities into their applications, platforms and websites. + + The version of the OpenAPI document: 2022-09-01 + Contact: developers@cashfree.com + Generated by OpenAPI Generator (https://openapi-generator.tech) + + Do not edit the class manually. +""" # noqa: E501 + + +from __future__ import annotations +from inspect import getfullargspec +import json +import pprint +import re # noqa: F401 + +from typing import Any, List, Optional +from pydantic import BaseModel, Field, StrictStr, ValidationError, validator +from cashfree_pg.models.offer_all import OfferAll +from cashfree_pg.models.offer_card import OfferCard +from cashfree_pg.models.offer_emi import OfferEMI +from cashfree_pg.models.offer_nb import OfferNB +from cashfree_pg.models.offer_paylater import OfferPaylater +from cashfree_pg.models.offer_upi import OfferUPI +from cashfree_pg.models.offer_wallet import OfferWallet +from typing import Union, Any, List, TYPE_CHECKING +from pydantic import StrictStr, Field + +OFFERVALIDATIONSPAYMENTMETHOD_ONE_OF_SCHEMAS = ["OfferAll", "OfferCard", "OfferEMI", "OfferNB", "OfferPaylater", "OfferUPI", "OfferWallet"] + +class OfferValidationsPaymentMethod(BaseModel): + """ + OfferValidationsPaymentMethod + """ + # data type: OfferAll + oneof_schema_1_validator: Optional[OfferAll] = None + # data type: OfferCard + oneof_schema_2_validator: Optional[OfferCard] = None + # data type: OfferNB + oneof_schema_3_validator: Optional[OfferNB] = None + # data type: OfferWallet + oneof_schema_4_validator: Optional[OfferWallet] = None + # data type: OfferUPI + oneof_schema_5_validator: Optional[OfferUPI] = None + # data type: OfferPaylater + oneof_schema_6_validator: Optional[OfferPaylater] = None + # data type: OfferEMI + oneof_schema_7_validator: Optional[OfferEMI] = None + if TYPE_CHECKING: + actual_instance: Union[OfferAll, OfferCard, OfferEMI, OfferNB, OfferPaylater, OfferUPI, OfferWallet] + else: + actual_instance: Any + one_of_schemas: List[str] = Field(OFFERVALIDATIONSPAYMENTMETHOD_ONE_OF_SCHEMAS, const=True) + + class Config: + validate_assignment = True + + def __init__(self, *args, **kwargs): + if args: + if len(args) > 1: + raise ValueError("If a position argument is used, only 1 is allowed to set `actual_instance`") + if kwargs: + raise ValueError("If a position argument is used, keyword arguments cannot be used.") + super().__init__(actual_instance=args[0]) + else: + super().__init__(**kwargs) + + @validator('actual_instance') + def actual_instance_must_validate_oneof(cls, v): + instance = OfferValidationsPaymentMethod.construct() + error_messages = [] + match = 0 + # validate data type: OfferAll + if not isinstance(v, OfferAll): + error_messages.append(f"Error! Input type `{type(v)}` is not `OfferAll`") + else: + match += 1 + # validate data type: OfferCard + if not isinstance(v, OfferCard): + error_messages.append(f"Error! Input type `{type(v)}` is not `OfferCard`") + else: + match += 1 + # validate data type: OfferNB + if not isinstance(v, OfferNB): + error_messages.append(f"Error! Input type `{type(v)}` is not `OfferNB`") + else: + match += 1 + # validate data type: OfferWallet + if not isinstance(v, OfferWallet): + error_messages.append(f"Error! Input type `{type(v)}` is not `OfferWallet`") + else: + match += 1 + # validate data type: OfferUPI + if not isinstance(v, OfferUPI): + error_messages.append(f"Error! Input type `{type(v)}` is not `OfferUPI`") + else: + match += 1 + # validate data type: OfferPaylater + if not isinstance(v, OfferPaylater): + error_messages.append(f"Error! Input type `{type(v)}` is not `OfferPaylater`") + else: + match += 1 + # validate data type: OfferEMI + if not isinstance(v, OfferEMI): + error_messages.append(f"Error! Input type `{type(v)}` is not `OfferEMI`") + else: + match += 1 + if match > 1: + # more than 1 match + raise ValueError("Multiple matches found when setting `actual_instance` in OfferValidationsPaymentMethod with oneOf schemas: OfferAll, OfferCard, OfferEMI, OfferNB, OfferPaylater, OfferUPI, OfferWallet. Details: " + ", ".join(error_messages)) + elif match == 0: + # no match + raise ValueError("No match found when setting `actual_instance` in OfferValidationsPaymentMethod with oneOf schemas: OfferAll, OfferCard, OfferEMI, OfferNB, OfferPaylater, OfferUPI, OfferWallet. Details: " + ", ".join(error_messages)) + else: + return v + + @classmethod + def from_dict(cls, obj: dict) -> OfferValidationsPaymentMethod: + return cls.from_json(json.dumps(obj)) + + @classmethod + def from_json(cls, json_str: str) -> OfferValidationsPaymentMethod: + """Returns the object represented by the json string""" + instance = OfferValidationsPaymentMethod.construct() + error_messages = [] + match = 0 + + # deserialize data into OfferAll + try: + instance.actual_instance = OfferAll.from_json(json_str) + match += 1 + except (ValidationError, ValueError) as e: + error_messages.append(str(e)) + # deserialize data into OfferCard + try: + instance.actual_instance = OfferCard.from_json(json_str) + match += 1 + except (ValidationError, ValueError) as e: + error_messages.append(str(e)) + # deserialize data into OfferNB + try: + instance.actual_instance = OfferNB.from_json(json_str) + match += 1 + except (ValidationError, ValueError) as e: + error_messages.append(str(e)) + # deserialize data into OfferWallet + try: + instance.actual_instance = OfferWallet.from_json(json_str) + match += 1 + except (ValidationError, ValueError) as e: + error_messages.append(str(e)) + # deserialize data into OfferUPI + try: + instance.actual_instance = OfferUPI.from_json(json_str) + match += 1 + except (ValidationError, ValueError) as e: + error_messages.append(str(e)) + # deserialize data into OfferPaylater + try: + instance.actual_instance = OfferPaylater.from_json(json_str) + match += 1 + except (ValidationError, ValueError) as e: + error_messages.append(str(e)) + # deserialize data into OfferEMI + try: + instance.actual_instance = OfferEMI.from_json(json_str) + match += 1 + except (ValidationError, ValueError) as e: + error_messages.append(str(e)) + + if match > 1: + # more than 1 match + raise ValueError("Multiple matches found when deserializing the JSON string into OfferValidationsPaymentMethod with oneOf schemas: OfferAll, OfferCard, OfferEMI, OfferNB, OfferPaylater, OfferUPI, OfferWallet. Details: " + ", ".join(error_messages)) + elif match == 0: + # no match + raise ValueError("No match found when deserializing the JSON string into OfferValidationsPaymentMethod with oneOf schemas: OfferAll, OfferCard, OfferEMI, OfferNB, OfferPaylater, OfferUPI, OfferWallet. Details: " + ", ".join(error_messages)) + else: + return instance + + def to_json(self) -> str: + """Returns the JSON representation of the actual instance""" + if self.actual_instance is None: + return "null" + + to_json = getattr(self.actual_instance, "to_json", None) + if callable(to_json): + return self.actual_instance.to_json() + else: + return json.dumps(self.actual_instance) + + def to_dict(self) -> dict: + """Returns the dict representation of the actual instance""" + if self.actual_instance is None: + return None + + to_dict = getattr(self.actual_instance, "to_dict", None) + if callable(to_dict): + return self.actual_instance.to_dict() + else: + # primitive type + return self.actual_instance + + def to_str(self) -> str: + """Returns the string representation of the actual instance""" + return pprint.pformat(self.dict()) + + diff --git a/models/offer_wallet.py b/models/offer_wallet.py new file mode 100644 index 0000000..6d0e1f0 --- /dev/null +++ b/models/offer_wallet.py @@ -0,0 +1,76 @@ +# coding: utf-8 + +""" + Cashfree Payment Gateway APIs + + Cashfree's Payment Gateway APIs provide developers with a streamlined pathway to integrate advanced payment processing capabilities into their applications, platforms and websites. + + The version of the OpenAPI document: 2022-09-01 + Contact: developers@cashfree.com + Generated by OpenAPI Generator (https://openapi-generator.tech) + + Do not edit the class manually. +""" # noqa: E501 + + +from __future__ import annotations +import pprint +import re # noqa: F401 +import json + + +from typing import Optional +from pydantic import BaseModel +from cashfree_pg.models.wallet_offer import WalletOffer + +class OfferWallet(BaseModel): + """ + Offer object for wallet payment method + """ + app: Optional[WalletOffer] = None + __properties = ["app"] + + class Config: + """Pydantic configuration""" + allow_population_by_field_name = True + validate_assignment = True + + def to_str(self) -> str: + """Returns the string representation of the model using alias""" + return pprint.pformat(self.dict(by_alias=True)) + + def to_json(self) -> str: + """Returns the JSON representation of the model using alias""" + return json.dumps(self.to_dict()) + + @classmethod + 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)) + + def to_dict(self): + """Returns the dictionary representation of the model using alias""" + _dict = self.dict(by_alias=True, + exclude={ + }, + exclude_none=True) + # override the default output from pydantic by calling `to_dict()` of app + if self.app: + _dict['app'] = self.app.to_dict() + return _dict + + @classmethod + def from_dict(cls, obj: dict) -> OfferWallet: + """Create an instance of OfferWallet from a dict""" + if obj is None: + return None + + if not isinstance(obj, dict): + return OfferWallet.parse_obj(obj) + + _obj = OfferWallet.parse_obj({ + "app": WalletOffer.from_dict(obj.get("app")) if obj.get("app") is not None else None + }) + return _obj + + diff --git a/models/order_authenticate_entity.py b/models/order_authenticate_entity.py new file mode 100644 index 0000000..d4b8cfc --- /dev/null +++ b/models/order_authenticate_entity.py @@ -0,0 +1,98 @@ +# coding: utf-8 + +""" + Cashfree Payment Gateway APIs + + Cashfree's Payment Gateway APIs provide developers with a streamlined pathway to integrate advanced payment processing capabilities into their applications, platforms and websites. + + The version of the OpenAPI document: 2022-09-01 + Contact: developers@cashfree.com + Generated by OpenAPI Generator (https://openapi-generator.tech) + + Do not edit the class manually. +""" # noqa: E501 + + +from __future__ import annotations +import pprint +import re # noqa: F401 +import json + + +from typing import Optional, Union +from pydantic import BaseModel, Field, StrictFloat, StrictInt, StrictStr, validator + +class OrderAuthenticateEntity(BaseModel): + """ + This is the response shared when merchant inovkes the OTP submit or resend API + """ + cf_payment_id: Optional[Union[StrictFloat, StrictInt]] = Field(None, description="The payment id for which this request was sent") + action: Optional[StrictStr] = Field(None, description="The action that was invoked for this request.") + authenticate_status: Optional[StrictStr] = Field(None, description="Status of the is action. Will be either failed or successful. If the action is successful, you should still call the authorization status to verify the final payment status.") + payment_message: Optional[StrictStr] = Field(None, description="Human readable message which describes the status in more detail") + __properties = ["cf_payment_id", "action", "authenticate_status", "payment_message"] + + @validator('action') + def action_validate_enum(cls, value): + """Validates the enum""" + if value is None: + return value + + if value not in ('SUBMIT_OTP', 'RESEND_OTP'): + raise ValueError("must be one of enum values ('SUBMIT_OTP', 'RESEND_OTP')") + return value + + @validator('authenticate_status') + def authenticate_status_validate_enum(cls, value): + """Validates the enum""" + if value is None: + return value + + if value not in ('FAILED', 'SUCCESS'): + raise ValueError("must be one of enum values ('FAILED', 'SUCCESS')") + return value + + class Config: + """Pydantic configuration""" + allow_population_by_field_name = True + validate_assignment = True + + def to_str(self) -> str: + """Returns the string representation of the model using alias""" + return pprint.pformat(self.dict(by_alias=True)) + + def to_json(self) -> str: + """Returns the JSON representation of the model using alias""" + return json.dumps(self.to_dict()) + + @classmethod + 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)) + + def to_dict(self): + """Returns the dictionary representation of the model using alias""" + _dict = self.dict(by_alias=True, + exclude={ + }, + exclude_none=True) + return _dict + + @classmethod + def from_dict(cls, obj: dict) -> OrderAuthenticateEntity: + """Create an instance of OrderAuthenticateEntity from a dict""" + if obj is None: + return None + + if not isinstance(obj, dict): + return OrderAuthenticateEntity.parse_obj(obj) + + _obj = OrderAuthenticateEntity.parse_obj({ + "cf_payment_id": obj.get("cf_payment_id"), + "action": obj.get("action"), + "authenticate_status": obj.get("authenticate_status"), + "payment_message": obj.get("payment_message") + }) + return _obj + + diff --git a/models/order_authenticate_payment_request.py b/models/order_authenticate_payment_request.py new file mode 100644 index 0000000..27d5e18 --- /dev/null +++ b/models/order_authenticate_payment_request.py @@ -0,0 +1,81 @@ +# coding: utf-8 + +""" + Cashfree Payment Gateway APIs + + Cashfree's Payment Gateway APIs provide developers with a streamlined pathway to integrate advanced payment processing capabilities into their applications, platforms and websites. + + The version of the OpenAPI document: 2022-09-01 + Contact: developers@cashfree.com + Generated by OpenAPI Generator (https://openapi-generator.tech) + + Do not edit the class manually. +""" # noqa: E501 + + +from __future__ import annotations +import pprint +import re # noqa: F401 +import json + + + +from pydantic import BaseModel, Field, StrictStr, validator + +class OrderAuthenticatePaymentRequest(BaseModel): + """ + OTP to be submitted for headless/native OTP + """ + otp: StrictStr = Field(..., description="OTP to be submitted") + action: StrictStr = Field(..., description="The action for this workflow. Could be either SUBMIT_OTP or RESEND_OTP") + __properties = ["otp", "action"] + + @validator('action') + def action_validate_enum(cls, value): + """Validates the enum""" + if value not in ('SUBMIT_OTP', 'RESEND_OTP'): + raise ValueError("must be one of enum values ('SUBMIT_OTP', 'RESEND_OTP')") + return value + + class Config: + """Pydantic configuration""" + allow_population_by_field_name = True + validate_assignment = True + + def to_str(self) -> str: + """Returns the string representation of the model using alias""" + return pprint.pformat(self.dict(by_alias=True)) + + def to_json(self) -> str: + """Returns the JSON representation of the model using alias""" + return json.dumps(self.to_dict()) + + @classmethod + 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)) + + def to_dict(self): + """Returns the dictionary representation of the model using alias""" + _dict = self.dict(by_alias=True, + exclude={ + }, + exclude_none=True) + return _dict + + @classmethod + def from_dict(cls, obj: dict) -> OrderAuthenticatePaymentRequest: + """Create an instance of OrderAuthenticatePaymentRequest from a dict""" + if obj is None: + return None + + if not isinstance(obj, dict): + return OrderAuthenticatePaymentRequest.parse_obj(obj) + + _obj = OrderAuthenticatePaymentRequest.parse_obj({ + "otp": obj.get("otp"), + "action": obj.get("action") + }) + return _obj + + diff --git a/models/order_create_refund_request.py b/models/order_create_refund_request.py new file mode 100644 index 0000000..34080d5 --- /dev/null +++ b/models/order_create_refund_request.py @@ -0,0 +1,98 @@ +# coding: utf-8 + +""" + Cashfree Payment Gateway APIs + + Cashfree's Payment Gateway APIs provide developers with a streamlined pathway to integrate advanced payment processing capabilities into their applications, platforms and websites. + + The version of the OpenAPI document: 2022-09-01 + Contact: developers@cashfree.com + Generated by OpenAPI Generator (https://openapi-generator.tech) + + Do not edit the class manually. +""" # noqa: E501 + + +from __future__ import annotations +import pprint +import re # noqa: F401 +import json + + +from typing import List, Optional, Union +from pydantic import BaseModel, Field, StrictFloat, StrictInt, StrictStr, conlist, constr, validator +from cashfree_pg.models.vendor_split import VendorSplit + +class OrderCreateRefundRequest(BaseModel): + """ + create refund request object + """ + refund_amount: Union[StrictFloat, StrictInt] = Field(..., description="Amount to be refunded. Should be lesser than or equal to the transaction amount. (Decimals allowed)") + refund_id: constr(strict=True, max_length=40, min_length=3) = Field(..., description="An unique ID to associate the refund with. Provie alphanumeric values") + refund_note: Optional[constr(strict=True, max_length=100, min_length=3)] = Field(None, description="A refund note for your reference.") + refund_speed: Optional[StrictStr] = Field(None, description="Speed at which the refund is processed. It's an optional field with default being STANDARD") + refund_splits: Optional[conlist(VendorSplit)] = None + __properties = ["refund_amount", "refund_id", "refund_note", "refund_speed", "refund_splits"] + + @validator('refund_speed') + def refund_speed_validate_enum(cls, value): + """Validates the enum""" + if value is None: + return value + + if value not in ('STANDARD', 'INSTANT'): + raise ValueError("must be one of enum values ('STANDARD', 'INSTANT')") + return value + + class Config: + """Pydantic configuration""" + allow_population_by_field_name = True + validate_assignment = True + + def to_str(self) -> str: + """Returns the string representation of the model using alias""" + return pprint.pformat(self.dict(by_alias=True)) + + def to_json(self) -> str: + """Returns the JSON representation of the model using alias""" + return json.dumps(self.to_dict()) + + @classmethod + 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)) + + def to_dict(self): + """Returns the dictionary representation of the model using alias""" + _dict = self.dict(by_alias=True, + exclude={ + }, + exclude_none=True) + # override the default output from pydantic by calling `to_dict()` of each item in refund_splits (list) + _items = [] + if self.refund_splits: + for _item in self.refund_splits: + if _item: + _items.append(_item.to_dict()) + _dict['refund_splits'] = _items + return _dict + + @classmethod + def from_dict(cls, obj: dict) -> OrderCreateRefundRequest: + """Create an instance of OrderCreateRefundRequest from a dict""" + if obj is None: + return None + + if not isinstance(obj, dict): + return OrderCreateRefundRequest.parse_obj(obj) + + _obj = OrderCreateRefundRequest.parse_obj({ + "refund_amount": obj.get("refund_amount"), + "refund_id": obj.get("refund_id"), + "refund_note": obj.get("refund_note"), + "refund_speed": obj.get("refund_speed"), + "refund_splits": [VendorSplit.from_dict(_item) for _item in obj.get("refund_splits")] if obj.get("refund_splits") is not None else None + }) + return _obj + + diff --git a/models/order_entity.py b/models/order_entity.py new file mode 100644 index 0000000..27365ae --- /dev/null +++ b/models/order_entity.py @@ -0,0 +1,142 @@ +# coding: utf-8 + +""" + Cashfree Payment Gateway APIs + + Cashfree's Payment Gateway APIs provide developers with a streamlined pathway to integrate advanced payment processing capabilities into their applications, platforms and websites. + + The version of the OpenAPI document: 2022-09-01 + Contact: developers@cashfree.com + Generated by OpenAPI Generator (https://openapi-generator.tech) + + Do not edit the class manually. +""" # noqa: E501 + + +from __future__ import annotations +import pprint +import re # noqa: F401 +import json + +from datetime import datetime +from typing import Dict, List, Optional, Union +from pydantic import BaseModel, Field, StrictFloat, StrictInt, StrictStr, conlist, constr +from cashfree_pg.models.customer_details import CustomerDetails +from cashfree_pg.models.order_meta import OrderMeta +from cashfree_pg.models.payment_url_object import PaymentURLObject +from cashfree_pg.models.refund_url_object import RefundURLObject +from cashfree_pg.models.settlement_url_object import SettlementURLObject +from cashfree_pg.models.vendor_split import VendorSplit + +class OrderEntity(BaseModel): + """ + The complete order entity + """ + cf_order_id: Optional[StrictInt] = Field(None, description="unique id generated by cashfree for your order") + order_id: Optional[StrictStr] = Field(None, description="order_id sent during the api request") + entity: Optional[StrictStr] = Field(None, description="Type of the entity.") + order_currency: Optional[StrictStr] = Field(None, description="Currency of the order. Example INR") + order_amount: Optional[Union[StrictFloat, StrictInt]] = None + order_status: Optional[StrictStr] = Field(None, description="Possible values are - `ACTIVE`: Order does not have a sucessful transaction yet - `PAID`: Order is PAID with one successful transaction - `EXPIRED`: Order was not PAID and not it has expired. No transaction can be initiated for an EXPIRED order. ") + payment_session_id: Optional[StrictStr] = None + order_expiry_time: Optional[datetime] = None + order_note: Optional[StrictStr] = Field(None, description="Additional note for order") + created_at: Optional[datetime] = Field(None, description="When the order was created at cashfree's server") + order_splits: Optional[conlist(VendorSplit)] = None + customer_details: Optional[CustomerDetails] = None + order_meta: Optional[OrderMeta] = None + payments: Optional[PaymentURLObject] = None + settlements: Optional[SettlementURLObject] = None + refunds: Optional[RefundURLObject] = None + order_tags: Optional[Dict[str, constr(strict=True, max_length=255, min_length=1)]] = Field(None, description="Custom Tags in thr form of {\"key\":\"value\"} which can be passed for an order. A maximum of 10 tags can be added") + __properties = ["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"] + + class Config: + """Pydantic configuration""" + allow_population_by_field_name = True + validate_assignment = True + + def to_str(self) -> str: + """Returns the string representation of the model using alias""" + return pprint.pformat(self.dict(by_alias=True)) + + def to_json(self) -> str: + """Returns the JSON representation of the model using alias""" + return json.dumps(self.to_dict()) + + @classmethod + 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)) + + def to_dict(self): + """Returns the dictionary representation of the model using alias""" + _dict = self.dict(by_alias=True, + exclude={ + }, + exclude_none=True) + # override the default output from pydantic by calling `to_dict()` of each item in order_splits (list) + _items = [] + if self.order_splits: + for _item in self.order_splits: + if _item: + _items.append(_item.to_dict()) + _dict['order_splits'] = _items + # override the default output from pydantic by calling `to_dict()` of customer_details + if self.customer_details: + _dict['customer_details'] = self.customer_details.to_dict() + # override the default output from pydantic by calling `to_dict()` of order_meta + if self.order_meta: + _dict['order_meta'] = self.order_meta.to_dict() + # override the default output from pydantic by calling `to_dict()` of payments + if self.payments: + _dict['payments'] = self.payments.to_dict() + # override the default output from pydantic by calling `to_dict()` of settlements + if self.settlements: + _dict['settlements'] = self.settlements.to_dict() + # override the default output from pydantic by calling `to_dict()` of refunds + if self.refunds: + _dict['refunds'] = self.refunds.to_dict() + # set to None if order_note (nullable) is None + # and __fields_set__ contains the field + if self.order_note is None and "order_note" in self.__fields_set__: + _dict['order_note'] = None + + # set to None if order_tags (nullable) is None + # and __fields_set__ contains the field + if self.order_tags is None and "order_tags" in self.__fields_set__: + _dict['order_tags'] = None + + return _dict + + @classmethod + def from_dict(cls, obj: dict) -> OrderEntity: + """Create an instance of OrderEntity from a dict""" + if obj is None: + return None + + if not isinstance(obj, dict): + return OrderEntity.parse_obj(obj) + + _obj = OrderEntity.parse_obj({ + "cf_order_id": obj.get("cf_order_id"), + "order_id": obj.get("order_id"), + "entity": obj.get("entity"), + "order_currency": obj.get("order_currency"), + "order_amount": obj.get("order_amount"), + "order_status": obj.get("order_status"), + "payment_session_id": obj.get("payment_session_id"), + "order_expiry_time": obj.get("order_expiry_time"), + "order_note": obj.get("order_note"), + "created_at": obj.get("created_at"), + "order_splits": [VendorSplit.from_dict(_item) for _item in obj.get("order_splits")] if obj.get("order_splits") is not None else None, + "customer_details": CustomerDetails.from_dict(obj.get("customer_details")) if obj.get("customer_details") is not None else None, + "order_meta": OrderMeta.from_dict(obj.get("order_meta")) if obj.get("order_meta") is not None else None, + "payments": PaymentURLObject.from_dict(obj.get("payments")) if obj.get("payments") is not None else None, + "settlements": SettlementURLObject.from_dict(obj.get("settlements")) if obj.get("settlements") is not None else None, + "refunds": RefundURLObject.from_dict(obj.get("refunds")) if obj.get("refunds") is not None else None, + "order_tags": obj.get("order_tags") + }) + return _obj + + diff --git a/models/order_meta.py b/models/order_meta.py new file mode 100644 index 0000000..6a8f7e6 --- /dev/null +++ b/models/order_meta.py @@ -0,0 +1,91 @@ +# coding: utf-8 + +""" + Cashfree Payment Gateway APIs + + Cashfree's Payment Gateway APIs provide developers with a streamlined pathway to integrate advanced payment processing capabilities into their applications, platforms and websites. + + The version of the OpenAPI document: 2022-09-01 + Contact: developers@cashfree.com + Generated by OpenAPI Generator (https://openapi-generator.tech) + + Do not edit the class manually. +""" # noqa: E501 + + +from __future__ import annotations +import pprint +import re # noqa: F401 +import json + + +from typing import Any, Optional +from pydantic import BaseModel, Field, StrictStr + +class OrderMeta(BaseModel): + """ + Optional meta details to control how the customer pays and how payment journey completes + """ + return_url: Optional[StrictStr] = Field(None, description="The URL to which user will be redirected to after the payment on bank OTP page. Maximum length: 250. The return_url must contain placeholder {order_id}. When redirecting the customer back to the return url from the bank’s OTP page, Cashfree will replace this placeholder with the actual value for that order.") + notify_url: Optional[StrictStr] = Field(None, description="Notification URL for server-server communication. Useful when user's connection drops while re-directing. NotifyUrl should be an https URL. Maximum length: 250.") + payment_methods: Optional[Any] = Field(None, description="Allowed payment modes for this order. Pass comma-separated values among following options - \"cc\", \"dc\", \"ccc\", \"ppc\",\"nb\",\"upi\",\"paypal\",\"app\",\"paylater\",\"cardlessemi\",\"dcemi\",\"ccemi\",\"banktransfer\". Leave it blank to show all available payment methods") + __properties = ["return_url", "notify_url", "payment_methods"] + + class Config: + """Pydantic configuration""" + allow_population_by_field_name = True + validate_assignment = True + + def to_str(self) -> str: + """Returns the string representation of the model using alias""" + return pprint.pformat(self.dict(by_alias=True)) + + def to_json(self) -> str: + """Returns the JSON representation of the model using alias""" + return json.dumps(self.to_dict()) + + @classmethod + 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)) + + def to_dict(self): + """Returns the dictionary representation of the model using alias""" + _dict = self.dict(by_alias=True, + exclude={ + }, + exclude_none=True) + # set to None if return_url (nullable) is None + # and __fields_set__ contains the field + if self.return_url is None and "return_url" in self.__fields_set__: + _dict['return_url'] = None + + # set to None if notify_url (nullable) is None + # and __fields_set__ contains the field + if self.notify_url is None and "notify_url" in self.__fields_set__: + _dict['notify_url'] = None + + # set to None if payment_methods (nullable) is None + # and __fields_set__ contains the field + if self.payment_methods is None and "payment_methods" in self.__fields_set__: + _dict['payment_methods'] = None + + return _dict + + @classmethod + def from_dict(cls, obj: dict) -> OrderMeta: + """Create an instance of OrderMeta from a dict""" + if obj is None: + return None + + if not isinstance(obj, dict): + return OrderMeta.parse_obj(obj) + + _obj = OrderMeta.parse_obj({ + "return_url": obj.get("return_url"), + "notify_url": obj.get("notify_url"), + "payment_methods": obj.get("payment_methods") + }) + return _obj + + diff --git a/models/order_pay_data.py b/models/order_pay_data.py new file mode 100644 index 0000000..adaba6a --- /dev/null +++ b/models/order_pay_data.py @@ -0,0 +1,98 @@ +# coding: utf-8 + +""" + Cashfree Payment Gateway APIs + + Cashfree's Payment Gateway APIs provide developers with a streamlined pathway to integrate advanced payment processing capabilities into their applications, platforms and websites. + + The version of the OpenAPI document: 2022-09-01 + Contact: developers@cashfree.com + Generated by OpenAPI Generator (https://openapi-generator.tech) + + Do not edit the class manually. +""" # noqa: E501 + + +from __future__ import annotations +import pprint +import re # noqa: F401 +import json + + +from typing import Any, Dict, Optional +from pydantic import BaseModel, StrictStr + +class OrderPayData(BaseModel): + """ + the data object pay api + """ + url: Optional[StrictStr] = None + payload: Optional[Dict[str, Any]] = None + content_type: Optional[StrictStr] = None + method: Optional[StrictStr] = None + __properties = ["url", "payload", "content_type", "method"] + + class Config: + """Pydantic configuration""" + allow_population_by_field_name = True + validate_assignment = True + + def to_str(self) -> str: + """Returns the string representation of the model using alias""" + return pprint.pformat(self.dict(by_alias=True)) + + def to_json(self) -> str: + """Returns the JSON representation of the model using alias""" + return json.dumps(self.to_dict()) + + @classmethod + 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)) + + def to_dict(self): + """Returns the dictionary representation of the model using alias""" + _dict = self.dict(by_alias=True, + exclude={ + }, + exclude_none=True) + # set to None if url (nullable) is None + # and __fields_set__ contains the field + if self.url is None and "url" in self.__fields_set__: + _dict['url'] = None + + # set to None if payload (nullable) is None + # and __fields_set__ contains the field + if self.payload is None and "payload" in self.__fields_set__: + _dict['payload'] = None + + # set to None if content_type (nullable) is None + # and __fields_set__ contains the field + if self.content_type is None and "content_type" in self.__fields_set__: + _dict['content_type'] = None + + # set to None if method (nullable) is None + # and __fields_set__ contains the field + if self.method is None and "method" in self.__fields_set__: + _dict['method'] = None + + return _dict + + @classmethod + def from_dict(cls, obj: dict) -> OrderPayData: + """Create an instance of OrderPayData from a dict""" + if obj is None: + return None + + if not isinstance(obj, dict): + return OrderPayData.parse_obj(obj) + + _obj = OrderPayData.parse_obj({ + "url": obj.get("url"), + "payload": obj.get("payload"), + "content_type": obj.get("content_type"), + "method": obj.get("method") + }) + return _obj + + diff --git a/models/pay_order_entity.py b/models/pay_order_entity.py new file mode 100644 index 0000000..ca1b579 --- /dev/null +++ b/models/pay_order_entity.py @@ -0,0 +1,121 @@ +# coding: utf-8 + +""" + Cashfree Payment Gateway APIs + + Cashfree's Payment Gateway APIs provide developers with a streamlined pathway to integrate advanced payment processing capabilities into their applications, platforms and websites. + + The version of the OpenAPI document: 2022-09-01 + Contact: developers@cashfree.com + Generated by OpenAPI Generator (https://openapi-generator.tech) + + Do not edit the class manually. +""" # noqa: E501 + + +from __future__ import annotations +import pprint +import re # noqa: F401 +import json + + +from typing import Optional, Union +from pydantic import BaseModel, Field, StrictFloat, StrictInt, StrictStr, validator +from cashfree_pg.models.order_pay_data import OrderPayData + +class PayOrderEntity(BaseModel): + """ + Order Pay response once you create a transaction for that order + """ + payment_amount: Optional[Union[StrictFloat, StrictInt]] = Field(None, description="total amount payable") + cf_payment_id: Optional[StrictInt] = Field(None, description="Payment identifier created by Cashfree") + payment_method: Optional[StrictStr] = Field(None, description="One of [\"upi\", \"netbanking\", \"card\", \"app\", \"cardless_emi\", \"paylater\", \"banktransfer\"] ") + channel: Optional[StrictStr] = Field(None, description="One of [\"link\", \"collect\", \"qrcode\"]. In an older version we used to support different channels like 'gpay', 'phonepe' etc. However, we now support only the following channels - link, collect and qrcode. To process payments using gpay, you will have to provide channel as 'link' and provider as 'gpay'") + action: Optional[StrictStr] = Field(None, description="One of [\"link\", \"custom\", \"form\"]") + data: Optional[OrderPayData] = None + __properties = ["payment_amount", "cf_payment_id", "payment_method", "channel", "action", "data"] + + @validator('payment_method') + def payment_method_validate_enum(cls, value): + """Validates the enum""" + if value is None: + return value + + if value not in ('netbanking', 'card', 'upi', 'app', 'cardless_emi', 'paylater', 'banktransfer'): + raise ValueError("must be one of enum values ('netbanking', 'card', 'upi', 'app', 'cardless_emi', 'paylater', 'banktransfer')") + return value + + @validator('channel') + def channel_validate_enum(cls, value): + """Validates the enum""" + if value is None: + return value + + if value not in ('link', 'collect', 'qrcode', 'post'): + raise ValueError("must be one of enum values ('link', 'collect', 'qrcode', 'post')") + return value + + @validator('action') + def action_validate_enum(cls, value): + """Validates the enum""" + if value is None: + return value + + if value not in ('link', 'custom', 'form', 'post'): + raise ValueError("must be one of enum values ('link', 'custom', 'form', 'post')") + return value + + class Config: + """Pydantic configuration""" + allow_population_by_field_name = True + validate_assignment = True + + def to_str(self) -> str: + """Returns the string representation of the model using alias""" + return pprint.pformat(self.dict(by_alias=True)) + + def to_json(self) -> str: + """Returns the JSON representation of the model using alias""" + return json.dumps(self.to_dict()) + + @classmethod + 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)) + + def to_dict(self): + """Returns the dictionary representation of the model using alias""" + _dict = self.dict(by_alias=True, + exclude={ + }, + exclude_none=True) + # override the default output from pydantic by calling `to_dict()` of data + if self.data: + _dict['data'] = self.data.to_dict() + # set to None if action (nullable) is None + # and __fields_set__ contains the field + if self.action is None and "action" in self.__fields_set__: + _dict['action'] = None + + return _dict + + @classmethod + def from_dict(cls, obj: dict) -> PayOrderEntity: + """Create an instance of PayOrderEntity from a dict""" + if obj is None: + return None + + if not isinstance(obj, dict): + return PayOrderEntity.parse_obj(obj) + + _obj = PayOrderEntity.parse_obj({ + "payment_amount": obj.get("payment_amount"), + "cf_payment_id": obj.get("cf_payment_id"), + "payment_method": obj.get("payment_method"), + "channel": obj.get("channel"), + "action": obj.get("action"), + "data": OrderPayData.from_dict(obj.get("data")) if obj.get("data") is not None else None + }) + return _obj + + diff --git a/models/pay_order_request.py b/models/pay_order_request.py new file mode 100644 index 0000000..5438fa4 --- /dev/null +++ b/models/pay_order_request.py @@ -0,0 +1,82 @@ +# coding: utf-8 + +""" + Cashfree Payment Gateway APIs + + Cashfree's Payment Gateway APIs provide developers with a streamlined pathway to integrate advanced payment processing capabilities into their applications, platforms and websites. + + The version of the OpenAPI document: 2022-09-01 + Contact: developers@cashfree.com + Generated by OpenAPI Generator (https://openapi-generator.tech) + + Do not edit the class manually. +""" # noqa: E501 + + +from __future__ import annotations +import pprint +import re # noqa: F401 +import json + + +from typing import Optional +from pydantic import BaseModel, Field, StrictBool, StrictStr +from cashfree_pg.models.pay_order_request_payment_method import PayOrderRequestPaymentMethod + +class PayOrderRequest(BaseModel): + """ + Complete object for the pay api that uses payment method objects + """ + payment_session_id: StrictStr = Field(...) + payment_method: PayOrderRequestPaymentMethod = Field(...) + save_instrument: Optional[StrictBool] = None + offer_id: Optional[StrictStr] = Field(None, description="This is required if any offers needs to be applied to the order.") + __properties = ["payment_session_id", "payment_method", "save_instrument", "offer_id"] + + class Config: + """Pydantic configuration""" + allow_population_by_field_name = True + validate_assignment = True + + def to_str(self) -> str: + """Returns the string representation of the model using alias""" + return pprint.pformat(self.dict(by_alias=True)) + + def to_json(self) -> str: + """Returns the JSON representation of the model using alias""" + return json.dumps(self.to_dict()) + + @classmethod + 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)) + + def to_dict(self): + """Returns the dictionary representation of the model using alias""" + _dict = self.dict(by_alias=True, + exclude={ + }, + exclude_none=True) + # override the default output from pydantic by calling `to_dict()` of payment_method + if self.payment_method: + _dict['payment_method'] = self.payment_method.to_dict() + return _dict + + @classmethod + def from_dict(cls, obj: dict) -> PayOrderRequest: + """Create an instance of PayOrderRequest from a dict""" + if obj is None: + return None + + if not isinstance(obj, dict): + return PayOrderRequest.parse_obj(obj) + + _obj = PayOrderRequest.parse_obj({ + "payment_session_id": obj.get("payment_session_id"), + "payment_method": PayOrderRequestPaymentMethod.from_dict(obj.get("payment_method")) if obj.get("payment_method") is not None else None, + "save_instrument": obj.get("save_instrument"), + "offer_id": obj.get("offer_id") + }) + return _obj + + diff --git a/models/pay_order_request_payment_method.py b/models/pay_order_request_payment_method.py new file mode 100644 index 0000000..5ec09cc --- /dev/null +++ b/models/pay_order_request_payment_method.py @@ -0,0 +1,212 @@ +# coding: utf-8 + +""" + Cashfree Payment Gateway APIs + + Cashfree's Payment Gateway APIs provide developers with a streamlined pathway to integrate advanced payment processing capabilities into their applications, platforms and websites. + + The version of the OpenAPI document: 2022-09-01 + Contact: developers@cashfree.com + Generated by OpenAPI Generator (https://openapi-generator.tech) + + Do not edit the class manually. +""" # noqa: E501 + + +from __future__ import annotations +from inspect import getfullargspec +import json +import pprint +import re # noqa: F401 + +from typing import Any, List, Optional +from pydantic import BaseModel, Field, StrictStr, ValidationError, validator +from cashfree_pg.models.app_payment_method import AppPaymentMethod +from cashfree_pg.models.card_emi_payment_method import CardEMIPaymentMethod +from cashfree_pg.models.card_payment_method import CardPaymentMethod +from cashfree_pg.models.cardless_emi_payment_method import CardlessEMIPaymentMethod +from cashfree_pg.models.net_banking_payment_method import NetBankingPaymentMethod +from cashfree_pg.models.paylater_payment_method import PaylaterPaymentMethod +from cashfree_pg.models.upi_payment_method import UPIPaymentMethod +from typing import Union, Any, List, TYPE_CHECKING +from pydantic import StrictStr, Field + +PAYORDERREQUESTPAYMENTMETHOD_ONE_OF_SCHEMAS = ["AppPaymentMethod", "CardEMIPaymentMethod", "CardPaymentMethod", "CardlessEMIPaymentMethod", "NetBankingPaymentMethod", "PaylaterPaymentMethod", "UPIPaymentMethod"] + +class PayOrderRequestPaymentMethod(BaseModel): + """ + PayOrderRequestPaymentMethod + """ + # data type: CardPaymentMethod + oneof_schema_1_validator: Optional[CardPaymentMethod] = None + # data type: UPIPaymentMethod + oneof_schema_2_validator: Optional[UPIPaymentMethod] = None + # data type: NetBankingPaymentMethod + oneof_schema_3_validator: Optional[NetBankingPaymentMethod] = None + # data type: AppPaymentMethod + oneof_schema_4_validator: Optional[AppPaymentMethod] = None + # data type: CardEMIPaymentMethod + oneof_schema_5_validator: Optional[CardEMIPaymentMethod] = None + # data type: CardlessEMIPaymentMethod + oneof_schema_6_validator: Optional[CardlessEMIPaymentMethod] = None + # data type: PaylaterPaymentMethod + oneof_schema_7_validator: Optional[PaylaterPaymentMethod] = None + if TYPE_CHECKING: + actual_instance: Union[AppPaymentMethod, CardEMIPaymentMethod, CardPaymentMethod, CardlessEMIPaymentMethod, NetBankingPaymentMethod, PaylaterPaymentMethod, UPIPaymentMethod] + else: + actual_instance: Any + one_of_schemas: List[str] = Field(PAYORDERREQUESTPAYMENTMETHOD_ONE_OF_SCHEMAS, const=True) + + class Config: + validate_assignment = True + + def __init__(self, *args, **kwargs): + if args: + if len(args) > 1: + raise ValueError("If a position argument is used, only 1 is allowed to set `actual_instance`") + if kwargs: + raise ValueError("If a position argument is used, keyword arguments cannot be used.") + super().__init__(actual_instance=args[0]) + else: + super().__init__(**kwargs) + + @validator('actual_instance') + def actual_instance_must_validate_oneof(cls, v): + instance = PayOrderRequestPaymentMethod.construct() + error_messages = [] + match = 0 + # validate data type: CardPaymentMethod + if not isinstance(v, CardPaymentMethod): + error_messages.append(f"Error! Input type `{type(v)}` is not `CardPaymentMethod`") + else: + match += 1 + # validate data type: UPIPaymentMethod + if not isinstance(v, UPIPaymentMethod): + error_messages.append(f"Error! Input type `{type(v)}` is not `UPIPaymentMethod`") + else: + match += 1 + # validate data type: NetBankingPaymentMethod + if not isinstance(v, NetBankingPaymentMethod): + error_messages.append(f"Error! Input type `{type(v)}` is not `NetBankingPaymentMethod`") + else: + match += 1 + # validate data type: AppPaymentMethod + if not isinstance(v, AppPaymentMethod): + error_messages.append(f"Error! Input type `{type(v)}` is not `AppPaymentMethod`") + else: + match += 1 + # validate data type: CardEMIPaymentMethod + if not isinstance(v, CardEMIPaymentMethod): + error_messages.append(f"Error! Input type `{type(v)}` is not `CardEMIPaymentMethod`") + else: + match += 1 + # validate data type: CardlessEMIPaymentMethod + if not isinstance(v, CardlessEMIPaymentMethod): + error_messages.append(f"Error! Input type `{type(v)}` is not `CardlessEMIPaymentMethod`") + else: + match += 1 + # validate data type: PaylaterPaymentMethod + if not isinstance(v, PaylaterPaymentMethod): + error_messages.append(f"Error! Input type `{type(v)}` is not `PaylaterPaymentMethod`") + else: + match += 1 + if match > 1: + # more than 1 match + raise ValueError("Multiple matches found when setting `actual_instance` in PayOrderRequestPaymentMethod with oneOf schemas: AppPaymentMethod, CardEMIPaymentMethod, CardPaymentMethod, CardlessEMIPaymentMethod, NetBankingPaymentMethod, PaylaterPaymentMethod, UPIPaymentMethod. Details: " + ", ".join(error_messages)) + elif match == 0: + # no match + raise ValueError("No match found when setting `actual_instance` in PayOrderRequestPaymentMethod with oneOf schemas: AppPaymentMethod, CardEMIPaymentMethod, CardPaymentMethod, CardlessEMIPaymentMethod, NetBankingPaymentMethod, PaylaterPaymentMethod, UPIPaymentMethod. Details: " + ", ".join(error_messages)) + else: + return v + + @classmethod + def from_dict(cls, obj: dict) -> PayOrderRequestPaymentMethod: + return cls.from_json(json.dumps(obj)) + + @classmethod + def from_json(cls, json_str: str) -> PayOrderRequestPaymentMethod: + """Returns the object represented by the json string""" + instance = PayOrderRequestPaymentMethod.construct() + error_messages = [] + match = 0 + + # deserialize data into CardPaymentMethod + try: + instance.actual_instance = CardPaymentMethod.from_json(json_str) + match += 1 + except (ValidationError, ValueError) as e: + error_messages.append(str(e)) + # deserialize data into UPIPaymentMethod + try: + instance.actual_instance = UPIPaymentMethod.from_json(json_str) + match += 1 + except (ValidationError, ValueError) as e: + error_messages.append(str(e)) + # deserialize data into NetBankingPaymentMethod + try: + instance.actual_instance = NetBankingPaymentMethod.from_json(json_str) + match += 1 + except (ValidationError, ValueError) as e: + error_messages.append(str(e)) + # deserialize data into AppPaymentMethod + try: + instance.actual_instance = AppPaymentMethod.from_json(json_str) + match += 1 + except (ValidationError, ValueError) as e: + error_messages.append(str(e)) + # deserialize data into CardEMIPaymentMethod + try: + instance.actual_instance = CardEMIPaymentMethod.from_json(json_str) + match += 1 + except (ValidationError, ValueError) as e: + error_messages.append(str(e)) + # deserialize data into CardlessEMIPaymentMethod + try: + instance.actual_instance = CardlessEMIPaymentMethod.from_json(json_str) + match += 1 + except (ValidationError, ValueError) as e: + error_messages.append(str(e)) + # deserialize data into PaylaterPaymentMethod + try: + instance.actual_instance = PaylaterPaymentMethod.from_json(json_str) + match += 1 + except (ValidationError, ValueError) as e: + error_messages.append(str(e)) + + if match > 1: + # more than 1 match + raise ValueError("Multiple matches found when deserializing the JSON string into PayOrderRequestPaymentMethod with oneOf schemas: AppPaymentMethod, CardEMIPaymentMethod, CardPaymentMethod, CardlessEMIPaymentMethod, NetBankingPaymentMethod, PaylaterPaymentMethod, UPIPaymentMethod. Details: " + ", ".join(error_messages)) + elif match == 0: + # no match + raise ValueError("No match found when deserializing the JSON string into PayOrderRequestPaymentMethod with oneOf schemas: AppPaymentMethod, CardEMIPaymentMethod, CardPaymentMethod, CardlessEMIPaymentMethod, NetBankingPaymentMethod, PaylaterPaymentMethod, UPIPaymentMethod. Details: " + ", ".join(error_messages)) + else: + return instance + + def to_json(self) -> str: + """Returns the JSON representation of the actual instance""" + if self.actual_instance is None: + return "null" + + to_json = getattr(self.actual_instance, "to_json", None) + if callable(to_json): + return self.actual_instance.to_json() + else: + return json.dumps(self.actual_instance) + + def to_dict(self) -> dict: + """Returns the dict representation of the actual instance""" + if self.actual_instance is None: + return None + + to_dict = getattr(self.actual_instance, "to_dict", None) + if callable(to_dict): + return self.actual_instance.to_dict() + else: + # primitive type + return self.actual_instance + + def to_str(self) -> str: + """Returns the string representation of the actual instance""" + return pprint.pformat(self.dict()) + + diff --git a/models/paylater.py b/models/paylater.py new file mode 100644 index 0000000..400bedb --- /dev/null +++ b/models/paylater.py @@ -0,0 +1,86 @@ +# coding: utf-8 + +""" + Cashfree Payment Gateway APIs + + Cashfree's Payment Gateway APIs provide developers with a streamlined pathway to integrate advanced payment processing capabilities into their applications, platforms and websites. + + The version of the OpenAPI document: 2022-09-01 + Contact: developers@cashfree.com + Generated by OpenAPI Generator (https://openapi-generator.tech) + + Do not edit the class manually. +""" # noqa: E501 + + +from __future__ import annotations +import pprint +import re # noqa: F401 +import json + + +from typing import Optional +from pydantic import BaseModel, Field, StrictStr, validator + +class Paylater(BaseModel): + """ + Paylater payment method + """ + channel: Optional[StrictStr] = Field(None, description="The channel for cardless EMI is always `link`") + provider: Optional[StrictStr] = Field(None, description="One of [\"kotak\", \"flexipay\", \"zestmoney\", \"lazypay\", \"olapostpaid\",\"simpl\", \"freechargepaylater\"]. Please note that Flexipay is offered by HDFC bank") + phone: Optional[StrictStr] = Field(None, description="Customers phone number for this payment instrument. If the customer is not eligible you will receive a 400 error with type as 'invalid_request_error' and code as 'invalid_request_error'") + __properties = ["channel", "provider", "phone"] + + @validator('provider') + def provider_validate_enum(cls, value): + """Validates the enum""" + if value is None: + return value + + if value not in ('kotak', 'flexipay', 'zestmoney', 'lazypay', 'olapostpaid', 'simpl', 'freechargepaylater'): + raise ValueError("must be one of enum values ('kotak', 'flexipay', 'zestmoney', 'lazypay', 'olapostpaid', 'simpl', 'freechargepaylater')") + return value + + class Config: + """Pydantic configuration""" + allow_population_by_field_name = True + validate_assignment = True + + def to_str(self) -> str: + """Returns the string representation of the model using alias""" + return pprint.pformat(self.dict(by_alias=True)) + + def to_json(self) -> str: + """Returns the JSON representation of the model using alias""" + return json.dumps(self.to_dict()) + + @classmethod + 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)) + + def to_dict(self): + """Returns the dictionary representation of the model using alias""" + _dict = self.dict(by_alias=True, + exclude={ + }, + exclude_none=True) + return _dict + + @classmethod + def from_dict(cls, obj: dict) -> Paylater: + """Create an instance of Paylater from a dict""" + if obj is None: + return None + + if not isinstance(obj, dict): + return Paylater.parse_obj(obj) + + _obj = Paylater.parse_obj({ + "channel": obj.get("channel"), + "provider": obj.get("provider"), + "phone": obj.get("phone") + }) + return _obj + + diff --git a/models/paylater_entity.py b/models/paylater_entity.py new file mode 100644 index 0000000..0e75191 --- /dev/null +++ b/models/paylater_entity.py @@ -0,0 +1,72 @@ +# coding: utf-8 + +""" + Cashfree Payment Gateway APIs + + Cashfree's Payment Gateway APIs provide developers with a streamlined pathway to integrate advanced payment processing capabilities into their applications, platforms and websites. + + The version of the OpenAPI document: 2022-09-01 + Contact: developers@cashfree.com + Generated by OpenAPI Generator (https://openapi-generator.tech) + + Do not edit the class manually. +""" # noqa: E501 + + +from __future__ import annotations +import pprint +import re # noqa: F401 +import json + + +from typing import Optional +from pydantic import BaseModel, StrictStr + +class PaylaterEntity(BaseModel): + """ + Paylater Entity + """ + payment_method: Optional[StrictStr] = None + __properties = ["payment_method"] + + class Config: + """Pydantic configuration""" + allow_population_by_field_name = True + validate_assignment = True + + def to_str(self) -> str: + """Returns the string representation of the model using alias""" + return pprint.pformat(self.dict(by_alias=True)) + + def to_json(self) -> str: + """Returns the JSON representation of the model using alias""" + return json.dumps(self.to_dict()) + + @classmethod + 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)) + + def to_dict(self): + """Returns the dictionary representation of the model using alias""" + _dict = self.dict(by_alias=True, + exclude={ + }, + exclude_none=True) + return _dict + + @classmethod + def from_dict(cls, obj: dict) -> PaylaterEntity: + """Create an instance of PaylaterEntity from a dict""" + if obj is None: + return None + + if not isinstance(obj, dict): + return PaylaterEntity.parse_obj(obj) + + _obj = PaylaterEntity.parse_obj({ + "payment_method": obj.get("payment_method") + }) + return _obj + + diff --git a/models/paylater_offer.py b/models/paylater_offer.py new file mode 100644 index 0000000..5e10da6 --- /dev/null +++ b/models/paylater_offer.py @@ -0,0 +1,72 @@ +# coding: utf-8 + +""" + Cashfree Payment Gateway APIs + + Cashfree's Payment Gateway APIs provide developers with a streamlined pathway to integrate advanced payment processing capabilities into their applications, platforms and websites. + + The version of the OpenAPI document: 2022-09-01 + Contact: developers@cashfree.com + Generated by OpenAPI Generator (https://openapi-generator.tech) + + Do not edit the class manually. +""" # noqa: E501 + + +from __future__ import annotations +import pprint +import re # noqa: F401 +import json + + +from typing import Optional +from pydantic import BaseModel, StrictStr + +class PaylaterOffer(BaseModel): + """ + PaylaterOffer + """ + provider: Optional[StrictStr] = None + __properties = ["provider"] + + class Config: + """Pydantic configuration""" + allow_population_by_field_name = True + validate_assignment = True + + def to_str(self) -> str: + """Returns the string representation of the model using alias""" + return pprint.pformat(self.dict(by_alias=True)) + + def to_json(self) -> str: + """Returns the JSON representation of the model using alias""" + return json.dumps(self.to_dict()) + + @classmethod + 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)) + + def to_dict(self): + """Returns the dictionary representation of the model using alias""" + _dict = self.dict(by_alias=True, + exclude={ + }, + exclude_none=True) + return _dict + + @classmethod + def from_dict(cls, obj: dict) -> PaylaterOffer: + """Create an instance of PaylaterOffer from a dict""" + if obj is None: + return None + + if not isinstance(obj, dict): + return PaylaterOffer.parse_obj(obj) + + _obj = PaylaterOffer.parse_obj({ + "provider": obj.get("provider") + }) + return _obj + + diff --git a/models/paylater_payment_method.py b/models/paylater_payment_method.py new file mode 100644 index 0000000..81c3c37 --- /dev/null +++ b/models/paylater_payment_method.py @@ -0,0 +1,76 @@ +# coding: utf-8 + +""" + Cashfree Payment Gateway APIs + + Cashfree's Payment Gateway APIs provide developers with a streamlined pathway to integrate advanced payment processing capabilities into their applications, platforms and websites. + + The version of the OpenAPI document: 2022-09-01 + Contact: developers@cashfree.com + Generated by OpenAPI Generator (https://openapi-generator.tech) + + Do not edit the class manually. +""" # noqa: E501 + + +from __future__ import annotations +import pprint +import re # noqa: F401 +import json + + +from typing import Optional +from pydantic import BaseModel +from cashfree_pg.models.paylater import Paylater + +class PaylaterPaymentMethod(BaseModel): + """ + paylater payment method + """ + paylater: Optional[Paylater] = None + __properties = ["paylater"] + + class Config: + """Pydantic configuration""" + allow_population_by_field_name = True + validate_assignment = True + + def to_str(self) -> str: + """Returns the string representation of the model using alias""" + return pprint.pformat(self.dict(by_alias=True)) + + def to_json(self) -> str: + """Returns the JSON representation of the model using alias""" + return json.dumps(self.to_dict()) + + @classmethod + 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)) + + def to_dict(self): + """Returns the dictionary representation of the model using alias""" + _dict = self.dict(by_alias=True, + exclude={ + }, + exclude_none=True) + # override the default output from pydantic by calling `to_dict()` of paylater + if self.paylater: + _dict['paylater'] = self.paylater.to_dict() + return _dict + + @classmethod + def from_dict(cls, obj: dict) -> PaylaterPaymentMethod: + """Create an instance of PaylaterPaymentMethod from a dict""" + if obj is None: + return None + + if not isinstance(obj, dict): + return PaylaterPaymentMethod.parse_obj(obj) + + _obj = PaylaterPaymentMethod.parse_obj({ + "paylater": Paylater.from_dict(obj.get("paylater")) if obj.get("paylater") is not None else None + }) + return _obj + + diff --git a/models/payment_entity.py b/models/payment_entity.py new file mode 100644 index 0000000..b8dd121 --- /dev/null +++ b/models/payment_entity.py @@ -0,0 +1,131 @@ +# coding: utf-8 + +""" + Cashfree Payment Gateway APIs + + Cashfree's Payment Gateway APIs provide developers with a streamlined pathway to integrate advanced payment processing capabilities into their applications, platforms and websites. + + The version of the OpenAPI document: 2022-09-01 + Contact: developers@cashfree.com + Generated by OpenAPI Generator (https://openapi-generator.tech) + + Do not edit the class manually. +""" # noqa: E501 + + +from __future__ import annotations +import pprint +import re # noqa: F401 +import json + + +from typing import Optional, Union +from pydantic import BaseModel, Field, StrictBool, StrictFloat, StrictInt, StrictStr, validator +from cashfree_pg.models.authorization_in_payments_entity import AuthorizationInPaymentsEntity +from cashfree_pg.models.error_details_in_payments_entity import ErrorDetailsInPaymentsEntity +from cashfree_pg.models.payment_method_in_payments_entity import PaymentMethodInPaymentsEntity + +class PaymentEntity(BaseModel): + """ + payment entity full object + """ + cf_payment_id: Optional[StrictInt] = None + order_id: Optional[StrictStr] = None + entity: Optional[StrictStr] = None + error_details: Optional[ErrorDetailsInPaymentsEntity] = None + is_captured: Optional[StrictBool] = None + order_amount: Optional[Union[StrictFloat, StrictInt]] = Field(None, description="Order amount can be different from payment amount if you collect service fee from the customer") + payment_group: Optional[StrictStr] = Field(None, description="Type of payment group. One of ['upi', 'card', 'app', 'netbanking', 'paylater', 'cardless_emi']") + payment_currency: Optional[StrictStr] = None + payment_amount: Optional[Union[StrictFloat, StrictInt]] = None + payment_time: Optional[StrictStr] = Field(None, description="This is the time when the payment was initiated") + payment_completion_time: Optional[StrictStr] = Field(None, description="This is the time when the payment reaches its terminal state") + payment_status: Optional[StrictStr] = Field(None, description="The transaction status can be one of [\"SUCCESS\", \"NOT_ATTEMPTED\", \"FAILED\", \"USER_DROPPED\", \"VOID\", \"CANCELLED\", \"PENDING\"]") + payment_message: Optional[StrictStr] = None + bank_reference: Optional[StrictStr] = None + auth_id: Optional[StrictStr] = None + authorization: Optional[AuthorizationInPaymentsEntity] = None + payment_method: Optional[PaymentMethodInPaymentsEntity] = None + __properties = ["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"] + + @validator('payment_status') + def payment_status_validate_enum(cls, value): + """Validates the enum""" + if value is None: + return value + + if value not in ('SUCCESS', 'NOT_ATTEMPTED', 'FAILED', 'USER_DROPPED', 'VOID', 'CANCELLED', 'PENDING'): + raise ValueError("must be one of enum values ('SUCCESS', 'NOT_ATTEMPTED', 'FAILED', 'USER_DROPPED', 'VOID', 'CANCELLED', 'PENDING')") + return value + + class Config: + """Pydantic configuration""" + allow_population_by_field_name = True + validate_assignment = True + + def to_str(self) -> str: + """Returns the string representation of the model using alias""" + return pprint.pformat(self.dict(by_alias=True)) + + def to_json(self) -> str: + """Returns the JSON representation of the model using alias""" + return json.dumps(self.to_dict()) + + @classmethod + 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)) + + def to_dict(self): + """Returns the dictionary representation of the model using alias""" + _dict = self.dict(by_alias=True, + exclude={ + }, + exclude_none=True) + # override the default output from pydantic by calling `to_dict()` of error_details + if self.error_details: + _dict['error_details'] = self.error_details.to_dict() + # override the default output from pydantic by calling `to_dict()` of authorization + if self.authorization: + _dict['authorization'] = self.authorization.to_dict() + # override the default output from pydantic by calling `to_dict()` of payment_method + if self.payment_method: + _dict['payment_method'] = self.payment_method.to_dict() + # set to None if authorization (nullable) is None + # and __fields_set__ contains the field + if self.authorization is None and "authorization" in self.__fields_set__: + _dict['authorization'] = None + + return _dict + + @classmethod + def from_dict(cls, obj: dict) -> PaymentEntity: + """Create an instance of PaymentEntity from a dict""" + if obj is None: + return None + + if not isinstance(obj, dict): + return PaymentEntity.parse_obj(obj) + + _obj = PaymentEntity.parse_obj({ + "cf_payment_id": obj.get("cf_payment_id"), + "order_id": obj.get("order_id"), + "entity": obj.get("entity"), + "error_details": ErrorDetailsInPaymentsEntity.from_dict(obj.get("error_details")) if obj.get("error_details") is not None else None, + "is_captured": obj.get("is_captured"), + "order_amount": obj.get("order_amount"), + "payment_group": obj.get("payment_group"), + "payment_currency": obj.get("payment_currency"), + "payment_amount": obj.get("payment_amount"), + "payment_time": obj.get("payment_time"), + "payment_completion_time": obj.get("payment_completion_time"), + "payment_status": obj.get("payment_status"), + "payment_message": obj.get("payment_message"), + "bank_reference": obj.get("bank_reference"), + "auth_id": obj.get("auth_id"), + "authorization": AuthorizationInPaymentsEntity.from_dict(obj.get("authorization")) if obj.get("authorization") is not None else None, + "payment_method": PaymentMethodInPaymentsEntity.from_dict(obj.get("payment_method")) if obj.get("payment_method") is not None else None + }) + return _obj + + diff --git a/models/payment_method_app_in_payments_entity.py b/models/payment_method_app_in_payments_entity.py new file mode 100644 index 0000000..d4d0f8e --- /dev/null +++ b/models/payment_method_app_in_payments_entity.py @@ -0,0 +1,76 @@ +# coding: utf-8 + +""" + Cashfree Payment Gateway APIs + + Cashfree's Payment Gateway APIs provide developers with a streamlined pathway to integrate advanced payment processing capabilities into their applications, platforms and websites. + + The version of the OpenAPI document: 2022-09-01 + Contact: developers@cashfree.com + Generated by OpenAPI Generator (https://openapi-generator.tech) + + Do not edit the class manually. +""" # noqa: E501 + + +from __future__ import annotations +import pprint +import re # noqa: F401 +import json + + +from typing import Optional +from pydantic import BaseModel, StrictStr + +class PaymentMethodAppInPaymentsEntity(BaseModel): + """ + payment method app object in payment entity + """ + channel: Optional[StrictStr] = None + provider: Optional[StrictStr] = None + phone: Optional[StrictStr] = None + __properties = ["channel", "provider", "phone"] + + class Config: + """Pydantic configuration""" + allow_population_by_field_name = True + validate_assignment = True + + def to_str(self) -> str: + """Returns the string representation of the model using alias""" + return pprint.pformat(self.dict(by_alias=True)) + + def to_json(self) -> str: + """Returns the JSON representation of the model using alias""" + return json.dumps(self.to_dict()) + + @classmethod + 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)) + + def to_dict(self): + """Returns the dictionary representation of the model using alias""" + _dict = self.dict(by_alias=True, + exclude={ + }, + exclude_none=True) + return _dict + + @classmethod + def from_dict(cls, obj: dict) -> PaymentMethodAppInPaymentsEntity: + """Create an instance of PaymentMethodAppInPaymentsEntity from a dict""" + if obj is None: + return None + + if not isinstance(obj, dict): + return PaymentMethodAppInPaymentsEntity.parse_obj(obj) + + _obj = PaymentMethodAppInPaymentsEntity.parse_obj({ + "channel": obj.get("channel"), + "provider": obj.get("provider"), + "phone": obj.get("phone") + }) + return _obj + + diff --git a/models/payment_method_card_in_payments_entity.py b/models/payment_method_card_in_payments_entity.py new file mode 100644 index 0000000..266bfbf --- /dev/null +++ b/models/payment_method_card_in_payments_entity.py @@ -0,0 +1,84 @@ +# coding: utf-8 + +""" + Cashfree Payment Gateway APIs + + Cashfree's Payment Gateway APIs provide developers with a streamlined pathway to integrate advanced payment processing capabilities into their applications, platforms and websites. + + The version of the OpenAPI document: 2022-09-01 + Contact: developers@cashfree.com + Generated by OpenAPI Generator (https://openapi-generator.tech) + + Do not edit the class manually. +""" # noqa: E501 + + +from __future__ import annotations +import pprint +import re # noqa: F401 +import json + + +from typing import Optional +from pydantic import BaseModel, StrictStr + +class PaymentMethodCardInPaymentsEntity(BaseModel): + """ + payment method card object in payment entity + """ + channel: Optional[StrictStr] = None + card_number: Optional[StrictStr] = None + card_network: Optional[StrictStr] = None + card_type: Optional[StrictStr] = None + card_country: Optional[StrictStr] = None + card_bank_name: Optional[StrictStr] = None + card_network_reference_id: Optional[StrictStr] = None + __properties = ["channel", "card_number", "card_network", "card_type", "card_country", "card_bank_name", "card_network_reference_id"] + + class Config: + """Pydantic configuration""" + allow_population_by_field_name = True + validate_assignment = True + + def to_str(self) -> str: + """Returns the string representation of the model using alias""" + return pprint.pformat(self.dict(by_alias=True)) + + def to_json(self) -> str: + """Returns the JSON representation of the model using alias""" + return json.dumps(self.to_dict()) + + @classmethod + 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)) + + def to_dict(self): + """Returns the dictionary representation of the model using alias""" + _dict = self.dict(by_alias=True, + exclude={ + }, + exclude_none=True) + return _dict + + @classmethod + def from_dict(cls, obj: dict) -> PaymentMethodCardInPaymentsEntity: + """Create an instance of PaymentMethodCardInPaymentsEntity from a dict""" + if obj is None: + return None + + if not isinstance(obj, dict): + return PaymentMethodCardInPaymentsEntity.parse_obj(obj) + + _obj = PaymentMethodCardInPaymentsEntity.parse_obj({ + "channel": obj.get("channel"), + "card_number": obj.get("card_number"), + "card_network": obj.get("card_network"), + "card_type": obj.get("card_type"), + "card_country": obj.get("card_country"), + "card_bank_name": obj.get("card_bank_name"), + "card_network_reference_id": obj.get("card_network_reference_id") + }) + return _obj + + diff --git a/models/payment_method_cardless_emiin_payments_entity.py b/models/payment_method_cardless_emiin_payments_entity.py new file mode 100644 index 0000000..aec5c02 --- /dev/null +++ b/models/payment_method_cardless_emiin_payments_entity.py @@ -0,0 +1,76 @@ +# coding: utf-8 + +""" + Cashfree Payment Gateway APIs + + Cashfree's Payment Gateway APIs provide developers with a streamlined pathway to integrate advanced payment processing capabilities into their applications, platforms and websites. + + The version of the OpenAPI document: 2022-09-01 + Contact: developers@cashfree.com + Generated by OpenAPI Generator (https://openapi-generator.tech) + + Do not edit the class manually. +""" # noqa: E501 + + +from __future__ import annotations +import pprint +import re # noqa: F401 +import json + + +from typing import Optional +from pydantic import BaseModel, StrictStr + +class PaymentMethodCardlessEMIInPaymentsEntity(BaseModel): + """ + payment method carless object in payment entity + """ + channel: Optional[StrictStr] = None + provider: Optional[StrictStr] = None + phone: Optional[StrictStr] = None + __properties = ["channel", "provider", "phone"] + + class Config: + """Pydantic configuration""" + allow_population_by_field_name = True + validate_assignment = True + + def to_str(self) -> str: + """Returns the string representation of the model using alias""" + return pprint.pformat(self.dict(by_alias=True)) + + def to_json(self) -> str: + """Returns the JSON representation of the model using alias""" + return json.dumps(self.to_dict()) + + @classmethod + 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)) + + def to_dict(self): + """Returns the dictionary representation of the model using alias""" + _dict = self.dict(by_alias=True, + exclude={ + }, + exclude_none=True) + return _dict + + @classmethod + def from_dict(cls, obj: dict) -> PaymentMethodCardlessEMIInPaymentsEntity: + """Create an instance of PaymentMethodCardlessEMIInPaymentsEntity from a dict""" + if obj is None: + return None + + if not isinstance(obj, dict): + return PaymentMethodCardlessEMIInPaymentsEntity.parse_obj(obj) + + _obj = PaymentMethodCardlessEMIInPaymentsEntity.parse_obj({ + "channel": obj.get("channel"), + "provider": obj.get("provider"), + "phone": obj.get("phone") + }) + return _obj + + diff --git a/models/payment_method_in_payments_entity.py b/models/payment_method_in_payments_entity.py new file mode 100644 index 0000000..dc39fc5 --- /dev/null +++ b/models/payment_method_in_payments_entity.py @@ -0,0 +1,76 @@ +# coding: utf-8 + +""" + Cashfree Payment Gateway APIs + + Cashfree's Payment Gateway APIs provide developers with a streamlined pathway to integrate advanced payment processing capabilities into their applications, platforms and websites. + + The version of the OpenAPI document: 2022-09-01 + Contact: developers@cashfree.com + Generated by OpenAPI Generator (https://openapi-generator.tech) + + Do not edit the class manually. +""" # noqa: E501 + + +from __future__ import annotations +import pprint +import re # noqa: F401 +import json + + +from typing import Optional +from pydantic import BaseModel +from cashfree_pg.models.payment_method_in_payments_entity_payment_method import PaymentMethodInPaymentsEntityPaymentMethod + +class PaymentMethodInPaymentsEntity(BaseModel): + """ + payment methods all + """ + payment_method: Optional[PaymentMethodInPaymentsEntityPaymentMethod] = None + __properties = ["payment_method"] + + class Config: + """Pydantic configuration""" + allow_population_by_field_name = True + validate_assignment = True + + def to_str(self) -> str: + """Returns the string representation of the model using alias""" + return pprint.pformat(self.dict(by_alias=True)) + + def to_json(self) -> str: + """Returns the JSON representation of the model using alias""" + return json.dumps(self.to_dict()) + + @classmethod + def from_json(cls, json_str: str) -> PaymentMethodInPaymentsEntity: + """Create an instance of PaymentMethodInPaymentsEntity from a JSON string""" + return cls.from_dict(json.loads(json_str)) + + def to_dict(self): + """Returns the dictionary representation of the model using alias""" + _dict = self.dict(by_alias=True, + exclude={ + }, + exclude_none=True) + # override the default output from pydantic by calling `to_dict()` of payment_method + if self.payment_method: + _dict['payment_method'] = self.payment_method.to_dict() + return _dict + + @classmethod + def from_dict(cls, obj: dict) -> PaymentMethodInPaymentsEntity: + """Create an instance of PaymentMethodInPaymentsEntity from a dict""" + if obj is None: + return None + + if not isinstance(obj, dict): + return PaymentMethodInPaymentsEntity.parse_obj(obj) + + _obj = PaymentMethodInPaymentsEntity.parse_obj({ + "payment_method": PaymentMethodInPaymentsEntityPaymentMethod.from_dict(obj.get("payment_method")) if obj.get("payment_method") is not None else None + }) + return _obj + + diff --git a/models/payment_method_in_payments_entity_payment_method.py b/models/payment_method_in_payments_entity_payment_method.py new file mode 100644 index 0000000..708c33f --- /dev/null +++ b/models/payment_method_in_payments_entity_payment_method.py @@ -0,0 +1,198 @@ +# coding: utf-8 + +""" + Cashfree Payment Gateway APIs + + Cashfree's Payment Gateway APIs provide developers with a streamlined pathway to integrate advanced payment processing capabilities into their applications, platforms and websites. + + The version of the OpenAPI document: 2022-09-01 + Contact: developers@cashfree.com + Generated by OpenAPI Generator (https://openapi-generator.tech) + + Do not edit the class manually. +""" # noqa: E501 + + +from __future__ import annotations +from inspect import getfullargspec +import json +import pprint +import re # noqa: F401 + +from typing import Any, List, Optional +from pydantic import BaseModel, Field, StrictStr, ValidationError, validator +from cashfree_pg.models.payment_method_app_in_payments_entity import PaymentMethodAppInPaymentsEntity +from cashfree_pg.models.payment_method_card_in_payments_entity import PaymentMethodCardInPaymentsEntity +from cashfree_pg.models.payment_method_cardless_emiin_payments_entity import PaymentMethodCardlessEMIInPaymentsEntity +from cashfree_pg.models.payment_method_net_banking_in_payments_entity import PaymentMethodNetBankingInPaymentsEntity +from cashfree_pg.models.payment_method_paylater_in_payments_entity import PaymentMethodPaylaterInPaymentsEntity +from cashfree_pg.models.payment_method_upiin_payments_entity import PaymentMethodUPIInPaymentsEntity +from typing import Union, Any, List, TYPE_CHECKING +from pydantic import StrictStr, Field + +PAYMENTMETHODINPAYMENTSENTITYPAYMENTMETHOD_ONE_OF_SCHEMAS = ["PaymentMethodAppInPaymentsEntity", "PaymentMethodCardInPaymentsEntity", "PaymentMethodCardlessEMIInPaymentsEntity", "PaymentMethodNetBankingInPaymentsEntity", "PaymentMethodPaylaterInPaymentsEntity", "PaymentMethodUPIInPaymentsEntity"] + +class PaymentMethodInPaymentsEntityPaymentMethod(BaseModel): + """ + PaymentMethodInPaymentsEntityPaymentMethod + """ + # data type: PaymentMethodCardInPaymentsEntity + oneof_schema_1_validator: Optional[PaymentMethodCardInPaymentsEntity] = None + # data type: PaymentMethodNetBankingInPaymentsEntity + oneof_schema_2_validator: Optional[PaymentMethodNetBankingInPaymentsEntity] = None + # data type: PaymentMethodUPIInPaymentsEntity + oneof_schema_3_validator: Optional[PaymentMethodUPIInPaymentsEntity] = None + # data type: PaymentMethodAppInPaymentsEntity + oneof_schema_4_validator: Optional[PaymentMethodAppInPaymentsEntity] = None + # data type: PaymentMethodCardlessEMIInPaymentsEntity + oneof_schema_5_validator: Optional[PaymentMethodCardlessEMIInPaymentsEntity] = None + # data type: PaymentMethodPaylaterInPaymentsEntity + oneof_schema_6_validator: Optional[PaymentMethodPaylaterInPaymentsEntity] = None + if TYPE_CHECKING: + actual_instance: Union[PaymentMethodAppInPaymentsEntity, PaymentMethodCardInPaymentsEntity, PaymentMethodCardlessEMIInPaymentsEntity, PaymentMethodNetBankingInPaymentsEntity, PaymentMethodPaylaterInPaymentsEntity, PaymentMethodUPIInPaymentsEntity] + else: + actual_instance: Any + one_of_schemas: List[str] = Field(PAYMENTMETHODINPAYMENTSENTITYPAYMENTMETHOD_ONE_OF_SCHEMAS, const=True) + + class Config: + validate_assignment = True + + def __init__(self, *args, **kwargs): + if args: + if len(args) > 1: + raise ValueError("If a position argument is used, only 1 is allowed to set `actual_instance`") + if kwargs: + raise ValueError("If a position argument is used, keyword arguments cannot be used.") + super().__init__(actual_instance=args[0]) + else: + super().__init__(**kwargs) + + @validator('actual_instance') + def actual_instance_must_validate_oneof(cls, v): + instance = PaymentMethodInPaymentsEntityPaymentMethod.construct() + error_messages = [] + match = 0 + # validate data type: PaymentMethodCardInPaymentsEntity + if not isinstance(v, PaymentMethodCardInPaymentsEntity): + error_messages.append(f"Error! Input type `{type(v)}` is not `PaymentMethodCardInPaymentsEntity`") + else: + match += 1 + # validate data type: PaymentMethodNetBankingInPaymentsEntity + if not isinstance(v, PaymentMethodNetBankingInPaymentsEntity): + error_messages.append(f"Error! Input type `{type(v)}` is not `PaymentMethodNetBankingInPaymentsEntity`") + else: + match += 1 + # validate data type: PaymentMethodUPIInPaymentsEntity + if not isinstance(v, PaymentMethodUPIInPaymentsEntity): + error_messages.append(f"Error! Input type `{type(v)}` is not `PaymentMethodUPIInPaymentsEntity`") + else: + match += 1 + # validate data type: PaymentMethodAppInPaymentsEntity + if not isinstance(v, PaymentMethodAppInPaymentsEntity): + error_messages.append(f"Error! Input type `{type(v)}` is not `PaymentMethodAppInPaymentsEntity`") + else: + match += 1 + # validate data type: PaymentMethodCardlessEMIInPaymentsEntity + if not isinstance(v, PaymentMethodCardlessEMIInPaymentsEntity): + error_messages.append(f"Error! Input type `{type(v)}` is not `PaymentMethodCardlessEMIInPaymentsEntity`") + else: + match += 1 + # validate data type: PaymentMethodPaylaterInPaymentsEntity + if not isinstance(v, PaymentMethodPaylaterInPaymentsEntity): + error_messages.append(f"Error! Input type `{type(v)}` is not `PaymentMethodPaylaterInPaymentsEntity`") + else: + match += 1 + if match > 1: + # more than 1 match + raise ValueError("Multiple matches found when setting `actual_instance` in PaymentMethodInPaymentsEntityPaymentMethod with oneOf schemas: PaymentMethodAppInPaymentsEntity, PaymentMethodCardInPaymentsEntity, PaymentMethodCardlessEMIInPaymentsEntity, PaymentMethodNetBankingInPaymentsEntity, PaymentMethodPaylaterInPaymentsEntity, PaymentMethodUPIInPaymentsEntity. Details: " + ", ".join(error_messages)) + elif match == 0: + # no match + raise ValueError("No match found when setting `actual_instance` in PaymentMethodInPaymentsEntityPaymentMethod with oneOf schemas: PaymentMethodAppInPaymentsEntity, PaymentMethodCardInPaymentsEntity, PaymentMethodCardlessEMIInPaymentsEntity, PaymentMethodNetBankingInPaymentsEntity, PaymentMethodPaylaterInPaymentsEntity, PaymentMethodUPIInPaymentsEntity. Details: " + ", ".join(error_messages)) + else: + return v + + @classmethod + def from_dict(cls, obj: dict) -> PaymentMethodInPaymentsEntityPaymentMethod: + return cls.from_json(json.dumps(obj)) + + @classmethod + def from_json(cls, json_str: str) -> PaymentMethodInPaymentsEntityPaymentMethod: + """Returns the object represented by the json string""" + instance = PaymentMethodInPaymentsEntityPaymentMethod.construct() + error_messages = [] + match = 0 + + # deserialize data into PaymentMethodCardInPaymentsEntity + try: + instance.actual_instance = PaymentMethodCardInPaymentsEntity.from_json(json_str) + match += 1 + except (ValidationError, ValueError) as e: + error_messages.append(str(e)) + # deserialize data into PaymentMethodNetBankingInPaymentsEntity + try: + instance.actual_instance = PaymentMethodNetBankingInPaymentsEntity.from_json(json_str) + match += 1 + except (ValidationError, ValueError) as e: + error_messages.append(str(e)) + # deserialize data into PaymentMethodUPIInPaymentsEntity + try: + instance.actual_instance = PaymentMethodUPIInPaymentsEntity.from_json(json_str) + match += 1 + except (ValidationError, ValueError) as e: + error_messages.append(str(e)) + # deserialize data into PaymentMethodAppInPaymentsEntity + try: + instance.actual_instance = PaymentMethodAppInPaymentsEntity.from_json(json_str) + match += 1 + except (ValidationError, ValueError) as e: + error_messages.append(str(e)) + # deserialize data into PaymentMethodCardlessEMIInPaymentsEntity + try: + instance.actual_instance = PaymentMethodCardlessEMIInPaymentsEntity.from_json(json_str) + match += 1 + except (ValidationError, ValueError) as e: + error_messages.append(str(e)) + # deserialize data into PaymentMethodPaylaterInPaymentsEntity + try: + instance.actual_instance = PaymentMethodPaylaterInPaymentsEntity.from_json(json_str) + match += 1 + except (ValidationError, ValueError) as e: + error_messages.append(str(e)) + + if match > 1: + # more than 1 match + raise ValueError("Multiple matches found when deserializing the JSON string into PaymentMethodInPaymentsEntityPaymentMethod with oneOf schemas: PaymentMethodAppInPaymentsEntity, PaymentMethodCardInPaymentsEntity, PaymentMethodCardlessEMIInPaymentsEntity, PaymentMethodNetBankingInPaymentsEntity, PaymentMethodPaylaterInPaymentsEntity, PaymentMethodUPIInPaymentsEntity. Details: " + ", ".join(error_messages)) + elif match == 0: + # no match + raise ValueError("No match found when deserializing the JSON string into PaymentMethodInPaymentsEntityPaymentMethod with oneOf schemas: PaymentMethodAppInPaymentsEntity, PaymentMethodCardInPaymentsEntity, PaymentMethodCardlessEMIInPaymentsEntity, PaymentMethodNetBankingInPaymentsEntity, PaymentMethodPaylaterInPaymentsEntity, PaymentMethodUPIInPaymentsEntity. Details: " + ", ".join(error_messages)) + else: + return instance + + def to_json(self) -> str: + """Returns the JSON representation of the actual instance""" + if self.actual_instance is None: + return "null" + + to_json = getattr(self.actual_instance, "to_json", None) + if callable(to_json): + return self.actual_instance.to_json() + else: + return json.dumps(self.actual_instance) + + def to_dict(self) -> dict: + """Returns the dict representation of the actual instance""" + if self.actual_instance is None: + return None + + to_dict = getattr(self.actual_instance, "to_dict", None) + if callable(to_dict): + return self.actual_instance.to_dict() + else: + # primitive type + return self.actual_instance + + def to_str(self) -> str: + """Returns the string representation of the actual instance""" + return pprint.pformat(self.dict()) + + diff --git a/models/payment_method_net_banking_in_payments_entity.py b/models/payment_method_net_banking_in_payments_entity.py new file mode 100644 index 0000000..984950f --- /dev/null +++ b/models/payment_method_net_banking_in_payments_entity.py @@ -0,0 +1,76 @@ +# coding: utf-8 + +""" + Cashfree Payment Gateway APIs + + Cashfree's Payment Gateway APIs provide developers with a streamlined pathway to integrate advanced payment processing capabilities into their applications, platforms and websites. + + The version of the OpenAPI document: 2022-09-01 + Contact: developers@cashfree.com + Generated by OpenAPI Generator (https://openapi-generator.tech) + + Do not edit the class manually. +""" # noqa: E501 + + +from __future__ import annotations +import pprint +import re # noqa: F401 +import json + + + +from pydantic import BaseModel, Field, StrictInt, StrictStr + +class PaymentMethodNetBankingInPaymentsEntity(BaseModel): + """ + netbanking payment method object for pay + """ + channel: StrictStr = Field(...) + netbanking_bank_code: StrictInt = Field(...) + netbanking_bank_name: StrictStr = Field(...) + __properties = ["channel", "netbanking_bank_code", "netbanking_bank_name"] + + class Config: + """Pydantic configuration""" + allow_population_by_field_name = True + validate_assignment = True + + def to_str(self) -> str: + """Returns the string representation of the model using alias""" + return pprint.pformat(self.dict(by_alias=True)) + + def to_json(self) -> str: + """Returns the JSON representation of the model using alias""" + return json.dumps(self.to_dict()) + + @classmethod + 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)) + + def to_dict(self): + """Returns the dictionary representation of the model using alias""" + _dict = self.dict(by_alias=True, + exclude={ + }, + exclude_none=True) + return _dict + + @classmethod + def from_dict(cls, obj: dict) -> PaymentMethodNetBankingInPaymentsEntity: + """Create an instance of PaymentMethodNetBankingInPaymentsEntity from a dict""" + if obj is None: + return None + + if not isinstance(obj, dict): + return PaymentMethodNetBankingInPaymentsEntity.parse_obj(obj) + + _obj = PaymentMethodNetBankingInPaymentsEntity.parse_obj({ + "channel": obj.get("channel"), + "netbanking_bank_code": obj.get("netbanking_bank_code"), + "netbanking_bank_name": obj.get("netbanking_bank_name") + }) + return _obj + + diff --git a/models/payment_method_paylater_in_payments_entity.py b/models/payment_method_paylater_in_payments_entity.py new file mode 100644 index 0000000..b2af334 --- /dev/null +++ b/models/payment_method_paylater_in_payments_entity.py @@ -0,0 +1,76 @@ +# coding: utf-8 + +""" + Cashfree Payment Gateway APIs + + Cashfree's Payment Gateway APIs provide developers with a streamlined pathway to integrate advanced payment processing capabilities into their applications, platforms and websites. + + The version of the OpenAPI document: 2022-09-01 + Contact: developers@cashfree.com + Generated by OpenAPI Generator (https://openapi-generator.tech) + + Do not edit the class manually. +""" # noqa: E501 + + +from __future__ import annotations +import pprint +import re # noqa: F401 +import json + + +from typing import Optional +from pydantic import BaseModel, StrictStr + +class PaymentMethodPaylaterInPaymentsEntity(BaseModel): + """ + paylater payment method object for pay api + """ + channel: Optional[StrictStr] = None + provider: Optional[StrictStr] = None + phone: Optional[StrictStr] = None + __properties = ["channel", "provider", "phone"] + + class Config: + """Pydantic configuration""" + allow_population_by_field_name = True + validate_assignment = True + + def to_str(self) -> str: + """Returns the string representation of the model using alias""" + return pprint.pformat(self.dict(by_alias=True)) + + def to_json(self) -> str: + """Returns the JSON representation of the model using alias""" + return json.dumps(self.to_dict()) + + @classmethod + 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)) + + def to_dict(self): + """Returns the dictionary representation of the model using alias""" + _dict = self.dict(by_alias=True, + exclude={ + }, + exclude_none=True) + return _dict + + @classmethod + def from_dict(cls, obj: dict) -> PaymentMethodPaylaterInPaymentsEntity: + """Create an instance of PaymentMethodPaylaterInPaymentsEntity from a dict""" + if obj is None: + return None + + if not isinstance(obj, dict): + return PaymentMethodPaylaterInPaymentsEntity.parse_obj(obj) + + _obj = PaymentMethodPaylaterInPaymentsEntity.parse_obj({ + "channel": obj.get("channel"), + "provider": obj.get("provider"), + "phone": obj.get("phone") + }) + return _obj + + diff --git a/models/payment_method_upiin_payments_entity.py b/models/payment_method_upiin_payments_entity.py new file mode 100644 index 0000000..074ed7f --- /dev/null +++ b/models/payment_method_upiin_payments_entity.py @@ -0,0 +1,74 @@ +# coding: utf-8 + +""" + Cashfree Payment Gateway APIs + + Cashfree's Payment Gateway APIs provide developers with a streamlined pathway to integrate advanced payment processing capabilities into their applications, platforms and websites. + + The version of the OpenAPI document: 2022-09-01 + Contact: developers@cashfree.com + Generated by OpenAPI Generator (https://openapi-generator.tech) + + Do not edit the class manually. +""" # noqa: E501 + + +from __future__ import annotations +import pprint +import re # noqa: F401 +import json + + +from typing import Optional +from pydantic import BaseModel, Field, StrictStr + +class PaymentMethodUPIInPaymentsEntity(BaseModel): + """ + UPI payment method for pay api + """ + channel: StrictStr = Field(...) + upi_id: Optional[StrictStr] = None + __properties = ["channel", "upi_id"] + + class Config: + """Pydantic configuration""" + allow_population_by_field_name = True + validate_assignment = True + + def to_str(self) -> str: + """Returns the string representation of the model using alias""" + return pprint.pformat(self.dict(by_alias=True)) + + def to_json(self) -> str: + """Returns the JSON representation of the model using alias""" + return json.dumps(self.to_dict()) + + @classmethod + 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)) + + def to_dict(self): + """Returns the dictionary representation of the model using alias""" + _dict = self.dict(by_alias=True, + exclude={ + }, + exclude_none=True) + return _dict + + @classmethod + def from_dict(cls, obj: dict) -> PaymentMethodUPIInPaymentsEntity: + """Create an instance of PaymentMethodUPIInPaymentsEntity from a dict""" + if obj is None: + return None + + if not isinstance(obj, dict): + return PaymentMethodUPIInPaymentsEntity.parse_obj(obj) + + _obj = PaymentMethodUPIInPaymentsEntity.parse_obj({ + "channel": obj.get("channel"), + "upi_id": obj.get("upi_id") + }) + return _obj + + diff --git a/models/payment_methods_filters.py b/models/payment_methods_filters.py new file mode 100644 index 0000000..cc70617 --- /dev/null +++ b/models/payment_methods_filters.py @@ -0,0 +1,72 @@ +# coding: utf-8 + +""" + Cashfree Payment Gateway APIs + + Cashfree's Payment Gateway APIs provide developers with a streamlined pathway to integrate advanced payment processing capabilities into their applications, platforms and websites. + + The version of the OpenAPI document: 2022-09-01 + Contact: developers@cashfree.com + Generated by OpenAPI Generator (https://openapi-generator.tech) + + Do not edit the class manually. +""" # noqa: E501 + + +from __future__ import annotations +import pprint +import re # noqa: F401 +import json + + +from typing import List, Optional +from pydantic import BaseModel, Field, StrictStr, conlist + +class PaymentMethodsFilters(BaseModel): + """ + Filter for Payment Methods + """ + payment_methods: Optional[conlist(StrictStr)] = Field(None, description="Array of payment methods to be filtered.") + __properties = ["payment_methods"] + + class Config: + """Pydantic configuration""" + allow_population_by_field_name = True + validate_assignment = True + + def to_str(self) -> str: + """Returns the string representation of the model using alias""" + return pprint.pformat(self.dict(by_alias=True)) + + def to_json(self) -> str: + """Returns the JSON representation of the model using alias""" + return json.dumps(self.to_dict()) + + @classmethod + 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)) + + def to_dict(self): + """Returns the dictionary representation of the model using alias""" + _dict = self.dict(by_alias=True, + exclude={ + }, + exclude_none=True) + return _dict + + @classmethod + def from_dict(cls, obj: dict) -> PaymentMethodsFilters: + """Create an instance of PaymentMethodsFilters from a dict""" + if obj is None: + return None + + if not isinstance(obj, dict): + return PaymentMethodsFilters.parse_obj(obj) + + _obj = PaymentMethodsFilters.parse_obj({ + "payment_methods": obj.get("payment_methods") + }) + return _obj + + diff --git a/models/payment_methods_queries.py b/models/payment_methods_queries.py new file mode 100644 index 0000000..7106c50 --- /dev/null +++ b/models/payment_methods_queries.py @@ -0,0 +1,72 @@ +# coding: utf-8 + +""" + Cashfree Payment Gateway APIs + + Cashfree's Payment Gateway APIs provide developers with a streamlined pathway to integrate advanced payment processing capabilities into their applications, platforms and websites. + + The version of the OpenAPI document: 2022-09-01 + Contact: developers@cashfree.com + Generated by OpenAPI Generator (https://openapi-generator.tech) + + Do not edit the class manually. +""" # noqa: E501 + + +from __future__ import annotations +import pprint +import re # noqa: F401 +import json + + +from typing import Optional, Union +from pydantic import BaseModel, Field, confloat, conint + +class PaymentMethodsQueries(BaseModel): + """ + Payment Method Query Object + """ + amount: Optional[Union[confloat(ge=1, strict=True), conint(ge=1, strict=True)]] = Field(None, description="Amount of the order.") + __properties = ["amount"] + + class Config: + """Pydantic configuration""" + allow_population_by_field_name = True + validate_assignment = True + + def to_str(self) -> str: + """Returns the string representation of the model using alias""" + return pprint.pformat(self.dict(by_alias=True)) + + def to_json(self) -> str: + """Returns the JSON representation of the model using alias""" + return json.dumps(self.to_dict()) + + @classmethod + 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)) + + def to_dict(self): + """Returns the dictionary representation of the model using alias""" + _dict = self.dict(by_alias=True, + exclude={ + }, + exclude_none=True) + return _dict + + @classmethod + def from_dict(cls, obj: dict) -> PaymentMethodsQueries: + """Create an instance of PaymentMethodsQueries from a dict""" + if obj is None: + return None + + if not isinstance(obj, dict): + return PaymentMethodsQueries.parse_obj(obj) + + _obj = PaymentMethodsQueries.parse_obj({ + "amount": obj.get("amount") + }) + return _obj + + diff --git a/models/payment_mode_details.py b/models/payment_mode_details.py new file mode 100644 index 0000000..a281e12 --- /dev/null +++ b/models/payment_mode_details.py @@ -0,0 +1,78 @@ +# coding: utf-8 + +""" + Cashfree Payment Gateway APIs + + Cashfree's Payment Gateway APIs provide developers with a streamlined pathway to integrate advanced payment processing capabilities into their applications, platforms and websites. + + The version of the OpenAPI document: 2022-09-01 + Contact: developers@cashfree.com + Generated by OpenAPI Generator (https://openapi-generator.tech) + + Do not edit the class manually. +""" # noqa: E501 + + +from __future__ import annotations +import pprint +import re # noqa: F401 +import json + + +from typing import Optional, Union +from pydantic import BaseModel, StrictBool, StrictFloat, StrictInt, StrictStr + +class PaymentModeDetails(BaseModel): + """ + payment mode eligiblity object + """ + nick: Optional[StrictStr] = None + display: Optional[StrictStr] = None + eligibility: Optional[StrictBool] = None + code: Optional[Union[StrictFloat, StrictInt]] = None + __properties = ["nick", "display", "eligibility", "code"] + + class Config: + """Pydantic configuration""" + allow_population_by_field_name = True + validate_assignment = True + + def to_str(self) -> str: + """Returns the string representation of the model using alias""" + return pprint.pformat(self.dict(by_alias=True)) + + def to_json(self) -> str: + """Returns the JSON representation of the model using alias""" + return json.dumps(self.to_dict()) + + @classmethod + 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)) + + def to_dict(self): + """Returns the dictionary representation of the model using alias""" + _dict = self.dict(by_alias=True, + exclude={ + }, + exclude_none=True) + return _dict + + @classmethod + def from_dict(cls, obj: dict) -> PaymentModeDetails: + """Create an instance of PaymentModeDetails from a dict""" + if obj is None: + return None + + if not isinstance(obj, dict): + return PaymentModeDetails.parse_obj(obj) + + _obj = PaymentModeDetails.parse_obj({ + "nick": obj.get("nick"), + "display": obj.get("display"), + "eligibility": obj.get("eligibility"), + "code": obj.get("code") + }) + return _obj + + diff --git a/models/payment_success_webhook.py b/models/payment_success_webhook.py new file mode 100644 index 0000000..2972924 --- /dev/null +++ b/models/payment_success_webhook.py @@ -0,0 +1,80 @@ +# coding: utf-8 + +""" + Cashfree Payment Gateway APIs + + Cashfree's Payment Gateway APIs provide developers with a streamlined pathway to integrate advanced payment processing capabilities into their applications, platforms and websites. + + The version of the OpenAPI document: 2022-09-01 + Contact: developers@cashfree.com + Generated by OpenAPI Generator (https://openapi-generator.tech) + + Do not edit the class manually. +""" # noqa: E501 + + +from __future__ import annotations +import pprint +import re # noqa: F401 +import json + + +from typing import Optional +from pydantic import BaseModel, StrictStr +from cashfree_pg.models.w_hdata import WHdata + +class PaymentSuccessWebhook(BaseModel): + """ + object for payment success webhook + """ + data: Optional[WHdata] = None + event_time: Optional[StrictStr] = None + type: Optional[StrictStr] = None + __properties = ["data", "event_time", "type"] + + class Config: + """Pydantic configuration""" + allow_population_by_field_name = True + validate_assignment = True + + def to_str(self) -> str: + """Returns the string representation of the model using alias""" + return pprint.pformat(self.dict(by_alias=True)) + + def to_json(self) -> str: + """Returns the JSON representation of the model using alias""" + return json.dumps(self.to_dict()) + + @classmethod + def from_json(cls, json_str: str) -> PaymentSuccessWebhook: + """Create an instance of PaymentSuccessWebhook from a JSON string""" + return cls.from_dict(json.loads(json_str)) + + def to_dict(self): + """Returns the dictionary representation of the model using alias""" + _dict = self.dict(by_alias=True, + exclude={ + }, + exclude_none=True) + # override the default output from pydantic by calling `to_dict()` of data + if self.data: + _dict['data'] = self.data.to_dict() + return _dict + + @classmethod + def from_dict(cls, obj: dict) -> PaymentSuccessWebhook: + """Create an instance of PaymentSuccessWebhook from a dict""" + if obj is None: + return None + + if not isinstance(obj, dict): + return PaymentSuccessWebhook.parse_obj(obj) + + _obj = PaymentSuccessWebhook.parse_obj({ + "data": WHdata.from_dict(obj.get("data")) if obj.get("data") is not None else None, + "event_time": obj.get("event_time"), + "type": obj.get("type") + }) + return _obj + + diff --git a/models/payment_url_object.py b/models/payment_url_object.py new file mode 100644 index 0000000..8492fdc --- /dev/null +++ b/models/payment_url_object.py @@ -0,0 +1,72 @@ +# coding: utf-8 + +""" + Cashfree Payment Gateway APIs + + Cashfree's Payment Gateway APIs provide developers with a streamlined pathway to integrate advanced payment processing capabilities into their applications, platforms and websites. + + The version of the OpenAPI document: 2022-09-01 + Contact: developers@cashfree.com + Generated by OpenAPI Generator (https://openapi-generator.tech) + + Do not edit the class manually. +""" # noqa: E501 + + +from __future__ import annotations +import pprint +import re # noqa: F401 +import json + + +from typing import Optional +from pydantic import BaseModel, StrictStr + +class PaymentURLObject(BaseModel): + """ + URL for payment retrieval for an order + """ + url: Optional[StrictStr] = None + __properties = ["url"] + + class Config: + """Pydantic configuration""" + allow_population_by_field_name = True + validate_assignment = True + + def to_str(self) -> str: + """Returns the string representation of the model using alias""" + return pprint.pformat(self.dict(by_alias=True)) + + def to_json(self) -> str: + """Returns the JSON representation of the model using alias""" + return json.dumps(self.to_dict()) + + @classmethod + 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)) + + def to_dict(self): + """Returns the dictionary representation of the model using alias""" + _dict = self.dict(by_alias=True, + exclude={ + }, + exclude_none=True) + return _dict + + @classmethod + def from_dict(cls, obj: dict) -> PaymentURLObject: + """Create an instance of PaymentURLObject from a dict""" + if obj is None: + return None + + if not isinstance(obj, dict): + return PaymentURLObject.parse_obj(obj) + + _obj = PaymentURLObject.parse_obj({ + "url": obj.get("url") + }) + return _obj + + diff --git a/models/rate_limit_error.py b/models/rate_limit_error.py new file mode 100644 index 0000000..f863219 --- /dev/null +++ b/models/rate_limit_error.py @@ -0,0 +1,86 @@ +# coding: utf-8 + +""" + Cashfree Payment Gateway APIs + + Cashfree's Payment Gateway APIs provide developers with a streamlined pathway to integrate advanced payment processing capabilities into their applications, platforms and websites. + + The version of the OpenAPI document: 2022-09-01 + Contact: developers@cashfree.com + Generated by OpenAPI Generator (https://openapi-generator.tech) + + Do not edit the class manually. +""" # noqa: E501 + + +from __future__ import annotations +import pprint +import re # noqa: F401 +import json + + +from typing import Optional +from pydantic import BaseModel, Field, StrictStr, validator + +class RateLimitError(BaseModel): + """ + Error when rate limit is breached for your api + """ + message: Optional[StrictStr] = None + code: Optional[StrictStr] = None + type: Optional[StrictStr] = Field(None, description="rate_limit_error") + __properties = ["message", "code", "type"] + + @validator('type') + def type_validate_enum(cls, value): + """Validates the enum""" + if value is None: + return value + + if value not in ('rate_limit_error'): + raise ValueError("must be one of enum values ('rate_limit_error')") + return value + + class Config: + """Pydantic configuration""" + allow_population_by_field_name = True + validate_assignment = True + + def to_str(self) -> str: + """Returns the string representation of the model using alias""" + return pprint.pformat(self.dict(by_alias=True)) + + def to_json(self) -> str: + """Returns the JSON representation of the model using alias""" + return json.dumps(self.to_dict()) + + @classmethod + 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)) + + def to_dict(self): + """Returns the dictionary representation of the model using alias""" + _dict = self.dict(by_alias=True, + exclude={ + }, + exclude_none=True) + return _dict + + @classmethod + def from_dict(cls, obj: dict) -> RateLimitError: + """Create an instance of RateLimitError from a dict""" + if obj is None: + return None + + if not isinstance(obj, dict): + return RateLimitError.parse_obj(obj) + + _obj = RateLimitError.parse_obj({ + "message": obj.get("message"), + "code": obj.get("code"), + "type": obj.get("type") + }) + return _obj + + diff --git a/models/recon_entity.py b/models/recon_entity.py new file mode 100644 index 0000000..046a0fe --- /dev/null +++ b/models/recon_entity.py @@ -0,0 +1,89 @@ +# coding: utf-8 + +""" + Cashfree Payment Gateway APIs + + Cashfree's Payment Gateway APIs provide developers with a streamlined pathway to integrate advanced payment processing capabilities into their applications, platforms and websites. + + The version of the OpenAPI document: 2022-09-01 + Contact: developers@cashfree.com + Generated by OpenAPI Generator (https://openapi-generator.tech) + + Do not edit the class manually. +""" # noqa: E501 + + +from __future__ import annotations +import pprint +import re # noqa: F401 +import json + + +from typing import List, Optional +from pydantic import BaseModel, Field, StrictInt, StrictStr, conlist +from cashfree_pg.models.recon_entity_data_inner import ReconEntityDataInner + +class ReconEntity(BaseModel): + """ + Settlement detailed recon response + """ + cursor: Optional[StrictStr] = Field(None, description="Specifies from where the next set of settlement details should be fetched.") + limit: Optional[StrictInt] = Field(None, description="Number of settlements you want to fetch in the next iteration.") + data: Optional[conlist(ReconEntityDataInner)] = None + __properties = ["cursor", "limit", "data"] + + class Config: + """Pydantic configuration""" + allow_population_by_field_name = True + validate_assignment = True + + def to_str(self) -> str: + """Returns the string representation of the model using alias""" + return pprint.pformat(self.dict(by_alias=True)) + + def to_json(self) -> str: + """Returns the JSON representation of the model using alias""" + return json.dumps(self.to_dict()) + + @classmethod + 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)) + + def to_dict(self): + """Returns the dictionary representation of the model using alias""" + _dict = self.dict(by_alias=True, + exclude={ + }, + exclude_none=True) + # override the default output from pydantic by calling `to_dict()` of each item in data (list) + _items = [] + if self.data: + for _item in self.data: + if _item: + _items.append(_item.to_dict()) + _dict['data'] = _items + # set to None if cursor (nullable) is None + # and __fields_set__ contains the field + if self.cursor is None and "cursor" in self.__fields_set__: + _dict['cursor'] = None + + return _dict + + @classmethod + def from_dict(cls, obj: dict) -> ReconEntity: + """Create an instance of ReconEntity from a dict""" + if obj is None: + return None + + if not isinstance(obj, dict): + return ReconEntity.parse_obj(obj) + + _obj = ReconEntity.parse_obj({ + "cursor": obj.get("cursor"), + "limit": obj.get("limit"), + "data": [ReconEntityDataInner.from_dict(_item) for _item in obj.get("data")] if obj.get("data") is not None else None + }) + return _obj + + diff --git a/models/recon_entity_data_inner.py b/models/recon_entity_data_inner.py new file mode 100644 index 0000000..d4dc6b3 --- /dev/null +++ b/models/recon_entity_data_inner.py @@ -0,0 +1,369 @@ +# coding: utf-8 + +""" + Cashfree Payment Gateway APIs + + Cashfree's Payment Gateway APIs provide developers with a streamlined pathway to integrate advanced payment processing capabilities into their applications, platforms and websites. + + The version of the OpenAPI document: 2022-09-01 + Contact: developers@cashfree.com + Generated by OpenAPI Generator (https://openapi-generator.tech) + + Do not edit the class manually. +""" # noqa: E501 + + +from __future__ import annotations +import pprint +import re # noqa: F401 +import json + + +from typing import Optional, Union +from pydantic import BaseModel, Field, StrictFloat, StrictInt, StrictStr + +class ReconEntityDataInner(BaseModel): + """ + ReconEntityDataInner + """ + event_id: Optional[StrictStr] = Field(None, description="Unique ID associated with the event.") + event_type: Optional[StrictStr] = Field(None, description="The event type can be SETTLEMENT, PAYMENT, REFUND, REFUND_REVERSAL, DISPUTE, DISPUTE_REVERSAL, CHARGEBACK, CHARGEBACK_REVERSAL, OTHER_ADJUSTMENT.") + event_settlement_amount: Optional[Union[StrictFloat, StrictInt]] = Field(None, description="Amount that is part of the settlement corresponding to the event.") + event_amount: Optional[Union[StrictFloat, StrictInt]] = Field(None, description="Amount of the event. Example, refund amount, dispute amount, payment amount, etc.") + sale_type: Optional[StrictStr] = Field(None, description="Indicates if it is CREDIT/DEBIT sale.") + event_status: Optional[StrictStr] = Field(None, description="Status of the event. Example - SUCCESS, FAILED, PENDING, CANCELLED.") + entity: Optional[StrictStr] = Field(None, description="Recon") + event_time: Optional[StrictStr] = Field(None, description="Time associated with the event. Example, transaction time, dispute initiation time") + event_currency: Optional[StrictStr] = Field(None, description="Curreny type - INR.") + order_id: Optional[StrictStr] = Field(None, description="Unique order ID. Alphanumeric and only '-' and '_' allowed.") + order_amount: Optional[Union[StrictFloat, StrictInt]] = Field(None, description="The amount which was passed at the order creation time.") + customer_phone: Optional[StrictStr] = Field(None, description="Customer phone number.") + customer_email: Optional[StrictStr] = Field(None, description="Customer email.") + customer_name: Optional[StrictStr] = Field(None, description="Customer name.") + payment_amount: Optional[Union[StrictFloat, StrictInt]] = Field(None, description="Payment amount captured.") + payment_utr: Optional[StrictStr] = Field(None, description="Unique transaction reference number of the payment.") + payment_time: Optional[StrictStr] = Field(None, description="Date and time when the payment was initiated.") + payment_service_charge: Optional[Union[StrictFloat, StrictInt]] = Field(None, description="Service charge applicable for the payment.") + payment_service_tax: Optional[Union[StrictFloat, StrictInt]] = Field(None, description="Service tax applicable on the payment.") + cf_payment_id: Optional[StrictInt] = Field(None, description="Cashfree Payments unique ID to identify a payment.") + cf_settlement_id: Optional[StrictInt] = Field(None, description="Unique ID to identify the settlement.") + settlement_date: Optional[StrictStr] = Field(None, description="Date and time when the settlement was processed.") + settlement_utr: Optional[StrictStr] = Field(None, description="Unique transaction reference number of the settlement.") + split_service_charge: Optional[Union[StrictFloat, StrictInt]] = Field(None, description="Service charge that is applicable for splitting the payment.") + split_service_tax: Optional[Union[StrictFloat, StrictInt]] = Field(None, description="Service tax applicable for splitting the amount to vendors.") + vendor_commission: Optional[Union[StrictFloat, StrictInt]] = Field(None, description="Vendor commission applicable for this transaction.") + closed_in_favor_of: Optional[StrictStr] = Field(None, description="Specifies whether the dispute was closed in favor of the merchant or customer. /n Possible values - Merchant, Customer") + dispute_resolved_on: Optional[StrictStr] = Field(None, description="Date and time when the dispute was resolved.") + dispute_category: Optional[StrictStr] = Field(None, description="Category of the dispute - Dispute code and the reason for dispute is shown.") + dispute_note: Optional[StrictStr] = Field(None, description="Note regarding the dispute.") + refund_processed_at: Optional[StrictStr] = Field(None, description="Date and time when the refund was processed.") + refund_arn: Optional[StrictStr] = Field(None, description="The bank reference number for the refund.") + refund_note: Optional[StrictStr] = Field(None, description="A refund note for your reference.") + refund_id: Optional[StrictStr] = Field(None, description="An unique ID to associate the refund with.") + adjustment_remarks: Optional[StrictStr] = Field(None, description="Other adjustment remarks.") + adjustment: Optional[Union[StrictFloat, StrictInt]] = Field(None, description="Amount that is adjusted from the settlement amount because of any credit/debit event such as refund, refund_reverse etc.") + service_tax: Optional[Union[StrictFloat, StrictInt]] = Field(None, description="Service tax applicable on the settlement amount.") + service_charge: Optional[Union[StrictFloat, StrictInt]] = Field(None, description="Service charge applicable on the settlement amount.") + amount_settled: Optional[Union[StrictFloat, StrictInt]] = Field(None, description="Net amount that is settled after considering the adjustments, settlement charge and tax.") + payment_from: Optional[StrictStr] = Field(None, description="The start time of the time range of the payments considered for the settlement.") + payment_till: Optional[StrictStr] = Field(None, description="The end time of time range of the payments considered for the settlement.") + reason: Optional[StrictStr] = Field(None, description="Reason for settlement failure.") + settlement_initiated_on: Optional[StrictStr] = Field(None, description="Date and time when the settlement was initiated.") + settlement_type: Optional[StrictStr] = Field(None, description="Type of settlement. Possible values - Standard, Instant, On demand.") + settlement_charge: Optional[Union[StrictFloat, StrictInt]] = Field(None, description="Settlement charges applicable on the settlement.") + settlement_tax: Optional[Union[StrictFloat, StrictInt]] = Field(None, description="Settlement tax applicable on the settlement.") + remarks: Optional[StrictStr] = Field(None, description="Remarks on the settlement.") + __properties = ["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"] + + class Config: + """Pydantic configuration""" + allow_population_by_field_name = True + validate_assignment = True + + def to_str(self) -> str: + """Returns the string representation of the model using alias""" + return pprint.pformat(self.dict(by_alias=True)) + + def to_json(self) -> str: + """Returns the JSON representation of the model using alias""" + return json.dumps(self.to_dict()) + + @classmethod + 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)) + + def to_dict(self): + """Returns the dictionary representation of the model using alias""" + _dict = self.dict(by_alias=True, + exclude={ + }, + exclude_none=True) + # set to None if sale_type (nullable) is None + # and __fields_set__ contains the field + if self.sale_type is None and "sale_type" in self.__fields_set__: + _dict['sale_type'] = None + + # set to None if event_status (nullable) is None + # and __fields_set__ contains the field + if self.event_status is None and "event_status" in self.__fields_set__: + _dict['event_status'] = None + + # set to None if event_currency (nullable) is None + # and __fields_set__ contains the field + if self.event_currency is None and "event_currency" in self.__fields_set__: + _dict['event_currency'] = None + + # set to None if order_id (nullable) is None + # and __fields_set__ contains the field + if self.order_id is None and "order_id" in self.__fields_set__: + _dict['order_id'] = None + + # set to None if order_amount (nullable) is None + # and __fields_set__ contains the field + if self.order_amount is None and "order_amount" in self.__fields_set__: + _dict['order_amount'] = None + + # set to None if customer_phone (nullable) is None + # and __fields_set__ contains the field + if self.customer_phone is None and "customer_phone" in self.__fields_set__: + _dict['customer_phone'] = None + + # set to None if customer_email (nullable) is None + # and __fields_set__ contains the field + if self.customer_email is None and "customer_email" in self.__fields_set__: + _dict['customer_email'] = None + + # set to None if customer_name (nullable) is None + # and __fields_set__ contains the field + if self.customer_name is None and "customer_name" in self.__fields_set__: + _dict['customer_name'] = None + + # set to None if payment_amount (nullable) is None + # and __fields_set__ contains the field + if self.payment_amount is None and "payment_amount" in self.__fields_set__: + _dict['payment_amount'] = None + + # set to None if payment_utr (nullable) is None + # and __fields_set__ contains the field + if self.payment_utr is None and "payment_utr" in self.__fields_set__: + _dict['payment_utr'] = None + + # set to None if payment_time (nullable) is None + # and __fields_set__ contains the field + if self.payment_time is None and "payment_time" in self.__fields_set__: + _dict['payment_time'] = None + + # set to None if payment_service_charge (nullable) is None + # and __fields_set__ contains the field + if self.payment_service_charge is None and "payment_service_charge" in self.__fields_set__: + _dict['payment_service_charge'] = None + + # set to None if payment_service_tax (nullable) is None + # and __fields_set__ contains the field + if self.payment_service_tax is None and "payment_service_tax" in self.__fields_set__: + _dict['payment_service_tax'] = None + + # set to None if cf_payment_id (nullable) is None + # and __fields_set__ contains the field + if self.cf_payment_id is None and "cf_payment_id" in self.__fields_set__: + _dict['cf_payment_id'] = None + + # set to None if cf_settlement_id (nullable) is None + # and __fields_set__ contains the field + if self.cf_settlement_id is None and "cf_settlement_id" in self.__fields_set__: + _dict['cf_settlement_id'] = None + + # set to None if settlement_date (nullable) is None + # and __fields_set__ contains the field + if self.settlement_date is None and "settlement_date" in self.__fields_set__: + _dict['settlement_date'] = None + + # set to None if settlement_utr (nullable) is None + # and __fields_set__ contains the field + if self.settlement_utr is None and "settlement_utr" in self.__fields_set__: + _dict['settlement_utr'] = None + + # set to None if split_service_charge (nullable) is None + # and __fields_set__ contains the field + if self.split_service_charge is None and "split_service_charge" in self.__fields_set__: + _dict['split_service_charge'] = None + + # set to None if split_service_tax (nullable) is None + # and __fields_set__ contains the field + if self.split_service_tax is None and "split_service_tax" in self.__fields_set__: + _dict['split_service_tax'] = None + + # set to None if vendor_commission (nullable) is None + # and __fields_set__ contains the field + if self.vendor_commission is None and "vendor_commission" in self.__fields_set__: + _dict['vendor_commission'] = None + + # set to None if closed_in_favor_of (nullable) is None + # and __fields_set__ contains the field + if self.closed_in_favor_of is None and "closed_in_favor_of" in self.__fields_set__: + _dict['closed_in_favor_of'] = None + + # set to None if dispute_resolved_on (nullable) is None + # and __fields_set__ contains the field + if self.dispute_resolved_on is None and "dispute_resolved_on" in self.__fields_set__: + _dict['dispute_resolved_on'] = None + + # set to None if dispute_category (nullable) is None + # and __fields_set__ contains the field + if self.dispute_category is None and "dispute_category" in self.__fields_set__: + _dict['dispute_category'] = None + + # set to None if dispute_note (nullable) is None + # and __fields_set__ contains the field + if self.dispute_note is None and "dispute_note" in self.__fields_set__: + _dict['dispute_note'] = None + + # set to None if refund_processed_at (nullable) is None + # and __fields_set__ contains the field + if self.refund_processed_at is None and "refund_processed_at" in self.__fields_set__: + _dict['refund_processed_at'] = None + + # set to None if refund_arn (nullable) is None + # and __fields_set__ contains the field + if self.refund_arn is None and "refund_arn" in self.__fields_set__: + _dict['refund_arn'] = None + + # set to None if refund_note (nullable) is None + # and __fields_set__ contains the field + if self.refund_note is None and "refund_note" in self.__fields_set__: + _dict['refund_note'] = None + + # set to None if refund_id (nullable) is None + # and __fields_set__ contains the field + if self.refund_id is None and "refund_id" in self.__fields_set__: + _dict['refund_id'] = None + + # set to None if adjustment_remarks (nullable) is None + # and __fields_set__ contains the field + if self.adjustment_remarks is None and "adjustment_remarks" in self.__fields_set__: + _dict['adjustment_remarks'] = None + + # set to None if adjustment (nullable) is None + # and __fields_set__ contains the field + if self.adjustment is None and "adjustment" in self.__fields_set__: + _dict['adjustment'] = None + + # set to None if service_tax (nullable) is None + # and __fields_set__ contains the field + if self.service_tax is None and "service_tax" in self.__fields_set__: + _dict['service_tax'] = None + + # set to None if service_charge (nullable) is None + # and __fields_set__ contains the field + if self.service_charge is None and "service_charge" in self.__fields_set__: + _dict['service_charge'] = None + + # set to None if amount_settled (nullable) is None + # and __fields_set__ contains the field + if self.amount_settled is None and "amount_settled" in self.__fields_set__: + _dict['amount_settled'] = None + + # set to None if payment_from (nullable) is None + # and __fields_set__ contains the field + if self.payment_from is None and "payment_from" in self.__fields_set__: + _dict['payment_from'] = None + + # set to None if payment_till (nullable) is None + # and __fields_set__ contains the field + if self.payment_till is None and "payment_till" in self.__fields_set__: + _dict['payment_till'] = None + + # set to None if reason (nullable) is None + # and __fields_set__ contains the field + if self.reason is None and "reason" in self.__fields_set__: + _dict['reason'] = None + + # set to None if settlement_initiated_on (nullable) is None + # and __fields_set__ contains the field + if self.settlement_initiated_on is None and "settlement_initiated_on" in self.__fields_set__: + _dict['settlement_initiated_on'] = None + + # set to None if settlement_type (nullable) is None + # and __fields_set__ contains the field + if self.settlement_type is None and "settlement_type" in self.__fields_set__: + _dict['settlement_type'] = None + + # set to None if settlement_charge (nullable) is None + # and __fields_set__ contains the field + if self.settlement_charge is None and "settlement_charge" in self.__fields_set__: + _dict['settlement_charge'] = None + + # set to None if settlement_tax (nullable) is None + # and __fields_set__ contains the field + if self.settlement_tax is None and "settlement_tax" in self.__fields_set__: + _dict['settlement_tax'] = None + + # set to None if remarks (nullable) is None + # and __fields_set__ contains the field + if self.remarks is None and "remarks" in self.__fields_set__: + _dict['remarks'] = None + + return _dict + + @classmethod + def from_dict(cls, obj: dict) -> ReconEntityDataInner: + """Create an instance of ReconEntityDataInner from a dict""" + if obj is None: + return None + + if not isinstance(obj, dict): + return ReconEntityDataInner.parse_obj(obj) + + _obj = ReconEntityDataInner.parse_obj({ + "event_id": obj.get("event_id"), + "event_type": obj.get("event_type"), + "event_settlement_amount": obj.get("event_settlement_amount"), + "event_amount": obj.get("event_amount"), + "sale_type": obj.get("sale_type"), + "event_status": obj.get("event_status"), + "entity": obj.get("entity"), + "event_time": obj.get("event_time"), + "event_currency": obj.get("event_currency"), + "order_id": obj.get("order_id"), + "order_amount": obj.get("order_amount"), + "customer_phone": obj.get("customer_phone"), + "customer_email": obj.get("customer_email"), + "customer_name": obj.get("customer_name"), + "payment_amount": obj.get("payment_amount"), + "payment_utr": obj.get("payment_utr"), + "payment_time": obj.get("payment_time"), + "payment_service_charge": obj.get("payment_service_charge"), + "payment_service_tax": obj.get("payment_service_tax"), + "cf_payment_id": obj.get("cf_payment_id"), + "cf_settlement_id": obj.get("cf_settlement_id"), + "settlement_date": obj.get("settlement_date"), + "settlement_utr": obj.get("settlement_utr"), + "split_service_charge": obj.get("split_service_charge"), + "split_service_tax": obj.get("split_service_tax"), + "vendor_commission": obj.get("vendor_commission"), + "closed_in_favor_of": obj.get("closed_in_favor_of"), + "dispute_resolved_on": obj.get("dispute_resolved_on"), + "dispute_category": obj.get("dispute_category"), + "dispute_note": obj.get("dispute_note"), + "refund_processed_at": obj.get("refund_processed_at"), + "refund_arn": obj.get("refund_arn"), + "refund_note": obj.get("refund_note"), + "refund_id": obj.get("refund_id"), + "adjustment_remarks": obj.get("adjustment_remarks"), + "adjustment": obj.get("adjustment"), + "service_tax": obj.get("service_tax"), + "service_charge": obj.get("service_charge"), + "amount_settled": obj.get("amount_settled"), + "payment_from": obj.get("payment_from"), + "payment_till": obj.get("payment_till"), + "reason": obj.get("reason"), + "settlement_initiated_on": obj.get("settlement_initiated_on"), + "settlement_type": obj.get("settlement_type"), + "settlement_charge": obj.get("settlement_charge"), + "settlement_tax": obj.get("settlement_tax"), + "remarks": obj.get("remarks") + }) + return _obj + + diff --git a/models/refund_entity.py b/models/refund_entity.py new file mode 100644 index 0000000..bdd3182 --- /dev/null +++ b/models/refund_entity.py @@ -0,0 +1,165 @@ +# coding: utf-8 + +""" + Cashfree Payment Gateway APIs + + Cashfree's Payment Gateway APIs provide developers with a streamlined pathway to integrate advanced payment processing capabilities into their applications, platforms and websites. + + The version of the OpenAPI document: 2022-09-01 + Contact: developers@cashfree.com + Generated by OpenAPI Generator (https://openapi-generator.tech) + + Do not edit the class manually. +""" # noqa: E501 + + +from __future__ import annotations +import pprint +import re # noqa: F401 +import json + + +from typing import Any, Dict, List, Optional, Union +from pydantic import BaseModel, Field, StrictFloat, StrictInt, StrictStr, conlist, validator +from cashfree_pg.models.refund_speed import RefundSpeed +from cashfree_pg.models.vendor_split import VendorSplit + +class RefundEntity(BaseModel): + """ + The refund entity + """ + cf_payment_id: Optional[StrictInt] = Field(None, description="Cashfree Payments ID of the payment for which refund is initiated") + cf_refund_id: Optional[StrictStr] = Field(None, description="Cashfree Payments ID for a refund") + order_id: Optional[StrictStr] = Field(None, description="Merchant’s order Id of the order for which refund is initiated") + refund_id: Optional[StrictStr] = Field(None, description="Merchant’s refund ID of the refund") + entity: Optional[StrictStr] = Field(None, description="Type of object") + refund_amount: Optional[Union[StrictFloat, StrictInt]] = Field(None, description="Amount that is refunded") + refund_currency: Optional[StrictStr] = Field(None, description="Currency of the refund amount") + refund_note: Optional[StrictStr] = Field(None, description="Note added by merchant for the refund") + refund_status: Optional[StrictStr] = Field(None, description="This can be one of [\"SUCCESS\", \"PENDING\", \"CANCELLED\", \"ONHOLD\", \"FAILED\"]") + refund_arn: Optional[StrictStr] = Field(None, description="The bank reference number for refund") + refund_charge: Optional[Union[StrictFloat, StrictInt]] = Field(None, description="Charges in INR for processing refund") + status_description: Optional[StrictStr] = Field(None, description="Description of refund status") + metadata: Optional[Dict[str, Any]] = Field(None, description="Key-value pair that can be used to store additional information about the entity. Maximum 5 key-value pairs") + refund_splits: Optional[conlist(VendorSplit)] = None + refund_type: Optional[StrictStr] = Field(None, description="This can be one of [\"PAYMENT_AUTO_REFUND\", \"MERCHANT_INITIATED\", \"UNRECONCILED_AUTO_REFUND\"]") + refund_mode: Optional[StrictStr] = Field(None, description="Method or speed of processing refund") + created_at: Optional[StrictStr] = Field(None, description="Time of refund creation") + processed_at: Optional[StrictStr] = Field(None, description="Time when refund was processed successfully") + refund_speed: Optional[RefundSpeed] = None + __properties = ["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"] + + @validator('entity') + def entity_validate_enum(cls, value): + """Validates the enum""" + if value is None: + return value + + if value not in ('refund'): + raise ValueError("must be one of enum values ('refund')") + return value + + @validator('refund_status') + def refund_status_validate_enum(cls, value): + """Validates the enum""" + if value is None: + return value + + if value not in ('SUCCESS', 'PENDING', 'CANCELLED', 'ONHOLD'): + raise ValueError("must be one of enum values ('SUCCESS', 'PENDING', 'CANCELLED', 'ONHOLD')") + return value + + @validator('refund_type') + def refund_type_validate_enum(cls, value): + """Validates the enum""" + if value is None: + return value + + if value not in ('PAYMENT_AUTO_REFUND', 'MERCHANT_INITIATED', 'UNRECONCILED_AUTO_REFUND'): + raise ValueError("must be one of enum values ('PAYMENT_AUTO_REFUND', 'MERCHANT_INITIATED', 'UNRECONCILED_AUTO_REFUND')") + return value + + @validator('refund_mode') + def refund_mode_validate_enum(cls, value): + """Validates the enum""" + if value is None: + return value + + if value not in ('STANDARD', 'INSTANT'): + raise ValueError("must be one of enum values ('STANDARD', 'INSTANT')") + return value + + class Config: + """Pydantic configuration""" + allow_population_by_field_name = True + validate_assignment = True + + def to_str(self) -> str: + """Returns the string representation of the model using alias""" + return pprint.pformat(self.dict(by_alias=True)) + + def to_json(self) -> str: + """Returns the JSON representation of the model using alias""" + return json.dumps(self.to_dict()) + + @classmethod + 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)) + + def to_dict(self): + """Returns the dictionary representation of the model using alias""" + _dict = self.dict(by_alias=True, + exclude={ + }, + exclude_none=True) + # override the default output from pydantic by calling `to_dict()` of each item in refund_splits (list) + _items = [] + if self.refund_splits: + for _item in self.refund_splits: + if _item: + _items.append(_item.to_dict()) + _dict['refund_splits'] = _items + # override the default output from pydantic by calling `to_dict()` of refund_speed + if self.refund_speed: + _dict['refund_speed'] = self.refund_speed.to_dict() + # set to None if metadata (nullable) is None + # and __fields_set__ contains the field + if self.metadata is None and "metadata" in self.__fields_set__: + _dict['metadata'] = None + + return _dict + + @classmethod + def from_dict(cls, obj: dict) -> RefundEntity: + """Create an instance of RefundEntity from a dict""" + if obj is None: + return None + + if not isinstance(obj, dict): + return RefundEntity.parse_obj(obj) + + _obj = RefundEntity.parse_obj({ + "cf_payment_id": obj.get("cf_payment_id"), + "cf_refund_id": obj.get("cf_refund_id"), + "order_id": obj.get("order_id"), + "refund_id": obj.get("refund_id"), + "entity": obj.get("entity"), + "refund_amount": obj.get("refund_amount"), + "refund_currency": obj.get("refund_currency"), + "refund_note": obj.get("refund_note"), + "refund_status": obj.get("refund_status"), + "refund_arn": obj.get("refund_arn"), + "refund_charge": obj.get("refund_charge"), + "status_description": obj.get("status_description"), + "metadata": obj.get("metadata"), + "refund_splits": [VendorSplit.from_dict(_item) for _item in obj.get("refund_splits")] if obj.get("refund_splits") is not None else None, + "refund_type": obj.get("refund_type"), + "refund_mode": obj.get("refund_mode"), + "created_at": obj.get("created_at"), + "processed_at": obj.get("processed_at"), + "refund_speed": RefundSpeed.from_dict(obj.get("refund_speed")) if obj.get("refund_speed") is not None else None + }) + return _obj + + diff --git a/models/refund_speed.py b/models/refund_speed.py new file mode 100644 index 0000000..7009d69 --- /dev/null +++ b/models/refund_speed.py @@ -0,0 +1,78 @@ +# coding: utf-8 + +""" + Cashfree Payment Gateway APIs + + Cashfree's Payment Gateway APIs provide developers with a streamlined pathway to integrate advanced payment processing capabilities into their applications, platforms and websites. + + The version of the OpenAPI document: 2022-09-01 + Contact: developers@cashfree.com + Generated by OpenAPI Generator (https://openapi-generator.tech) + + Do not edit the class manually. +""" # noqa: E501 + + +from __future__ import annotations +import pprint +import re # noqa: F401 +import json + + +from typing import Optional +from pydantic import BaseModel, Field, StrictStr + +class RefundSpeed(BaseModel): + """ + How fast refund has to be proecessed + """ + requested: Optional[StrictStr] = Field(None, description="Requested speed of refund.") + accepted: Optional[StrictStr] = Field(None, description="Accepted speed of refund.") + processed: Optional[StrictStr] = Field(None, description="Processed speed of refund.") + message: Optional[StrictStr] = Field(None, description="Error message, if any for refund_speed request") + __properties = ["requested", "accepted", "processed", "message"] + + class Config: + """Pydantic configuration""" + allow_population_by_field_name = True + validate_assignment = True + + def to_str(self) -> str: + """Returns the string representation of the model using alias""" + return pprint.pformat(self.dict(by_alias=True)) + + def to_json(self) -> str: + """Returns the JSON representation of the model using alias""" + return json.dumps(self.to_dict()) + + @classmethod + 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)) + + def to_dict(self): + """Returns the dictionary representation of the model using alias""" + _dict = self.dict(by_alias=True, + exclude={ + }, + exclude_none=True) + return _dict + + @classmethod + def from_dict(cls, obj: dict) -> RefundSpeed: + """Create an instance of RefundSpeed from a dict""" + if obj is None: + return None + + if not isinstance(obj, dict): + return RefundSpeed.parse_obj(obj) + + _obj = RefundSpeed.parse_obj({ + "requested": obj.get("requested"), + "accepted": obj.get("accepted"), + "processed": obj.get("processed"), + "message": obj.get("message") + }) + return _obj + + diff --git a/models/refund_url_object.py b/models/refund_url_object.py new file mode 100644 index 0000000..dc619f7 --- /dev/null +++ b/models/refund_url_object.py @@ -0,0 +1,72 @@ +# coding: utf-8 + +""" + Cashfree Payment Gateway APIs + + Cashfree's Payment Gateway APIs provide developers with a streamlined pathway to integrate advanced payment processing capabilities into their applications, platforms and websites. + + The version of the OpenAPI document: 2022-09-01 + Contact: developers@cashfree.com + Generated by OpenAPI Generator (https://openapi-generator.tech) + + Do not edit the class manually. +""" # noqa: E501 + + +from __future__ import annotations +import pprint +import re # noqa: F401 +import json + + +from typing import Optional +from pydantic import BaseModel, StrictStr + +class RefundURLObject(BaseModel): + """ + URL to get refunds for order + """ + url: Optional[StrictStr] = None + __properties = ["url"] + + class Config: + """Pydantic configuration""" + allow_population_by_field_name = True + validate_assignment = True + + def to_str(self) -> str: + """Returns the string representation of the model using alias""" + return pprint.pformat(self.dict(by_alias=True)) + + def to_json(self) -> str: + """Returns the JSON representation of the model using alias""" + return json.dumps(self.to_dict()) + + @classmethod + 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)) + + def to_dict(self): + """Returns the dictionary representation of the model using alias""" + _dict = self.dict(by_alias=True, + exclude={ + }, + exclude_none=True) + return _dict + + @classmethod + def from_dict(cls, obj: dict) -> RefundURLObject: + """Create an instance of RefundURLObject from a dict""" + if obj is None: + return None + + if not isinstance(obj, dict): + return RefundURLObject.parse_obj(obj) + + _obj = RefundURLObject.parse_obj({ + "url": obj.get("url") + }) + return _obj + + diff --git a/models/saved_instrument_meta.py b/models/saved_instrument_meta.py new file mode 100644 index 0000000..e61c728 --- /dev/null +++ b/models/saved_instrument_meta.py @@ -0,0 +1,85 @@ +# coding: utf-8 + +""" + Cashfree Payment Gateway APIs + + Cashfree's Payment Gateway APIs provide developers with a streamlined pathway to integrate advanced payment processing capabilities into their applications, platforms and websites. + + The version of the OpenAPI document: 2022-09-01 + Contact: developers@cashfree.com + Generated by OpenAPI Generator (https://openapi-generator.tech) + + Do not edit the class manually. +""" # noqa: E501 + + +from __future__ import annotations +import pprint +import re # noqa: F401 +import json + + +from typing import Any, Dict, Optional +from pydantic import BaseModel, Field, StrictStr + +class SavedInstrumentMeta(BaseModel): + """ + Card instrument meta information + """ + card_network: Optional[StrictStr] = Field(None, description="card scheme/network of the saved card. Example visa, mastercard") + card_bank_name: Optional[StrictStr] = Field(None, description="Issuing bank name of saved card") + card_country: Optional[StrictStr] = Field(None, description="Issuing country of saved card") + card_type: Optional[StrictStr] = Field(None, description="Type of saved card") + card_token_details: Optional[Dict[str, Any]] = None + __properties = ["card_network", "card_bank_name", "card_country", "card_type", "card_token_details"] + + class Config: + """Pydantic configuration""" + allow_population_by_field_name = True + validate_assignment = True + + def to_str(self) -> str: + """Returns the string representation of the model using alias""" + return pprint.pformat(self.dict(by_alias=True)) + + def to_json(self) -> str: + """Returns the JSON representation of the model using alias""" + return json.dumps(self.to_dict()) + + @classmethod + 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)) + + def to_dict(self): + """Returns the dictionary representation of the model using alias""" + _dict = self.dict(by_alias=True, + exclude={ + }, + exclude_none=True) + # set to None if card_token_details (nullable) is None + # and __fields_set__ contains the field + if self.card_token_details is None and "card_token_details" in self.__fields_set__: + _dict['card_token_details'] = None + + return _dict + + @classmethod + def from_dict(cls, obj: dict) -> SavedInstrumentMeta: + """Create an instance of SavedInstrumentMeta from a dict""" + if obj is None: + return None + + if not isinstance(obj, dict): + return SavedInstrumentMeta.parse_obj(obj) + + _obj = SavedInstrumentMeta.parse_obj({ + "card_network": obj.get("card_network"), + "card_bank_name": obj.get("card_bank_name"), + "card_country": obj.get("card_country"), + "card_type": obj.get("card_type"), + "card_token_details": obj.get("card_token_details") + }) + return _obj + + diff --git a/models/settlement_entity.py b/models/settlement_entity.py new file mode 100644 index 0000000..c79c692 --- /dev/null +++ b/models/settlement_entity.py @@ -0,0 +1,98 @@ +# coding: utf-8 + +""" + Cashfree Payment Gateway APIs + + Cashfree's Payment Gateway APIs provide developers with a streamlined pathway to integrate advanced payment processing capabilities into their applications, platforms and websites. + + The version of the OpenAPI document: 2022-09-01 + Contact: developers@cashfree.com + Generated by OpenAPI Generator (https://openapi-generator.tech) + + Do not edit the class manually. +""" # noqa: E501 + + +from __future__ import annotations +import pprint +import re # noqa: F401 +import json + + +from typing import Optional, Union +from pydantic import BaseModel, StrictFloat, StrictInt, StrictStr + +class SettlementEntity(BaseModel): + """ + Settlement entity object + """ + cf_payment_id: Optional[StrictInt] = None + cf_settlement_id: Optional[StrictInt] = None + settlement_currency: Optional[StrictStr] = None + order_id: Optional[StrictStr] = None + entity: Optional[StrictStr] = None + order_amount: Optional[Union[StrictFloat, StrictInt]] = None + payment_time: Optional[StrictStr] = None + service_charge: Optional[Union[StrictFloat, StrictInt]] = None + service_tax: Optional[Union[StrictFloat, StrictInt]] = None + settlement_amount: Optional[Union[StrictFloat, StrictInt]] = None + settlement_id: Optional[StrictInt] = None + transfer_id: Optional[StrictInt] = None + transfer_time: Optional[StrictStr] = None + transfer_utr: Optional[StrictStr] = None + __properties = ["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"] + + class Config: + """Pydantic configuration""" + allow_population_by_field_name = True + validate_assignment = True + + def to_str(self) -> str: + """Returns the string representation of the model using alias""" + return pprint.pformat(self.dict(by_alias=True)) + + def to_json(self) -> str: + """Returns the JSON representation of the model using alias""" + return json.dumps(self.to_dict()) + + @classmethod + 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)) + + def to_dict(self): + """Returns the dictionary representation of the model using alias""" + _dict = self.dict(by_alias=True, + exclude={ + }, + exclude_none=True) + return _dict + + @classmethod + def from_dict(cls, obj: dict) -> SettlementEntity: + """Create an instance of SettlementEntity from a dict""" + if obj is None: + return None + + if not isinstance(obj, dict): + return SettlementEntity.parse_obj(obj) + + _obj = SettlementEntity.parse_obj({ + "cf_payment_id": obj.get("cf_payment_id"), + "cf_settlement_id": obj.get("cf_settlement_id"), + "settlement_currency": obj.get("settlement_currency"), + "order_id": obj.get("order_id"), + "entity": obj.get("entity"), + "order_amount": obj.get("order_amount"), + "payment_time": obj.get("payment_time"), + "service_charge": obj.get("service_charge"), + "service_tax": obj.get("service_tax"), + "settlement_amount": obj.get("settlement_amount"), + "settlement_id": obj.get("settlement_id"), + "transfer_id": obj.get("transfer_id"), + "transfer_time": obj.get("transfer_time"), + "transfer_utr": obj.get("transfer_utr") + }) + return _obj + + diff --git a/models/settlement_fetch_recon_request.py b/models/settlement_fetch_recon_request.py new file mode 100644 index 0000000..87443ef --- /dev/null +++ b/models/settlement_fetch_recon_request.py @@ -0,0 +1,82 @@ +# coding: utf-8 + +""" + Cashfree Payment Gateway APIs + + Cashfree's Payment Gateway APIs provide developers with a streamlined pathway to integrate advanced payment processing capabilities into their applications, platforms and websites. + + The version of the OpenAPI document: 2022-09-01 + Contact: developers@cashfree.com + Generated by OpenAPI Generator (https://openapi-generator.tech) + + Do not edit the class manually. +""" # noqa: E501 + + +from __future__ import annotations +import pprint +import re # noqa: F401 +import json + + + +from pydantic import BaseModel, Field +from cashfree_pg.models.fetch_settlements_request_pagination import FetchSettlementsRequestPagination +from cashfree_pg.models.settlement_fetch_recon_request_filters import SettlementFetchReconRequestFilters + +class SettlementFetchReconRequest(BaseModel): + """ + Recon Request Object + """ + pagination: FetchSettlementsRequestPagination = Field(...) + filters: SettlementFetchReconRequestFilters = Field(...) + __properties = ["pagination", "filters"] + + class Config: + """Pydantic configuration""" + allow_population_by_field_name = True + validate_assignment = True + + def to_str(self) -> str: + """Returns the string representation of the model using alias""" + return pprint.pformat(self.dict(by_alias=True)) + + def to_json(self) -> str: + """Returns the JSON representation of the model using alias""" + return json.dumps(self.to_dict()) + + @classmethod + 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)) + + def to_dict(self): + """Returns the dictionary representation of the model using alias""" + _dict = self.dict(by_alias=True, + exclude={ + }, + exclude_none=True) + # override the default output from pydantic by calling `to_dict()` of pagination + if self.pagination: + _dict['pagination'] = self.pagination.to_dict() + # override the default output from pydantic by calling `to_dict()` of filters + if self.filters: + _dict['filters'] = self.filters.to_dict() + return _dict + + @classmethod + def from_dict(cls, obj: dict) -> SettlementFetchReconRequest: + """Create an instance of SettlementFetchReconRequest from a dict""" + if obj is None: + return None + + if not isinstance(obj, dict): + return SettlementFetchReconRequest.parse_obj(obj) + + _obj = SettlementFetchReconRequest.parse_obj({ + "pagination": FetchSettlementsRequestPagination.from_dict(obj.get("pagination")) if obj.get("pagination") is not None else None, + "filters": SettlementFetchReconRequestFilters.from_dict(obj.get("filters")) if obj.get("filters") is not None else None + }) + return _obj + + diff --git a/models/settlement_fetch_recon_request_filters.py b/models/settlement_fetch_recon_request_filters.py new file mode 100644 index 0000000..1e70f07 --- /dev/null +++ b/models/settlement_fetch_recon_request_filters.py @@ -0,0 +1,78 @@ +# coding: utf-8 + +""" + Cashfree Payment Gateway APIs + + Cashfree's Payment Gateway APIs provide developers with a streamlined pathway to integrate advanced payment processing capabilities into their applications, platforms and websites. + + The version of the OpenAPI document: 2022-09-01 + Contact: developers@cashfree.com + Generated by OpenAPI Generator (https://openapi-generator.tech) + + Do not edit the class manually. +""" # noqa: E501 + + +from __future__ import annotations +import pprint +import re # noqa: F401 +import json + + +from typing import List, Optional +from pydantic import BaseModel, Field, StrictInt, StrictStr, conlist + +class SettlementFetchReconRequestFilters(BaseModel): + """ + Specify either the Settlement ID, Settlement UTR, or start date and end date to fetch the settlement details. + """ + cf_settlement_ids: Optional[conlist(StrictInt)] = Field(None, description="List of settlement IDs for which you want the settlement reconciliation details.") + settlement_utrs: Optional[conlist(StrictStr)] = Field(None, description="List of settlement UTRs for which you want the settlement reconciliation details.") + start_date: Optional[StrictStr] = Field(None, description="Specify the start date from when you want the settlement reconciliation details.") + end_date: Optional[StrictStr] = Field(None, description="Specify the end date till when you want the settlement reconciliation details.") + __properties = ["cf_settlement_ids", "settlement_utrs", "start_date", "end_date"] + + class Config: + """Pydantic configuration""" + allow_population_by_field_name = True + validate_assignment = True + + def to_str(self) -> str: + """Returns the string representation of the model using alias""" + return pprint.pformat(self.dict(by_alias=True)) + + def to_json(self) -> str: + """Returns the JSON representation of the model using alias""" + return json.dumps(self.to_dict()) + + @classmethod + 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)) + + def to_dict(self): + """Returns the dictionary representation of the model using alias""" + _dict = self.dict(by_alias=True, + exclude={ + }, + exclude_none=True) + return _dict + + @classmethod + def from_dict(cls, obj: dict) -> SettlementFetchReconRequestFilters: + """Create an instance of SettlementFetchReconRequestFilters from a dict""" + if obj is None: + return None + + if not isinstance(obj, dict): + return SettlementFetchReconRequestFilters.parse_obj(obj) + + _obj = SettlementFetchReconRequestFilters.parse_obj({ + "cf_settlement_ids": obj.get("cf_settlement_ids"), + "settlement_utrs": obj.get("settlement_utrs"), + "start_date": obj.get("start_date"), + "end_date": obj.get("end_date") + }) + return _obj + + diff --git a/models/settlement_recon_entity.py b/models/settlement_recon_entity.py new file mode 100644 index 0000000..cf2d5ff --- /dev/null +++ b/models/settlement_recon_entity.py @@ -0,0 +1,84 @@ +# coding: utf-8 + +""" + Cashfree Payment Gateway APIs + + Cashfree's Payment Gateway APIs provide developers with a streamlined pathway to integrate advanced payment processing capabilities into their applications, platforms and websites. + + The version of the OpenAPI document: 2022-09-01 + Contact: developers@cashfree.com + Generated by OpenAPI Generator (https://openapi-generator.tech) + + Do not edit the class manually. +""" # noqa: E501 + + +from __future__ import annotations +import pprint +import re # noqa: F401 +import json + + +from typing import List, Optional +from pydantic import BaseModel, Field, StrictInt, StrictStr, conlist +from cashfree_pg.models.settlement_recon_entity_data_inner import SettlementReconEntityDataInner + +class SettlementReconEntity(BaseModel): + """ + Recon object for settlement + """ + cursor: Optional[StrictStr] = Field(None, description="Specifies from where the next set of settlement details should be fetched.") + limit: Optional[StrictInt] = Field(None, description="Number of settlements you want to fetch in the next iteration.") + data: Optional[conlist(SettlementReconEntityDataInner)] = None + __properties = ["cursor", "limit", "data"] + + class Config: + """Pydantic configuration""" + allow_population_by_field_name = True + validate_assignment = True + + def to_str(self) -> str: + """Returns the string representation of the model using alias""" + return pprint.pformat(self.dict(by_alias=True)) + + def to_json(self) -> str: + """Returns the JSON representation of the model using alias""" + return json.dumps(self.to_dict()) + + @classmethod + 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)) + + def to_dict(self): + """Returns the dictionary representation of the model using alias""" + _dict = self.dict(by_alias=True, + exclude={ + }, + exclude_none=True) + # override the default output from pydantic by calling `to_dict()` of each item in data (list) + _items = [] + if self.data: + for _item in self.data: + if _item: + _items.append(_item.to_dict()) + _dict['data'] = _items + return _dict + + @classmethod + def from_dict(cls, obj: dict) -> SettlementReconEntity: + """Create an instance of SettlementReconEntity from a dict""" + if obj is None: + return None + + if not isinstance(obj, dict): + return SettlementReconEntity.parse_obj(obj) + + _obj = SettlementReconEntity.parse_obj({ + "cursor": obj.get("cursor"), + "limit": obj.get("limit"), + "data": [SettlementReconEntityDataInner.from_dict(_item) for _item in obj.get("data")] if obj.get("data") is not None else None + }) + return _obj + + diff --git a/models/settlement_recon_entity_data_inner.py b/models/settlement_recon_entity_data_inner.py new file mode 100644 index 0000000..8360dab --- /dev/null +++ b/models/settlement_recon_entity_data_inner.py @@ -0,0 +1,140 @@ +# coding: utf-8 + +""" + Cashfree Payment Gateway APIs + + Cashfree's Payment Gateway APIs provide developers with a streamlined pathway to integrate advanced payment processing capabilities into their applications, platforms and websites. + + The version of the OpenAPI document: 2022-09-01 + Contact: developers@cashfree.com + Generated by OpenAPI Generator (https://openapi-generator.tech) + + Do not edit the class manually. +""" # noqa: E501 + + +from __future__ import annotations +import pprint +import re # noqa: F401 +import json + + +from typing import Optional, Union +from pydantic import BaseModel, Field, StrictFloat, StrictInt, StrictStr + +class SettlementReconEntityDataInner(BaseModel): + """ + SettlementReconEntityDataInner + """ + event_id: Optional[StrictStr] = Field(None, description="Unique ID associated with the event.") + event_type: Optional[StrictStr] = Field(None, description="The event type can be PAYMENT, REFUND, REFUND_REVERSAL, DISPUTE, DISPUTE_REVERSAL, CHARGEBACK, CHARGEBACK_REVERSAL, OTHER_ADJUSTMENT.") + event_settlement_amount: Optional[Union[StrictFloat, StrictInt]] = Field(None, description="Amount that is part of the settlement corresponding to the event.") + event_amount: Optional[Union[StrictFloat, StrictInt]] = Field(None, description="Amount corresponding to the event. Example, refund amount, dispute amount, payment amount, etc.") + sale_type: Optional[StrictStr] = Field(None, description="Indicates if it is CREDIT/DEBIT sale.") + event_status: Optional[StrictStr] = Field(None, description="Status of the event. Example - SUCCESS, FAILED, PENDING, CANCELLED.") + entity: Optional[StrictStr] = Field(None, description="Recon") + event_time: Optional[StrictStr] = Field(None, description="Time associated with the event. Example, transaction time, dispute initiation time") + event_currency: Optional[StrictStr] = Field(None, description="Curreny type - INR.") + order_id: Optional[StrictStr] = Field(None, description="Unique order ID. Alphanumeric and only '-' and '_' allowed.") + order_amount: Optional[Union[StrictFloat, StrictInt]] = Field(None, description="The amount which was passed at the order creation time.") + customer_phone: Optional[StrictStr] = Field(None, description="Customer phone number.") + customer_email: Optional[StrictStr] = Field(None, description="Customer email.") + customer_name: Optional[StrictStr] = Field(None, description="Customer name.") + payment_amount: Optional[Union[StrictFloat, StrictInt]] = Field(None, description="Payment amount captured.") + payment_utr: Optional[StrictStr] = Field(None, description="Unique transaction reference number of the payment.") + payment_time: Optional[StrictStr] = Field(None, description="Date and time when the payment was initiated.") + payment_service_charge: Optional[Union[StrictFloat, StrictInt]] = Field(None, description="Service charge applicable for the payment.") + payment_service_tax: Optional[Union[StrictFloat, StrictInt]] = Field(None, description="Service tax applicable on the payment.") + cf_payment_id: Optional[StrictInt] = Field(None, description="Cashfree Payments unique ID to identify a payment.") + cf_settlement_id: Optional[StrictInt] = Field(None, description="Unique ID to identify the settlement.") + settlement_date: Optional[StrictStr] = Field(None, description="Date and time when the settlement was processed.") + settlement_utr: Optional[StrictStr] = Field(None, description="Unique transaction reference number of the settlement.") + split_service_charge: Optional[Union[StrictFloat, StrictInt]] = Field(None, description="Service charge that is applicable for splitting the payment.") + split_service_tax: Optional[Union[StrictFloat, StrictInt]] = Field(None, description="Service tax applicable for splitting the amount to vendors.") + vendor_commission: Optional[Union[StrictFloat, StrictInt]] = Field(None, description="Vendor commission applicable for this transaction.") + closed_in_favor_of: Optional[StrictStr] = Field(None, description="Specifies whether the dispute was closed in favor of the merchant or customer. Possible values - Merchant, Customer.") + dispute_resolved_on: Optional[StrictStr] = Field(None, description="Date and time when the dispute was resolved.") + dispute_category: Optional[StrictStr] = Field(None, description="Category of the dispute - Dispute code and the reason for dispute is shown.") + dispute_note: Optional[StrictStr] = Field(None, description="Note regarding the dispute.") + refund_processed_at: Optional[StrictStr] = Field(None, description="Date and time when the refund was processed.") + refund_arn: Optional[StrictStr] = Field(None, description="The bank reference number for refund.") + refund_note: Optional[StrictStr] = Field(None, description="A refund note for your reference.") + refund_id: Optional[StrictStr] = Field(None, description="An unique ID associated with the refund.") + adjustment_remarks: Optional[StrictStr] = Field(None, description="Other adjustment remarks.") + __properties = ["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"] + + class Config: + """Pydantic configuration""" + allow_population_by_field_name = True + validate_assignment = True + + def to_str(self) -> str: + """Returns the string representation of the model using alias""" + return pprint.pformat(self.dict(by_alias=True)) + + def to_json(self) -> str: + """Returns the JSON representation of the model using alias""" + return json.dumps(self.to_dict()) + + @classmethod + 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)) + + def to_dict(self): + """Returns the dictionary representation of the model using alias""" + _dict = self.dict(by_alias=True, + exclude={ + }, + exclude_none=True) + return _dict + + @classmethod + def from_dict(cls, obj: dict) -> SettlementReconEntityDataInner: + """Create an instance of SettlementReconEntityDataInner from a dict""" + if obj is None: + return None + + if not isinstance(obj, dict): + return SettlementReconEntityDataInner.parse_obj(obj) + + _obj = SettlementReconEntityDataInner.parse_obj({ + "event_id": obj.get("event_id"), + "event_type": obj.get("event_type"), + "event_settlement_amount": obj.get("event_settlement_amount"), + "event_amount": obj.get("event_amount"), + "sale_type": obj.get("sale_type"), + "event_status": obj.get("event_status"), + "entity": obj.get("entity"), + "event_time": obj.get("event_time"), + "event_currency": obj.get("event_currency"), + "order_id": obj.get("order_id"), + "order_amount": obj.get("order_amount"), + "customer_phone": obj.get("customer_phone"), + "customer_email": obj.get("customer_email"), + "customer_name": obj.get("customer_name"), + "payment_amount": obj.get("payment_amount"), + "payment_utr": obj.get("payment_utr"), + "payment_time": obj.get("payment_time"), + "payment_service_charge": obj.get("payment_service_charge"), + "payment_service_tax": obj.get("payment_service_tax"), + "cf_payment_id": obj.get("cf_payment_id"), + "cf_settlement_id": obj.get("cf_settlement_id"), + "settlement_date": obj.get("settlement_date"), + "settlement_utr": obj.get("settlement_utr"), + "split_service_charge": obj.get("split_service_charge"), + "split_service_tax": obj.get("split_service_tax"), + "vendor_commission": obj.get("vendor_commission"), + "closed_in_favor_of": obj.get("closed_in_favor_of"), + "dispute_resolved_on": obj.get("dispute_resolved_on"), + "dispute_category": obj.get("dispute_category"), + "dispute_note": obj.get("dispute_note"), + "refund_processed_at": obj.get("refund_processed_at"), + "refund_arn": obj.get("refund_arn"), + "refund_note": obj.get("refund_note"), + "refund_id": obj.get("refund_id"), + "adjustment_remarks": obj.get("adjustment_remarks") + }) + return _obj + + diff --git a/models/settlement_url_object.py b/models/settlement_url_object.py new file mode 100644 index 0000000..569511b --- /dev/null +++ b/models/settlement_url_object.py @@ -0,0 +1,72 @@ +# coding: utf-8 + +""" + Cashfree Payment Gateway APIs + + Cashfree's Payment Gateway APIs provide developers with a streamlined pathway to integrate advanced payment processing capabilities into their applications, platforms and websites. + + The version of the OpenAPI document: 2022-09-01 + Contact: developers@cashfree.com + Generated by OpenAPI Generator (https://openapi-generator.tech) + + Do not edit the class manually. +""" # noqa: E501 + + +from __future__ import annotations +import pprint +import re # noqa: F401 +import json + + +from typing import Optional +from pydantic import BaseModel, StrictStr + +class SettlementURLObject(BaseModel): + """ + Settlement URL object + """ + url: Optional[StrictStr] = None + __properties = ["url"] + + class Config: + """Pydantic configuration""" + allow_population_by_field_name = True + validate_assignment = True + + def to_str(self) -> str: + """Returns the string representation of the model using alias""" + return pprint.pformat(self.dict(by_alias=True)) + + def to_json(self) -> str: + """Returns the JSON representation of the model using alias""" + return json.dumps(self.to_dict()) + + @classmethod + 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)) + + def to_dict(self): + """Returns the dictionary representation of the model using alias""" + _dict = self.dict(by_alias=True, + exclude={ + }, + exclude_none=True) + return _dict + + @classmethod + def from_dict(cls, obj: dict) -> SettlementURLObject: + """Create an instance of SettlementURLObject from a dict""" + if obj is None: + return None + + if not isinstance(obj, dict): + return SettlementURLObject.parse_obj(obj) + + _obj = SettlementURLObject.parse_obj({ + "url": obj.get("url") + }) + return _obj + + diff --git a/models/terminal_details.py b/models/terminal_details.py new file mode 100644 index 0000000..20eb846 --- /dev/null +++ b/models/terminal_details.py @@ -0,0 +1,90 @@ +# coding: utf-8 + +""" + Cashfree Payment Gateway APIs + + Cashfree's Payment Gateway APIs provide developers with a streamlined pathway to integrate advanced payment processing capabilities into their applications, platforms and websites. + + The version of the OpenAPI document: 2022-09-01 + Contact: developers@cashfree.com + Generated by OpenAPI Generator (https://openapi-generator.tech) + + Do not edit the class manually. +""" # noqa: E501 + + +from __future__ import annotations +import pprint +import re # noqa: F401 +import json + + +from typing import Optional +from pydantic import BaseModel, Field, StrictInt, StrictStr, constr + +class TerminalDetails(BaseModel): + """ + Use this if you are creating an order for cashfree's softPOS + """ + added_on: Optional[StrictStr] = Field(None, description="date time at which terminal is added") + cf_terminal_id: Optional[StrictInt] = Field(None, description="cashfree terminal id") + last_updated_on: Optional[StrictStr] = Field(None, description="last instant when this terminal was updated") + terminal_address: Optional[StrictStr] = Field(None, description="location of terminal") + terminal_id: constr(strict=True, max_length=100, min_length=3) = Field(..., description="terminal id for merchant reference") + terminal_name: Optional[StrictStr] = Field(None, description="name of terminal/agent/storefront") + terminal_note: Optional[StrictStr] = Field(None, description="note given by merchant while creating the terminal") + terminal_phone_no: StrictStr = Field(..., description="mobile num of the terminal/agent/storefront") + terminal_status: Optional[StrictStr] = Field(None, description="status of terminal active/inactive") + terminal_type: constr(strict=True, max_length=10, min_length=4) = Field(..., description="To identify the type of terminal product in use, in this case it is SPOS.") + __properties = ["added_on", "cf_terminal_id", "last_updated_on", "terminal_address", "terminal_id", "terminal_name", "terminal_note", "terminal_phone_no", "terminal_status", "terminal_type"] + + class Config: + """Pydantic configuration""" + allow_population_by_field_name = True + validate_assignment = True + + def to_str(self) -> str: + """Returns the string representation of the model using alias""" + return pprint.pformat(self.dict(by_alias=True)) + + def to_json(self) -> str: + """Returns the JSON representation of the model using alias""" + return json.dumps(self.to_dict()) + + @classmethod + 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)) + + def to_dict(self): + """Returns the dictionary representation of the model using alias""" + _dict = self.dict(by_alias=True, + exclude={ + }, + exclude_none=True) + return _dict + + @classmethod + def from_dict(cls, obj: dict) -> TerminalDetails: + """Create an instance of TerminalDetails from a dict""" + if obj is None: + return None + + if not isinstance(obj, dict): + return TerminalDetails.parse_obj(obj) + + _obj = TerminalDetails.parse_obj({ + "added_on": obj.get("added_on"), + "cf_terminal_id": obj.get("cf_terminal_id"), + "last_updated_on": obj.get("last_updated_on"), + "terminal_address": obj.get("terminal_address"), + "terminal_id": obj.get("terminal_id"), + "terminal_name": obj.get("terminal_name"), + "terminal_note": obj.get("terminal_note"), + "terminal_phone_no": obj.get("terminal_phone_no"), + "terminal_status": obj.get("terminal_status"), + "terminal_type": obj.get("terminal_type") + }) + return _obj + + diff --git a/models/terminal_entity.py b/models/terminal_entity.py new file mode 100644 index 0000000..71fad28 --- /dev/null +++ b/models/terminal_entity.py @@ -0,0 +1,94 @@ +# coding: utf-8 + +""" + Cashfree Payment Gateway APIs + + Cashfree's Payment Gateway APIs provide developers with a streamlined pathway to integrate advanced payment processing capabilities into their applications, platforms and websites. + + The version of the OpenAPI document: 2022-09-01 + Contact: developers@cashfree.com + Generated by OpenAPI Generator (https://openapi-generator.tech) + + Do not edit the class manually. +""" # noqa: E501 + + +from __future__ import annotations +import pprint +import re # noqa: F401 +import json + + +from typing import Optional +from pydantic import BaseModel, StrictInt, StrictStr + +class TerminalEntity(BaseModel): + """ + Create terminal response object + """ + added_on: Optional[StrictStr] = None + cf_terminal_id: Optional[StrictInt] = None + last_updated_on: Optional[StrictStr] = None + terminal_address: Optional[StrictStr] = None + terminal_email: Optional[StrictStr] = None + terminal_type: Optional[StrictStr] = None + teminal_id: Optional[StrictStr] = None + terminal_name: Optional[StrictStr] = None + terminal_note: Optional[StrictStr] = None + terminal_phone_no: Optional[StrictStr] = None + terminal_status: Optional[StrictStr] = None + terminal_meta: Optional[StrictStr] = None + __properties = ["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"] + + class Config: + """Pydantic configuration""" + allow_population_by_field_name = True + validate_assignment = True + + def to_str(self) -> str: + """Returns the string representation of the model using alias""" + return pprint.pformat(self.dict(by_alias=True)) + + def to_json(self) -> str: + """Returns the JSON representation of the model using alias""" + return json.dumps(self.to_dict()) + + @classmethod + 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)) + + def to_dict(self): + """Returns the dictionary representation of the model using alias""" + _dict = self.dict(by_alias=True, + exclude={ + }, + exclude_none=True) + return _dict + + @classmethod + def from_dict(cls, obj: dict) -> TerminalEntity: + """Create an instance of TerminalEntity from a dict""" + if obj is None: + return None + + if not isinstance(obj, dict): + return TerminalEntity.parse_obj(obj) + + _obj = TerminalEntity.parse_obj({ + "added_on": obj.get("added_on"), + "cf_terminal_id": obj.get("cf_terminal_id"), + "last_updated_on": obj.get("last_updated_on"), + "terminal_address": obj.get("terminal_address"), + "terminal_email": obj.get("terminal_email"), + "terminal_type": obj.get("terminal_type"), + "teminal_id": obj.get("teminal_id"), + "terminal_name": obj.get("terminal_name"), + "terminal_note": obj.get("terminal_note"), + "terminal_phone_no": obj.get("terminal_phone_no"), + "terminal_status": obj.get("terminal_status"), + "terminal_meta": obj.get("terminal_meta") + }) + return _obj + + diff --git a/models/terminal_transaction_entity.py b/models/terminal_transaction_entity.py new file mode 100644 index 0000000..b6fd1d1 --- /dev/null +++ b/models/terminal_transaction_entity.py @@ -0,0 +1,82 @@ +# coding: utf-8 + +""" + Cashfree Payment Gateway APIs + + Cashfree's Payment Gateway APIs provide developers with a streamlined pathway to integrate advanced payment processing capabilities into their applications, platforms and websites. + + The version of the OpenAPI document: 2022-09-01 + Contact: developers@cashfree.com + Generated by OpenAPI Generator (https://openapi-generator.tech) + + Do not edit the class manually. +""" # noqa: E501 + + +from __future__ import annotations +import pprint +import re # noqa: F401 +import json + + +from typing import Optional +from pydantic import BaseModel, StrictInt, StrictStr + +class TerminalTransactionEntity(BaseModel): + """ + Create terminal response object + """ + cf_payment_id: Optional[StrictInt] = None + payment_amount: Optional[StrictInt] = None + payment_method: Optional[StrictStr] = None + payment_url: Optional[StrictStr] = None + qrcode: Optional[StrictStr] = None + timeout: Optional[StrictStr] = None + __properties = ["cf_payment_id", "payment_amount", "payment_method", "payment_url", "qrcode", "timeout"] + + class Config: + """Pydantic configuration""" + allow_population_by_field_name = True + validate_assignment = True + + def to_str(self) -> str: + """Returns the string representation of the model using alias""" + return pprint.pformat(self.dict(by_alias=True)) + + def to_json(self) -> str: + """Returns the JSON representation of the model using alias""" + return json.dumps(self.to_dict()) + + @classmethod + 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)) + + def to_dict(self): + """Returns the dictionary representation of the model using alias""" + _dict = self.dict(by_alias=True, + exclude={ + }, + exclude_none=True) + return _dict + + @classmethod + def from_dict(cls, obj: dict) -> TerminalTransactionEntity: + """Create an instance of TerminalTransactionEntity from a dict""" + if obj is None: + return None + + if not isinstance(obj, dict): + return TerminalTransactionEntity.parse_obj(obj) + + _obj = TerminalTransactionEntity.parse_obj({ + "cf_payment_id": obj.get("cf_payment_id"), + "payment_amount": obj.get("payment_amount"), + "payment_method": obj.get("payment_method"), + "payment_url": obj.get("payment_url"), + "qrcode": obj.get("qrcode"), + "timeout": obj.get("timeout") + }) + return _obj + + diff --git a/models/upi.py b/models/upi.py new file mode 100644 index 0000000..7611fc9 --- /dev/null +++ b/models/upi.py @@ -0,0 +1,93 @@ +# coding: utf-8 + +""" + Cashfree Payment Gateway APIs + + Cashfree's Payment Gateway APIs provide developers with a streamlined pathway to integrate advanced payment processing capabilities into their applications, platforms and websites. + + The version of the OpenAPI document: 2022-09-01 + Contact: developers@cashfree.com + Generated by OpenAPI Generator (https://openapi-generator.tech) + + Do not edit the class manually. +""" # noqa: E501 + + +from __future__ import annotations +import pprint +import re # noqa: F401 +import json + + +from typing import Optional, Union +from pydantic import BaseModel, Field, StrictBool, StrictFloat, StrictInt, StrictStr, validator +from cashfree_pg.models.upi_authorize_details import UPIAuthorizeDetails + +class Upi(BaseModel): + """ + UPI collect payment method object + """ + channel: StrictStr = Field(..., description="Specify the channel through which the payment must be processed. Can be one of [\"link\", \"collect\", \"qrcode\"]") + upi_id: Optional[StrictStr] = Field(None, description="Customer UPI VPA to process payment. ### Important This is a required parameter for channel = `collect` ") + upi_redirect_url: Optional[StrictBool] = Field(None, description="use this if you want cashfree to show a loader. Sample response below. It is only supported for collect `action:collect` will be returned with `data.url` having the link for redirection ") + upi_expiry_minutes: Optional[Union[StrictFloat, StrictInt]] = Field(None, description="The UPI request will be valid for this expiry minutes. This parameter is only applicable for a UPI collect payment. The default value is 5 minutes. You should keep the minimum as 5 minutes, and maximum as 15 minutes") + authorize_only: Optional[StrictBool] = Field(None, description="For one time mandate on UPI. Set this as authorize_only = true. Please note that you can only use the \"collect\" channel if you are sending a one time mandate request") + authorization: Optional[UPIAuthorizeDetails] = None + __properties = ["channel", "upi_id", "upi_redirect_url", "upi_expiry_minutes", "authorize_only", "authorization"] + + @validator('channel') + def channel_validate_enum(cls, value): + """Validates the enum""" + if value not in ('link', 'collect', 'qrcode'): + raise ValueError("must be one of enum values ('link', 'collect', 'qrcode')") + return value + + class Config: + """Pydantic configuration""" + allow_population_by_field_name = True + validate_assignment = True + + def to_str(self) -> str: + """Returns the string representation of the model using alias""" + return pprint.pformat(self.dict(by_alias=True)) + + def to_json(self) -> str: + """Returns the JSON representation of the model using alias""" + return json.dumps(self.to_dict()) + + @classmethod + 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)) + + def to_dict(self): + """Returns the dictionary representation of the model using alias""" + _dict = self.dict(by_alias=True, + exclude={ + }, + exclude_none=True) + # override the default output from pydantic by calling `to_dict()` of authorization + if self.authorization: + _dict['authorization'] = self.authorization.to_dict() + return _dict + + @classmethod + def from_dict(cls, obj: dict) -> Upi: + """Create an instance of Upi from a dict""" + if obj is None: + return None + + if not isinstance(obj, dict): + return Upi.parse_obj(obj) + + _obj = Upi.parse_obj({ + "channel": obj.get("channel"), + "upi_id": obj.get("upi_id"), + "upi_redirect_url": obj.get("upi_redirect_url"), + "upi_expiry_minutes": obj.get("upi_expiry_minutes"), + "authorize_only": obj.get("authorize_only"), + "authorization": UPIAuthorizeDetails.from_dict(obj.get("authorization")) if obj.get("authorization") is not None else None + }) + return _obj + + diff --git a/models/upi_authorize_details.py b/models/upi_authorize_details.py new file mode 100644 index 0000000..2130038 --- /dev/null +++ b/models/upi_authorize_details.py @@ -0,0 +1,76 @@ +# coding: utf-8 + +""" + Cashfree Payment Gateway APIs + + Cashfree's Payment Gateway APIs provide developers with a streamlined pathway to integrate advanced payment processing capabilities into their applications, platforms and websites. + + The version of the OpenAPI document: 2022-09-01 + Contact: developers@cashfree.com + Generated by OpenAPI Generator (https://openapi-generator.tech) + + Do not edit the class manually. +""" # noqa: E501 + + +from __future__ import annotations +import pprint +import re # noqa: F401 +import json + + +from typing import Optional +from pydantic import BaseModel, Field, StrictStr + +class UPIAuthorizeDetails(BaseModel): + """ + object when you are using preauth in UPI in order pay + """ + approve_by: Optional[StrictStr] = Field(None, description="Time by which this authorization should be approved by the customer.") + start_time: Optional[StrictStr] = Field(None, description="This is the time when the UPI one time mandate will start") + end_time: Optional[StrictStr] = Field(None, description="This is the time when the UPI mandate will be over. If the mandate has not been executed by this time, the funds will be returned back to the customer after this time.") + __properties = ["approve_by", "start_time", "end_time"] + + class Config: + """Pydantic configuration""" + allow_population_by_field_name = True + validate_assignment = True + + def to_str(self) -> str: + """Returns the string representation of the model using alias""" + return pprint.pformat(self.dict(by_alias=True)) + + def to_json(self) -> str: + """Returns the JSON representation of the model using alias""" + return json.dumps(self.to_dict()) + + @classmethod + 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)) + + def to_dict(self): + """Returns the dictionary representation of the model using alias""" + _dict = self.dict(by_alias=True, + exclude={ + }, + exclude_none=True) + return _dict + + @classmethod + def from_dict(cls, obj: dict) -> UPIAuthorizeDetails: + """Create an instance of UPIAuthorizeDetails from a dict""" + if obj is None: + return None + + if not isinstance(obj, dict): + return UPIAuthorizeDetails.parse_obj(obj) + + _obj = UPIAuthorizeDetails.parse_obj({ + "approve_by": obj.get("approve_by"), + "start_time": obj.get("start_time"), + "end_time": obj.get("end_time") + }) + return _obj + + diff --git a/models/upi_payment_method.py b/models/upi_payment_method.py new file mode 100644 index 0000000..139dc51 --- /dev/null +++ b/models/upi_payment_method.py @@ -0,0 +1,76 @@ +# coding: utf-8 + +""" + Cashfree Payment Gateway APIs + + Cashfree's Payment Gateway APIs provide developers with a streamlined pathway to integrate advanced payment processing capabilities into their applications, platforms and websites. + + The version of the OpenAPI document: 2022-09-01 + Contact: developers@cashfree.com + Generated by OpenAPI Generator (https://openapi-generator.tech) + + Do not edit the class manually. +""" # noqa: E501 + + +from __future__ import annotations +import pprint +import re # noqa: F401 +import json + + + +from pydantic import BaseModel, Field +from cashfree_pg.models.upi import Upi + +class UPIPaymentMethod(BaseModel): + """ + Complete payment method for UPI collect + """ + upi: Upi = Field(...) + __properties = ["upi"] + + class Config: + """Pydantic configuration""" + allow_population_by_field_name = True + validate_assignment = True + + def to_str(self) -> str: + """Returns the string representation of the model using alias""" + return pprint.pformat(self.dict(by_alias=True)) + + def to_json(self) -> str: + """Returns the JSON representation of the model using alias""" + return json.dumps(self.to_dict()) + + @classmethod + 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)) + + def to_dict(self): + """Returns the dictionary representation of the model using alias""" + _dict = self.dict(by_alias=True, + exclude={ + }, + exclude_none=True) + # override the default output from pydantic by calling `to_dict()` of upi + if self.upi: + _dict['upi'] = self.upi.to_dict() + return _dict + + @classmethod + def from_dict(cls, obj: dict) -> UPIPaymentMethod: + """Create an instance of UPIPaymentMethod from a dict""" + if obj is None: + return None + + if not isinstance(obj, dict): + return UPIPaymentMethod.parse_obj(obj) + + _obj = UPIPaymentMethod.parse_obj({ + "upi": Upi.from_dict(obj.get("upi")) if obj.get("upi") is not None else None + }) + return _obj + + diff --git a/models/vendor_split.py b/models/vendor_split.py new file mode 100644 index 0000000..8f746aa --- /dev/null +++ b/models/vendor_split.py @@ -0,0 +1,76 @@ +# coding: utf-8 + +""" + Cashfree Payment Gateway APIs + + Cashfree's Payment Gateway APIs provide developers with a streamlined pathway to integrate advanced payment processing capabilities into their applications, platforms and websites. + + The version of the OpenAPI document: 2022-09-01 + Contact: developers@cashfree.com + Generated by OpenAPI Generator (https://openapi-generator.tech) + + Do not edit the class manually. +""" # noqa: E501 + + +from __future__ import annotations +import pprint +import re # noqa: F401 +import json + + +from typing import Optional, Union +from pydantic import BaseModel, Field, StrictFloat, StrictInt, StrictStr + +class VendorSplit(BaseModel): + """ + Use to split order when cashfree's Easy Split is enabled for your account. + """ + vendor_id: Optional[StrictStr] = Field(None, description="Vendor id created in Cashfree system") + amount: Optional[Union[StrictFloat, StrictInt]] = Field(None, description="Amount which will be associated with this vendor") + percentage: Optional[Union[StrictFloat, StrictInt]] = Field(None, description="Percentage of order amount which shall get added to vendor account") + __properties = ["vendor_id", "amount", "percentage"] + + class Config: + """Pydantic configuration""" + allow_population_by_field_name = True + validate_assignment = True + + def to_str(self) -> str: + """Returns the string representation of the model using alias""" + return pprint.pformat(self.dict(by_alias=True)) + + def to_json(self) -> str: + """Returns the JSON representation of the model using alias""" + return json.dumps(self.to_dict()) + + @classmethod + 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)) + + def to_dict(self): + """Returns the dictionary representation of the model using alias""" + _dict = self.dict(by_alias=True, + exclude={ + }, + exclude_none=True) + return _dict + + @classmethod + def from_dict(cls, obj: dict) -> VendorSplit: + """Create an instance of VendorSplit from a dict""" + if obj is None: + return None + + if not isinstance(obj, dict): + return VendorSplit.parse_obj(obj) + + _obj = VendorSplit.parse_obj({ + "vendor_id": obj.get("vendor_id"), + "amount": obj.get("amount"), + "percentage": obj.get("percentage") + }) + return _obj + + diff --git a/models/w_hcustomer_details.py b/models/w_hcustomer_details.py new file mode 100644 index 0000000..8f022d6 --- /dev/null +++ b/models/w_hcustomer_details.py @@ -0,0 +1,78 @@ +# coding: utf-8 + +""" + Cashfree Payment Gateway APIs + + Cashfree's Payment Gateway APIs provide developers with a streamlined pathway to integrate advanced payment processing capabilities into their applications, platforms and websites. + + The version of the OpenAPI document: 2022-09-01 + Contact: developers@cashfree.com + Generated by OpenAPI Generator (https://openapi-generator.tech) + + Do not edit the class manually. +""" # noqa: E501 + + +from __future__ import annotations +import pprint +import re # noqa: F401 +import json + + +from typing import Optional +from pydantic import BaseModel, StrictStr + +class WHcustomerDetails(BaseModel): + """ + customer details object in webhook + """ + customer_name: Optional[StrictStr] = None + customer_id: Optional[StrictStr] = None + customer_email: Optional[StrictStr] = None + customer_phone: Optional[StrictStr] = None + __properties = ["customer_name", "customer_id", "customer_email", "customer_phone"] + + class Config: + """Pydantic configuration""" + allow_population_by_field_name = True + validate_assignment = True + + def to_str(self) -> str: + """Returns the string representation of the model using alias""" + return pprint.pformat(self.dict(by_alias=True)) + + def to_json(self) -> str: + """Returns the JSON representation of the model using alias""" + return json.dumps(self.to_dict()) + + @classmethod + def from_json(cls, json_str: str) -> WHcustomerDetails: + """Create an instance of WHcustomerDetails from a JSON string""" + return cls.from_dict(json.loads(json_str)) + + def to_dict(self): + """Returns the dictionary representation of the model using alias""" + _dict = self.dict(by_alias=True, + exclude={ + }, + exclude_none=True) + return _dict + + @classmethod + def from_dict(cls, obj: dict) -> WHcustomerDetails: + """Create an instance of WHcustomerDetails from a dict""" + if obj is None: + return None + + if not isinstance(obj, dict): + return WHcustomerDetails.parse_obj(obj) + + _obj = WHcustomerDetails.parse_obj({ + "customer_name": obj.get("customer_name"), + "customer_id": obj.get("customer_id"), + "customer_email": obj.get("customer_email"), + "customer_phone": obj.get("customer_phone") + }) + return _obj + + diff --git a/models/w_hdata.py b/models/w_hdata.py new file mode 100644 index 0000000..6753bc4 --- /dev/null +++ b/models/w_hdata.py @@ -0,0 +1,88 @@ +# coding: utf-8 + +""" + Cashfree Payment Gateway APIs + + Cashfree's Payment Gateway APIs provide developers with a streamlined pathway to integrate advanced payment processing capabilities into their applications, platforms and websites. + + The version of the OpenAPI document: 2022-09-01 + Contact: developers@cashfree.com + Generated by OpenAPI Generator (https://openapi-generator.tech) + + Do not edit the class manually. +""" # noqa: E501 + + +from __future__ import annotations +import pprint +import re # noqa: F401 +import json + + +from typing import Optional +from pydantic import BaseModel +from cashfree_pg.models.payment_entity import PaymentEntity +from cashfree_pg.models.w_hcustomer_details import WHcustomerDetails +from cashfree_pg.models.w_horder import WHorder + +class WHdata(BaseModel): + """ + webhook object + """ + order: Optional[WHorder] = None + payment: Optional[PaymentEntity] = None + customer_details: Optional[WHcustomerDetails] = None + __properties = ["order", "payment", "customer_details"] + + class Config: + """Pydantic configuration""" + allow_population_by_field_name = True + validate_assignment = True + + def to_str(self) -> str: + """Returns the string representation of the model using alias""" + return pprint.pformat(self.dict(by_alias=True)) + + def to_json(self) -> str: + """Returns the JSON representation of the model using alias""" + return json.dumps(self.to_dict()) + + @classmethod + def from_json(cls, json_str: str) -> WHdata: + """Create an instance of WHdata from a JSON string""" + return cls.from_dict(json.loads(json_str)) + + def to_dict(self): + """Returns the dictionary representation of the model using alias""" + _dict = self.dict(by_alias=True, + exclude={ + }, + exclude_none=True) + # override the default output from pydantic by calling `to_dict()` of order + if self.order: + _dict['order'] = self.order.to_dict() + # override the default output from pydantic by calling `to_dict()` of payment + if self.payment: + _dict['payment'] = self.payment.to_dict() + # override the default output from pydantic by calling `to_dict()` of customer_details + if self.customer_details: + _dict['customer_details'] = self.customer_details.to_dict() + return _dict + + @classmethod + def from_dict(cls, obj: dict) -> WHdata: + """Create an instance of WHdata from a dict""" + if obj is None: + return None + + if not isinstance(obj, dict): + return WHdata.parse_obj(obj) + + _obj = WHdata.parse_obj({ + "order": WHorder.from_dict(obj.get("order")) if obj.get("order") is not None else None, + "payment": PaymentEntity.from_dict(obj.get("payment")) if obj.get("payment") is not None else None, + "customer_details": WHcustomerDetails.from_dict(obj.get("customer_details")) if obj.get("customer_details") is not None else None + }) + return _obj + + diff --git a/models/w_horder.py b/models/w_horder.py new file mode 100644 index 0000000..c3179be --- /dev/null +++ b/models/w_horder.py @@ -0,0 +1,83 @@ +# coding: utf-8 + +""" + Cashfree Payment Gateway APIs + + Cashfree's Payment Gateway APIs provide developers with a streamlined pathway to integrate advanced payment processing capabilities into their applications, platforms and websites. + + The version of the OpenAPI document: 2022-09-01 + Contact: developers@cashfree.com + Generated by OpenAPI Generator (https://openapi-generator.tech) + + Do not edit the class manually. +""" # noqa: E501 + + +from __future__ import annotations +import pprint +import re # noqa: F401 +import json + + +from typing import Dict, Optional, Union +from pydantic import BaseModel, Field, StrictFloat, StrictInt, StrictStr, constr + +class WHorder(BaseModel): + """ + order entity in webhook + """ + order_id: Optional[StrictStr] = None + order_amount: Optional[Union[StrictFloat, StrictInt]] = None + order_currency: Optional[StrictStr] = None + order_tags: Optional[Dict[str, constr(strict=True, max_length=255, min_length=1)]] = Field(None, description="Custom Tags in thr form of {\"key\":\"value\"} which can be passed for an order. A maximum of 10 tags can be added") + __properties = ["order_id", "order_amount", "order_currency", "order_tags"] + + class Config: + """Pydantic configuration""" + allow_population_by_field_name = True + validate_assignment = True + + def to_str(self) -> str: + """Returns the string representation of the model using alias""" + return pprint.pformat(self.dict(by_alias=True)) + + def to_json(self) -> str: + """Returns the JSON representation of the model using alias""" + return json.dumps(self.to_dict()) + + @classmethod + def from_json(cls, json_str: str) -> WHorder: + """Create an instance of WHorder from a JSON string""" + return cls.from_dict(json.loads(json_str)) + + def to_dict(self): + """Returns the dictionary representation of the model using alias""" + _dict = self.dict(by_alias=True, + exclude={ + }, + exclude_none=True) + # set to None if order_tags (nullable) is None + # and __fields_set__ contains the field + if self.order_tags is None and "order_tags" in self.__fields_set__: + _dict['order_tags'] = None + + return _dict + + @classmethod + def from_dict(cls, obj: dict) -> WHorder: + """Create an instance of WHorder from a dict""" + if obj is None: + return None + + if not isinstance(obj, dict): + return WHorder.parse_obj(obj) + + _obj = WHorder.parse_obj({ + "order_id": obj.get("order_id"), + "order_amount": obj.get("order_amount"), + "order_currency": obj.get("order_currency"), + "order_tags": obj.get("order_tags") + }) + return _obj + + diff --git a/models/wallet_offer.py b/models/wallet_offer.py new file mode 100644 index 0000000..694654f --- /dev/null +++ b/models/wallet_offer.py @@ -0,0 +1,72 @@ +# coding: utf-8 + +""" + Cashfree Payment Gateway APIs + + Cashfree's Payment Gateway APIs provide developers with a streamlined pathway to integrate advanced payment processing capabilities into their applications, platforms and websites. + + The version of the OpenAPI document: 2022-09-01 + Contact: developers@cashfree.com + Generated by OpenAPI Generator (https://openapi-generator.tech) + + Do not edit the class manually. +""" # noqa: E501 + + +from __future__ import annotations +import pprint +import re # noqa: F401 +import json + + +from typing import Optional +from pydantic import BaseModel, StrictStr + +class WalletOffer(BaseModel): + """ + WalletOffer + """ + provider: Optional[StrictStr] = None + __properties = ["provider"] + + class Config: + """Pydantic configuration""" + allow_population_by_field_name = True + validate_assignment = True + + def to_str(self) -> str: + """Returns the string representation of the model using alias""" + return pprint.pformat(self.dict(by_alias=True)) + + def to_json(self) -> str: + """Returns the JSON representation of the model using alias""" + return json.dumps(self.to_dict()) + + @classmethod + 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)) + + def to_dict(self): + """Returns the dictionary representation of the model using alias""" + _dict = self.dict(by_alias=True, + exclude={ + }, + exclude_none=True) + return _dict + + @classmethod + def from_dict(cls, obj: dict) -> WalletOffer: + """Create an instance of WalletOffer from a dict""" + if obj is None: + return None + + if not isinstance(obj, dict): + return WalletOffer.parse_obj(obj) + + _obj = WalletOffer.parse_obj({ + "provider": obj.get("provider") + }) + return _obj + + diff --git a/py.typed b/py.typed new file mode 100644 index 0000000..e69de29 diff --git a/pyproject.toml b/pyproject.toml index b24a02b..f2a0306 100644 --- a/pyproject.toml +++ b/pyproject.toml @@ -1,6 +1,6 @@ [tool.poetry] name = "cashfree_pg" -version = "3.0.1" +version = "3.0.3" description = "Cashfree Payment Gateway APIs" authors = ["API Support "] license = "Apache 2.0" diff --git a/rest.py b/rest.py new file mode 100644 index 0000000..41e7dab --- /dev/null +++ b/rest.py @@ -0,0 +1,304 @@ +# coding: utf-8 + +""" + Cashfree Payment Gateway APIs + + Cashfree's Payment Gateway APIs provide developers with a streamlined pathway to integrate advanced payment processing capabilities into their applications, platforms and websites. + + The version of the OpenAPI document: 2022-09-01 + Contact: developers@cashfree.com + Generated by OpenAPI Generator (https://openapi-generator.tech) + + Do not edit the class manually. +""" # noqa: E501 + + +import io +import json +import logging +import re +import ssl + +from urllib.parse import urlencode, quote_plus +import urllib3 + +from cashfree_pg.exceptions import ApiException, UnauthorizedException, ForbiddenException, NotFoundException, ServiceException, ApiValueError, BadRequestException + + +logger = logging.getLogger(__name__) + + +class RESTResponse(io.IOBase): + + def __init__(self, resp): + self.urllib3_response = resp + self.status = resp.status + self.reason = resp.reason + self.data = resp.data + + def getheaders(self): + """Returns a dictionary of the response headers.""" + return self.urllib3_response.headers + + def getheader(self, name, default=None): + """Returns a given response header.""" + return self.urllib3_response.headers.get(name, default) + + +class RESTClientObject(object): + + def __init__(self, configuration, pools_size=4, maxsize=None): + # urllib3.PoolManager will pass all kw parameters to connectionpool + # https://github.com/shazow/urllib3/blob/f9409436f83aeb79fbaf090181cd81b784f1b8ce/urllib3/poolmanager.py#L75 # noqa: E501 + # https://github.com/shazow/urllib3/blob/f9409436f83aeb79fbaf090181cd81b784f1b8ce/urllib3/connectionpool.py#L680 # noqa: E501 + # maxsize is the number of requests to host that are allowed in parallel # noqa: E501 + # Custom SSL certificates and client certificates: http://urllib3.readthedocs.io/en/latest/advanced-usage.html # noqa: E501 + + # cert_reqs + if configuration.verify_ssl: + cert_reqs = ssl.CERT_REQUIRED + else: + cert_reqs = ssl.CERT_NONE + + addition_pool_args = {} + if configuration.assert_hostname is not None: + addition_pool_args['assert_hostname'] = configuration.assert_hostname # noqa: E501 + + if configuration.retries is not None: + addition_pool_args['retries'] = configuration.retries + + if configuration.tls_server_name: + addition_pool_args['server_hostname'] = configuration.tls_server_name + + + if configuration.socket_options is not None: + addition_pool_args['socket_options'] = configuration.socket_options + + if maxsize is None: + if configuration.connection_pool_maxsize is not None: + maxsize = configuration.connection_pool_maxsize + else: + maxsize = 4 + + # https pool manager + if configuration.proxy: + self.pool_manager = urllib3.ProxyManager( + num_pools=pools_size, + maxsize=maxsize, + cert_reqs=cert_reqs, + ca_certs=configuration.ssl_ca_cert, + cert_file=configuration.cert_file, + key_file=configuration.key_file, + proxy_url=configuration.proxy, + proxy_headers=configuration.proxy_headers, + **addition_pool_args + ) + else: + self.pool_manager = urllib3.PoolManager( + num_pools=pools_size, + maxsize=maxsize, + cert_reqs=cert_reqs, + ca_certs=configuration.ssl_ca_cert, + cert_file=configuration.cert_file, + key_file=configuration.key_file, + **addition_pool_args + ) + + def request(self, method, url, query_params=None, headers=None, + body=None, post_params=None, _preload_content=True, + _request_timeout=None): + """Perform requests. + + :param method: http request method + :param url: http request url + :param query_params: query parameters in the url + :param headers: http request headers + :param body: request json body, for `application/json` + :param post_params: request post parameters, + `application/x-www-form-urlencoded` + and `multipart/form-data` + :param _preload_content: if False, the urllib3.HTTPResponse object will + be returned without reading/decoding response + data. Default is True. + :param _request_timeout: timeout setting for this request. If one + number provided, it will be total request + timeout. It can also be a pair (tuple) of + (connection, read) timeouts. + """ + method = method.upper() + assert method in ['GET', 'HEAD', 'DELETE', 'POST', 'PUT', + 'PATCH', 'OPTIONS'] + + if post_params and body: + raise ApiValueError( + "body parameter cannot be used with post_params parameter." + ) + + post_params = post_params or {} + headers = headers or {} + # url already contains the URL query string + # so reset query_params to empty dict + query_params = {} + + timeout = None + if _request_timeout: + if isinstance(_request_timeout, (int,float)): # noqa: E501,F821 + timeout = urllib3.Timeout(total=_request_timeout) + elif (isinstance(_request_timeout, tuple) and + len(_request_timeout) == 2): + timeout = urllib3.Timeout( + connect=_request_timeout[0], read=_request_timeout[1]) + + try: + # For `POST`, `PUT`, `PATCH`, `OPTIONS`, `DELETE` + if method in ['POST', 'PUT', 'PATCH', 'OPTIONS', 'DELETE']: + + # no content type provided or payload is json + if not headers.get('Content-Type') or re.search('json', headers['Content-Type'], re.IGNORECASE): + request_body = None + if body is not None: + request_body = json.dumps(body) + r = self.pool_manager.request( + method, url, + body=request_body, + preload_content=_preload_content, + timeout=timeout, + headers=headers) + elif headers['Content-Type'] == 'application/x-www-form-urlencoded': # noqa: E501 + r = self.pool_manager.request( + method, url, + fields=post_params, + encode_multipart=False, + preload_content=_preload_content, + timeout=timeout, + headers=headers) + elif headers['Content-Type'] == 'multipart/form-data': + # must del headers['Content-Type'], or the correct + # Content-Type which generated by urllib3 will be + # overwritten. + del headers['Content-Type'] + r = self.pool_manager.request( + method, url, + fields=post_params, + encode_multipart=True, + preload_content=_preload_content, + timeout=timeout, + headers=headers) + # Pass a `string` parameter directly in the body to support + # other content types than Json when `body` argument is + # provided in serialized form + elif isinstance(body, str) or isinstance(body, bytes): + request_body = body + r = self.pool_manager.request( + method, url, + body=request_body, + preload_content=_preload_content, + timeout=timeout, + headers=headers) + else: + # Cannot generate the request from given parameters + msg = """Cannot prepare a request message for provided + arguments. Please check that your arguments match + declared content type.""" + raise ApiException(status=0, reason=msg) + # For `GET`, `HEAD` + else: + r = self.pool_manager.request(method, url, + fields={}, + preload_content=_preload_content, + timeout=timeout, + headers=headers) + except urllib3.exceptions.SSLError as e: + msg = "{0}\n{1}".format(type(e).__name__, str(e)) + raise ApiException(status=0, reason=msg) + + if _preload_content: + r = RESTResponse(r) + + # log response body + logger.debug("response body: %s", r.data) + + if not 200 <= r.status <= 299: + if r.status == 400: + raise BadRequestException(http_resp=r) + + if r.status == 401: + raise UnauthorizedException(http_resp=r) + + if r.status == 403: + raise ForbiddenException(http_resp=r) + + if r.status == 404: + raise NotFoundException(http_resp=r) + + if 500 <= r.status <= 599: + raise ServiceException(http_resp=r) + + raise ApiException(http_resp=r) + + return r + + def get_request(self, url, headers=None, query_params=None, _preload_content=True, + _request_timeout=None): + return self.request("GET", url, + headers=headers, + _preload_content=_preload_content, + _request_timeout=_request_timeout, + query_params=query_params) + + def head_request(self, url, headers=None, query_params=None, _preload_content=True, + _request_timeout=None): + return self.request("HEAD", url, + headers=headers, + _preload_content=_preload_content, + _request_timeout=_request_timeout, + query_params=query_params) + + def options_request(self, url, headers=None, query_params=None, post_params=None, + body=None, _preload_content=True, _request_timeout=None): + return self.request("OPTIONS", url, + headers=headers, + query_params=query_params, + post_params=post_params, + _preload_content=_preload_content, + _request_timeout=_request_timeout, + body=body) + + def delete_request(self, url, headers=None, query_params=None, body=None, + _preload_content=True, _request_timeout=None): + return self.request("DELETE", url, + headers=headers, + query_params=query_params, + _preload_content=_preload_content, + _request_timeout=_request_timeout, + body=body) + + def post_request(self, url, headers=None, query_params=None, post_params=None, + body=None, _preload_content=True, _request_timeout=None): + return self.request("POST", url, + headers=headers, + query_params=query_params, + post_params=post_params, + _preload_content=_preload_content, + _request_timeout=_request_timeout, + body=body) + + def put_request(self, url, headers=None, query_params=None, post_params=None, + body=None, _preload_content=True, _request_timeout=None): + return self.request("PUT", url, + headers=headers, + query_params=query_params, + post_params=post_params, + _preload_content=_preload_content, + _request_timeout=_request_timeout, + body=body) + + def patch_request(self, url, headers=None, query_params=None, post_params=None, + body=None, _preload_content=True, _request_timeout=None): + return self.request("PATCH", url, + headers=headers, + query_params=query_params, + post_params=post_params, + _preload_content=_preload_content, + _request_timeout=_request_timeout, + body=body) diff --git a/setup.py b/setup.py index b6e4a91..716f2d3 100644 --- a/setup.py +++ b/setup.py @@ -22,7 +22,9 @@ # prerequisite: setuptools # http://pypi.python.org/pypi/setuptools NAME = "cashfree_pg" -VERSION = "3.0.1" +VERSION = "3.0.3" +with open("README.md", "r", encoding="utf-8") as fh: + readme = fh.read() PYTHON_REQUIRES = ">=3.7" REQUIRES = [ "urllib3 >= 1.25.3, < 2.1.0", @@ -45,7 +47,7 @@ include_package_data=True, license="Apache 2.0", long_description_content_type='text/markdown', - long_description="""\ + long_description=readme, Cashfree's Payment Gateway APIs provide developers with a streamlined pathway to integrate advanced payment processing capabilities into their applications, platforms and websites. """, # noqa: E501 package_data={"cashfree_pg": ["py.typed"]},