Пример #1
0
    async def delete_discount(self, **kwargs):
        requestor = api_requestor.APIRequestor(self.api_key,
                                               account=self.stripe_account)
        url = self.instance_url() + '/discount'

        _, api_key = await requestor.request('delete', url)

        self.refresh_from({'discount': None}, api_key, True)
Пример #2
0
    async def close_dispute(self, idempotency_key=None):
        requestor = api_requestor.APIRequestor(self.api_key,
                                               account=self.stripe_account)
        url = self.instance_url() + '/dispute/close'
        headers = populate_headers(idempotency_key)
        response, api_key = await requestor.request('post', url, {}, headers)
        self.refresh_from({'dispute': response}, api_key, True)

        return self.dispute
Пример #3
0
 async def create(cls, api_key=None, stripe_account=None, **kwargs):
     requestor = api_requestor.APIRequestor(api_key,
                                            api_base=cls.api_base(),
                                            account=stripe_account)
     url = cls.class_url()
     supplied_headers = {'Content-Type': 'multipart/form-data'}
     response, api_key = await requestor.request('post',
                                                 url,
                                                 params=kwargs,
                                                 headers=supplied_headers)
     return convert_to_stripe_object(response, api_key, stripe_account)
Пример #4
0
    async def list(cls,
                   api_key=None,
                   idempotency_key=None,
                   stripe_account=None,
                   **kwargs):
        requestor = api_requestor.APIRequestor(api_key, account=stripe_account)
        url = cls.class_url()

        response, api_key = await requestor.request('get', url, kwargs)

        return convert_to_stripe_object(response, api_key, stripe_account)
Пример #5
0
    async def request(self, method, url, params=None, headers=None):
        if params is None:
            params = self._retrieve_params

        requestor = api_requestor.APIRequestor(key=self.api_key,
                                               api_base=self.api_base(),
                                               account=self.stripe_account)
        response, api_key = await requestor.request(method, url, params,
                                                    headers)

        return convert_to_stripe_object(response, api_key, self.stripe_account)
Пример #6
0
    async def create(cls,
                     api_key=None,
                     idempotency_key=None,
                     stripe_account=None,
                     **kwargs):
        requestor = api_requestor.APIRequestor(api_key, account=stripe_account)
        url = cls.class_url()
        headers = populate_headers(idempotency_key)

        response, api_key = await requestor.request('post', url, kwargs,
                                                    headers)

        return convert_to_stripe_object(response, api_key, stripe_account)