How to use the mercadopago.abstract_api.UpdatableAPIResource 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
class PlanAPI(RetrievableAPIResource, CreatableAPIResource,
              UpdatableAPIResource):
    _base_path = '/v1/plans'


class PreferenceAPI(RetrievableAPIResource, CreatableAPIResource,
                    UpdatableAPIResource, ListableAPIResource):
    _base_path = '/checkout/preferences'


class MoneyRequestAPI(RetrievableAPIResource, CreatableAPIResource):
    _base_path = '/money_requests'


class PreapprovalAPI(CreatableAPIResource, UpdatableAPIResource,
                     SearchableAPIResource):
    _base_path = '/preapproval'

    def get(self, id):
        # NOTE: this is actually performing a search with ID and mangling
        # the response data to conform to a single object format.
        # There is no method to retrieve a preapproval by ID at the moment.

        res = self.search(id=id)

        if not res.data['results']:
            raise errors.NotFoundError('could not find preapproval with ID = %s' % id)

        res = Response(self._client.client, res._response)  # pylint: disable=protected-access
        res.data = res.data['results'][0]
github federicobond / pymercadopago / mercadopago / api.py View on Github external
def __init__(self, client, payment_id):
        super().__init__(client, path_args={'payment_id': payment_id})

    def refunds(self, id, **data):
        return self._client.post('/{disbursement_id}/refunds', {'disbursement_id': id}, json=data)

    def disburses(self, id, **data):
        return self._client.post('/{disbursement_id}/disburses', {'disbursement_id': id}, json=data)


class ChargebackAPI(RetrievableAPIResource):
    _base_path = '/v1/chargebacks'


class PlanAPI(RetrievableAPIResource, CreatableAPIResource,
              UpdatableAPIResource):
    _base_path = '/v1/plans'


class PreferenceAPI(RetrievableAPIResource, CreatableAPIResource,
                    UpdatableAPIResource, ListableAPIResource):
    _base_path = '/checkout/preferences'


class MoneyRequestAPI(RetrievableAPIResource, CreatableAPIResource):
    _base_path = '/money_requests'


class PreapprovalAPI(CreatableAPIResource, UpdatableAPIResource,
                     SearchableAPIResource):
    _base_path = '/preapproval'
github federicobond / pymercadopago / mercadopago / api.py View on Github external
_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,
                       UpdatableAPIResource):
    _base_path = '/merchant_orders'


class PaymentMethodAPI(ListableAPIResource):
    _base_path = '/v1/payment_methods'

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

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


class PaymentAPI(RetrievableAPIResource, CreatableAPIResource,
                 UpdatableAPIResource, SearchableAPIResource):
    _base_path = '/v1/payments'