Skip to content

Commit

Permalink
Static methods for delete/list on BankAccount/Card cannot be implemen…
Browse files Browse the repository at this point in the history
…ted. Use the onces on Customer instead. (#1420)
  • Loading branch information
ramya-stripe authored Jun 27, 2024
1 parent f0c40e0 commit fa2baeb
Show file tree
Hide file tree
Showing 2 changed files with 21 additions and 24 deletions.
23 changes: 11 additions & 12 deletions lib/stripe/resources/bank_account.rb
Original file line number Diff line number Diff line change
Expand Up @@ -64,12 +64,12 @@ def self.retrieve(_id, _opts = nil)
end

def self.delete(id, params = {}, opts = {})
request_stripe_object(
method: :delete,
path: "#{resource_url}/#{id}",
params: params,
opts: opts
)
raise NotImplementedError,
"Bank accounts cannot be deleted without a customer ID or an " \
"account ID. Delete a bank account using " \
"`Customer.delete_source('customer_id', 'bank_account_id')` " \
"or `Account.delete_external_account('account_id', " \
"'bank_account_id')`"
end

def delete(params = {}, opts = {})
Expand All @@ -82,12 +82,11 @@ def delete(params = {}, opts = {})
end

def self.list(filters = {}, opts = {})
request_stripe_object(
method: :delete,
path: resource_url.to_s,
params: filters,
opts: opts
)
raise NotImplementedError,
"Bank accounts cannot be listed without a customer ID or an " \
"account ID. List bank accounts using " \
"`Customer.list_sources('customer_id')` " \
"or `Account.list_external_accounts('account_id')`"
end
end
end
22 changes: 10 additions & 12 deletions lib/stripe/resources/card.rb
Original file line number Diff line number Diff line change
Expand Up @@ -42,12 +42,11 @@ def self.retrieve(_id, _opts = nil)
end

def self.delete(id, params = {}, opts = {})
request_stripe_object(
method: :delete,
path: "#{resource_url}/#{id}",
params: params,
opts: opts
)
raise NotImplementedError,
"Card cannot be deleted without a customer ID or an account " \
"ID. Delete a card using `Customer.delete_source(" \
"'customer_id', 'card_id')` or " \
"`Account.delete_external_account('account_id', 'card_id')`"
end

def delete(params = {}, opts = {})
Expand All @@ -60,12 +59,11 @@ def delete(params = {}, opts = {})
end

def self.list(filters = {}, opts = {})
request_stripe_object(
method: :delete,
path: resource_url.to_s,
params: filters,
opts: opts
)
raise NotImplementedError,
"Cards cannot be listed without a customer ID or an account " \
"ID. List cards using `Customer.list_sources(" \
"'customer_id')` or " \
"`Account.list_external_accounts('account_id')`"
end
end
end

0 comments on commit fa2baeb

Please sign in to comment.