Skip to content

Commit

Permalink
Update generated code (#1329)
Browse files Browse the repository at this point in the history
* Update generated code for v818

* Update generated code for v820

* Update generated code for v828

* Update generated code for v829

---------

Co-authored-by: Stripe OpenAPI <105521251+stripe-openapi[bot]@users.noreply.github.com>
Co-authored-by: helenye-stripe <[email protected]>
  • Loading branch information
stripe-openapi[bot] and helenye-stripe authored Feb 15, 2024
1 parent 06d1bfb commit e3f1a90
Show file tree
Hide file tree
Showing 6 changed files with 37 additions and 15 deletions.
2 changes: 1 addition & 1 deletion OPENAPI_VERSION
Original file line number Diff line number Diff line change
@@ -1 +1 @@
v810
v829
7 changes: 3 additions & 4 deletions lib/stripe/resources/account.rb
Original file line number Diff line number Diff line change
Expand Up @@ -24,6 +24,9 @@ def self.object_name
nested_resource_class_methods :capability,
operations: %i[retrieve update list],
resource_plural: "capabilities"
nested_resource_class_methods :external_account,
operations: %i[create retrieve update delete list]
nested_resource_class_methods :login_link, operations: %i[create]
nested_resource_class_methods :person, operations: %i[create retrieve update delete list]

# Returns a list of people associated with the account's legal entity. The people are returned sorted by creation date, with the most recent people appearing first.
Expand Down Expand Up @@ -72,10 +75,6 @@ def self.reject(account, params = {}, opts = {})

save_nested_resource :external_account

nested_resource_class_methods :external_account,
operations: %i[create retrieve update delete list]
nested_resource_class_methods :login_link, operations: %i[create]

def resource_url
if self["id"]
super
Expand Down
3 changes: 1 addition & 2 deletions lib/stripe/resources/customer.rb
Original file line number Diff line number Diff line change
Expand Up @@ -20,6 +20,7 @@ def self.object_name

nested_resource_class_methods :balance_transaction, operations: %i[create retrieve update list]
nested_resource_class_methods :cash_balance_transaction, operations: %i[retrieve list]
nested_resource_class_methods :source, operations: %i[create retrieve update delete list]
nested_resource_class_methods :tax_id, operations: %i[create retrieve delete list]

# Retrieve funding instructions for a customer cash balance. If funding instructions do not yet exist for the customer, new
Expand Down Expand Up @@ -107,8 +108,6 @@ def self.retrieve_payment_method(customer, payment_method, params = {}, opts = {
end

save_nested_resource :source
nested_resource_class_methods :source,
operations: %i[create retrieve update delete list]

# The API request for deleting a card or bank account and for detaching a
# source object are the same.
Expand Down
6 changes: 2 additions & 4 deletions lib/stripe/resources/payment_intent.rb
Original file line number Diff line number Diff line change
Expand Up @@ -83,8 +83,7 @@ def capture(params = {}, opts = {})
# return to the requires_confirmation state
# after those actions are completed. Your server needs to then
# explicitly re-confirm the PaymentIntent to initiate the next payment
# attempt. Read the [expanded documentation](https://stripe.com/docs/payments/payment-intents/web-manual)
# to learn more about manual confirmation.
# attempt.
def confirm(params = {}, opts = {})
request_stripe_object(
method: :post,
Expand Down Expand Up @@ -196,8 +195,7 @@ def self.capture(intent, params = {}, opts = {})
# return to the requires_confirmation state
# after those actions are completed. Your server needs to then
# explicitly re-confirm the PaymentIntent to initiate the next payment
# attempt. Read the [expanded documentation](https://stripe.com/docs/payments/payment-intents/web-manual)
# to learn more about manual confirmation.
# attempt.
def self.confirm(intent, params = {}, opts = {})
request_stripe_object(
method: :post,
Expand Down
6 changes: 2 additions & 4 deletions lib/stripe/resources/tax_id.rb
Original file line number Diff line number Diff line change
Expand Up @@ -30,21 +30,19 @@ def self.retrieve(_id, _opts = {})
"'tax_id_id')`"
end

# Deletes an existing tax_id object.
def self.delete(id, params = {}, opts = {})
request_stripe_object(
method: :delete,
path: format("/v1/customers/%<customer>s/tax_ids/%<id>s", { customer: CGI.escape(customer), id: CGI.escape(id) }),
path: "#{resource_url}/#{id}",
params: params,
opts: opts
)
end

# Deletes an existing tax_id object.
def delete(params = {}, opts = {})
request_stripe_object(
method: :delete,
path: format("/v1/customers/%<customer>s/tax_ids/%<id>s", { customer: CGI.escape(self["id"]), id: CGI.escape(id) }),
path: resource_url.to_s,
params: params,
opts: opts
)
Expand Down
28 changes: 28 additions & 0 deletions test/stripe/generated_examples_test.rb
Original file line number Diff line number Diff line change
Expand Up @@ -482,6 +482,14 @@ class CodegennedExampleTest < Test::Unit::TestCase
Stripe::Customer.search({ query: "name:'fakename' AND metadata['foo']:'bar'" })
assert_requested :get, "#{Stripe.api_base}/v1/customers/search?query=name:'fakename' AND metadata['foo']:'bar'"
end
should "Test customers sources delete" do
Stripe::Customer.delete_source("cus_xxxxxxxxxxxxx", "ba_xxxxxxxxxxxxx")
assert_requested :delete, "#{Stripe.api_base}/v1/customers/cus_xxxxxxxxxxxxx/sources/ba_xxxxxxxxxxxxx?"
end
should "Test customers sources delete 2" do
Stripe::Customer.delete_source("cus_xxxxxxxxxxxxx", "card_xxxxxxxxxxxxx")
assert_requested :delete, "#{Stripe.api_base}/v1/customers/cus_xxxxxxxxxxxxx/sources/card_xxxxxxxxxxxxx?"
end
should "Test customers sources get" do
Stripe::Customer.list_sources(
"cus_xxxxxxxxxxxxx",
Expand Down Expand Up @@ -510,6 +518,10 @@ class CodegennedExampleTest < Test::Unit::TestCase
Stripe::Customer.retrieve_source("cus_xxxxxxxxxxxxx", "card_xxxxxxxxxxxxx")
assert_requested :get, "#{Stripe.api_base}/v1/customers/cus_xxxxxxxxxxxxx/sources/card_xxxxxxxxxxxxx?"
end
should "Test customers sources post" do
Stripe::Customer.update_source("cus_123", "card_123", { account_holder_name: "Kamil" })
assert_requested :post, "#{Stripe.api_base}/v1/customers/cus_123/sources/card_123"
end
should "Test customers sources post 2" do
Stripe::Customer.create_source("cus_xxxxxxxxxxxxx", { source: "btok_xxxxxxxxxxxxx" })
assert_requested :post, "#{Stripe.api_base}/v1/customers/cus_xxxxxxxxxxxxx/sources"
Expand All @@ -518,6 +530,22 @@ class CodegennedExampleTest < Test::Unit::TestCase
Stripe::Customer.create_source("cus_xxxxxxxxxxxxx", { source: "tok_xxxx" })
assert_requested :post, "#{Stripe.api_base}/v1/customers/cus_xxxxxxxxxxxxx/sources"
end
should "Test customers sources post 4" do
Stripe::Customer.update_source(
"cus_xxxxxxxxxxxxx",
"ba_xxxxxxxxxxxxx",
{ metadata: { order_id: "6735" } }
)
assert_requested :post, "#{Stripe.api_base}/v1/customers/cus_xxxxxxxxxxxxx/sources/ba_xxxxxxxxxxxxx"
end
should "Test customers sources post 5" do
Stripe::Customer.update_source(
"cus_xxxxxxxxxxxxx",
"card_xxxxxxxxxxxxx",
{ name: "Jenny Rosen" }
)
assert_requested :post, "#{Stripe.api_base}/v1/customers/cus_xxxxxxxxxxxxx/sources/card_xxxxxxxxxxxxx"
end
should "Test customers tax ids delete" do
Stripe::Customer.delete_tax_id("cus_xxxxxxxxxxxxx", "txi_xxxxxxxxxxxxx")
assert_requested :delete, "#{Stripe.api_base}/v1/customers/cus_xxxxxxxxxxxxx/tax_ids/txi_xxxxxxxxxxxxx?"
Expand Down

0 comments on commit e3f1a90

Please sign in to comment.