summaryrefslogtreecommitdiff
path: root/postgresqleu/paypal/views.py
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/paypal/views.py
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/paypal/views.py')
-rw-r--r--postgresqleu/paypal/views.py18
1 files changed, 1 insertions, 17 deletions
diff --git a/postgresqleu/paypal/views.py b/postgresqleu/paypal/views.py
index b700fc18..9d7f3958 100644
--- a/postgresqleu/paypal/views.py
+++ b/postgresqleu/paypal/views.py
@@ -173,25 +173,9 @@ def paypal_return_handler(request, methodid):
ti.matchinfo = 'Matched standard invoice (auto)'
ti.save()
- # Now figure out where to return the user. This comes from the
- # invoice processor, assuming we have one
- if p:
- url = p.get_return_url(i)
- else:
- # No processor, so redirect the user back to the basic
- # invoice page.
- if i.recipient_user:
- # Registered to a specific user, so request that users
- # login on redirect
- url = "%s/invoices/%s/" % (settings.SITEBASE, i.pk)
- else:
- # No user account registered, so send back to the secret
- # url version
- url = "%s/invoices/%s/%s/" % (settings.SITEBASE, i.pk, i.recipient_secret)
-
return render(request, 'paypal/complete.html', {
'invoice': i,
- 'url': url,
+ 'url': invoicemanager.get_invoice_return_url(i),
})
else:
# Did not match an invoice anywhere!