Giter Club home page Giter Club logo

django-mercadopago's Introduction

django-mercadopago's People

Contributors

dyend avatar pre-commit-ci[bot] avatar pwqw avatar whynothugo avatar

Stargazers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

Watchers

 avatar  avatar  avatar  avatar  avatar  avatar

django-mercadopago's Issues

Documentación: ¿Cómo sería el mecanismo básico?

  1. Creo una Preferencia.
  2. Uso .url para armar el botón de pago.
  3. Ejecuto poll_status() para actualizar preferencia.

¿Ese es el mecanismo básico que se espera a utilizar? ¿Hay que crear una preferencia por cada unidad de producto vendida?

Multiple items per Preference

Create an Item model with a foreign key to the preference. Maintaining backward compatibility if you want to continue using only one Item per preference in PreferenceManager.create

Account help_text Mercado Pago utiliza otros nombres

msgid "The APP_ID given by MercadoPago."
msgstr "El APP_ID dato por MercadoPago."

msgid "The SECRET_KEY given by MercadoPago."
msgstr "El SECRET_KEY dado por MercadoPago."

APP_ID ahora es CLIENT_ID
y
SECRET_KEY ahora es CLIENT_SECRET

[Bug] In migration 0002, using multiple databases

assuming I have another database set:

$ python manage.py migrate --database another

Operations to perform:
  Apply all migrations: ..., mp, ...
Running migrations:
  Applying mp.0001_initial... OK
  Applying mp.0002_auto_20150923_2328...Traceback (most recent call last):
  File ".../lib/python3.6/site-packages/django/db/backends/utils.py", line 64, in execute
    return self.cursor.execute(sql, params)
psycopg2.IntegrityError: duplicate key value violates unique constraint "mp_account_slug_f896377f_uniq"
DETAIL:  Key (slug)=(_) already exists.


The above exception was the direct cause of the following exception:

Traceback (most recent call last):

More info here https://docs.djangoproject.com/en/1.11/ref/migration-operations/#runpython

Hola este proyecto sigue funcionando?

Buenas, no se si hablas español, pero quiero saber si sigue funcionando para tratar de utilizarlo. Hay alguna pagina que ya este usando esto? Es posible utilizar este código para construir un marketplace?

Try to integrate front end

Hi @WhyNotHugo , I'm trying to integrate my webservice with front end and Mercado pagoA API, I need to create payments with recurrencing every month.

How do I make this ?

Grave problema al generar un Payment teniendo multiples Accounts

El modelo Payment tiene el campo mp_id como único y, al generarse pagos de Accounts diferentes es posible que vengan con la misma identificación generando así un:

IntegrityError: (1062, "Duplicate entry '2147483647' for key 'mp_id'")

Sugiero:
a. Eliminar la línea 351 dejándolo libre sin validación.
b. Agregar programáticamente algo similar a

class Meta:
   unique_together = (("mp_id", "preference__owner"),)

relation "mp_account" does not exist

I got this error when create run 'python manage.py runserver'. The credentials used on the Account objects was tested and works.

Then I been trying reload the migrations and it still raising this error

File "/usr/local/lib/python3.7/site-packages/django/db/backends/utils.py", line 86, in _execute
return self.cursor.execute(sql, params)
psycopg2.errors.UndefinedTable: relation "mp_account" does not exist
LINE 1: ...ccount"."secret_key", "mp_account"."sandbox" FROM "mp_accoun...
^

The above exception was the direct cause of the following exception:

Traceback (most recent call last):
File "/usr/local/lib/python3.7/threading.py", line 926, in _bootstrap_inner
self.run()
File "/usr/local/lib/python3.7/threading.py", line 870, in run
self._target(*self._args, **self._kwargs)
File "/usr/local/lib/python3.7/site-packages/django/utils/autoreload.py", line 53, in wrapper
fn(*args, **kwargs)
File "/usr/local/lib/python3.7/site-packages/django/core/management/commands/runserver.py", lin
e 109, in inner_run
autoreload.raise_last_exception()
File "/usr/local/lib/python3.7/site-packages/django/utils/autoreload.py", line 76, in raise_las
t_exception
raise _exception[1]
File "/usr/local/lib/python3.7/site-packages/django/core/management/init.py", line 357, in
execute
autoreload.check_errors(django.setup)()
File "/usr/local/lib/python3.7/site-packages/django/utils/autoreload.py", line 53, in wrapper
fn(*args, **kwargs)
File "/usr/local/lib/python3.7/site-packages/django/init.py", line 24, in setup
apps.populate(settings.INSTALLED_APPS)
File "/usr/local/lib/python3.7/site-packages/django/apps/registry.py", line 114, in populate
app_config.import_models()
File "/usr/local/lib/python3.7/site-packages/django/apps/config.py", line 211, in import_models
self.models_module = import_module(models_module_name)
File "/usr/local/lib/python3.7/importlib/init.py", line 127, in import_module
return _bootstrap._gcd_import(name[level:], package, level)
File "", line 1006, in _gcd_import
File "", line 983, in _find_and_load
File "", line 967, in _find_and_load_unlocked
File "", line 677, in _load_unlocked
File "", line 728, in exec_module
File "", line 219, in call_with_frames_removed
File "/src/payment/models.py", line 83, in
class MPPayment(models.Model):
File "/src/payment/models.py", line 96, in MPPayment
account = Account.objects.first()
File "/usr/local/lib/python3.7/site-packages/django/db/models/manager.py", line 82, in manager

