How to use the mercadopago.abstract_api.DeletableAPIResource function in mercadopago

To help you get started, we’ve selected a few mercadopago examples, based on popular ways it is used in public projects.

Secure your code as it's written. Use Snyk Code to scan source code in minutes - no build needed - and fix issues immediately.

github federicobond / pymercadopago / mercadopago / api.py View on Github external
from . import errors
from .abstract_api import (
    API,
    CreatableAPIResource,
    DeletableAPIResource,
    ListableAPIResource,
    RetrievableAPIResource,
    SearchableAPIResource,
    UpdatableAPIResource,
)
from .client import BaseClient
from .response import Response


class CardAPI(ListableAPIResource, RetrievableAPIResource, CreatableAPIResource,
              UpdatableAPIResource, DeletableAPIResource):
    _base_path = '/v1/customers/{customer_id}/cards'

    def __init__(self, client, customer_id):
        super().__init__(client, path_args={'customer_id': customer_id})


class CardTokenAPI(API):
    _base_path = '/v1/card_tokens'

    def create(self, public_key, **data):
        return self._client.post('/', params={'public_key': public_key}, json=data)

    def get(self, id, public_key):
        return self._client.get('/{id}', {'id': id}, params={'public_key': public_key})

    def update(self, id, public_key, **data):
github federicobond / pymercadopago / mercadopago / api.py View on Github external
class CardTokenAPI(API):
    _base_path = '/v1/card_tokens'

    def create(self, public_key, **data):
        return self._client.post('/', params={'public_key': public_key}, json=data)

    def get(self, id, public_key):
        return self._client.get('/{id}', {'id': id}, params={'public_key': public_key})

    def update(self, id, public_key, **data):
        return self._client.put('/{id}', {'id': id}, params={'public_key': public_key}, json=data)


class CustomerAPI(RetrievableAPIResource, CreatableAPIResource,
                  UpdatableAPIResource, DeletableAPIResource,
                  SearchableAPIResource):
    _base_path = '/v1/customers'

    def cards(self, id):
        return CardAPI(self._client, id)


class IdentificationTypeAPI(ListableAPIResource):
    _base_path = '/identification_types'


class InvoiceAPI(RetrievableAPIResource):
    _base_path = '/v1/invoices'


class MerchantOrderAPI(RetrievableAPIResource, CreatableAPIResource,
github federicobond / pymercadopago / mercadopago / api.py View on Github external
def cancel(self, id):
        return self.update(id, status='cancelled')

    def pause(self, id):
        return self.update(id, status='paused')


class ShippingOptionAPI(API):
    _base_path = '/shipping_options'

    def get(self, **data):
        return self._client.get(params=data)


class PosAPI(RetrievableAPIResource, CreatableAPIResource,
             UpdatableAPIResource, DeletableAPIResource, ListableAPIResource):
    _base_path = '/pos'


class UsersAPI(API):
    _base_path = '/users'

    def me(self):
        return self._client.get('/me')

    def account_balance(self, user_id=None):
        if user_id is None:
            user_id = self.me().data['id']

        return self._client.get('/{user_id}/mercadopago_account/balance', {
            'user_id': user_id
        })