diff --git a/lib/stripe/resources/customer.rb b/lib/stripe/resources/customer.rb index 1f2c87cf3..390ebd95f 100644 --- a/lib/stripe/resources/customer.rb +++ b/lib/stripe/resources/customer.rb @@ -112,11 +112,11 @@ def self.search_auto_paging_each(params = {}, opts = {}, &blk) search(params, opts).auto_paging_each(&blk) end - def self.retrieve_cash_balance(customer, opts = {}) + def self.retrieve_cash_balance(customer, params = {}, opts = {}) request_stripe_object( method: :get, path: format("/v1/customers/%s/cash_balance", { customer: CGI.escape(customer) }), - params: {}, + params: params, opts: opts ) end diff --git a/test/stripe/customer_test.rb b/test/stripe/customer_test.rb index 326f54474..66070b69d 100644 --- a/test/stripe/customer_test.rb +++ b/test/stripe/customer_test.rb @@ -230,30 +230,22 @@ class CustomerTest < Test::Unit::TestCase # compatibility for existing users. context "#retrieve_cash_balance" do - should "legacy call pattern - retrieve_cash_balance(customer_id, nil)" do + should "retrieve with just ID" do Stripe::Customer.retrieve_cash_balance("cus_123") assert_requested :get, "#{Stripe.api_base}/v1/customers/cus_123/cash_balance" end - should "legacy call pattern - retrieve_cash_balance(customer_id, opts)" do + should "retrieve with custom opts" do # Assert that we're actually making a change by swapping out the API base. assert Stripe.api_base != Stripe.connect_base - Stripe::Customer.retrieve_cash_balance("cus_123", { api_base: Stripe.connect_base }) - assert_requested :get, "#{Stripe.connect_base}/v1/customers/cus_123/cash_balance" - end - - should "modern call pattern - retrieve_cash_balance(customer_id, opts)" do - # Assert that we're actually making a change by swapping out the API base. - assert Stripe.api_base != Stripe.connect_base - - Stripe::Customer.retrieve_cash_balance("cus_123", { api_base: Stripe.connect_base }) + Stripe::Customer.retrieve_cash_balance("cus_123", {}, { api_base: Stripe.connect_base }) assert_requested :get, "#{Stripe.connect_base}/v1/customers/cus_123/cash_balance" end end context "#update_cash_balance" do - should "legacy call pattern - update_cash_balance(customer, params)" do + should "update with ID, params" do Stripe::Customer.update_cash_balance("cus_123", { settings: { reconciliation_mode: "manual" } }) assert_requested :post, "#{Stripe.api_base}/v1/customers/cus_123/cash_balance" do |req| @@ -261,7 +253,7 @@ class CustomerTest < Test::Unit::TestCase end end - should "legacy call pattern - update_cash_balance(customer, params, opts)" do + should "update with ID, params and opts" do # Assert that we're actually making a change by swapping out the API base. assert Stripe.api_base != Stripe.connect_base @@ -276,7 +268,7 @@ class CustomerTest < Test::Unit::TestCase end end - should "modern call pattern - update_cash_balance(customer)" do + should "update with just ID" do Stripe::Customer.update_cash_balance("cus_123") assert_requested :post, "#{Stripe.api_base}/v1/customers/cus_123/cash_balance"