Return 500 on IPN error so PayPal resends

This commit is contained in:
Tanner Collin 2022-04-21 23:01:43 +00:00
parent 0c5da88d7d
commit aa39c8a37a

View File

@ -6,7 +6,7 @@ from django.shortcuts import get_object_or_404, redirect
from django.db import transaction from django.db import transaction
from django.db.models import Max, F, Count, Q, Sum from django.db.models import Max, F, Count, Q, Sum
from django.db.utils import OperationalError from django.db.utils import OperationalError
from django.http import HttpResponse, Http404, FileResponse from django.http import HttpResponse, Http404, FileResponse, HttpResponseServerError
from django.core.files.base import File from django.core.files.base import File
from django.core.cache import cache from django.core.cache import cache
from django.utils.timezone import now from django.utils.timezone import now
@ -563,8 +563,9 @@ class IpnView(views.APIView):
utils_paypal.process_paypal_ipn(request.data) utils_paypal.process_paypal_ipn(request.data)
except BaseException as e: except BaseException as e:
logger.error('IPN route - {} - {}'.format(e.__class__.__name__, str(e))) logger.error('IPN route - {} - {}'.format(e.__class__.__name__, str(e)))
finally: return HttpResponseServerError()
return Response(200)
return Response(200)
class StatsViewSet(viewsets.ViewSet, List): class StatsViewSet(viewsets.ViewSet, List):