mirror of
https://github.com/pretix/pretix.git
synced 2026-05-11 16:13:59 +00:00
PayPal: Do not crash on failed refund
This commit is contained in:
@@ -427,6 +427,7 @@ class Paypal(BasePaymentProvider):
|
||||
def execute_refund(self, refund: OrderRefund):
|
||||
self.init_api()
|
||||
|
||||
try:
|
||||
sale = None
|
||||
for res in refund.payment.info_data['transactions'][0]['related_resources']:
|
||||
for k, v in res.items():
|
||||
@@ -440,6 +441,8 @@ class Paypal(BasePaymentProvider):
|
||||
"currency": refund.order.event.currency
|
||||
}
|
||||
})
|
||||
except paypalrestsdk.exceptions.ConnectionError as e:
|
||||
raise PaymentException(_('Refunding the amount via PayPal failed: {}').format(str(e)))
|
||||
if not pp_refund.success():
|
||||
raise PaymentException(_('Refunding the amount via PayPal failed: {}').format(pp_refund.error))
|
||||
else:
|
||||
|
||||
Reference in New Issue
Block a user