PayPal: Add additional error handling for old SDK (PRETIXEU-77B)

This commit is contained in:
Raphael Michel
2022-09-12 12:57:21 +02:00
parent 489ad87ad6
commit 948952875c

View File

@@ -51,6 +51,7 @@ from django.utils.translation import gettext as __, gettext_lazy as _
from i18nfield.strings import LazyI18nString
from paypalrestsdk.exceptions import BadRequest, UnauthorizedAccess
from paypalrestsdk.openid_connect import Tokeninfo
from requests import RequestException
from pretix.base.decimal import round_decimal
from pretix.base.models import Event, Order, OrderPayment, OrderRefund, Quota
@@ -423,6 +424,9 @@ class Paypal(BasePaymentProvider):
except paypalrestsdk.exceptions.ConnectionError as e:
messages.error(request, _('We had trouble communicating with PayPal'))
logger.exception('Error on creating payment: ' + str(e))
except RequestException as e:
messages.error(request, _('We had trouble communicating with PayPal'))
logger.exception('Error on creating payment: ' + str(e))
for trans in payment.transactions:
for rr in trans.related_resources: