diff --git a/CHANGELOG.md b/CHANGELOG.md index 5b250b0bd..441c58cb7 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -1,5 +1,11 @@ # Changelog +## 12.5.0 - 2024-08-08 +* [#1440](https://github.com/stripe/stripe-ruby/pull/1440) Update generated code + * Add support for new resources `Billing.AlertTriggered` and `Billing.Alert` + * Add support for `activate`, `archive`, `create`, `deactivate`, `list`, and `retrieve` methods on resource `Alert` + * Add support for `retrieve` method on resource `Tax.Calculation` + ## 12.5.0-beta.2 - 2024-08-01 * [#1439](https://github.com/stripe/stripe-ruby/pull/1439) Update generated code for beta * Add support for `attach_payment` method on resource `Invoice` diff --git a/OPENAPI_VERSION b/OPENAPI_VERSION index 404e303af..b7ea530db 100644 --- a/OPENAPI_VERSION +++ b/OPENAPI_VERSION @@ -1 +1 @@ -v1165 \ No newline at end of file +v1247 \ No newline at end of file diff --git a/lib/stripe/api_version.rb b/lib/stripe/api_version.rb index a868907f5..9dfdf3388 100644 --- a/lib/stripe/api_version.rb +++ b/lib/stripe/api_version.rb @@ -4,6 +4,6 @@ module Stripe module ApiVersion CURRENT = "2024-06-20" - PREVIEW = "2024-07-16.preview-v2" + PREVIEW = "2024-09-05.preview-v2" end end diff --git a/lib/stripe/object_types.rb b/lib/stripe/object_types.rb index 42862fd8b..aa7cbe0d9 100644 --- a/lib/stripe/object_types.rb +++ b/lib/stripe/object_types.rb @@ -140,6 +140,7 @@ def self.object_names_to_classes Terminal::ConnectionToken.object_name => Terminal::ConnectionToken, Terminal::Location.object_name => Terminal::Location, Terminal::Reader.object_name => Terminal::Reader, + Terminal::ReaderCollectedData.object_name => Terminal::ReaderCollectedData, TestHelpers::TestClock.object_name => TestHelpers::TestClock, Token.object_name => Token, Topup.object_name => Topup, diff --git a/lib/stripe/resources.rb b/lib/stripe/resources.rb index 2e79673aa..cc98740a7 100644 --- a/lib/stripe/resources.rb +++ b/lib/stripe/resources.rb @@ -127,6 +127,7 @@ require "stripe/resources/terminal/connection_token" require "stripe/resources/terminal/location" require "stripe/resources/terminal/reader" +require "stripe/resources/terminal/reader_collected_data" require "stripe/resources/test_helpers/test_clock" require "stripe/resources/token" require "stripe/resources/topup" diff --git a/lib/stripe/resources/account.rb b/lib/stripe/resources/account.rb index 8d20fe6c1..aaa3f36f9 100644 --- a/lib/stripe/resources/account.rb +++ b/lib/stripe/resources/account.rb @@ -48,7 +48,7 @@ def self.create(params = {}, opts = {}) # # Test-mode accounts can be deleted at any time. # - # Live-mode accounts where Stripe is responsible for negative account balances cannot be deleted, which includes Standard accounts. Live-mode accounts where your platform is liable for negative account balances, which includes Custom and Express accounts, can be deleted when all [balances](https://stripe.com/api/balance/balanace_object) are zero. + # Live-mode accounts where Stripe is responsible for negative account balances cannot be deleted, which includes Standard accounts. Live-mode accounts where your platform is liable for negative account balances, which includes Custom and Express accounts, can be deleted when all [balances](https://stripe.com/api/balance/balance_object) are zero. # # If you want to delete your own account, use the [account information tab in your account settings](https://dashboard.stripe.com/settings/account) instead. def self.delete(id, params = {}, opts = {}) @@ -64,7 +64,7 @@ def self.delete(id, params = {}, opts = {}) # # Test-mode accounts can be deleted at any time. # - # Live-mode accounts where Stripe is responsible for negative account balances cannot be deleted, which includes Standard accounts. Live-mode accounts where your platform is liable for negative account balances, which includes Custom and Express accounts, can be deleted when all [balances](https://stripe.com/api/balance/balanace_object) are zero. + # Live-mode accounts where Stripe is responsible for negative account balances cannot be deleted, which includes Standard accounts. Live-mode accounts where your platform is liable for negative account balances, which includes Custom and Express accounts, can be deleted when all [balances](https://stripe.com/api/balance/balance_object) are zero. # # If you want to delete your own account, use the [account information tab in your account settings](https://dashboard.stripe.com/settings/account) instead. def delete(params = {}, opts = {}) diff --git a/lib/stripe/resources/customer_session.rb b/lib/stripe/resources/customer_session.rb index 9d66e044d..b6af08c28 100644 --- a/lib/stripe/resources/customer_session.rb +++ b/lib/stripe/resources/customer_session.rb @@ -4,6 +4,10 @@ module Stripe # A Customer Session allows you to grant Stripe's frontend SDKs (like Stripe.js) client-side access # control over a Customer. + # + # Related guides: [Customer Session with the Payment Element](https://stripe.com/payments/accept-a-payment-deferred?platform=web&type=payment#save-payment-methods), + # [Customer Session with the Pricing Table](https://stripe.com/payments/checkout/pricing-table#customer-session), + # [Customer Session with the Buy Button](https://stripe.com/payment-links/buy-button#pass-an-existing-customer). class CustomerSession < APIResource extend Stripe::APIOperations::Create diff --git a/lib/stripe/resources/file.rb b/lib/stripe/resources/file.rb index 7f991f263..4ac61fad1 100644 --- a/lib/stripe/resources/file.rb +++ b/lib/stripe/resources/file.rb @@ -18,6 +18,23 @@ def self.object_name "file" end + # To upload a file to Stripe, you need to send a request of type multipart/form-data. Include the file you want to upload in the request, and the parameters for creating a file. + # + # All of Stripe's officially supported Client libraries support sending multipart/form-data. + def self.create(params = {}, opts = {}) + config = opts[:client]&.config || Stripe.config + upload_base = config.uploads_base + opts = { api_base: upload_base }.merge(Util.normalize_opts(opts)) + + if params[:file] && !params[:file].is_a?(String) && !params[:file].respond_to?(:read) + raise ArgumentError, "file must respond to `#read`" + end + + opts = { content_type: MultipartEncoder::MULTIPART_FORM_DATA }.merge(Util.normalize_opts(opts)) + + request_stripe_object(method: :post, path: "/v1/files", params: params, opts: opts) + end + # Returns a list of the files that your account has access to. Stripe sorts and returns the files by their creation dates, placing the most recently created files at the top. def self.list(filters = {}, opts = {}) request_stripe_object(method: :get, path: "/v1/files", params: filters, opts: opts) @@ -35,18 +52,5 @@ def self.object_name_alt def self.resource_url "/v1/files" end - - def self.create(params = {}, opts = {}) - if params[:file] && !params[:file].is_a?(String) && !params[:file].respond_to?(:read) - raise ArgumentError, "file must respond to `#read`" - end - - config = opts[:client]&.config || Stripe.config - opts = { - api_base: config.uploads_base, - content_type: MultipartEncoder::MULTIPART_FORM_DATA, - }.merge(Util.normalize_opts(opts)) - super - end end end diff --git a/lib/stripe/resources/invoice_line_item.rb b/lib/stripe/resources/invoice_line_item.rb index a22c122b9..fb3c25ad1 100644 --- a/lib/stripe/resources/invoice_line_item.rb +++ b/lib/stripe/resources/invoice_line_item.rb @@ -2,6 +2,9 @@ # frozen_string_literal: true module Stripe + # Invoice Line Items represent the individual lines within an [invoice](https://stripe.com/docs/api/invoices) and only exist within the context of an invoice. + # + # Each line item is backed by either an [invoice item](https://stripe.com/docs/api/invoiceitems) or a [subscription item](https://stripe.com/docs/api/subscription_items). class InvoiceLineItem < StripeObject include Stripe::APIOperations::Save diff --git a/lib/stripe/resources/payment_intent.rb b/lib/stripe/resources/payment_intent.rb index b87a57cf2..98b37c8a9 100644 --- a/lib/stripe/resources/payment_intent.rb +++ b/lib/stripe/resources/payment_intent.rb @@ -122,6 +122,9 @@ def self.capture(intent, params = {}, opts = {}) # after those actions are completed. Your server needs to then # explicitly re-confirm the PaymentIntent to initiate the next payment # attempt. + # There is a variable upper limit on how many times a PaymentIntent can be confirmed. + # After this limit is reached, any further calls to this endpoint will + # transition the PaymentIntent to the canceled state. def confirm(params = {}, opts = {}) request_stripe_object( method: :post, @@ -153,6 +156,9 @@ def confirm(params = {}, opts = {}) # after those actions are completed. Your server needs to then # explicitly re-confirm the PaymentIntent to initiate the next payment # attempt. + # There is a variable upper limit on how many times a PaymentIntent can be confirmed. + # After this limit is reached, any further calls to this endpoint will + # transition the PaymentIntent to the canceled state. def self.confirm(intent, params = {}, opts = {}) request_stripe_object( method: :post, diff --git a/lib/stripe/resources/quote.rb b/lib/stripe/resources/quote.rb index c85363b0a..a3501e030 100644 --- a/lib/stripe/resources/quote.rb +++ b/lib/stripe/resources/quote.rb @@ -208,7 +208,7 @@ def self.mark_stale(quote, params = {}, opts = {}) ) end - # Download the PDF for a finalized quote. Explanation for special handling can be found [here](https://docs.corp.stripe.com/quotes/overview#quote_pdf) + # Download the PDF for a finalized quote. Explanation for special handling can be found [here](https://docs.stripe.com/quotes/overview#quote_pdf) def pdf(params = {}, opts = {}, &read_body_chunk_block) config = opts[:client]&.config || Stripe.config opts = { api_base: config.uploads_base }.merge(opts) @@ -221,7 +221,7 @@ def pdf(params = {}, opts = {}, &read_body_chunk_block) ) end - # Download the PDF for a finalized quote. Explanation for special handling can be found [here](https://docs.corp.stripe.com/quotes/overview#quote_pdf) + # Download the PDF for a finalized quote. Explanation for special handling can be found [here](https://docs.stripe.com/quotes/overview#quote_pdf) def self.pdf(quote, params = {}, opts = {}, &read_body_chunk_block) config = opts[:client]&.config || Stripe.config opts = { api_base: config.uploads_base }.merge(opts) diff --git a/lib/stripe/resources/terminal/reader_collected_data.rb b/lib/stripe/resources/terminal/reader_collected_data.rb new file mode 100644 index 000000000..8a9ebe146 --- /dev/null +++ b/lib/stripe/resources/terminal/reader_collected_data.rb @@ -0,0 +1,14 @@ +# File generated from our OpenAPI spec +# frozen_string_literal: true + +module Stripe + module Terminal + # Returns data collected by Terminal readers. This data is only stored for 24 hours. + class ReaderCollectedData < APIResource + OBJECT_NAME = "terminal.reader_collected_data" + def self.object_name + "terminal.reader_collected_data" + end + end + end +end diff --git a/lib/stripe/resources/treasury/inbound_transfer.rb b/lib/stripe/resources/treasury/inbound_transfer.rb index ec55fdc11..ed8c70ff6 100644 --- a/lib/stripe/resources/treasury/inbound_transfer.rb +++ b/lib/stripe/resources/treasury/inbound_transfer.rb @@ -3,7 +3,9 @@ module Stripe module Treasury - # Use [InboundTransfers](https://stripe.com/docs/treasury/moving-money/financial-accounts/into/inbound-transfers) to add funds to your [FinancialAccount](https://stripe.com/docs/api#financial_accounts) via a PaymentMethod that is owned by you. The funds will be transferred via an ACH debit. + # Use [InboundTransfers](https://docs.stripe.com/docs/treasury/moving-money/financial-accounts/into/inbound-transfers) to add funds to your [FinancialAccount](https://stripe.com/docs/api#financial_accounts) via a PaymentMethod that is owned by you. The funds will be transferred via an ACH debit. + # + # Related guide: [Moving money with Treasury using InboundTransfer objects](https://docs.stripe.com/docs/treasury/moving-money/financial-accounts/into/inbound-transfers) class InboundTransfer < APIResource extend Stripe::APIOperations::Create extend Stripe::APIOperations::List diff --git a/lib/stripe/resources/treasury/outbound_payment.rb b/lib/stripe/resources/treasury/outbound_payment.rb index 4ed791fde..dd61f55d5 100644 --- a/lib/stripe/resources/treasury/outbound_payment.rb +++ b/lib/stripe/resources/treasury/outbound_payment.rb @@ -3,9 +3,11 @@ module Stripe module Treasury - # Use OutboundPayments to send funds to another party's external bank account or [FinancialAccount](https://stripe.com/docs/api#financial_accounts). To send money to an account belonging to the same user, use an [OutboundTransfer](https://stripe.com/docs/api#outbound_transfers). + # Use [OutboundPayments](https://docs.stripe.com/docs/treasury/moving-money/financial-accounts/out-of/outbound-payments) to send funds to another party's external bank account or [FinancialAccount](https://stripe.com/docs/api#financial_accounts). To send money to an account belonging to the same user, use an [OutboundTransfer](https://stripe.com/docs/api#outbound_transfers). # # Simulate OutboundPayment state changes with the `/v1/test_helpers/treasury/outbound_payments` endpoints. These methods can only be called on test mode objects. + # + # Related guide: [Moving money with Treasury using OutboundPayment objects](https://docs.stripe.com/docs/treasury/moving-money/financial-accounts/out-of/outbound-payments) class OutboundPayment < APIResource extend Stripe::APIOperations::Create extend Stripe::APIOperations::List diff --git a/lib/stripe/resources/treasury/outbound_transfer.rb b/lib/stripe/resources/treasury/outbound_transfer.rb index 0636e7c27..a5ed090df 100644 --- a/lib/stripe/resources/treasury/outbound_transfer.rb +++ b/lib/stripe/resources/treasury/outbound_transfer.rb @@ -3,9 +3,11 @@ module Stripe module Treasury - # Use OutboundTransfers to transfer funds from a [FinancialAccount](https://stripe.com/docs/api#financial_accounts) to a PaymentMethod belonging to the same entity. To send funds to a different party, use [OutboundPayments](https://stripe.com/docs/api#outbound_payments) instead. You can send funds over ACH rails or through a domestic wire transfer to a user's own external bank account. + # Use [OutboundTransfers](https://docs.stripe.com/docs/treasury/moving-money/financial-accounts/out-of/outbound-transfers) to transfer funds from a [FinancialAccount](https://stripe.com/docs/api#financial_accounts) to a PaymentMethod belonging to the same entity. To send funds to a different party, use [OutboundPayments](https://stripe.com/docs/api#outbound_payments) instead. You can send funds over ACH rails or through a domestic wire transfer to a user's own external bank account. # # Simulate OutboundTransfer state changes with the `/v1/test_helpers/treasury/outbound_transfers` endpoints. These methods can only be called on test mode objects. + # + # Related guide: [Moving money with Treasury using OutboundTransfer objects](https://docs.stripe.com/docs/treasury/moving-money/financial-accounts/out-of/outbound-transfers) class OutboundTransfer < APIResource extend Stripe::APIOperations::Create extend Stripe::APIOperations::List