Example #1
0
    def create_refund_with_http_info(self, id, refund, **kwargs):  # noqa: E501
        """Create refund  # noqa: E501

        決済の全額あるいは一部の返金処理を行います。  # 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_refund_with_http_info(id, refund, async_req=True)
        >>> result = thread.get()

        :param async_req bool: execute request asynchronously
        :param str id: Charge ID (required)
        :param RefundReq refund: 返金の詳細情報 (required)
        :param _return_http_data_only: response data without head status code
                                       and headers
        :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.
        :return: tuple(RefundDto, status_code(int), headers(HTTPHeaderDict))
                 If the method is called asynchronously,
                 returns the request thread.
        """

        local_var_params = locals()

        all_params = ['id', 'refund']  # noqa: E501
        all_params.append('async_req')
        all_params.append('_return_http_data_only')
        all_params.append('_preload_content')
        all_params.append('_request_timeout')

        for key, val in six.iteritems(local_var_params['kwargs']):
            if key not in all_params:
                raise ApiTypeError("Got an unexpected keyword argument '%s'"
                                   " to method create_refund" % key)
            local_var_params[key] = val
        del local_var_params['kwargs']
        # verify the required parameter 'id' is set
        if ('id' not in local_var_params or local_var_params['id'] is None):
            raise ApiValueError(
                "Missing the required parameter `id` when calling `create_refund`"
            )  # noqa: E501
        # verify the required parameter 'refund' is set
        if ('refund' not in local_var_params
                or local_var_params['refund'] is None):
            raise ApiValueError(
                "Missing the required parameter `refund` when calling `create_refund`"
            )  # noqa: E501

        collection_formats = {}

        path_params = {}
        if 'id' in local_var_params:
            path_params['id'] = local_var_params['id']  # noqa: E501

        query_params = []

        header_params = {}

        form_params = []
        local_var_files = {}

        body_params = None
        if 'refund' in local_var_params:
            body_params = local_var_params['refund']
        # HTTP header `Accept`
        header_params['Accept'] = self.api_client.select_header_accept(
            ['application/json;charset=utf-8'])  # noqa: E501

        # HTTP header `Content-Type`
        header_params[
            'Content-Type'] = self.api_client.select_header_content_type(  # noqa: E501
                ['application/json;charset=utf-8'])  # noqa: E501

        # Authentication setting
        auth_settings = ['BasicAuth']  # noqa: E501

        return self.api_client.call_api(
            '/charges/{id}/refunds',
            'POST',
            path_params,
            query_params,
            header_params,
            body=body_params,
            post_params=form_params,
            files=local_var_files,
            response_type='RefundDto',  # noqa: E501
            auth_settings=auth_settings,
            async_req=local_var_params.get('async_req'),
            _return_http_data_only=local_var_params.get(
                '_return_http_data_only'),  # noqa: E501
            _preload_content=local_var_params.get('_preload_content', True),
            _request_timeout=local_var_params.get('_request_timeout'),
            collection_formats=collection_formats)
Example #2
0
    def list_charges_with_http_info(self, **kwargs):  # noqa: E501
        """List charges  # noqa: E501

        決済に関する情報を一覧で取得します。  # noqa: E501
        This method makes a synchronous HTTP request by default. To make an
        asynchronous HTTP request, please pass async_req=True
        >>> thread = api.list_charges_with_http_info(async_req=True)
        >>> result = thread.get()

        :param async_req bool: execute request asynchronously
        :param list[str] payment_method: 決済方法(複数の指定が可能です)
        :param int _from: 開始時間(UTC)。指定した時間以降に作成されたデータを取得します。
        :param int to: 終了時間(UTC)。指定した時間以前に作成されたデータを取得します
        :param str date_field: 検索対象範囲の項目を指定します。
        :param str status: 支払状況
        :param int limit: 最大件数
        :param int offset: 検索開始位置
        :param str sort: ソート項目
        :param str order: ソート順
        :param _return_http_data_only: response data without head status code
                                       and headers
        :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.
        :return: tuple(ChargesResponse, status_code(int), headers(HTTPHeaderDict))
                 If the method is called asynchronously,
                 returns the request thread.
        """

        local_var_params = locals()

        all_params = [
            'payment_method', '_from', 'to', 'date_field', 'status', 'limit',
            'offset', 'sort', 'order'
        ]  # noqa: E501
        all_params.append('async_req')
        all_params.append('_return_http_data_only')
        all_params.append('_preload_content')
        all_params.append('_request_timeout')

        for key, val in six.iteritems(local_var_params['kwargs']):
            if key not in all_params:
                raise ApiTypeError("Got an unexpected keyword argument '%s'"
                                   " to method list_charges" % key)
            local_var_params[key] = val
        del local_var_params['kwargs']

        if 'limit' in local_var_params and local_var_params[
                'limit'] > 100:  # noqa: E501
            raise ApiValueError(
                "Invalid value for parameter `limit` when calling `list_charges`, must be a value less than or equal to `100`"
            )  # noqa: E501
        collection_formats = {}

        path_params = {}

        query_params = []
        if 'payment_method' in local_var_params:
            query_params.append(
                ('paymentMethod',
                 local_var_params['payment_method']))  # noqa: E501
            collection_formats['paymentMethod'] = 'multi'  # noqa: E501
        if '_from' in local_var_params:
            query_params.append(
                ('from', local_var_params['_from']))  # noqa: E501
        if 'to' in local_var_params:
            query_params.append(('to', local_var_params['to']))  # noqa: E501
        if 'date_field' in local_var_params:
            query_params.append(
                ('dateField', local_var_params['date_field']))  # noqa: E501
        if 'status' in local_var_params:
            query_params.append(
                ('status', local_var_params['status']))  # noqa: E501
        if 'limit' in local_var_params:
            query_params.append(
                ('limit', local_var_params['limit']))  # noqa: E501
        if 'offset' in local_var_params:
            query_params.append(
                ('offset', local_var_params['offset']))  # noqa: E501
        if 'sort' in local_var_params:
            query_params.append(
                ('sort', local_var_params['sort']))  # noqa: E501
        if 'order' in local_var_params:
            query_params.append(
                ('order', local_var_params['order']))  # noqa: E501

        header_params = {}

        form_params = []
        local_var_files = {}

        body_params = None
        # HTTP header `Accept`
        header_params['Accept'] = self.api_client.select_header_accept(
            ['application/json;charset=utf-8'])  # noqa: E501

        # Authentication setting
        auth_settings = ['BasicAuth']  # noqa: E501

        return self.api_client.call_api(
            '/charges',
            'GET',
            path_params,
            query_params,
            header_params,
            body=body_params,
            post_params=form_params,
            files=local_var_files,
            response_type='ChargesResponse',  # noqa: E501
            auth_settings=auth_settings,
            async_req=local_var_params.get('async_req'),
            _return_http_data_only=local_var_params.get(
                '_return_http_data_only'),  # noqa: E501
            _preload_content=local_var_params.get('_preload_content', True),
            _request_timeout=local_var_params.get('_request_timeout'),
            collection_formats=collection_formats)