mirror of
https://github.com/stripe/stripe-ruby.git
synced 2025-11-22 00:05:58 -05:00
Include stripe account parameter for setting header.
This commit is contained in:
parent
67da7aa9a7
commit
6990bbd798
@ -127,6 +127,9 @@ module Stripe
|
||||
if opts[:idempotency_key]
|
||||
headers[:idempotency_key] = opts[:idempotency_key]
|
||||
end
|
||||
if opts[:stripe_account]
|
||||
headers[:stripe_account] = opts[:stripe_account]
|
||||
end
|
||||
return opts[:api_key], headers
|
||||
else
|
||||
raise TypeError.new("parse_opts expects a string or a hash")
|
||||
|
||||
@ -67,6 +67,25 @@ module Stripe
|
||||
end
|
||||
end
|
||||
|
||||
should "send stripe account as header when set" do
|
||||
stripe_account = "acct_0000"
|
||||
Stripe.expects(:execute_request).with do |opts|
|
||||
opts[:headers][:stripe_account] == stripe_account
|
||||
end.returns(test_response(test_charge))
|
||||
|
||||
Stripe::Charge.create({:card => {:number => '4242424242424242'}},
|
||||
{:stripe_account => stripe_account, :api_key => 'sk_test_local'})
|
||||
end
|
||||
|
||||
should "not send stripe account as header when not set" do
|
||||
Stripe.expects(:execute_request).with do |opts|
|
||||
opts[:headers][:stripe_account].nil?
|
||||
end.returns(test_response(test_charge))
|
||||
|
||||
Stripe::Charge.create({:card => {:number => '4242424242424242'}},
|
||||
'sk_test_local')
|
||||
end
|
||||
|
||||
context "when specifying per-object credentials" do
|
||||
context "with no global API key set" do
|
||||
should "use the per-object credential when creating" do
|
||||
|
||||
Loading…
x
Reference in New Issue
Block a user