Skip to content

Commit

Permalink
try no lugar correto
Browse files Browse the repository at this point in the history
  • Loading branch information
leonardocintra committed Jul 30, 2022
1 parent 1961805 commit 18d5731
Showing 1 changed file with 6 additions and 5 deletions.
11 changes: 6 additions & 5 deletions pagamento/views.py
Original file line number Diff line number Diff line change
Expand Up @@ -204,15 +204,16 @@ def mp_notifications(request):
try:
# TODO: as vezes pode ter mais de um resuts. Entao fazer um loop para pegar sempre o ultimo
payment_id = datas['results'][0]['id']

Pedido.objects.filter(uuid=external_reference).update(
session_ativa=False)
PagamentoMercadoPago.objects.filter(
pedido=pedido).update(payment_id=payment_id)
except Exception as e:
capture_exception(e)
return JsonResponse({"payment_id": "payment_id-nao-encontrado"}, status=200)

Pedido.objects.filter(uuid=external_reference).update(
session_ativa=False)
PagamentoMercadoPago.objects.filter(
pedido=pedido).update(payment_id=payment_id)


payment = get_payment(payment_id)
if payment['status'] == 404:
return JsonResponse({"pagamento": "nao-encontrado"}, status=200)
Expand Down

0 comments on commit 18d5731

Please sign in to comment.