diff options
Diffstat (limited to 'postgresqleu/paypal/views.py')
-rw-r--r-- | postgresqleu/paypal/views.py | 9 |
1 files changed, 8 insertions, 1 deletions
diff --git a/postgresqleu/paypal/views.py b/postgresqleu/paypal/views.py index df92baf1..23b8eb6d 100644 --- a/postgresqleu/paypal/views.py +++ b/postgresqleu/paypal/views.py @@ -1,4 +1,4 @@ -from django.http import HttpResponseForbidden +from django.http import HttpResponseForbidden, HttpResponse from django.db import transaction from django.shortcuts import render_to_response from django.template import RequestContext @@ -106,6 +106,13 @@ def paypal_return_handler(request): # Payment is completed. Create a paypal transaction info # object for it, and then try to match it to an invoice. + # Double-check if it is already added. We did check this furter + # up, but it seems it can sometimes be called more than once + # asynchronously, due to the check with paypal taking too + # long. + if TransactionInfo.objects.filter(paypaltransid=tx).exists(): + return HttpResponse("Transaction already processed", content_type='text/plain') + # Paypal seems to randomly change which field actually contains # the transaction title. if d.has_key('transaction_subject') and d['transaction_subject'] != '': |