"""
    Nomad Broker

    Nomad payment provider aggregation, including make payments, and customs declaration for orders and etc.  # noqa: E501

    The version of the OpenAPI document: 1.5.1
    Contact: ben.song@samarkand.global
    Generated by: https://openapi-generator.tech
"""


import re  # noqa: F401
import sys  # noqa: F401

from nomad_broker_cli.api_client import ApiClient, Endpoint
from nomad_broker_cli.model_utils import (  # noqa: F401
    check_allowed_values,
    check_validations,
    date,
    datetime,
    file_type,
    none_type,
    validate_and_convert_types
)
from nomad_broker_cli.model.base_api_response import BaseApiResponse
from nomad_broker_cli.model.error_api_response import ErrorApiResponse
from nomad_broker_cli.model.payment_close_response import PaymentCloseResponse
from nomad_broker_cli.model.payment_detail_response import PaymentDetailResponse
from nomad_broker_cli.model.payment_invocation_request import PaymentInvocationRequest
from nomad_broker_cli.model.payment_method import PaymentMethod
from nomad_broker_cli.model.payment_request import PaymentRequest
from nomad_broker_cli.model.payment_response import PaymentResponse


class PaymentApi(object):
    """NOTE: This class is auto generated by OpenAPI Generator
    Ref: https://openapi-generator.tech

    Do not edit the class manually.
    """

    def __init__(self, api_client=None):
        if api_client is None:
            api_client = ApiClient()
        self.api_client = api_client

        def __close_payment(
            self,
            merchant,
            order_ref,
            **kwargs
        ):
            """ClosePayment  # noqa: E501

            Close a 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.close_payment(merchant, order_ref, async_req=True)
            >>> result = thread.get()

            Args:
                merchant (str): Merchant name to payment company, e.g. weixinpay.test
                order_ref (str): Merchant order no.

            Keyword Args:
                payment_method (PaymentMethod): Must be `wechatpay` or `alipay`. [optional]
                _return_http_data_only (bool): response data without head status
                    code and headers. Default is True.
                _preload_content (bool): if False, the urllib3.HTTPResponse object
                    will be returned without reading/decoding response data.
                    Default is True.
                _request_timeout (float/tuple): 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.
                    Default is None.
                _check_input_type (bool): specifies if type checking
                    should be done one the data sent to the server.
                    Default is True.
                _check_return_type (bool): specifies if type checking
                    should be done one the data received from the server.
                    Default is True.
                _host_index (int/None): specifies the index of the server
                    that we want to use.
                    Default is read from the configuration.
                async_req (bool): execute request asynchronously

            Returns:
                PaymentCloseResponse
                    If the method is called asynchronously, returns the request
                    thread.
            """
            kwargs['async_req'] = kwargs.get(
                'async_req', False
            )
            kwargs['_return_http_data_only'] = kwargs.get(
                '_return_http_data_only', True
            )
            kwargs['_preload_content'] = kwargs.get(
                '_preload_content', True
            )
            kwargs['_request_timeout'] = kwargs.get(
                '_request_timeout', None
            )
            kwargs['_check_input_type'] = kwargs.get(
                '_check_input_type', True
            )
            kwargs['_check_return_type'] = kwargs.get(
                '_check_return_type', True
            )
            kwargs['_host_index'] = kwargs.get('_host_index')
            kwargs['merchant'] = \
                merchant
            kwargs['order_ref'] = \
                order_ref
            return self.call_with_http_info(**kwargs)

        self.close_payment = Endpoint(
            settings={
                'response_type': (PaymentCloseResponse,),
                'auth': [
                    'authorization'
                ],
                'endpoint_path': '/payment/close/{merchant}/{order_ref}',
                'operation_id': 'close_payment',
                'http_method': 'POST',
                'servers': None,
            },
            params_map={
                'all': [
                    'merchant',
                    'order_ref',
                    'payment_method',
                ],
                'required': [
                    'merchant',
                    'order_ref',
                ],
                'nullable': [
                ],
                'enum': [
                ],
                'validation': [
                ]
            },
            root_map={
                'validations': {
                },
                'allowed_values': {
                },
                'openapi_types': {
                    'merchant':
                        (str,),
                    'order_ref':
                        (str,),
                    'payment_method':
                        (PaymentMethod,),
                },
                'attribute_map': {
                    'merchant': 'merchant',
                    'order_ref': 'order_ref',
                    'payment_method': 'payment_method',
                },
                'location_map': {
                    'merchant': 'path',
                    'order_ref': 'path',
                    'payment_method': 'query',
                },
                'collection_format_map': {
                }
            },
            headers_map={
                'accept': [
                    'application/json'
                ],
                'content_type': [],
            },
            api_client=api_client,
            callable=__close_payment
        )

        def __create_payment(
            self,
            merchant,
            **kwargs
        ):
            """CreatePayment  # noqa: E501

            Create a 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.create_payment(merchant, async_req=True)
            >>> result = thread.get()

            Args:
                merchant (str): Merchant name to payment company, e.g. weixinpay.test

            Keyword Args:
                payment_request (PaymentRequest): [optional]
                _return_http_data_only (bool): response data without head status
                    code and headers. Default is True.
                _preload_content (bool): if False, the urllib3.HTTPResponse object
                    will be returned without reading/decoding response data.
                    Default is True.
                _request_timeout (float/tuple): 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.
                    Default is None.
                _check_input_type (bool): specifies if type checking
                    should be done one the data sent to the server.
                    Default is True.
                _check_return_type (bool): specifies if type checking
                    should be done one the data received from the server.
                    Default is True.
                _host_index (int/None): specifies the index of the server
                    that we want to use.
                    Default is read from the configuration.
                async_req (bool): execute request asynchronously

            Returns:
                PaymentResponse
                    If the method is called asynchronously, returns the request
                    thread.
            """
            kwargs['async_req'] = kwargs.get(
                'async_req', False
            )
            kwargs['_return_http_data_only'] = kwargs.get(
                '_return_http_data_only', True
            )
            kwargs['_preload_content'] = kwargs.get(
                '_preload_content', True
            )
            kwargs['_request_timeout'] = kwargs.get(
                '_request_timeout', None
            )
            kwargs['_check_input_type'] = kwargs.get(
                '_check_input_type', True
            )
            kwargs['_check_return_type'] = kwargs.get(
                '_check_return_type', True
            )
            kwargs['_host_index'] = kwargs.get('_host_index')
            kwargs['merchant'] = \
                merchant
            return self.call_with_http_info(**kwargs)

        self.create_payment = Endpoint(
            settings={
                'response_type': (PaymentResponse,),
                'auth': [
                    'authorization'
                ],
                'endpoint_path': '/payment/{merchant}',
                'operation_id': 'create_payment',
                'http_method': 'POST',
                'servers': None,
            },
            params_map={
                'all': [
                    'merchant',
                    'payment_request',
                ],
                'required': [
                    'merchant',
                ],
                'nullable': [
                ],
                'enum': [
                ],
                'validation': [
                ]
            },
            root_map={
                'validations': {
                },
                'allowed_values': {
                },
                'openapi_types': {
                    'merchant':
                        (str,),
                    'payment_request':
                        (PaymentRequest,),
                },
                'attribute_map': {
                    'merchant': 'merchant',
                },
                'location_map': {
                    'merchant': 'path',
                    'payment_request': 'body',
                },
                'collection_format_map': {
                }
            },
            headers_map={
                'accept': [
                    'application/json'
                ],
                'content_type': [
                    'application/json'
                ]
            },
            api_client=api_client,
            callable=__create_payment
        )

        def __invoke_payment(
            self,
            merchant,
            **kwargs
        ):
            """InvokePayment  # noqa: E501

            Invoke a 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.invoke_payment(merchant, async_req=True)
            >>> result = thread.get()

            Args:
                merchant (str): Merchant name to payment company, e.g. weixinpay.test

            Keyword Args:
                payment_invocation_request (PaymentInvocationRequest): [optional]
                _return_http_data_only (bool): response data without head status
                    code and headers. Default is True.
                _preload_content (bool): if False, the urllib3.HTTPResponse object
                    will be returned without reading/decoding response data.
                    Default is True.
                _request_timeout (float/tuple): 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.
                    Default is None.
                _check_input_type (bool): specifies if type checking
                    should be done one the data sent to the server.
                    Default is True.
                _check_return_type (bool): specifies if type checking
                    should be done one the data received from the server.
                    Default is True.
                _host_index (int/None): specifies the index of the server
                    that we want to use.
                    Default is read from the configuration.
                async_req (bool): execute request asynchronously

            Returns:
                PaymentResponse
                    If the method is called asynchronously, returns the request
                    thread.
            """
            kwargs['async_req'] = kwargs.get(
                'async_req', False
            )
            kwargs['_return_http_data_only'] = kwargs.get(
                '_return_http_data_only', True
            )
            kwargs['_preload_content'] = kwargs.get(
                '_preload_content', True
            )
            kwargs['_request_timeout'] = kwargs.get(
                '_request_timeout', None
            )
            kwargs['_check_input_type'] = kwargs.get(
                '_check_input_type', True
            )
            kwargs['_check_return_type'] = kwargs.get(
                '_check_return_type', True
            )
            kwargs['_host_index'] = kwargs.get('_host_index')
            kwargs['merchant'] = \
                merchant
            return self.call_with_http_info(**kwargs)

        self.invoke_payment = Endpoint(
            settings={
                'response_type': (PaymentResponse,),
                'auth': [
                    'authorization'
                ],
                'endpoint_path': '/payment/invocation/{merchant}',
                'operation_id': 'invoke_payment',
                'http_method': 'POST',
                'servers': None,
            },
            params_map={
                'all': [
                    'merchant',
                    'payment_invocation_request',
                ],
                'required': [
                    'merchant',
                ],
                'nullable': [
                ],
                'enum': [
                ],
                'validation': [
                ]
            },
            root_map={
                'validations': {
                },
                'allowed_values': {
                },
                'openapi_types': {
                    'merchant':
                        (str,),
                    'payment_invocation_request':
                        (PaymentInvocationRequest,),
                },
                'attribute_map': {
                    'merchant': 'merchant',
                },
                'location_map': {
                    'merchant': 'path',
                    'payment_invocation_request': 'body',
                },
                'collection_format_map': {
                }
            },
            headers_map={
                'accept': [
                    'application/json'
                ],
                'content_type': [
                    'application/json'
                ]
            },
            api_client=api_client,
            callable=__invoke_payment
        )

        def __query_payment(
            self,
            merchant,
            order_ref,
            **kwargs
        ):
            """QueryPayment  # noqa: E501

            Query a 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.query_payment(merchant, order_ref, async_req=True)
            >>> result = thread.get()

            Args:
                merchant (str): Merchant name to payment company, e.g. weixinpay.test
                order_ref (str): Merchant order no.

            Keyword Args:
                payment_method (PaymentMethod): Must be `wechatpay` or `alipay`. [optional]
                _return_http_data_only (bool): response data without head status
                    code and headers. Default is True.
                _preload_content (bool): if False, the urllib3.HTTPResponse object
                    will be returned without reading/decoding response data.
                    Default is True.
                _request_timeout (float/tuple): 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.
                    Default is None.
                _check_input_type (bool): specifies if type checking
                    should be done one the data sent to the server.
                    Default is True.
                _check_return_type (bool): specifies if type checking
                    should be done one the data received from the server.
                    Default is True.
                _host_index (int/None): specifies the index of the server
                    that we want to use.
                    Default is read from the configuration.
                async_req (bool): execute request asynchronously

            Returns:
                PaymentDetailResponse
                    If the method is called asynchronously, returns the request
                    thread.
            """
            kwargs['async_req'] = kwargs.get(
                'async_req', False
            )
            kwargs['_return_http_data_only'] = kwargs.get(
                '_return_http_data_only', True
            )
            kwargs['_preload_content'] = kwargs.get(
                '_preload_content', True
            )
            kwargs['_request_timeout'] = kwargs.get(
                '_request_timeout', None
            )
            kwargs['_check_input_type'] = kwargs.get(
                '_check_input_type', True
            )
            kwargs['_check_return_type'] = kwargs.get(
                '_check_return_type', True
            )
            kwargs['_host_index'] = kwargs.get('_host_index')
            kwargs['merchant'] = \
                merchant
            kwargs['order_ref'] = \
                order_ref
            return self.call_with_http_info(**kwargs)

        self.query_payment = Endpoint(
            settings={
                'response_type': (PaymentDetailResponse,),
                'auth': [
                    'authorization'
                ],
                'endpoint_path': '/payment/{merchant}',
                'operation_id': 'query_payment',
                'http_method': 'GET',
                'servers': None,
            },
            params_map={
                'all': [
                    'merchant',
                    'order_ref',
                    'payment_method',
                ],
                'required': [
                    'merchant',
                    'order_ref',
                ],
                'nullable': [
                ],
                'enum': [
                ],
                'validation': [
                ]
            },
            root_map={
                'validations': {
                },
                'allowed_values': {
                },
                'openapi_types': {
                    'merchant':
                        (str,),
                    'order_ref':
                        (str,),
                    'payment_method':
                        (PaymentMethod,),
                },
                'attribute_map': {
                    'merchant': 'merchant',
                    'order_ref': 'order_ref',
                    'payment_method': 'payment_method',
                },
                'location_map': {
                    'merchant': 'path',
                    'order_ref': 'query',
                    'payment_method': 'query',
                },
                'collection_format_map': {
                }
            },
            headers_map={
                'accept': [
                    'application/json'
                ],
                'content_type': [],
            },
            api_client=api_client,
            callable=__query_payment
        )
