How to use the mercadopago.mercadopagorestclient.MercadoPagoRestClient 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 mercadopago / sdk-python / mercadopago / discountcampaign.py View on Github external
from .mercadopagorestclient import MercadoPagoRestClient

class DiscountCampaign(MercadoPagoRestClient):
    def __init__(self, client_id, client_secret, access_token, version):
        super(DiscountCampaign, self).__init__(client_id, client_secret, access_token, version)

    def get(self, transaction_amount, payer_email, coupon_code):
        access_token = self.get_access_token()
        filters = {}
        filters["access_token"] = access_token
        filters["transaction_amount"] = transaction_amount
        filters["payer_email"] = payer_email
        filters["coupon_code"] = coupon_code

        payment_result = self.get_rest_client().get("/v1/discount_campaigns", filters)
        return payment_result
github mercadopago / sdk-python / mercadopago / merchantorder.py View on Github external
from .mercadopagorestclient import MercadoPagoRestClient

class MerchantOrder(MercadoPagoRestClient):
    def __init__(self, client_id, client_secret, access_token, version):
        super(MerchantOrder, self).__init__(client_id, client_secret, access_token, version)

    def create(self, merchant_order):
        access_token = self.get_access_token()
        result = self.get_rest_client().post("/merchant_orders?access_token=" + access_token, merchant_order)
        return result

    def update(self, id, merchant_order):
        access_token = self.get_access_token()
        result = self.get_rest_client().put("/merchant_orders/" + id + "?access_token=" + access_token, merchant_order)
        return result

    def get(self, id):
        access_token = self.get_access_token()
        result = self.get_rest_client().get("/merchant_orders/" + id + "?access_token=" + access_token)
github mercadopago / sdk-python / mercadopago / genericcall.py View on Github external
from .mercadopagorestclient import MercadoPagoRestClient

class GenericCall(MercadoPagoRestClient):
    def __init__(self, client_id, client_secret, access_token, version):
        super(GenericCall, self).__init__(client_id, client_secret, access_token, version)

    def get(self, uri, params=None, authenticate=True):
        if params is None:
            params = {}

        if authenticate:
            access_token = self.get_access_token()
            params["access_token"] = access_token

        result = self.get_rest_client().get(uri, params)
        return result

    def post(self, uri, data, params=None):
        if params is None:
github mercadopago / sdk-python / mercadopago / preference.py View on Github external
from .mercadopagorestclient import MercadoPagoRestClient

class Preference(MercadoPagoRestClient):
    def __init__(self, client_id, client_secret, access_token, version):
        super(Preference, self).__init__(client_id, client_secret, access_token, version)

    def create(self, preference):
        access_token = self.get_access_token()
        preference_result = self.get_rest_client().post("/checkout/preferences?access_token=" + access_token, preference)
        return preference_result

    def update(self, id, preference):
        access_token = self.get_access_token()
        preference_result = self.get_rest_client().put("/checkout/preferences/" + id + "?access_token=" + access_token, preference)
        return preference_result

    def get(self, id):
        access_token = self.get_access_token()
        preference_result = self.get_rest_client().get("/checkout/preferences/" + id + "?access_token=" + access_token)
github mercadopago / sdk-python / mercadopago / payment.py View on Github external
from .mercadopagorestclient import MercadoPagoRestClient

class Payment(MercadoPagoRestClient):
    def __init__(self, client_id, client_secret, access_token, version):
        super(Payment, self).__init__(client_id, client_secret, access_token, version)

    def get(self, id):
        access_token = self.get_access_token()

        #uri_prefix = "/sandbox" if MercadoPago.__sandbox else ""

        payment_info = self.get_rest_client().get("/v1/payments/" + id + "?access_token=" + access_token)
        return payment_info

    def get_authorized(self, id):
        access_token = self.get_access_token()
        authorized_payment_info = self.get_rest_client().get("/authorized_payments/" + id + "?access_token=" + access_token)
        return authorized_payment_info
github mercadopago / sdk-python / mercadopago / identificationtype.py View on Github external
from .mercadopagorestclient import MercadoPagoRestClient

class IdentificationType(MercadoPagoRestClient):
    def __init__(self, client_id, client_secret, access_token, version):
        super(IdentificationType, self).__init__(client_id, client_secret, access_token, version)

    def get(self, id):
        access_token = self.get_access_token()
        result = self.get_rest_client().get("/v1/identification_types?access_token=" + access_token)
        return result
github mercadopago / sdk-python / mercadopago / cardtoken.py View on Github external
from .mercadopagorestclient import MercadoPagoRestClient

class CardToken(MercadoPagoRestClient):
    def __init__(self, client_id, client_secret, access_token, version):
        super(CardToken, self).__init__(client_id, client_secret, access_token, version)

    def create(self, cardtoken):
        access_token = self.get_access_token()
        result = self.get_rest_client().post("/v1/card_tokens?access_token=" + access_token, cardtoken)
        return result

    def get(self, id):
        access_token = self.get_access_token()
        result = self.get_rest_client().get("/v1/card_tokens/" + id + "?access_token=" + access_token)
        return result
github mercadopago / sdk-python / mercadopago / customer.py View on Github external
from .mercadopagorestclient import MercadoPagoRestClient

class Customer(MercadoPagoRestClient):
    def __init__(self, client_id, client_secret, access_token, version):
        super(Customer, self).__init__(client_id, client_secret, access_token, version)

    def get(self, id):
        access_token = self.get_access_token()
        result = self.get_rest_client().get("/v1/customers/" + id + "?access_token=" + access_token)
        return result

    def create(self, customer):
        access_token = self.get_access_token()
        response = self.get_rest_client().post("/v1/customers?access_token=" + access_token, customer)
        return response

    def update(self, id, customer):
        access_token = self.get_access_token()
        response = self.get_rest_client().put("/v1/customers/" + id + "?access_token=" + access_token, customer)
github mercadopago / sdk-python / mercadopago / card.py View on Github external
from .mercadopagorestclient import MercadoPagoRestClient

class Card(MercadoPagoRestClient):
    def __init__(self, client_id, client_secret, access_token, version):
        super(Card, self).__init__(client_id, client_secret, access_token, version)

    def create(self, card):
        access_token = self.get_access_token()
        result = self.get_rest_client().post("/v1/customers/" + id + "/cards?access_token=" + access_token, card)
        return result

    def update(self, id, card):
        access_token = self.get_access_token()
        result = self.get_rest_client().put("/v1/customers/" + id + "/cards?access_token=" + access_token, card)
        return result

    def delete(self, id):
        access_token = self.get_access_token()
        result = self.get_rest_client().delete("/v1/customers/" + id + "/cards?access_token=" + access_token)