<filename>billforward/apis/charges_api.py<gh_stars>1-10
# coding: utf-8

"""
    BillForward REST API


    OpenAPI spec version: 1.0.0
    
    Generated by: https://github.com/swagger-api/swagger-codegen.git

    Licensed under the Apache License, Version 2.0 (the "License");
    you may not use this file except in compliance with the License.
    You may obtain a copy of the License at

        http://www.apache.org/licenses/LICENSE-2.0

    Unless required by applicable law or agreed to in writing, software
    distributed under the License is distributed on an "AS IS" BASIS,
    WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
    See the License for the specific language governing permissions and
    limitations under the License.
"""

from __future__ import absolute_import

import sys
import os
import re

# python 2 and python 3 compatibility library
from six import iteritems

from ..configuration import Configuration
from ..api_client import ApiClient


class ChargesApi(object):
    """
    NOTE: This class is auto generated by the swagger code generator program.
    Do not edit the class manually.
    Ref: https://github.com/swagger-api/swagger-codegen
    """

    def __init__(self, api_client=None):
        config = Configuration()
        if api_client:
            self.api_client = api_client
        else:
            if not config.api_client:
                config.api_client = ApiClient()
            self.api_client = config.api_client

    def get_all_subscription_charges(self, **kwargs):
        """
        Retrieves a collection of all charges. By default 10 values are returned. Records are returned in natural order.
        {\"nickname\":\"Retrieve all charges\",\"response\":\"getChargeAll.html\"}

        This method makes a synchronous HTTP request by default. To make an
        asynchronous HTTP request, please define a `callback` function
        to be invoked when receiving the response.
        >>> def callback_function(response):
        >>>     pprint(response)
        >>>
        >>> thread = api.get_all_subscription_charges(callback=callback_function)

        :param callback function: The callback function
            for asynchronous request. (optional)
        :param list[str] organizations: A list of organization-IDs used to restrict the scope of API calls.
        :param int offset: The offset from the first subscription to return.
        :param int records: The maximum number of subscriptions to return.
        :param str order_by: Specify a field used to order the result set.
        :param str order: Ihe direction of any ordering, either ASC or DESC.
        :param bool include_retired: Whether retired subscriptions should be returned.
        :return: SubscriptionChargePagedMetadata
                 If the method is called asynchronously,
                 returns the request thread.
        """
        kwargs['_return_http_data_only'] = True
        if kwargs.get('callback'):
            return self.get_all_subscription_charges_with_http_info(**kwargs)
        else:
            (data) = self.get_all_subscription_charges_with_http_info(**kwargs)
            return data

    def get_all_subscription_charges_with_http_info(self, **kwargs):
        """
        Retrieves a collection of all charges. By default 10 values are returned. Records are returned in natural order.
        {\"nickname\":\"Retrieve all charges\",\"response\":\"getChargeAll.html\"}

        This method makes a synchronous HTTP request by default. To make an
        asynchronous HTTP request, please define a `callback` function
        to be invoked when receiving the response.
        >>> def callback_function(response):
        >>>     pprint(response)
        >>>
        >>> thread = api.get_all_subscription_charges_with_http_info(callback=callback_function)

        :param callback function: The callback function
            for asynchronous request. (optional)
        :param list[str] organizations: A list of organization-IDs used to restrict the scope of API calls.
        :param int offset: The offset from the first subscription to return.
        :param int records: The maximum number of subscriptions to return.
        :param str order_by: Specify a field used to order the result set.
        :param str order: Ihe direction of any ordering, either ASC or DESC.
        :param bool include_retired: Whether retired subscriptions should be returned.
        :return: SubscriptionChargePagedMetadata
                 If the method is called asynchronously,
                 returns the request thread.
        """

        all_params = ['organizations', 'offset', 'records', 'order_by', 'order', 'include_retired']
        all_params.append('callback')
        all_params.append('_return_http_data_only')

        params = locals()
        for key, val in iteritems(params['kwargs']):
            if key not in all_params:
                raise TypeError(
                    "Got an unexpected keyword argument '%s'"
                    " to method get_all_subscription_charges" % key
                )
            params[key] = val
        del params['kwargs']

        resource_path = '/charges'.replace('{format}', 'json')
        path_params = {}

        query_params = {}
        if 'organizations' in params:
            query_params['organizations'] = params['organizations']
        if 'offset' in params:
            query_params['offset'] = params['offset']
        if 'records' in params:
            query_params['records'] = params['records']
        if 'order_by' in params:
            query_params['order_by'] = params['order_by']
        if 'order' in params:
            query_params['order'] = params['order']
        if 'include_retired' in params:
            query_params['include_retired'] = params['include_retired']

        header_params = {}

        form_params = []
        local_var_files = {}

        body_params = None

        # HTTP header `Accept`
        header_params['Accept'] = self.api_client.\
            select_header_accept(['application/json'])
        if not header_params['Accept']:
            del header_params['Accept']

        # HTTP header `Content-Type`
        header_params['Content-Type'] = self.api_client.\
            select_header_content_type([])

        # Authentication setting
        auth_settings = []

        return self.api_client.call_api(resource_path, 'GET',
                                            path_params,
                                            query_params,
                                            header_params,
                                            body=body_params,
                                            post_params=form_params,
                                            files=local_var_files,
                                            response_type='SubscriptionChargePagedMetadata',
                                            auth_settings=auth_settings,
                                            callback=params.get('callback'),
                                            _return_http_data_only=params.get('_return_http_data_only'))

    def get_subscription_charge_by_account_id(self, account_id, **kwargs):
        """
        Retrieves a collection of charges, specified by the account-ID parameter. By default 10 values are returned. Records are returned in natural order.
        {\"nickname\":\"Retrieve by account\",\"response\":\"getChargeByAccount.html\"}

        This method makes a synchronous HTTP request by default. To make an
        asynchronous HTTP request, please define a `callback` function
        to be invoked when receiving the response.
        >>> def callback_function(response):
        >>>     pprint(response)
        >>>
        >>> thread = api.get_subscription_charge_by_account_id(account_id, callback=callback_function)

        :param callback function: The callback function
            for asynchronous request. (optional)
        :param str account_id: The string ID of the account (required)
        :param list[str] organizations: A list of organization-IDs used to restrict the scope of API calls.
        :param int offset: The offset from the first subscription to return.
        :param int records: The maximum number of subscriptions to return.
        :param str order_by: Specify a field used to order the result set.
        :param str order: Ihe direction of any ordering, either ASC or DESC.
        :param bool include_retired: Whether retired subscriptions should be returned.
        :return: SubscriptionChargePagedMetadata
                 If the method is called asynchronously,
                 returns the request thread.
        """
        kwargs['_return_http_data_only'] = True
        if kwargs.get('callback'):
            return self.get_subscription_charge_by_account_id_with_http_info(account_id, **kwargs)
        else:
            (data) = self.get_subscription_charge_by_account_id_with_http_info(account_id, **kwargs)
            return data

    def get_subscription_charge_by_account_id_with_http_info(self, account_id, **kwargs):
        """
        Retrieves a collection of charges, specified by the account-ID parameter. By default 10 values are returned. Records are returned in natural order.
        {\"nickname\":\"Retrieve by account\",\"response\":\"getChargeByAccount.html\"}

        This method makes a synchronous HTTP request by default. To make an
        asynchronous HTTP request, please define a `callback` function
        to be invoked when receiving the response.
        >>> def callback_function(response):
        >>>     pprint(response)
        >>>
        >>> thread = api.get_subscription_charge_by_account_id_with_http_info(account_id, callback=callback_function)

        :param callback function: The callback function
            for asynchronous request. (optional)
        :param str account_id: The string ID of the account (required)
        :param list[str] organizations: A list of organization-IDs used to restrict the scope of API calls.
        :param int offset: The offset from the first subscription to return.
        :param int records: The maximum number of subscriptions to return.
        :param str order_by: Specify a field used to order the result set.
        :param str order: Ihe direction of any ordering, either ASC or DESC.
        :param bool include_retired: Whether retired subscriptions should be returned.
        :return: SubscriptionChargePagedMetadata
                 If the method is called asynchronously,
                 returns the request thread.
        """

        all_params = ['account_id', 'organizations', 'offset', 'records', 'order_by', 'order', 'include_retired']
        all_params.append('callback')
        all_params.append('_return_http_data_only')

        params = locals()
        for key, val in iteritems(params['kwargs']):
            if key not in all_params:
                raise TypeError(
                    "Got an unexpected keyword argument '%s'"
                    " to method get_subscription_charge_by_account_id" % key
                )
            params[key] = val
        del params['kwargs']
        # verify the required parameter 'account_id' is set
        if ('account_id' not in params) or (params['account_id'] is None):
            raise ValueError("Missing the required parameter `account_id` when calling `get_subscription_charge_by_account_id`")

        resource_path = '/charges/account/{account-ID}'.replace('{format}', 'json')
        path_params = {}
        if 'account_id' in params:
            path_params['account-ID'] = params['account_id']

        query_params = {}
        if 'organizations' in params:
            query_params['organizations'] = params['organizations']
        if 'offset' in params:
            query_params['offset'] = params['offset']
        if 'records' in params:
            query_params['records'] = params['records']
        if 'order_by' in params:
            query_params['order_by'] = params['order_by']
        if 'order' in params:
            query_params['order'] = params['order']
        if 'include_retired' in params:
            query_params['include_retired'] = params['include_retired']

        header_params = {}

        form_params = []
        local_var_files = {}

        body_params = None

        # HTTP header `Accept`
        header_params['Accept'] = self.api_client.\
            select_header_accept(['application/json'])
        if not header_params['Accept']:
            del header_params['Accept']

        # HTTP header `Content-Type`
        header_params['Content-Type'] = self.api_client.\
            select_header_content_type(['text/plain'])

        # Authentication setting
        auth_settings = []

        return self.api_client.call_api(resource_path, 'GET',
                                            path_params,
                                            query_params,
                                            header_params,
                                            body=body_params,
                                            post_params=form_params,
                                            files=local_var_files,
                                            response_type='SubscriptionChargePagedMetadata',
                                            auth_settings=auth_settings,
                                            callback=params.get('callback'),
                                            _return_http_data_only=params.get('_return_http_data_only'))

    def get_subscription_charge_by_id(self, charge_id, **kwargs):
        """
        Retrieves a single charge, specified by the charge-id parameter.
        {\"nickname\":\"Retrieve a charge\",\"response\":\"getChargeByID.html\"}

        This method makes a synchronous HTTP request by default. To make an
        asynchronous HTTP request, please define a `callback` function
        to be invoked when receiving the response.
        >>> def callback_function(response):
        >>>     pprint(response)
        >>>
        >>> thread = api.get_subscription_charge_by_id(charge_id, callback=callback_function)

        :param callback function: The callback function
            for asynchronous request. (optional)
        :param str charge_id: The unique string-ID of the subscription. (required)
        :param list[str] organizations: A list of organization-IDs used to restrict the scope of API calls.
        :param int offset: The offset from the first subscription to return.
        :param int records: The maximum number of subscriptions to return.
        :param str order_by: Specify a field used to order the result set.
        :param str order: Ihe direction of any ordering, either ASC or DESC.
        :param bool include_retired: Whether retired subscriptions should be returned.
        :return: SubscriptionChargePagedMetadata
                 If the method is called asynchronously,
                 returns the request thread.
        """
        kwargs['_return_http_data_only'] = True
        if kwargs.get('callback'):
            return self.get_subscription_charge_by_id_with_http_info(charge_id, **kwargs)
        else:
            (data) = self.get_subscription_charge_by_id_with_http_info(charge_id, **kwargs)
            return data

    def get_subscription_charge_by_id_with_http_info(self, charge_id, **kwargs):
        """
        Retrieves a single charge, specified by the charge-id parameter.
        {\"nickname\":\"Retrieve a charge\",\"response\":\"getChargeByID.html\"}

        This method makes a synchronous HTTP request by default. To make an
        asynchronous HTTP request, please define a `callback` function
        to be invoked when receiving the response.
        >>> def callback_function(response):
        >>>     pprint(response)
        >>>
        >>> thread = api.get_subscription_charge_by_id_with_http_info(charge_id, callback=callback_function)

        :param callback function: The callback function
            for asynchronous request. (optional)
        :param str charge_id: The unique string-ID of the subscription. (required)
        :param list[str] organizations: A list of organization-IDs used to restrict the scope of API calls.
        :param int offset: The offset from the first subscription to return.
        :param int records: The maximum number of subscriptions to return.
        :param str order_by: Specify a field used to order the result set.
        :param str order: Ihe direction of any ordering, either ASC or DESC.
        :param bool include_retired: Whether retired subscriptions should be returned.
        :return: SubscriptionChargePagedMetadata
                 If the method is called asynchronously,
                 returns the request thread.
        """

        all_params = ['charge_id', 'organizations', 'offset', 'records', 'order_by', 'order', 'include_retired']
        all_params.append('callback')
        all_params.append('_return_http_data_only')

        params = locals()
        for key, val in iteritems(params['kwargs']):
            if key not in all_params:
                raise TypeError(
                    "Got an unexpected keyword argument '%s'"
                    " to method get_subscription_charge_by_id" % key
                )
            params[key] = val
        del params['kwargs']
        # verify the required parameter 'charge_id' is set
        if ('charge_id' not in params) or (params['charge_id'] is None):
            raise ValueError("Missing the required parameter `charge_id` when calling `get_subscription_charge_by_id`")

        resource_path = '/charges/{charge-id}'.replace('{format}', 'json')
        path_params = {}
        if 'charge_id' in params:
            path_params['charge-id'] = params['charge_id']

        query_params = {}
        if 'organizations' in params:
            query_params['organizations'] = params['organizations']
        if 'offset' in params:
            query_params['offset'] = params['offset']
        if 'records' in params:
            query_params['records'] = params['records']
        if 'order_by' in params:
            query_params['order_by'] = params['order_by']
        if 'order' in params:
            query_params['order'] = params['order']
        if 'include_retired' in params:
            query_params['include_retired'] = params['include_retired']

        header_params = {}

        form_params = []
        local_var_files = {}

        body_params = None

        # HTTP header `Accept`
        header_params['Accept'] = self.api_client.\
            select_header_accept(['application/json'])
        if not header_params['Accept']:
            del header_params['Accept']

        # HTTP header `Content-Type`
        header_params['Content-Type'] = self.api_client.\
            select_header_content_type(['text/plain'])

        # Authentication setting
        auth_settings = []

        return self.api_client.call_api(resource_path, 'GET',
                                            path_params,
                                            query_params,
                                            header_params,
                                            body=body_params,
                                            post_params=form_params,
                                            files=local_var_files,
                                            response_type='SubscriptionChargePagedMetadata',
                                            auth_settings=auth_settings,
                                            callback=params.get('callback'),
                                            _return_http_data_only=params.get('_return_http_data_only'))

    def get_subscription_charge_by_state(self, state, **kwargs):
        """
        Retrieves a collection of charges, specified by the state parameter. By default 10 values are returned. Records are returned in natural order.
        {\"nickname\":\"Retrieve by state\",\"response\":\"getChargeByState.html\"}

        This method makes a synchronous HTTP request by default. To make an
        asynchronous HTTP request, please define a `callback` function
        to be invoked when receiving the response.
        >>> def callback_function(response):
        >>>     pprint(response)
        >>>
        >>> thread = api.get_subscription_charge_by_state(state, callback=callback_function)

        :param callback function: The callback function
            for asynchronous request. (optional)
        :param str state: The current state of the charge (required)
        :param list[str] organizations: A list of organization-IDs used to restrict the scope of API calls.
        :param int offset: The offset from the first subscription to return.
        :param int records: The maximum number of subscriptions to return.
        :param str order_by: Specify a field used to order the result set.
        :param str order: Ihe direction of any ordering, either ASC or DESC.
        :param bool include_retired: Whether retired subscriptions should be returned.
        :return: SubscriptionChargePagedMetadata
                 If the method is called asynchronously,
                 returns the request thread.
        """
        kwargs['_return_http_data_only'] = True
        if kwargs.get('callback'):
            return self.get_subscription_charge_by_state_with_http_info(state, **kwargs)
        else:
            (data) = self.get_subscription_charge_by_state_with_http_info(state, **kwargs)
            return data

    def get_subscription_charge_by_state_with_http_info(self, state, **kwargs):
        """
        Retrieves a collection of charges, specified by the state parameter. By default 10 values are returned. Records are returned in natural order.
        {\"nickname\":\"Retrieve by state\",\"response\":\"getChargeByState.html\"}

        This method makes a synchronous HTTP request by default. To make an
        asynchronous HTTP request, please define a `callback` function
        to be invoked when receiving the response.
        >>> def callback_function(response):
        >>>     pprint(response)
        >>>
        >>> thread = api.get_subscription_charge_by_state_with_http_info(state, callback=callback_function)

        :param callback function: The callback function
            for asynchronous request. (optional)
        :param str state: The current state of the charge (required)
        :param list[str] organizations: A list of organization-IDs used to restrict the scope of API calls.
        :param int offset: The offset from the first subscription to return.
        :param int records: The maximum number of subscriptions to return.
        :param str order_by: Specify a field used to order the result set.
        :param str order: Ihe direction of any ordering, either ASC or DESC.
        :param bool include_retired: Whether retired subscriptions should be returned.
        :return: SubscriptionChargePagedMetadata
                 If the method is called asynchronously,
                 returns the request thread.
        """

        all_params = ['state', 'organizations', 'offset', 'records', 'order_by', 'order', 'include_retired']
        all_params.append('callback')
        all_params.append('_return_http_data_only')

        params = locals()
        for key, val in iteritems(params['kwargs']):
            if key not in all_params:
                raise TypeError(
                    "Got an unexpected keyword argument '%s'"
                    " to method get_subscription_charge_by_state" % key
                )
            params[key] = val
        del params['kwargs']
        # verify the required parameter 'state' is set
        if ('state' not in params) or (params['state'] is None):
            raise ValueError("Missing the required parameter `state` when calling `get_subscription_charge_by_state`")

        resource_path = '/charges/state/{state}'.replace('{format}', 'json')
        path_params = {}
        if 'state' in params:
            path_params['state'] = params['state']

        query_params = {}
        if 'organizations' in params:
            query_params['organizations'] = params['organizations']
        if 'offset' in params:
            query_params['offset'] = params['offset']
        if 'records' in params:
            query_params['records'] = params['records']
        if 'order_by' in params:
            query_params['order_by'] = params['order_by']
        if 'order' in params:
            query_params['order'] = params['order']
        if 'include_retired' in params:
            query_params['include_retired'] = params['include_retired']

        header_params = {}

        form_params = []
        local_var_files = {}

        body_params = None

        # HTTP header `Accept`
        header_params['Accept'] = self.api_client.\
            select_header_accept(['application/json'])
        if not header_params['Accept']:
            del header_params['Accept']

        # HTTP header `Content-Type`
        header_params['Content-Type'] = self.api_client.\
            select_header_content_type([])

        # Authentication setting
        auth_settings = []

        return self.api_client.call_api(resource_path, 'GET',
                                            path_params,
                                            query_params,
                                            header_params,
                                            body=body_params,
                                            post_params=form_params,
                                            files=local_var_files,
                                            response_type='SubscriptionChargePagedMetadata',
                                            auth_settings=auth_settings,
                                            callback=params.get('callback'),
                                            _return_http_data_only=params.get('_return_http_data_only'))

    def get_subscription_charge_by_version_id(self, version_id, **kwargs):
        """
        Retrieves a single charge, specified by the version-ID parameter.
        {\"nickname\":\"Retrieve by version\",\"response\":\"getChargeByVersionID.html\"}

        This method makes a synchronous HTTP request by default. To make an
        asynchronous HTTP request, please define a `callback` function
        to be invoked when receiving the response.
        >>> def callback_function(response):
        >>>     pprint(response)
        >>>
        >>> thread = api.get_subscription_charge_by_version_id(version_id, callback=callback_function)

        :param callback function: The callback function
            for asynchronous request. (optional)
        :param str version_id: The version-ID of the charge. (required)
        :param list[str] organizations: A list of organization-IDs used to restrict the scope of API calls.
        :return: SubscriptionChargePagedMetadata
                 If the method is called asynchronously,
                 returns the request thread.
        """
        kwargs['_return_http_data_only'] = True
        if kwargs.get('callback'):
            return self.get_subscription_charge_by_version_id_with_http_info(version_id, **kwargs)
        else:
            (data) = self.get_subscription_charge_by_version_id_with_http_info(version_id, **kwargs)
            return data

    def get_subscription_charge_by_version_id_with_http_info(self, version_id, **kwargs):
        """
        Retrieves a single charge, specified by the version-ID parameter.
        {\"nickname\":\"Retrieve by version\",\"response\":\"getChargeByVersionID.html\"}

        This method makes a synchronous HTTP request by default. To make an
        asynchronous HTTP request, please define a `callback` function
        to be invoked when receiving the response.
        >>> def callback_function(response):
        >>>     pprint(response)
        >>>
        >>> thread = api.get_subscription_charge_by_version_id_with_http_info(version_id, callback=callback_function)

        :param callback function: The callback function
            for asynchronous request. (optional)
        :param str version_id: The version-ID of the charge. (required)
        :param list[str] organizations: A list of organization-IDs used to restrict the scope of API calls.
        :return: SubscriptionChargePagedMetadata
                 If the method is called asynchronously,
                 returns the request thread.
        """

        all_params = ['version_id', 'organizations']
        all_params.append('callback')
        all_params.append('_return_http_data_only')

        params = locals()
        for key, val in iteritems(params['kwargs']):
            if key not in all_params:
                raise TypeError(
                    "Got an unexpected keyword argument '%s'"
                    " to method get_subscription_charge_by_version_id" % key
                )
            params[key] = val
        del params['kwargs']
        # verify the required parameter 'version_id' is set
        if ('version_id' not in params) or (params['version_id'] is None):
            raise ValueError("Missing the required parameter `version_id` when calling `get_subscription_charge_by_version_id`")

        resource_path = '/charges/version/{version-ID}'.replace('{format}', 'json')
        path_params = {}
        if 'version_id' in params:
            path_params['version-ID'] = params['version_id']

        query_params = {}
        if 'organizations' in params:
            query_params['organizations'] = params['organizations']

        header_params = {}

        form_params = []
        local_var_files = {}

        body_params = None

        # HTTP header `Accept`
        header_params['Accept'] = self.api_client.\
            select_header_accept(['application/json'])
        if not header_params['Accept']:
            del header_params['Accept']

        # HTTP header `Content-Type`
        header_params['Content-Type'] = self.api_client.\
            select_header_content_type(['text/plain'])

        # Authentication setting
        auth_settings = []

        return self.api_client.call_api(resource_path, 'GET',
                                            path_params,
                                            query_params,
                                            header_params,
                                            body=body_params,
                                            post_params=form_params,
                                            files=local_var_files,
                                            response_type='SubscriptionChargePagedMetadata',
                                            auth_settings=auth_settings,
                                            callback=params.get('callback'),
                                            _return_http_data_only=params.get('_return_http_data_only'))

    def recalculate_subscription_charge(self, charge_id, charge, **kwargs):
        """
        Recalculate a charge.
        {\"nickname\":\"Re-calculate a charge\",\"request\":\"recalculateChargeRequest.html\",\"response\":\"recalculateChargeResponse.html\"}

        This method makes a synchronous HTTP request by default. To make an
        asynchronous HTTP request, please define a `callback` function
        to be invoked when receiving the response.
        >>> def callback_function(response):
        >>>     pprint(response)
        >>>
        >>> thread = api.recalculate_subscription_charge(charge_id, charge, callback=callback_function)

        :param callback function: The callback function
            for asynchronous request. (optional)
        :param str charge_id: Unique id of the charge. (required)
        :param RecalculateChargeRequest charge: The charge to be re-calculated. (required)
        :return: SubscriptionChargePagedMetadata
                 If the method is called asynchronously,
                 returns the request thread.
        """
        kwargs['_return_http_data_only'] = True
        if kwargs.get('callback'):
            return self.recalculate_subscription_charge_with_http_info(charge_id, charge, **kwargs)
        else:
            (data) = self.recalculate_subscription_charge_with_http_info(charge_id, charge, **kwargs)
            return data

    def recalculate_subscription_charge_with_http_info(self, charge_id, charge, **kwargs):
        """
        Recalculate a charge.
        {\"nickname\":\"Re-calculate a charge\",\"request\":\"recalculateChargeRequest.html\",\"response\":\"recalculateChargeResponse.html\"}

        This method makes a synchronous HTTP request by default. To make an
        asynchronous HTTP request, please define a `callback` function
        to be invoked when receiving the response.
        >>> def callback_function(response):
        >>>     pprint(response)
        >>>
        >>> thread = api.recalculate_subscription_charge_with_http_info(charge_id, charge, callback=callback_function)

        :param callback function: The callback function
            for asynchronous request. (optional)
        :param str charge_id: Unique id of the charge. (required)
        :param RecalculateChargeRequest charge: The charge to be re-calculated. (required)
        :return: SubscriptionChargePagedMetadata
                 If the method is called asynchronously,
                 returns the request thread.
        """

        all_params = ['charge_id', 'charge']
        all_params.append('callback')
        all_params.append('_return_http_data_only')

        params = locals()
        for key, val in iteritems(params['kwargs']):
            if key not in all_params:
                raise TypeError(
                    "Got an unexpected keyword argument '%s'"
                    " to method recalculate_subscription_charge" % key
                )
            params[key] = val
        del params['kwargs']
        # verify the required parameter 'charge_id' is set
        if ('charge_id' not in params) or (params['charge_id'] is None):
            raise ValueError("Missing the required parameter `charge_id` when calling `recalculate_subscription_charge`")
        # verify the required parameter 'charge' is set
        if ('charge' not in params) or (params['charge'] is None):
            raise ValueError("Missing the required parameter `charge` when calling `recalculate_subscription_charge`")

        resource_path = '/charges/{charge-ID}/recalculate'.replace('{format}', 'json')
        path_params = {}
        if 'charge_id' in params:
            path_params['charge-ID'] = params['charge_id']

        query_params = {}

        header_params = {}

        form_params = []
        local_var_files = {}

        body_params = None
        if 'charge' in params:
            body_params = params['charge']

        # HTTP header `Accept`
        header_params['Accept'] = self.api_client.\
            select_header_accept(['text/xml', 'application/xml', 'application/json'])
        if not header_params['Accept']:
            del header_params['Accept']

        # HTTP header `Content-Type`
        header_params['Content-Type'] = self.api_client.\
            select_header_content_type(['application/json'])

        # Authentication setting
        auth_settings = []

        return self.api_client.call_api(resource_path, 'POST',
                                            path_params,
                                            query_params,
                                            header_params,
                                            body=body_params,
                                            post_params=form_params,
                                            files=local_var_files,
                                            response_type='SubscriptionChargePagedMetadata',
                                            auth_settings=auth_settings,
                                            callback=params.get('callback'),
                                            _return_http_data_only=params.get('_return_http_data_only'))

    def void_subscription_charge(self, charge_id, **kwargs):
        """
        Void the charge with the specified charge-ID.
        {\"nickname\":\"Void charge\",\"response\":\"deleteCharge.html\"}

        This method makes a synchronous HTTP request by default. To make an
        asynchronous HTTP request, please define a `callback` function
        to be invoked when receiving the response.
        >>> def callback_function(response):
        >>>     pprint(response)
        >>>
        >>> thread = api.void_subscription_charge(charge_id, callback=callback_function)

        :param callback function: The callback function
            for asynchronous request. (optional)
        :param str charge_id: Unique id of the charge. (required)
        :param list[str] organizations: A list of organization-IDs used to restrict the scope of API calls.
        :return: SubscriptionChargePagedMetadata
                 If the method is called asynchronously,
                 returns the request thread.
        """
        kwargs['_return_http_data_only'] = True
        if kwargs.get('callback'):
            return self.void_subscription_charge_with_http_info(charge_id, **kwargs)
        else:
            (data) = self.void_subscription_charge_with_http_info(charge_id, **kwargs)
            return data

    def void_subscription_charge_with_http_info(self, charge_id, **kwargs):
        """
        Void the charge with the specified charge-ID.
        {\"nickname\":\"Void charge\",\"response\":\"deleteCharge.html\"}

        This method makes a synchronous HTTP request by default. To make an
        asynchronous HTTP request, please define a `callback` function
        to be invoked when receiving the response.
        >>> def callback_function(response):
        >>>     pprint(response)
        >>>
        >>> thread = api.void_subscription_charge_with_http_info(charge_id, callback=callback_function)

        :param callback function: The callback function
            for asynchronous request. (optional)
        :param str charge_id: Unique id of the charge. (required)
        :param list[str] organizations: A list of organization-IDs used to restrict the scope of API calls.
        :return: SubscriptionChargePagedMetadata
                 If the method is called asynchronously,
                 returns the request thread.
        """

        all_params = ['charge_id', 'organizations']
        all_params.append('callback')
        all_params.append('_return_http_data_only')

        params = locals()
        for key, val in iteritems(params['kwargs']):
            if key not in all_params:
                raise TypeError(
                    "Got an unexpected keyword argument '%s'"
                    " to method void_subscription_charge" % key
                )
            params[key] = val
        del params['kwargs']
        # verify the required parameter 'charge_id' is set
        if ('charge_id' not in params) or (params['charge_id'] is None):
            raise ValueError("Missing the required parameter `charge_id` when calling `void_subscription_charge`")

        resource_path = '/charges/{charge-id}'.replace('{format}', 'json')
        path_params = {}
        if 'charge_id' in params:
            path_params['charge-id'] = params['charge_id']

        query_params = {}
        if 'organizations' in params:
            query_params['organizations'] = params['organizations']

        header_params = {}

        form_params = []
        local_var_files = {}

        body_params = None

        # HTTP header `Accept`
        header_params['Accept'] = self.api_client.\
            select_header_accept(['application/json'])
        if not header_params['Accept']:
            del header_params['Accept']

        # HTTP header `Content-Type`
        header_params['Content-Type'] = self.api_client.\
            select_header_content_type([])

        # Authentication setting
        auth_settings = []

        return self.api_client.call_api(resource_path, 'DELETE',
                                            path_params,
                                            query_params,
                                            header_params,
                                            body=body_params,
                                            post_params=form_params,
                                            files=local_var_files,
                                            response_type='SubscriptionChargePagedMetadata',
                                            auth_settings=auth_settings,
                                            callback=params.get('callback'),
                                            _return_http_data_only=params.get('_return_http_data_only'))
