Skip to content

Commit

Permalink
fix #411 Manually following process URL results in a crash
Browse files Browse the repository at this point in the history
  • Loading branch information
Goury authored and WhyNotHugo committed Oct 31, 2024
1 parent c93ead6 commit 7daa596
Showing 1 changed file with 3 additions and 1 deletion.
4 changes: 3 additions & 1 deletion payments/paypal/__init__.py
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,7 @@
from functools import wraps

import requests
from django.http import HttpResponseForbidden
from django.http import HttpResponseForbidden, HttpResponseBadRequest
from django.shortcuts import redirect
from django.utils import timezone
from requests.exceptions import HTTPError
Expand Down Expand Up @@ -248,6 +248,8 @@ def process_data(self, payment, request):
executed_payment = self.execute_payment(payment, payer_id)
except PaymentError:
return redirect(failure_url)
except KeyError:
return HttpResponseBadRequest()
self.set_response_links(payment, executed_payment)
payment.attrs.payer_info = executed_payment["payer"]["payer_info"]
if self._capture:
Expand Down

0 comments on commit 7daa596

Please sign in to comment.