mirror of
https://github.com/openfoodfoundation/openfoodnetwork
synced 2026-03-13 04:00:21 +00:00
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:
@@ -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)
|
||||
|
||||
Reference in New Issue
Block a user