fix coinify callbacks by passing request argument to order.mark_as_paid()

This commit is contained in:
Thomas Steen Rasmussen 2018-07-13 14:38:01 +02:00
parent 9bfdc714f0
commit d3ba04b6f2
2 changed files with 5 additions and 4 deletions

View file

@ -8,7 +8,7 @@ import requests
logger = logging.getLogger("bornhack.%s" % __name__)
def process_coinify_invoice_json(invoicejson, order):
def process_coinify_invoice_json(invoicejson, order, request):
# create or update the invoice object in our database
coinifyinvoice, created = CoinifyAPIInvoice.objects.update_or_create(
coinify_id=invoicejson['id'],
@ -20,7 +20,7 @@ def process_coinify_invoice_json(invoicejson, order):
# if the order is paid in full call the mark as paid method now
if invoicejson['state'] == 'complete' and not coinifyinvoice.order.paid:
coinifyinvoice.order.mark_as_paid()
coinifyinvoice.order.mark_as_paid(request=request)
return coinifyinvoice

View file

@ -562,8 +562,9 @@ class CoinifyCallbackView(SingleObjectMixin, View):
if callbackobject.payload['event'] == 'invoice_state_change' or callbackobject.payload['event'] == 'invoice_manual_resend':
process_coinify_invoice_json(
callbackobject.payload['data'],
self.get_object()
invoicejson=callbackobject.payload['data'],
order=self.get_object(),
request=request,
)
return HttpResponse('OK')
else: