fix coinify callbacks by passing request argument to order.mark_as_paid()
This commit is contained in:
parent
9bfdc714f0
commit
d3ba04b6f2
|
@ -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
|
||||
|
||||
|
|
|
@ -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:
|
||||
|
|
Loading…
Reference in a new issue