summaryrefslogtreecommitdiff
path: root/postgresqleu/adyen
diff options
context:
space:
mode:
authorMagnus Hagander2022-01-01 14:02:28 +0000
committerMagnus Hagander2022-01-05 16:11:34 +0000
commit2c17af9394204e386118c336feec6188a92dda95 (patch)
treeeec324947befd26e9b75401216341f7670b987f7 /postgresqleu/adyen
parentebf4658751fda8ce61015170df8845a90ad7c287 (diff)
Centralize creation of invoice return URLs
This code was copy/pasted between several different places, so centralize it into the InvoiceManager class to reduce the risk of furhter off-by-one mistakes when editing.
Diffstat (limited to 'postgresqleu/adyen')
-rw-r--r--postgresqleu/adyen/views.py10
1 files changed, 1 insertions, 9 deletions
diff --git a/postgresqleu/adyen/views.py b/postgresqleu/adyen/views.py
index 2250d60b..44b59e75 100644
--- a/postgresqleu/adyen/views.py
+++ b/postgresqleu/adyen/views.py
@@ -42,15 +42,7 @@ def adyen_return_handler(request, methodid):
return render(request, 'adyen/invalidreference.html', {
'reference': request.GET['merchantReturnData'],
})
- manager = InvoiceManager()
- if invoice.processor:
- processor = manager.get_invoice_processor(invoice)
- returnurl = processor.get_return_url(invoice)
- else:
- if invoice.recipient_user:
- returnurl = "%s/invoices/%s/" % (settings.SITEBASE, invoice.pk)
- else:
- returnurl = "%s/invoices/%s/%s/" % (settings.SITEBASE, invoice.pk, invoice.recipient_secret)
+ returnurl = InvoiceManager().get_invoice_return_url(invoice)
AdyenLog(pspReference='', message='Return handler received %s result for %s' % (request.GET['authResult'], request.GET['merchantReturnData']), error=False, paymentmethod=method).save()
if request.GET['authResult'] == 'REFUSED':