# Path: pagarme/resources/handler_request.py
# TEMPORARY_COMPANY = 'https://api.pagar.me/1/companies/temporary'
# KEYS = {}
# def validate_response(pagarme_response):
# def create_temporary_company():
# def authentication_key(api_key=None, company_temporary=False):
# def delete(end_point, data = {}):
# def get(end_point, data = {}):
# def post(end_point, data={}):
# def put(end_point, data = {}):
# def error(data):
# 
# Path: pagarme/resources/routes/subscription_routes.py
# BASE_URL = 'https://api.pagar.me/1/subscriptions'
# CANCEL_SUBSCRIPTION = BASE_URL + '/{0}/cancel'
# GET_ALL_SUBSCRIPTIONS = BASE_URL
# GET_ALL_SUBSCRIPTIONS_POSTBACKS = BASE_URL + '/{0}/postbacks'
# GET_ALL_SUBSCRIPTIONS_TRANSACTIONS = BASE_URL + '/{0}/transactions'
# GET_SUBSCRIPTION_BY = BASE_URL
# GET_SUBSCRIPTION_POSTBACK_BY_ID = BASE_URL + '/{0}/postbacks/{1}'
# REDELIVER_SUBSCRIPTION_POSTBACK_BY_ID = BASE_URL + '/{0}/postbacks/{1}/redeliver'
# SETTLE_CHARGES_SUBSCRIPTION = BASE_URL + '/{0}/settle_charge'
# UPDATE_SUBSCRIPTION = BASE_URL + '/{0}'


from pagarme.resources import handler_request
from pagarme.resources.routes import subscription_routes


def cancel(subscription_id):
    return handler_request.post(subscription_routes.CANCEL_SUBSCRIPTION.format(subscription_id))


def create(dictionary):
    return handler_request.post(subscription_routes.BASE_URL, dictionary)


def find_all():
    return handler_request.get(subscription_routes.GET_ALL_SUBSCRIPTIONS)


def find_by(search_params):
    return handler_request.get(subscription_routes.GET_SUBSCRIPTION_BY, search_params)


def transactions(subscription_id):
    return handler_request.get(subscription_routes.GET_ALL_SUBSCRIPTIONS_TRANSACTIONS.format(subscription_id))


def postbacks(subscription_id):
    return handler_request.get(subscription_routes.GET_ALL_SUBSCRIPTIONS_POSTBACKS.format(subscription_id))


def postback_redeliver(subscription_id, postback_id):
    return \

# Path: pagarme/resources/handler_request.py
# TEMPORARY_COMPANY = 'https://api.pagar.me/1/companies/temporary'
# KEYS = {}
# def validate_response(pagarme_response):
# def create_temporary_company():
# def authentication_key(api_key=None, company_temporary=False):
# def delete(end_point, data = {}):
# def get(end_point, data = {}):
# def post(end_point, data={}):
# def put(end_point, data = {}):
# def error(data):
# 
# Path: pagarme/resources/routes/subscription_routes.py
# BASE_URL = 'https://api.pagar.me/1/subscriptions'
# CANCEL_SUBSCRIPTION = BASE_URL + '/{0}/cancel'
# GET_ALL_SUBSCRIPTIONS = BASE_URL
# GET_ALL_SUBSCRIPTIONS_POSTBACKS = BASE_URL + '/{0}/postbacks'
# GET_ALL_SUBSCRIPTIONS_TRANSACTIONS = BASE_URL + '/{0}/transactions'
# GET_SUBSCRIPTION_BY = BASE_URL
# GET_SUBSCRIPTION_POSTBACK_BY_ID = BASE_URL + '/{0}/postbacks/{1}'
# REDELIVER_SUBSCRIPTION_POSTBACK_BY_ID = BASE_URL + '/{0}/postbacks/{1}/redeliver'
# SETTLE_CHARGES_SUBSCRIPTION = BASE_URL + '/{0}/settle_charge'
# UPDATE_SUBSCRIPTION = BASE_URL + '/{0}'


# Path: pagarme/subscription.py
from pagarme.resources import handler_request
from pagarme.resources.routes import subscription_routes



def cancel(subscription_id):
    return handler_request.post(subscription_routes.CANCEL_SUBSCRIPTION.format(subscription_id))


def create(dictionary):
    return handler_request.post(subscription_routes.BASE_URL, dictionary)


def find_all():
    return handler_request.get(subscription_routes.GET_ALL_SUBSCRIPTIONS)


def find_by(search_params):
    return handler_request.get(subscription_routes.GET_SUBSCRIPTION_BY, search_params)


def transactions(subscription_id):
    return handler_request.get(subscription_routes.GET_ALL_SUBSCRIPTIONS_TRANSACTIONS.format(subscription_id))


def postbacks(subscription_id):
    return handler_request.get(subscription_routes.GET_ALL_SUBSCRIPTIONS_POSTBACKS.format(subscription_id))


def postback_redeliver(subscription_id, postback_id):
    return \

        handler_request.post(subscription_routes.REDELIVER_SUBSCRIPTION_POSTBACK_BY_ID.format(subscription_id, postback_id))