Record invalid payment states for debugging

We observed invalid payment states in Bugsnag but we don't actually know
in which state the payment intent was in. From the context we can guess
that it was "succeeded" but it would be good to validate this. And in
the future it would be good to know if there are other invalid states we
can end up in.

The notification to Bugsnag happens in another part of the code.
This commit is contained in:
Maikel Linke
2021-03-19 16:55:49 +11:00
parent 3dac451e5b
commit fce8d3a2f8
4 changed files with 15 additions and 4 deletions

View File

@@ -23,9 +23,10 @@ module Stripe
end
def raise_if_not_in_capture_state(payment_intent_response)
return unless payment_intent_response.status != 'requires_capture'
state = payment_intent_response.status
return unless state != 'requires_capture'
raise Stripe::StripeError, I18n.t(:invalid_payment_state)
raise Stripe::StripeError, I18n.t(:invalid_payment_state, state: state)
end
end
end