method
return getattr(self.get_queryset(), name)(*args, **kwargs)
File "/usr/local/lib/python3.7/site-packages/django/db/models/query.py", line 664, in first
for obj in (self if self.ordered else self.order_by('pk'))[:1]:
File "/usr/local/lib/python3.7/site-packages/django/db/models/query.py", line 276, in iter
self._fetch_all()
File "/usr/local/lib/python3.7/site-packages/django/db/models/query.py", line 1261, in _fetch_a
ll
self._result_cache = list(self._iterable_class(self))
File "/usr/local/lib/python3.7/site-packages/django/db/models/query.py", line 57, in iter
results = compiler.execute_sql(chunked_fetch=self.chunked_fetch, chunk_size=self.chunk_size)
File "/usr/local/lib/python3.7/site-packages/django/db/models/sql/compiler.py", line 1144, in e
xecute_sql
cursor.execute(sql, params)
File "/usr/local/lib/python3.7/site-packages/django/db/backends/utils.py", line 100, in execute
return super().execute(sql, params)
File "/usr/local/lib/python3.7/site-packages/django/db/backends/utils.py", line 68, in execute
return self._execute_with_wrappers(sql, params, many=False, executor=self._execute)
File "/usr/local/lib/python3.7/site-packages/django/db/backends/utils.py", line 77, in _execute
_with_wrappers
return executor(sql, params, many, context)
File "/usr/local/lib/python3.7/site-packages/django/db/backends/utils.py", line 86, in _execute
return self.cursor.execute(sql, params)
File "/usr/local/lib/python3.7/site-packages/django/db/utils.py", line 90, in exit
raise dj_exc_value.with_traceback(traceback) from exc_value
File "/usr/local/lib/python3.7/site-packages/django/db/backends/utils.py", line 86, in _execute
return self.cursor.execute(sql, params)
django.db.utils.ProgrammingError: relation "mp_account" does not exist
LINE 1: ...ccount"."secret_key", "mp_account"."sandbox" FROM "mp_accoun...

Collection id is not always sent for view PaymentSuccessView(CSRFExemptMixin, View):

This causes an exception when is not sent, here i will show an example with credit card payment and its json anwser

{
  "collection_id": ["155448647"],
  "collection_status": ["approved"],
  "payment_id": ["155448647"],
  "status": ["approved"],
  "external_reference": ["orden-5"],
  "payment_type": ["credit_card"],
  "merchant_order_id": ["3125411900"],
  "preference_id": ["-----------"],
  "site_id": ["MLC"],
  "processing_mode": ["aggregator"],
  "merchant_account_id": ["null"]
}

here with debit card:

{
  "payment_id": ["155448647"],
  "payment_status": ["approved"],
  "external_reference": ["orden-4"],
  "payment_method_id": ["webpay"]
}

as we can see collection id is not sent with debit card payment, but payment_id yes and is the same id.

here is the exception :

