-
-
Notifications
You must be signed in to change notification settings - Fork 12
Could the MercadoPagoService class be customizable through settings.py ? #21
Comments
I'm happy to discuss any changes/features that you might need, but you've given me absolutely NO information about what you're trying to do.
…On Mon, Nov 4, 2019, at 15:55, Alexis Caffa wrote:
https://github.com/WhyNotHugo/django-mercadopago/blob/master/django_mercadopago/models.py#L20
I need to personalize some of this..
—
You are receiving this because you are subscribed to this thread.
Reply to this email directly, view it on GitHub <#21?email_source=notifications&email_token=AAFSNOY5TEKOBUPFGI7PKXDQSAZV7A5CNFSM4JIUXWD2YY3PNVWWK3TUL52HS4DFUVEXG43VMWVGG33NNVSW45C7NFSM4HWT6BDA>, or unsubscribe <https://github.com/notifications/unsubscribe-auth/AAFSNO5EEJR5XX3A656OVZTQSAZV7ANCNFSM4JIUXWDQ>.
--
Hugo Osvaldo Barrera
|
This issue is related to a capability for create a MercadoPago Marketplace, in my case. First of all, I need to use another token (obtained from a link to my account with the account of a third party). The most practical, it would be to be able to use a custom class, set from the Alternatively, def apply_monkeypatch_to_mp_account(mp_account):
def get_service(self):
service = MP(self.third_party_related_account.mp_access_token)
service.sandbox_mode(self.sandbox)
return service
setattr(mp_account.__class__, 'service', property(get_service))
return mp_account But.. I still can't size the amount of possibilities that would open just by admitting this configuration. |
Including it in I've been looking at the docs, and it seems the simplest clean approach would be to:
I'll start fiddling with some bits of this. Does the general idea make sense to you? Do you see any problems with it, or me missing anything? |
Then it would be necessary to implement the task for the token refresh, which expires every 6 months. class MyAccount(models.Model):
mp_account = models.OneToOneField(
django_mercadopago.models.Account,
on_delete=models.CASCADE,
related_name='wallet_account',
blank=True,
null=True,
)
mp_public_key = models.CharField(
verbose_name='Clave pública',
help_text='La "Public key" dada por Mercado Pago',
max_length=255,
blank=True,
null=True,
)
owner = models.ForeignKey(
User,
help_text='A quién le corresponde esta cuenta de Mercado Pago',
related_name='accounts',
on_delete=models.CASCADE,
blank=True,
null=True,
)
mp_user_id = models.IntegerField(
verbose_name='Mercado Pago user_id',
blank=True,
null=True,
)
mp_access_token = models.CharField(
verbose_name='Token de acceso',
help_text='Token de acceso para marketplace',
max_length=255,
blank=True,
null=True,
)
mp_token_type = models.CharField(
verbose_name='Tipo de token',
help_text='Tipo de access token',
max_length=32,
blank=True,
null=True,
)
mp_expires_in = models.PositiveIntegerField(
verbose_name='Expira en',
help_text='Tiempo que expira el token',
blank=True,
null=True,
)
mp_scope = models.CharField(
verbose_name='Permisos del token',
help_text='Accesos brindados por el marketplace',
max_length=255,
blank=True,
null=True,
)
mp_refresh_token = models.CharField(
verbose_name='Token de refresco',
help_text='Token para actualizar el token de acceso. Cada 6 meses se vence.',
max_length=255,
blank=True,
null=True,
) |
Haciéndo eso sigue siendo compatible con no-marketplaces? |
django-mercadopago/django_mercadopago/models.py
Line 20 in 0cf8a43
I need to personalize some of this..
The text was updated successfully, but these errors were encountered: