Skip to content

Commit

Permalink
Fix APIResource#retrieve not sending stripe_version (#1483)
Browse files Browse the repository at this point in the history
* Fix retrieve stripe version

* better test
  • Loading branch information
helenye-stripe authored Nov 6, 2024
1 parent 91c68e4 commit aa88043
Show file tree
Hide file tree
Showing 2 changed files with 12 additions and 1 deletion.
2 changes: 1 addition & 1 deletion lib/stripe/request_options.rb
Original file line number Diff line number Diff line change
Expand Up @@ -63,7 +63,7 @@ def self.combine_opts(object_opts, req_opts)
idempotency_key: req_opts[:idempotency_key],
stripe_account: req_opts[:stripe_account] || object_opts[:stripe_account],
stripe_context: req_opts[:stripe_context] || object_opts[:stripe_context],
stripe_version: req_opts[:stripe_version] || object_opts[:api_version],
stripe_version: req_opts[:stripe_version] || object_opts[:stripe_version],
}

# Remove nil values from headers
Expand Down
11 changes: 11 additions & 0 deletions test/stripe/request_options_test.rb
Original file line number Diff line number Diff line change
Expand Up @@ -77,5 +77,16 @@ class RequestOptionsTest < Test::Unit::TestCase
assert_equal({ "A-Header" => "header", "B-Header" => "header" }, request_opts[:headers])
end
end

context "combine_opts" do
should "correctly combine user specified options" do
object_opts = { api_key: "sk_123", stripe_version: "2022-11-15" }
request_opts = { api_key: "sk_456", stripe_account: "acct_123" }
combined = RequestOptions.combine_opts(object_opts, request_opts)
assert_equal(combined[:stripe_version], "2022-11-15")
assert_equal(combined[:api_key], "sk_456")
assert_equal(combined[:stripe_account], "acct_123")
end
end
end
end

0 comments on commit aa88043

Please sign in to comment.