diff options
| author | Magnus Hagander | 2022-01-01 14:02:28 +0000 |
|---|---|---|
| committer | Magnus Hagander | 2022-01-05 16:11:34 +0000 |
| commit | 2c17af9394204e386118c336feec6188a92dda95 (patch) | |
| tree | eec324947befd26e9b75401216341f7670b987f7 /postgresqleu/paypal/views.py | |
| parent | ebf4658751fda8ce61015170df8845a90ad7c287 (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.py | 18 |
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! |
