Skip to content

Commit

Permalink
fix jazzband#411 Manually following process URL results in a crash
Browse files Browse the repository at this point in the history
  • Loading branch information
Goury committed Jul 6, 2024
1 parent 887f9e7 commit 4380461
Showing 1 changed file with 3 additions and 4 deletions.
7 changes: 3 additions & 4 deletions payments/paypal/__init__.py
Original file line number Diff line number Diff line change
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 All @@ -267,10 +269,7 @@ def create_payment(self, payment, extra_data=None):
def execute_payment(self, payment, payer_id):
post = {"payer_id": payer_id}
links = self._get_links(payment)
try:
execute_url = links["execute"]["href"]
except KeyError:
return HttpResponseBadRequest()
execute_url = links["execute"]["href"]
return self.post(payment, execute_url, data=post)

def get_amount_data(self, payment, amount=None):
Expand Down

0 comments on commit 4380461

Please sign in to comment.