From aa39c8a37accad98608a827d089f8d1dd2d34e68 Mon Sep 17 00:00:00 2001 From: Tanner Collin Date: Thu, 21 Apr 2022 23:01:43 +0000 Subject: [PATCH] Return 500 on IPN error so PayPal resends --- apiserver/apiserver/api/views.py | 7 ++++--- 1 file changed, 4 insertions(+), 3 deletions(-) diff --git a/apiserver/apiserver/api/views.py b/apiserver/apiserver/api/views.py index 68203d4..4e65ec8 100644 --- a/apiserver/apiserver/api/views.py +++ b/apiserver/apiserver/api/views.py @@ -6,7 +6,7 @@ from django.shortcuts import get_object_or_404, redirect from django.db import transaction from django.db.models import Max, F, Count, Q, Sum 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.cache import cache from django.utils.timezone import now @@ -563,8 +563,9 @@ class IpnView(views.APIView): utils_paypal.process_paypal_ipn(request.data) except BaseException as e: logger.error('IPN route - {} - {}'.format(e.__class__.__name__, str(e))) - finally: - return Response(200) + return HttpResponseServerError() + + return Response(200) class StatsViewSet(viewsets.ViewSet, List):