From 9b43557059f84f315b81460f851dfc90c166ccf9 Mon Sep 17 00:00:00 2001 From: Stripe OpenAPI <105521251+stripe-openapi[bot]@users.noreply.github.com> Date: Tue, 25 Jun 2024 06:52:53 +0000 Subject: [PATCH 1/3] Update generated code for v1095 --- OPENAPI_VERSION | 2 +- lib/stripe/resources/bank_account.rb | 23 +++++++++++------------ lib/stripe/resources/card.rb | 22 ++++++++++------------ 3 files changed, 22 insertions(+), 25 deletions(-) diff --git a/OPENAPI_VERSION b/OPENAPI_VERSION index 1dbca34fc..eb43ae0c9 100644 --- a/OPENAPI_VERSION +++ b/OPENAPI_VERSION @@ -1 +1 @@ -v1093 \ No newline at end of file +v1095 \ No newline at end of file diff --git a/lib/stripe/resources/bank_account.rb b/lib/stripe/resources/bank_account.rb index 36e85bfb4..5f4c17a25 100644 --- a/lib/stripe/resources/bank_account.rb +++ b/lib/stripe/resources/bank_account.rb @@ -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 = {}) @@ -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 diff --git a/lib/stripe/resources/card.rb b/lib/stripe/resources/card.rb index 1ef141ede..5f9f3c160 100644 --- a/lib/stripe/resources/card.rb +++ b/lib/stripe/resources/card.rb @@ -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 = {}) @@ -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 From 6d8e4244d21306c0f3b1bd373f0f12d62cf447e2 Mon Sep 17 00:00:00 2001 From: Stripe OpenAPI <105521251+stripe-openapi[bot]@users.noreply.github.com> Date: Fri, 28 Jun 2024 21:16:55 +0000 Subject: [PATCH 2/3] Update generated code for v1105 --- OPENAPI_VERSION | 2 +- lib/stripe/resources/customer_session.rb | 6 +++--- 2 files changed, 4 insertions(+), 4 deletions(-) diff --git a/OPENAPI_VERSION b/OPENAPI_VERSION index eb43ae0c9..f5fcb6b49 100644 --- a/OPENAPI_VERSION +++ b/OPENAPI_VERSION @@ -1 +1 @@ -v1095 \ No newline at end of file +v1105 \ No newline at end of file diff --git a/lib/stripe/resources/customer_session.rb b/lib/stripe/resources/customer_session.rb index 73dcaf5a8..9d66e044d 100644 --- a/lib/stripe/resources/customer_session.rb +++ b/lib/stripe/resources/customer_session.rb @@ -2,8 +2,8 @@ # frozen_string_literal: true module Stripe - # A customer session allows you to grant client access to Stripe's frontend SDKs (like StripeJs) - # control over a customer. + # A Customer Session allows you to grant Stripe's frontend SDKs (like Stripe.js) client-side access + # control over a Customer. class CustomerSession < APIResource extend Stripe::APIOperations::Create @@ -12,7 +12,7 @@ def self.object_name "customer_session" end - # Creates a customer session object that includes a single-use client secret that you can use on your front-end to grant client-side API access for certain customer resources. + # Creates a Customer Session object that includes a single-use client secret that you can use on your front-end to grant client-side API access for certain customer resources. def self.create(params = {}, opts = {}) request_stripe_object( method: :post, From d551d985cc5a4cdbe2d8ffb22044b1b7e29fc7ca Mon Sep 17 00:00:00 2001 From: Stripe OpenAPI <105521251+stripe-openapi[bot]@users.noreply.github.com> Date: Tue, 2 Jul 2024 22:20:59 +0000 Subject: [PATCH 3/3] Update generated code for v1111 --- OPENAPI_VERSION | 2 +- lib/stripe/resources/invoice.rb | 60 +++++++++++++++++++++++++++++++++ 2 files changed, 61 insertions(+), 1 deletion(-) diff --git a/OPENAPI_VERSION b/OPENAPI_VERSION index f5fcb6b49..d1614a49b 100644 --- a/OPENAPI_VERSION +++ b/OPENAPI_VERSION @@ -1 +1 @@ -v1105 \ No newline at end of file +v1111 \ No newline at end of file diff --git a/lib/stripe/resources/invoice.rb b/lib/stripe/resources/invoice.rb index 4761243a6..a3c723344 100644 --- a/lib/stripe/resources/invoice.rb +++ b/lib/stripe/resources/invoice.rb @@ -49,6 +49,26 @@ def self.object_name nested_resource_class_methods :line, operations: %i[list] + # Adds multiple line items to an invoice. This is only possible when an invoice is still a draft. + def add_lines(params = {}, opts = {}) + request_stripe_object( + method: :post, + path: format("/v1/invoices/%s/add_lines", { invoice: CGI.escape(self["id"]) }), + params: params, + opts: opts + ) + end + + # Adds multiple line items to an invoice. This is only possible when an invoice is still a draft. + def self.add_lines(invoice, params = {}, opts = {}) + request_stripe_object( + method: :post, + path: format("/v1/invoices/%s/add_lines", { invoice: CGI.escape(invoice) }), + params: params, + opts: opts + ) + end + # This endpoint creates a draft invoice for a given customer. The invoice remains a draft until you [finalize the invoice, which allows you to [pay](#pay_invoice) or send](https://stripe.com/docs/api#finalize_invoice) the invoice to your customers. def self.create(params = {}, opts = {}) request_stripe_object(method: :post, path: "/v1/invoices", params: params, opts: opts) @@ -165,6 +185,26 @@ def self.pay(invoice, params = {}, opts = {}) ) end + # Removes multiple line items from an invoice. This is only possible when an invoice is still a draft. + def remove_lines(params = {}, opts = {}) + request_stripe_object( + method: :post, + path: format("/v1/invoices/%s/remove_lines", { invoice: CGI.escape(self["id"]) }), + params: params, + opts: opts + ) + end + + # Removes multiple line items from an invoice. This is only possible when an invoice is still a draft. + def self.remove_lines(invoice, params = {}, opts = {}) + request_stripe_object( + method: :post, + path: format("/v1/invoices/%s/remove_lines", { invoice: CGI.escape(invoice) }), + params: params, + opts: opts + ) + end + def self.search(params = {}, opts = {}) request_stripe_object(method: :get, path: "/v1/invoices/search", params: params, opts: opts) end @@ -223,6 +263,26 @@ def self.update(id, params = {}, opts = {}) ) end + # Updates multiple line items on an invoice. This is only possible when an invoice is still a draft. + def update_lines(params = {}, opts = {}) + request_stripe_object( + method: :post, + path: format("/v1/invoices/%s/update_lines", { invoice: CGI.escape(self["id"]) }), + params: params, + opts: opts + ) + end + + # Updates multiple line items on an invoice. This is only possible when an invoice is still a draft. + def self.update_lines(invoice, params = {}, opts = {}) + request_stripe_object( + method: :post, + path: format("/v1/invoices/%s/update_lines", { invoice: CGI.escape(invoice) }), + params: params, + opts: opts + ) + end + # Mark a finalized invoice as void. This cannot be undone. Voiding an invoice is similar to [deletion](https://stripe.com/docs/api#delete_invoice), however it only applies to finalized invoices and maintains a papertrail where the invoice can still be found. # # Consult with local regulations to determine whether and how an invoice might be amended, canceled, or voided in the jurisdiction you're doing business in. You might need to [issue another invoice or credit note](https://stripe.com/docs/api#create_invoice) instead. Stripe recommends that you consult with your legal counsel for advice specific to your business.