From f5e05ac51c4743b89e9589374843c9710696937e Mon Sep 17 00:00:00 2001 From: Thomas Steen Rasmussen Date: Tue, 17 May 2016 15:35:28 +0200 Subject: [PATCH] make epay callback code handle multiple callbacks for the same order (happens sometimes) --- shop/views.py | 8 ++++++-- 1 file changed, 6 insertions(+), 2 deletions(-) diff --git a/shop/views.py b/shop/views.py index a6bd283f..b45bfcfb 100644 --- a/shop/views.py +++ b/shop/views.py @@ -307,9 +307,13 @@ class EpayCallbackView(View): print "bad epay callback!" return HttpResponse(status=400) - ### epay callback is valid - if the order been paid in full, - ### create an EpayPayment object linking the callback to the order + if order.paid: + ### this order is already paid, perhaps we are seeing a double callback? + return HttpResponse('OK') + + ### epay callback is valid - has the order been paid in full? if int(query['amount']) == order.total * 100: + ### create an EpayPayment object linking the callback to the order EpayPayment.objects.create( order=order, callback=callback,