diff --git a/OPENAPI_VERSION b/OPENAPI_VERSION index 560468415..091591c63 100644 --- a/OPENAPI_VERSION +++ b/OPENAPI_VERSION @@ -1 +1 @@ -v756 \ No newline at end of file +v794 \ No newline at end of file diff --git a/lib/stripe/api_operations/search.rb b/lib/stripe/api_operations/search.rb index 655ad74ee..7af48b423 100644 --- a/lib/stripe/api_operations/search.rb +++ b/lib/stripe/api_operations/search.rb @@ -1,8 +1,9 @@ # frozen_string_literal: true -# TODO: (major) Deprecated, Remove along with extends module Stripe module APIOperations + # The _search method via API Operations is deprecated. + # Please use the search method from within the resource instead. module Search def _search(search_url, filters = {}, opts = {}) request_stripe_object( @@ -12,6 +13,9 @@ def _search(search_url, filters = {}, opts = {}) opts: opts ) end + + extend Gem::Deprecate + deprecate :_search, "request_stripe_object", 2024, 1 end end end diff --git a/lib/stripe/object_types.rb b/lib/stripe/object_types.rb index 292a274bb..b0f308b49 100644 --- a/lib/stripe/object_types.rb +++ b/lib/stripe/object_types.rb @@ -12,6 +12,7 @@ def self.object_names_to_classes SearchResultObject::OBJECT_NAME => SearchResultObject, # business objects + File::OBJECT_NAME_ALT => File, Account::OBJECT_NAME => Account, AccountLink::OBJECT_NAME => AccountLink, AccountNotice::OBJECT_NAME => AccountNotice, @@ -51,7 +52,6 @@ def self.object_names_to_classes Event::OBJECT_NAME => Event, ExchangeRate::OBJECT_NAME => ExchangeRate, File::OBJECT_NAME => File, - File::OBJECT_NAME_ALT => File, FileLink::OBJECT_NAME => FileLink, FinancialConnections::Account::OBJECT_NAME => FinancialConnections::Account, FinancialConnections::AccountInferredBalance::OBJECT_NAME => diff --git a/lib/stripe/resources/account.rb b/lib/stripe/resources/account.rb index e094df33f..f5247ff6f 100644 --- a/lib/stripe/resources/account.rb +++ b/lib/stripe/resources/account.rb @@ -7,9 +7,8 @@ module Stripe # enabled to make live charges or receive payouts. # # For Custom accounts, the properties below are always returned. For other accounts, some properties are returned until that - # account has started to go through Connect Onboarding. Once you create an [Account Link](https://stripe.com/docs/api/account_links) - # for a Standard or Express account, some parameters are no longer returned. These are marked as **Custom Only** or **Custom and Express** - # below. Learn about the differences [between accounts](https://stripe.com/docs/connect/accounts). + # account has started to go through Connect Onboarding. Once you create an [Account Link](https://stripe.com/docs/api/account_links) or [Account Session](https://stripe.com/docs/api/account_sessions), + # some properties are only returned for Custom accounts. Learn about the differences [between accounts](https://stripe.com/docs/connect/accounts). class Account < APIResource extend Gem::Deprecate extend Stripe::APIOperations::Create diff --git a/lib/stripe/resources/invoice.rb b/lib/stripe/resources/invoice.rb index c6ddfe6ac..9cc59aa9b 100644 --- a/lib/stripe/resources/invoice.rb +++ b/lib/stripe/resources/invoice.rb @@ -134,6 +134,20 @@ def self.attach_payment_intent(invoice, params = {}, opts = {}) ) end + # At any time, you can preview the upcoming invoice for a customer. This will show you all the charges that are pending, including subscription renewal charges, invoice item charges, etc. It will also show you any discounts that are applicable to the invoice. + # + # Note that when you are viewing an upcoming invoice, you are simply viewing a preview – the invoice has not yet been created. As such, the upcoming invoice will not show up in invoice listing calls, and you cannot use the API to pay or edit the invoice. If you want to change the amount that your customer will be billed, you can add, remove, or update pending invoice items, or update the customer's discount. + # + # You can preview the effects of updating a subscription, including a preview of what proration will take place. To ensure that the actual proration is calculated exactly the same as the previewed proration, you should pass a proration_date parameter when doing the actual subscription update. The value passed in should be the same as the subscription_proration_date returned on the upcoming invoice resource. The recommended way to get only the prorations being previewed is to consider only proration line items where period[start] is equal to the subscription_proration_date on the upcoming invoice resource. + def self.create_preview(params = {}, opts = {}) + request_stripe_object( + method: :post, + path: "/v1/invoices/create_preview", + params: params, + opts: opts + ) + end + # Stripe automatically finalizes drafts before sending and attempting payment on invoices. However, if you'd like to finalize a draft invoice manually, you can do so using this method. def self.finalize_invoice(invoice, params = {}, opts = {}) request_stripe_object( diff --git a/lib/stripe/resources/payout.rb b/lib/stripe/resources/payout.rb index e50de02e4..0f4995ae2 100644 --- a/lib/stripe/resources/payout.rb +++ b/lib/stripe/resources/payout.rb @@ -17,7 +17,7 @@ class Payout < APIResource OBJECT_NAME = "payout" - # You can cancel a previously created payout if it hasn't been paid out yet. Stripe refunds the funds to your available balance. You can't cancel automatic Stripe payouts. + # You can cancel a previously created payout if its status is pending. Stripe refunds the funds to your available balance. You can't cancel automatic Stripe payouts. def cancel(params = {}, opts = {}) request_stripe_object( method: :post, @@ -27,7 +27,7 @@ def cancel(params = {}, opts = {}) ) end - # Reverses a payout by debiting the destination bank account. At this time, you can only reverse payouts for connected accounts to US bank accounts. If the payout is in the pending status, use /v1/payouts/:id/cancel instead. + # Reverses a payout by debiting the destination bank account. At this time, you can only reverse payouts for connected accounts to US bank accounts. If the payout is manual and in the pending status, use /v1/payouts/:id/cancel instead. # # By requesting a reversal through /v1/payouts/:id/reverse, you confirm that the authorized signatory of the selected bank account authorizes the debit on the bank account and that no other authorization is required. def reverse(params = {}, opts = {}) @@ -39,7 +39,7 @@ def reverse(params = {}, opts = {}) ) end - # You can cancel a previously created payout if it hasn't been paid out yet. Stripe refunds the funds to your available balance. You can't cancel automatic Stripe payouts. + # You can cancel a previously created payout if its status is pending. Stripe refunds the funds to your available balance. You can't cancel automatic Stripe payouts. def self.cancel(payout, params = {}, opts = {}) request_stripe_object( method: :post, @@ -49,7 +49,7 @@ def self.cancel(payout, params = {}, opts = {}) ) end - # Reverses a payout by debiting the destination bank account. At this time, you can only reverse payouts for connected accounts to US bank accounts. If the payout is in the pending status, use /v1/payouts/:id/cancel instead. + # Reverses a payout by debiting the destination bank account. At this time, you can only reverse payouts for connected accounts to US bank accounts. If the payout is manual and in the pending status, use /v1/payouts/:id/cancel instead. # # By requesting a reversal through /v1/payouts/:id/reverse, you confirm that the authorized signatory of the selected bank account authorizes the debit on the bank account and that no other authorization is required. def self.reverse(payout, params = {}, opts = {}) diff --git a/test/stripe/api_operations_test.rb b/test/stripe/api_operations_test.rb index e171ee92e..515290197 100644 --- a/test/stripe/api_operations_test.rb +++ b/test/stripe/api_operations_test.rb @@ -39,6 +39,26 @@ def self.protected_fields end end + context ".search" do + should "warn that ._search is deprecated" do + old_stderr = $stderr + $stderr = StringIO.new + begin + stub_request(:post, "#{Stripe.api_base}/v1/customers/search?query=foo:bar") + .to_return(body: JSON.generate(object: "customer")) + + client = StripeClient.new + client.request { Customer._search("/v1/customers/search", query: "foo:bar") } + + message = "NOTE: Stripe::Customer._search is deprecated; use request_stripe_object " \ + "instead. It will be removed on or after 2024-01." + assert_match Regexp.new(message), $stderr.string + ensure + $stderr = old_stderr + end + end + end + context ".nested_resource_class_methods" do class MainResource < APIResource # rubocop:todo Lint/ConstantDefinitionInBlock extend Stripe::APIOperations::NestedResource