Internal Server Error: /mercadopago/post_payment/orden-4
Traceback (most recent call last):
  File "/usr/local/lib/python3.9/site-packages/django/db/models/query.py", line 581, in get_or_create
    return self.get(**kwargs), False
  File "/usr/local/lib/python3.9/site-packages/django/db/models/query.py", line 435, in get
    raise self.model.DoesNotExist(
django_mercadopago.models.Notification.DoesNotExist: Notification matching query does not exist.

During handling of the above exception, another exception occurred:

Traceback (most recent call last):
  File "/usr/local/lib/python3.9/site-packages/django/db/backends/utils.py", line 84, in _execute
    return self.cursor.execute(sql, params)
psycopg2.errors.NotNullViolation: null value in column "resource_id" of relation "mp_notification" violates not-null constraint
DETAIL:  Failing row contains (5, p, null, 2021-09-10 02:35:34.826117+00, 1, unp, 5).


The above exception was the direct cause of the following exception:

Traceback (most recent call last):
  File "/usr/local/lib/python3.9/site-packages/django/core/handlers/exception.py", line 47, in inner
    response = get_response(request)
  File "/usr/local/lib/python3.9/site-packages/django/core/handlers/base.py", line 181, in _get_response
    response = wrapped_callback(request, *callback_args, **callback_kwargs)
  File "/usr/local/lib/python3.9/site-packages/django/views/generic/base.py", line 70, in view
    return self.dispatch(request, *args, **kwargs)
  File "/usr/local/lib/python3.9/site-packages/django/utils/decorators.py", line 43, in _wrapper
    return bound_method(*args, **kwargs)
  File "/usr/local/lib/python3.9/site-packages/django/views/decorators/csrf.py", line 54, in wrapped_view
    return view_func(*args, **kwargs)
  File "/usr/local/lib/python3.9/site-packages/django_mercadopago/views.py", line 45, in dispatch
    return super().dispatch(*args, **kwargs)
  File "/usr/local/lib/python3.9/site-packages/django/views/generic/base.py", line 98, in dispatch
    return handler(request, *args, **kwargs)
  File "/usr/local/lib/python3.9/site-packages/django_mercadopago/views.py", line 93, in get
    notification, created = _create_notification(
  File "/usr/local/lib/python3.9/site-packages/django_mercadopago/views.py", line 27, in _create_notification
    notification, created = Notification.objects.update_or_create(
  File "/usr/local/lib/python3.9/site-packages/django/db/models/manager.py", line 85, in manager_method
    return getattr(self.get_queryset(), name)(*args, **kwargs)
  File "/usr/local/lib/python3.9/site-packages/django/db/models/query.py", line 608, in update_or_create
    obj, created = self.select_for_update().get_or_create(defaults, **kwargs)
  File "/usr/local/lib/python3.9/site-packages/django/db/models/query.py", line 588, in get_or_create
    return self.create(**params), True
  File "/usr/local/lib/python3.9/site-packages/django/db/models/query.py", line 453, in create
    obj.save(force_insert=True, using=self.db)
  File "/usr/local/lib/python3.9/site-packages/django/db/models/base.py", line 726, in save
    self.save_base(using=using, force_insert=force_insert,
  File "/usr/local/lib/python3.9/site-packages/django/db/models/base.py", line 763, in save_base
    updated = self._save_table(
  File "/usr/local/lib/python3.9/site-packages/django/db/models/base.py", line 868, in _save_table
    results = self._do_insert(cls._base_manager, using, fields, returning_fields, raw)
  File "/usr/local/lib/python3.9/site-packages/django/db/models/base.py", line 906, in _do_insert
    return manager._insert(
  File "/usr/local/lib/python3.9/site-packages/django/db/models/manager.py", line 85, in manager_method
    return getattr(self.get_queryset(), name)(*args, **kwargs)
  File "/usr/local/lib/python3.9/site-packages/django/db/models/query.py", line 1270, in _insert
    return query.get_compiler(using=using).execute_sql(returning_fields)
  File "/usr/local/lib/python3.9/site-packages/django/db/models/sql/compiler.py", line 1416, in execute_sql
    cursor.execute(sql, params)
  File "/usr/local/lib/python3.9/site-packages/django/db/backends/utils.py", line 66, in execute
    return self._execute_with_wrappers(sql, params, many=False, executor=self._execute)
  File "/usr/local/lib/python3.9/site-packages/django/db/backends/utils.py", line 75, in _execute_with_wrappers
    return executor(sql, params, many, context)
  File "/usr/local/lib/python3.9/site-packages/django/db/backends/utils.py", line 84, in _execute
    return self.cursor.execute(sql, params)
  File "/usr/local/lib/python3.9/site-packages/django/db/utils.py", line 90, in __exit__
    raise dj_exc_value.with_traceback(traceback) from exc_value
  File "/usr/local/lib/python3.9/site-packages/django/db/backends/utils.py", line 84, in _execute
    return self.cursor.execute(sql, params)
django.db.utils.IntegrityError: null value in column "resource_id" of relation "mp_notification" violates not-null constraint
DETAIL:  Failing row contains (5, p, null, 2021-09-10 02:35:34.826117+00, 1, unp, 5).

Maintanence status

I've migrated to using django-payments on most of the websites I maintain for over a year now.

It's generally better designed, and has the upside of supporting multiple payment processors.

Because of this, I won't really be maintaining this library much any more -- I'd recommend looking at django-payments if you're getting started on a new project.

django-mercadopago currently works with the latest version of Django, and should continue working fine for the next couple of releases too. I'll accept PRs for bugfixes, and if anyone needs to continue using this library and wants to adopt it, I'm open to that too. However, I would recommend looking at django-payments, since having two libraries which can achieve the same thing is a bit of wasted/duplicate effort.

May are sensible data in the tests

Sorry about that. I'm do not have a great security knowledges.

I just want to ensure that you do not have real access tokens in the test of this project. Or may you have a mercadopago account only for tests.

If it will be true, please delete the access token in MercadoPago because if you only deletes ths information in Github this will be persists in the logs and commit history.

Having tokens publicly exposed are a bad practice in general. But may you know that and do not have any security problems.

Anyway... you repo is awesome, thaks a lot!

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.