Stripe: Improve refund error handling

This commit is contained in:
Raphael Michel
2021-06-03 16:37:02 +02:00
parent 3819df57d8
commit 96eabebc15

View File

@@ -586,6 +586,16 @@ class StripeMethod(BasePaymentProvider):
else: else:
err = {'message': str(e)} err = {'message': str(e)}
logger.exception('Stripe error: %s' % 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 ' raise PaymentException(_('We had trouble communicating with Stripe. Please try again and contact '
'support if the problem persists.')) 'support if the problem persists.'))
except stripe.error.StripeError as err: except stripe.error.StripeError as err: