Skip to content

Commit

Permalink
Add missing static method for verify on BankAccount (#1418)
Browse files Browse the repository at this point in the history
  • Loading branch information
ramya-stripe authored Jun 18, 2024
1 parent da8d64c commit 6dadabe
Show file tree
Hide file tree
Showing 2 changed files with 23 additions and 2 deletions.
17 changes: 15 additions & 2 deletions lib/stripe/resources/bank_account.rb
Original file line number Diff line number Diff line change
Expand Up @@ -20,8 +20,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 = {})
request_stripe_object(
method: :post,
path: "#{Customer.resource_url}/#{customer}/sources/#{id}/verify",
params: params,
opts: opts
)
end

def resource_url
Expand Down
8 changes: 8 additions & 0 deletions test/stripe/bank_account_test.rb
Original file line number Diff line number Diff line change
Expand Up @@ -30,6 +30,14 @@ class BankAccountTest < Test::Unit::TestCase
id: "ba_123")
bank_account = bank_account.verify(amounts: [1, 2])
assert bank_account.is_a?(Stripe::BankAccount)
assert_requested :post, "#{Stripe.api_base}/v1/customers/cus_123/sources/ba_123/verify"
end

should "verify the account using the static method" do
bank_account = Stripe::BankAccount.verify("cus_123",
"ba_123", amounts: [1, 2])
assert bank_account.is_a?(Stripe::BankAccount)
assert_requested :post, "#{Stripe.api_base}/v1/customers/cus_123/sources/ba_123/verify"
end
end
end
Expand Down

0 comments on commit 6dadabe

Please sign in to comment.