def create(cls, tr_type, name, account_number=None, bank_code=None, metadata=None, currency=None, description=None, authorization_code=None): params = clean_params(locals()) params['type'] = params['tr_type'] #type is python builtin function del params['tr_type'] uri = paystacklib.api_base + cls.object_type return cls(uri=uri, method='post', params=params).execute()
def totals(cls, fr=None, to=None): params = clean_params(locals()) if 'fr' in params.keys(): params['from'] = params['fr'] del params['fr'] uri = paystacklib.api_base + cls.object_type + '/totals' return cls(uri=uri, method='get', params=params).execute()
def list(cls, fr=None, to=None, subaccount=None): params = clean_params(locals()) if 'fr' in params.keys(): params['from'] = params['fr'] #from is a keyword in Python del params['fr'] uri = paystacklib.api_base + cls.object_type return cls(uri=uri, method='get', params=params).execute()
def update( cls, product_id, name=None, description=None, price=None, currency=None, limited=None, quantity=None): params = clean_params(locals()) uri = paystacklib.api_base + \ '{0}/{1}'.format(cls.object_type, str(product_id)) return cls(uri=uri, method='put', params=params).execute()
def update( cls, id_or_slug, name=None, description=None, amount=None, active=None): params = clean_params(locals()) uri = paystacklib.api_base + \ '{0}/{1}'.format(cls.object_type, str(id_or_slug)) return cls(uri=uri, method='put', params=params).execute()
def check_authorization(cls, authorization_code, amount, email, currency=None): params = clean_params(locals()) uri = paystacklib.api_base + cls.object_type + '/check_authorization' return cls(uri=uri, method='post', params=params).execute()
def create( cls, business_name, settlement_bank, account_number, percentage_charge, primary_contact_email=None, primary_contact_name=None, primary_contact_phone=None, metadata=None, settlement_schedule=None): params = clean_params(locals()) uri = paystacklib.api_base + cls.object_type return cls(uri=uri, method='post', params=params).execute()
def update(cls, id_or_customer_code, first_name=None, last_name=None, phone=None, metadata=None): params = clean_params(locals()) uri = paystacklib.api_base + cls.object_type + '/id_or_customer_code' return cls(uri=uri, method='put', params=params).execute()
def create(cls, email, first_name=None, last_name=None, phone=None, metadata=None): params = clean_params(locals()) uri = paystacklib.api_base + cls.object_type return cls(uri=uri, method='post', params=params).execute()
def add_products(page_id, products): """ products is an array of product ids """ params = clean_params(locals()) del params['page_id'] uri = paystacklib.api_base + \ '{0}/{1}'.format(cls.object_type, str(page_id)) + '/product' return cls(uri=uri, method='post', params=params).execute()
def list(cls, customer=None, status=None, currency=None, paid=None, include_archive=None): params = clean_params(locals()) uri = paystacklib.api_base + cls.object_type return cls(method='get', params=params).execute()
def create(cls, transaction, amount=None, currency=None, customer_note=None, merchant_note=None): params = clean_params(locals()) uri = paystacklib.api_base + cls.object_type return cls(uri=uri, method='post', params=params).execute()
def initiate(cls, amount, recipient, source='balance', currency=None, reason=None, reference=None): params = clean_params(locals()) uri = paystacklib.api_base + cls.object_type return cls(uri=uri, method='post', params=params).execute()
def request_reauthorization(cls, authorization_code, amount, email, reference=None, metadata=None): params = clean_params(locals()) uri = paystacklib.api_base + cls.object_type + \ '/request_reauthorization' return cls(uri=uri, method='post', params=params).execute()
def update( cls, id_or_slug, business_name=None, settlement_bank=None, account_number=None, percentage_charge=None, primary_contact_email=None, description=None, primary_contact_name=None, primary_contact_phone=None, metadata=None, settlement_schedule=None): params = clean_params(locals()) uri = paystacklib.api_base + \ '{0}/{1}'.format(cls.object_type, str(id_or_slug)) return cls(uri=uri, method='put', params=params).execute()
def fetch_charges_in_batch(cls, id_or_code, status=None, perPage=None, page=None): params = clean_params(locals()) uri = paystacklib.api_base + \ '{0}/{1}/charges'.format(cls.object_type, str(id_or_code)) del params['id_or_code'] return cls(uri=uri, method='get', params=params).execute()
def create(cls, name, amount, interval, description=None, send_invoices=None, send_sms=None, currency=None, invoice_limit=None): params = clean_params(locals()) uri = paystacklib.api_base + cls.object_type return cls(uri=uri, method='post', params=params).execute()
def update(cls, id_or_plan_code, name=None, amount=None, description=None, send_invoices=None, send_sms=None, currency=None, invoice_limit=None): params = clean_params(locals()) uri = paystacklib.api_base + \ '{0}/{1}'.format(cls.object_type, str(id_or_plan_code)) return cls(uri=uri, method='put', params=params).execute()
def list(cls, per_page=50, page=1, customer=None, status=None, fr=None, to=None, amount=None): params = clean_params(locals()) if 'fr' in params.keys(): params['from'] = params['fr'] del params['fr'] uri = paystacklib.api_base + cls.object_type return cls(method='get', params=params).execute()
def initialize(cls, amount, email, callback_url=None, reference=None, plan=None, invoice_limit=None, metadata=None, subaccount=None, transaction_charge=None, bearer=None, channels=None): params = clean_params(locals()) uri = paystacklib.api_base + cls.object_type + '/initialize' return cls(uri=uri, method='post', params=params).execute()
def update(cls, id_or_code, customer=None, amount=None, due_date=None, description=None, line_items=None, tax=None, currency=None, metadata=None, send_notification=None): params = clean_params(locals()) uri = paystacklib.api_base + \ '{0}/{1}'.format(cls.object_type, str(id_or_code)) return cls(uri=uri, method='put', params=params).execute()
def charge(cls, authorization_code, amount, email, reference=None, plan=None, currency=None, metadata=None, subaccount=None, transaction_charge=None, bearer=None, invoice_limit=None, queue=None): params = clean_params(locals()) uri = paystacklib.api_base + cls.object_type + '/charge_authorization' return cls(uri=uri, method='post', params=params).execute()
def export(cls, fr=None, to=None, settled=None, payment_page=None, customer=None, currency=None, settlement=None, amount=None, status=None): params = clean_params(locals()) if 'fr' in params.keys(): params['from'] = params['fr'] del params['fr'] uri = paystacklib.api_base + cls.object_type + '/export' return cls(uri=uri, method='get', params=params).execute()
def create(cls, customer, amount, due_date, description=None, line_items=None, tax=None, currency=None, metadata=None, send_notification=None, subaccount=None, draft=None, has_invoice=None, invoice_number=None): params = clean_params(locals()) uri = paystacklib.api_base + cls.object_type return cls(uri=uri, method='post', params=params).execute()
def charge(cls, amount, email, bank_code=None, bank_account_number=None, authorization_code=None, pin=None, metadata=None, reference=None, ussd_type=None, mobile_money=None, device_id=None): bank_object = None ussd_object = None if bank_code and bank_account_number: bank_object = {} bank_object['code'] = str(bank_code) bank_object['account_number'] = str(bank_account_number) if ussd_type: ussd_object = {} ussd_object['type'] = ussd_type params = { 'amount': amount, 'email': email, 'bank': bank_object, 'authorization_code': authorization_code, 'pin': pin, 'metadata': metadata, 'reference': reference, 'ussd': ussd_object, 'mobile_money': mobile_money, 'device_id': device_id } params = clean_params(params) uri = paystacklib.api_base + cls.object_type return cls(uri=uri, method='post', params=params).execute()
def finalize(cls, id_or_code, send_notification=None): params = clean_params(locals()) del params['id_or_code'] #not passed in body or as query param uri = paystacklib.api_base + \ '{0}/finalize/{1}'.format(cls.object_type, str(id_or_code)) return cls(uri=uri, method='post', params=params).execute()
def list(cls, perPage=None, page=None): params = clean_params(locals()) uri = paystacklib.api_base + cls.object_type return cls(uri=uri, method='get', params=params).execute()
def deactivate_authorization(cls, authorization_code): params = clean_params(locals()) uri = paystacklib.api_base + cls.object_type + '/deactivate_authorization' return cls(uri=uri, method='post', params=params).execute()
def set_risk_action(cls, customer, risk_action=None): params = clean_params(locals()) uri = paystacklib.api_base + cls.object_type + '/set_risk_action' return cls(uri=uri, method='post', params=params).execute()
def create( cls, name, description=None, amount= None, slug=None, metadata=None, redirect_url=None, custom_fields=None): params = clean_params(locals()) uri = paystacklib.api_base + cls.object_type return cls(uri=uri, method='post', params=params).execute()