示例#1
0
 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() 
示例#2
0
 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()
示例#4
0
 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()
示例#5
0
 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()
示例#6
0
 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() 
示例#8
0
 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()
示例#9
0
 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()
示例#10
0
 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()
示例#11
0
 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()
示例#12
0
 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()
示例#13
0
 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()
示例#14
0
 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()
示例#15
0
 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()
示例#16
0
 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()
示例#17
0
 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()
示例#18
0
 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()
示例#19
0
 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()
示例#20
0
 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()
示例#21
0
 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()
示例#22
0
 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()
示例#23
0
 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()
示例#24
0
 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()
示例#25
0
 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()
示例#26
0
 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()
示例#27
0
 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()
示例#28
0
 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()
示例#29
0
 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()
示例#30
0
 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()