Exemplo n.º 1
0
    def execute(cls, payment_token, params=None, api=None):
        api = api or default_api()
        params = params or {}

        url = util.join_url(cls.path, payment_token, 'agreement-execute')

        return Resource(api.post(url, params), api=api)
Exemplo n.º 2
0
    def search(cls, params=None, api=None):
        api = api or default_api()
        params = params or {}
        path = "v1/invoicing"

        url = util.join_url(path, 'search')

        return Resource(api.post(url, params), api=api)
Exemplo n.º 3
0
    def get_qr_code(self, height=500, width=500, api=None):

        # height and width have default value of 500 as in the APIs
        api = api or default_api()

        # Construct url similar to
        # /invoicing/invoices/<INVOICE-ID>/qr-code?height=<HEIGHT>&width=<WIDTH>
        endpoint = util.join_url(self.path, str(self['id']), 'qr-code')
        image_attributes = [('height', height), ('width', width)]
        url = util.join_url_params(endpoint, image_attributes)

        return Resource(self.api.get(url), api=api)
Exemplo n.º 4
0
    def search_transactions(self, start_date, end_date, api=None):
        if not start_date or not end_date:
            raise exceptions.MissingParam(
                "Search transactions needs valid start_date and end_date.")
        api = api or default_api()

        # Construct url similar to
        # /billing-agreements/I-HT38K76XPMGJ/transactions?start-date=2014-04-13&end-date=2014-04-30
        endpoint = util.join_url(self.path, str(self['id']), 'transactions')
        date_range = [('start_date', start_date), ('end_date', end_date)]
        url = util.join_url_params(endpoint, date_range)

        return Resource(self.api.get(url), api=api)
Exemplo n.º 5
0
 def get_event_types(self, api=None):
     """Get the list of events types that are subscribed to a webhook
     """
     api = api or default_api()
     url = util.join_url(self.path, str(self['id']), 'event-types')
     return Resource(self.api.get(url), api=api)
Exemplo n.º 6
0
 def next_invoice_number(cls, api=None):
     api = api or default_api()
     url = util.join_url(cls.path, 'next-invoice-number')
     return Resource(api.post(url), api=api)
Exemplo n.º 7
0
 def delete_external_refund(self, transactionId):
     # /invoicing/invoices/<INVOICE-ID>/refund-records/<TRANSACTION-ID>
     endpoint = util.join_url(self.path, str(self['id']), 'refund-records',
                              str(transactionId))
     return Resource(self.api.delete(endpoint), api=self.api)