Commit 64c27f8f authored by Alexander Mamonchik's avatar Alexander Mamonchik
Browse files

Merge pull request #319 from MelianLabs/capture_with_application_fee

allow for updating an application fee upon charge capture
parents 64b3e94c c826f4de
......@@ -78,6 +78,10 @@ module StripeMock
add_refund_to_charge(refund, charge)
end
if params[:application_fee]
charge[:application_fee] = params[:application_fee]
end
charge[:captured] = true
charge
end
......
......@@ -199,7 +199,12 @@ shared_examples 'Charge API' do
charge.amount = 777
charge.source = {any: "source"}
expect { charge.save }.to raise_error(Stripe::InvalidRequestError, /Received unknown parameters: currency, amount, source/i)
expect { charge.save }.to raise_error(Stripe::InvalidRequestError) do |error|
expect(error.message).to match(/Received unknown parameters/)
expect(error.message).to match(/currency/)
expect(error.message).to match(/amount/)
expect(error.message).to match(/source/)
end
end
......@@ -335,9 +340,10 @@ shared_examples 'Charge API' do
capture: false
})
returned_charge = charge.capture({ amount: 677 })
returned_charge = charge.capture({ amount: 677, application_fee: 123 })
expect(charge.captured).to eq(true)
expect(returned_charge.amount_refunded).to eq(100)
expect(returned_charge.application_fee).to eq(123)
expect(returned_charge.id).to eq(charge.id)
expect(returned_charge.captured).to eq(true)
end
......
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment