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

@@ -39,6 +39,16 @@ describe Spree::Gateway::StripeSCA, type: :model do
expect(response.success?).to eq true
end
it "provides an error message to help developer debug" do
stub_request(:get, "https://api.stripe.com/v1/payment_intents/12345").
to_return(status: 200, body: capture_successful)
response = subject.purchase(order.total, credit_card, gateway_options)
expect(response.success?).to eq false
expect(response.message).to eq "Invalid payment state: succeeded"
end
end
def payment_intent(amount, status)