From 96eabebc157b16be01c151a94f6ee93d71190861 Mon Sep 17 00:00:00 2001 From: Raphael Michel Date: Thu, 3 Jun 2021 16:37:02 +0200 Subject: [PATCH] Stripe: Improve refund error handling --- src/pretix/plugins/stripe/payment.py | 10 ++++++++++ 1 file changed, 10 insertions(+) diff --git a/src/pretix/plugins/stripe/payment.py b/src/pretix/plugins/stripe/payment.py index 76cabb68eb..498a51367f 100644 --- a/src/pretix/plugins/stripe/payment.py +++ b/src/pretix/plugins/stripe/payment.py @@ -586,6 +586,16 @@ class StripeMethod(BasePaymentProvider): else: err = {'message': str(e)} logger.exception('Stripe error: %s' % str(e)) + + refund.info = err + refund.state = OrderRefund.REFUND_STATE_FAILED + refund.execution_date = now() + refund.save() + refund.order.log_action('pretix.event.order.refund.failed', { + 'local_id': refund.local_id, + 'provider': refund.provider, + 'error': str(e) + }) raise PaymentException(_('We had trouble communicating with Stripe. Please try again and contact ' 'support if the problem persists.')) except stripe.error.StripeError as err: