Skip to content

Commit

Permalink
Merge pull request #1 from Goury/paypal_execute_exception_fix
Browse files Browse the repository at this point in the history
fix jazzband#411 Manually following process URL results in a crash
  • Loading branch information
Goury authored Jul 6, 2024
2 parents e6a16fd + 887f9e7 commit 859730c
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 859730c

Please sign in to comment.