mirror of
https://github.com/openfoodfoundation/openfoodnetwork
synced 2026-01-28 21:07:16 +00:00
Update PaymentIntentValidator spec
This commit is contained in:
@@ -27,23 +27,11 @@ module Stripe
|
||||
it "returns payment intent id and does not raise" do
|
||||
expect {
|
||||
result = validator.call(payment_intent_id, stripe_account_id)
|
||||
expect(result).to eq payment_intent_id
|
||||
expect(result).to eq payment_intent_response_body
|
||||
}.to_not raise_error Stripe::StripeError
|
||||
end
|
||||
end
|
||||
|
||||
context "when payment intent status is not requires status" do
|
||||
let(:payment_intent_response_body) {
|
||||
JSON.generate(id: payment_intent_id, status: "failed")
|
||||
}
|
||||
|
||||
it "raises Stripe error with an invalid_payment_state message" do
|
||||
expect {
|
||||
validator.call(payment_intent_id, stripe_account_id)
|
||||
}.to raise_error Stripe::StripeError, "Invalid payment state: failed"
|
||||
end
|
||||
end
|
||||
|
||||
context "when payment intent contains an error" do
|
||||
let(:payment_intent_response_body) {
|
||||
JSON.generate(id: payment_intent_id, last_payment_error: { message: "No money" })
|
||||
|
||||
Reference in New Issue
Block a user