Skip to content

Commit

Permalink
Merge pull request #640 from Nabobil/payment-intents-requires-capture…
Browse files Browse the repository at this point in the history
…-status

Support Payment Intent status requires_capture
  • Loading branch information
alexmamonchik committed Jan 10, 2020
2 parents 6740b17 + b10f611 commit 1eb6d6d
Show file tree
Hide file tree
Showing 2 changed files with 11 additions and 0 deletions.
1 change: 1 addition & 0 deletions lib/stripe_mock/request_handlers/payment_intents.rb
Original file line number Diff line number Diff line change
Expand Up @@ -20,6 +20,7 @@ def new_payment_intent(route, method_url, params, headers)
status = case params[:amount]
when 3184 then 'requires_action'
when 3178 then 'requires_payment_method'
when 3055 then 'requires_capture'
else
'succeeded'
end
Expand Down
10 changes: 10 additions & 0 deletions spec/shared_stripe_examples/payment_intent_examples.rb
Original file line number Diff line number Diff line change
Expand Up @@ -36,6 +36,16 @@
expect(payment_intent.last_payment_error.message).to eq('Not enough funds.')
end

it "creates a requires_payment_method stripe payment_intent when amount matches 3055" do
payment_intent = Stripe::PaymentIntent.create(amount: 3055, currency: "usd")

expect(payment_intent.id).to match(/^test_pi/)
expect(payment_intent.amount).to eq(3055)
expect(payment_intent.currency).to eq('usd')
expect(payment_intent.metadata.to_hash).to eq({})
expect(payment_intent.status).to eq('requires_capture')
end

describe "listing payment_intent" do
before do
3.times do
Expand Down

0 comments on commit 1eb6d6d

Please sign in to comment.