make epay callback code handle multiple callbacks for the same order (happens sometimes)

This commit is contained in:
Thomas Steen Rasmussen 2016-05-17 15:35:28 +02:00
parent 9ff4be7272
commit f5e05ac51c

View file

@ -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,