From 5400d26c60b7a4fceab2c832419e63abfd785f0d Mon Sep 17 00:00:00 2001 From: Martin Gross Date: Fri, 17 Apr 2020 12:02:43 +0200 Subject: [PATCH] Log the reason for failed PayPal refunds --- src/pretix/plugins/paypal/payment.py | 10 ++++++++++ 1 file changed, 10 insertions(+) diff --git a/src/pretix/plugins/paypal/payment.py b/src/pretix/plugins/paypal/payment.py index ade28b0b9..8817b1332 100644 --- a/src/pretix/plugins/paypal/payment.py +++ b/src/pretix/plugins/paypal/payment.py @@ -442,8 +442,18 @@ class Paypal(BasePaymentProvider): } }) except paypalrestsdk.exceptions.ConnectionError as e: + refund.order.log_action('pretix.event.order.refund.failed', { + 'local_id': refund.local_id, + 'provider': refund.provider, + 'error': str(e) + }) raise PaymentException(_('Refunding the amount via PayPal failed: {}').format(str(e))) if not pp_refund.success(): + refund.order.log_action('pretix.event.order.refund.failed', { + 'local_id': refund.local_id, + 'provider': refund.provider, + 'error': str(pp_refund.error) + }) raise PaymentException(_('Refunding the amount via PayPal failed: {}').format(pp_refund.error)) else: sale = paypalrestsdk.Payment.find(refund.payment.info_data['id'])