Skip to content

Commit

Permalink
Use request_stripe_object and fix tests
Browse files Browse the repository at this point in the history
  • Loading branch information
ramya-stripe committed Jun 17, 2024
1 parent 28513fb commit 35e4305
Show file tree
Hide file tree
Showing 2 changed files with 14 additions and 6 deletions.
16 changes: 12 additions & 4 deletions lib/stripe/resources/bank_account.rb
Original file line number Diff line number Diff line change
Expand Up @@ -21,13 +21,21 @@ def self.object_name
end

def verify(params = {}, opts = {})
resp, opts = execute_resource_request(:post, resource_url + "/verify", params, opts)
initialize_from(resp.data, opts)
request_stripe_object(
method: :post,
path: "#{Customer.resource_url}/#{customer}/sources/#{id}/verify",
params: params,
opts: opts
)
end

def self.verify(customer, id, params = {}, opts = {})
resp, opts = execute_resource_request(:post, "#{Customer.resource_url}/#{customer}/sources/#{id}/verify", params, opts)
initialize_from(resp.data, opts)
request_stripe_object(
method: :post,
path: "#{Customer.resource_url}/#{customer}/sources/#{id}/verify",
params: params,
opts: opts
)
end

def resource_url
Expand Down
4 changes: 2 additions & 2 deletions test/stripe/bank_account_test.rb
Original file line number Diff line number Diff line change
Expand Up @@ -33,8 +33,8 @@ class BankAccountTest < Test::Unit::TestCase
end

should "verify the account using the static method" do
bank_account = Stripe::BankAccount.verify(customer: "cus_123",
id: "ba_123", amounts: [1, 2])
bank_account = Stripe::BankAccount.verify("cus_123",
"ba_123", amounts: [1, 2])
assert bank_account.is_a?(Stripe::BankAccount)
end
end
Expand Down

0 comments on commit 35e4305

Please sign in to comment.