Skip to content

Commit

Permalink
Redirecting to the proper URL in MercadoPago when clicking on "return to
Browse files Browse the repository at this point in the history
shop"
  • Loading branch information
Delawen committed Oct 11, 2020
1 parent 8cb7b00 commit fe0d366
Showing 1 changed file with 10 additions and 4 deletions.
14 changes: 10 additions & 4 deletions pretix_mercadopago/payment.py
Original file line number Diff line number Diff line change
Expand Up @@ -222,6 +222,14 @@ def execute_payment(self, request: HttpRequest, payment_obj: OrderPayment):
if self.settings.get('currency') is not order.event.currency:
price = price * float(self.settings.get('exchange_rate'))
price = round(price, 2)

order_url = build_absolute_uri(request.event,
'presale:event.order',
kwargs={
'order': order.code,
'secret': order.secret
}
)

preference = {
"items": [
Expand All @@ -235,11 +243,9 @@ def execute_payment(self, request: HttpRequest, payment_obj: OrderPayment):
"currency_id": self.settings.get('currency')
}
],
"auto_return": 'all', # solo para las ordenes aprobadas, all
"auto_return": 'all',
"back_urls": {
"failure":
build_absolute_uri(request.event,
'plugins:pretix_mercadopago:return'),
"failure": order_url,
"pending":
build_absolute_uri(request.event,
'plugins:pretix_mercadopago:return'),
Expand Down

0 comments on commit fe0d366

Please sign in to comment.