def withdraw(bank_account_id, params, connect_key=None): if not bank_account_id or not params: raise error.InvalidRequestError( "Bank account id and params cannot be empty", 400) return api_resource.post( params, '{}/{}/withdraw'.format(RESOURCE_URL, bank_account_id), connect_key)
def authorize(charge_id, auth_code): if not charge_id: raise error.InvalidRequestError("Charge id cannot be empty", 400) if not auth_code: raise error.InvalidRequestError("auth_code cannot be empty", 400) params = {'auth_code': auth_code} return api_resource.post(params, '{}/{}/authorize'.format(RESOURCE_URL, charge_id), None)
def set_default(card_id, user_api_token): if not card_id: raise error.InvalidRequestError("Card id cannot be empty", 400) if not user_api_token: raise error.InvalidRequestError("user_api_token cannot be empty", 400) params = {'user_api_token': user_api_token} return api_resource.post(params, '{}/{}/set_default'.format(RESOURCE_URL, card_id), None)
def cancel(charge_id, connect_key=None): if not charge_id: raise error.InvalidRequestError("Charge id cannot be empty", 400) return api_resource.post(None, '{}/{}/cancel'.format(RESOURCE_URL, charge_id), connect_key)
def validate(charge_id, params, connect_key=None): if not charge_id: raise error.InvalidRequestError("Charge id cannot be empty", 400) return api_resource.post(params, '{}/{}/validate'.format(RESOURCE_URL, charge_id), connect_key)
def create(params, connect_key=None): if not params: raise error.InvalidRequestError("Params cannot be empty", 400) return api_resource.post(params, RESOURCE_URL, connect_key)
def authorize(params, connect_key=None): if not params: raise error.InvalidRequestError("Params cannot be empty", 400) return api_resource.post(params, '{}/signup_login'.format(RESOURCE_URL), connect_key)
def charge_existing(card_id): if not card_id: raise error.InvalidRequestError("Card id cannot be empty", 400) params = {'txn_id': card_id} return api_resource.post(params, '/credit_card_charges/charge_card', None)
def charge_guest(params): if not params: raise error.InvalidRequestError("Params cannot be empty", 400) return api_resource.post(params, '/credit_card_charges/charge_card_guest', None)
def add(params): if not params: raise error.InvalidRequestError("Params cannot be empty", 400) return api_resource.post(params, RESOURCE_URL, None)