Skip to content

Commit

Permalink
Merge pull request #888 from stripe-ruby-mock/revert-860-add-refund-e…
Browse files Browse the repository at this point in the history
…rror

Revert "Adds error when attempting to refund a charge that has alread…
  • Loading branch information
alexmamonchik committed Oct 24, 2023
2 parents 6db7a8b + b6c6e0c commit ef359cd
Show file tree
Hide file tree
Showing 2 changed files with 0 additions and 17 deletions.
6 changes: 0 additions & 6 deletions lib/stripe_mock/request_handlers/helpers/charge_helpers.rb
Original file line number Diff line number Diff line change
Expand Up @@ -3,12 +3,6 @@ module RequestHandlers
module Helpers

def add_refund_to_charge(refund, charge)
if refund[:amount] + charge[:amount_refunded] > charge[:amount]
raise Stripe::InvalidRequestError.new(
"Charge #{charge[:id]} has already been refunded.",
'amount'
)
end
refunds = charge[:refunds]
refunds[:data] << refund
refunds[:total_count] = refunds[:data].count
Expand Down
11 changes: 0 additions & 11 deletions spec/shared_stripe_examples/refund_examples.rb
Original file line number Diff line number Diff line change
Expand Up @@ -338,17 +338,6 @@
expect(half.data.first.id).to eq(all_refunds.data.at(2).id)
end

it "returns an InvalidRequestError when attempting to refund more than the original charge amount" do
charge = Stripe::Charge.create(
amount: 1000,
currency: 'usd',
source: stripe_helper.generate_card_token
)
expect {
Stripe::Refund.create(charge: charge.id, amount: 2000)
}.to raise_error(Stripe::InvalidRequestError)
end

describe "idempotency" do
let(:customer) { Stripe::Customer.create(email: 'johnny@appleseed.com') }
let(:charge) do
Expand Down

0 comments on commit ef359cd

Please sign in to comment.