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 e6a16fd commit 887f9e7
Showing 1 changed file with 5 additions and 2 deletions.
7 changes: 5 additions & 2 deletions 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 @@ -267,7 +267,10 @@ 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)
execute_url = links["execute"]["href"]
try:
execute_url = links["execute"]["href"]
except KeyError:
return HttpResponseBadRequest()
return self.post(payment, execute_url, data=post)

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

0 comments on commit 887f9e7

Please sign in to comment.