Skip to content

Commit d45cbec

Browse files
committed
Merge branch 'beta' into DEVSDK-2822
2 parents a334266 + 2661170 commit d45cbec

File tree

929 files changed

+224398
-53772
lines changed

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

929 files changed

+224398
-53772
lines changed

.rubocop.yml

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -78,7 +78,6 @@ Metrics/ModuleLength:
7878
Enabled: false
7979

8080
Metrics/ParameterLists:
81-
# There's 2 methods in `StripeClient` that have long parameter lists.
8281
Max: 8
8382
# Optional parameters should be consistent across libraries, we need not be
8483
# concerned about this. Was introduced with adding `base_address`

.rubocop_todo.yml

Lines changed: 7 additions & 12 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
# This configuration was generated by
22
# `rubocop --auto-gen-config`
3-
# on 2023-11-28 01:02:03 UTC using RuboCop version 1.57.2.
3+
# on 2023-11-29 18:39:02 UTC using RuboCop version 1.57.2.
44
# The point is for the user to remove these configuration records
55
# one by one as the offenses are removed from the code base.
66
# Note that changes in the inspected code, or installation of new
@@ -11,30 +11,25 @@ Lint/HashCompareByIdentity:
1111
Exclude:
1212
- 'lib/stripe/api_requestor.rb'
1313

14-
# Offense count: 26
14+
# Offense count: 27
1515
# Configuration parameters: AllowedMethods, AllowedPatterns, CountRepeatedAttributes.
1616
Metrics/AbcSize:
17-
Max: 50
17+
Max: 55
1818

19-
# Offense count: 9
19+
# Offense count: 10
2020
# Configuration parameters: CountComments, CountAsOne.
2121
Metrics/ClassLength:
22-
Max: 592
22+
Max: 618
2323

2424
# Offense count: 12
2525
# Configuration parameters: AllowedMethods, AllowedPatterns.
2626
Metrics/CyclomaticComplexity:
2727
Max: 12
2828

2929
# Offense count: 9
30-
# Configuration parameters: CountKeywordArgs, MaxOptionalParameters.
31-
Metrics/ParameterLists:
32-
Max: 7
33-
34-
# Offense count: 8
3530
# Configuration parameters: AllowedMethods, AllowedPatterns.
3631
Metrics/PerceivedComplexity:
37-
Max: 12
32+
Max: 13
3833

3934
# Offense count: 1
4035
# This cop supports unsafe autocorrection (--autocorrect-all).
@@ -49,7 +44,7 @@ Style/CombinableLoops:
4944
Exclude:
5045
- 'lib/stripe/api_requestor.rb'
5146

52-
# Offense count: 39
47+
# Offense count: 44
5348
# Configuration parameters: AllowedConstants.
5449
Style/Documentation:
5550
Enabled: false

API_VERSION

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1 +1 @@
1-
6d15a7f20cb77c2c22091a30e499cb89d7e3248c
1+
c5d9f47b11fbac901125e0621faadddc6ac6eb1e

CHANGELOG.md

Lines changed: 1748 additions & 645 deletions
Large diffs are not rendered by default.

OPENAPI_VERSION

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1 +1 @@
1-
v2111
1+
v2104

VERSION

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1 +1 @@
1-
17.2.0
1+
17.2.0-beta.1

lib/stripe.rb

Lines changed: 53 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -112,6 +112,7 @@ class << self
112112

113113
# User configurable options
114114
def_delegators :@config, :api_key, :api_key=
115+
def_delegators :@config, :authenticator, :authenticator=
115116
def_delegators :@config, :api_version, :api_version=
116117
def_delegators :@config, :stripe_account, :stripe_account=
117118
def_delegators :@config, :api_base, :api_base=
@@ -159,6 +160,58 @@ def self.set_app_info(name, partner_id: nil, url: nil, version: nil)
159160
version: version,
160161
}
161162
end
163+
164+
def self.add_beta_version(beta_name, version)
165+
unless version.start_with?("v") && version[1..].to_i.to_s == version[1..]
166+
raise ArgumentError, "Version must be in the format 'v' followed by a number (e.g., 'v3')"
167+
end
168+
169+
if (index = api_version.index("; #{beta_name}="))
170+
start_index = index + "; #{beta_name}=".length
171+
end_index = api_version.index(";", start_index) || api_version.length
172+
current_version = api_version[start_index...end_index][1..].to_i
173+
new_version = version[1..].to_i
174+
return if new_version <= current_version # Keep the higher version, no update needed
175+
176+
self.api_version = api_version[0...index] + "; #{beta_name}=#{version}" + api_version[end_index..]
177+
else
178+
self.api_version = "#{api_version}; #{beta_name}=#{version}"
179+
end
180+
end
181+
182+
class RawRequest
183+
def initialize
184+
@opts = {}
185+
end
186+
187+
def execute(method, url, base_address: :api, params: {}, opts: {}, usage: [])
188+
opts = Util.normalize_opts(opts)
189+
req_opts = RequestOptions.extract_opts_from_hash(opts)
190+
191+
requestor = APIRequestor.active_requestor
192+
resp, = requestor.send(:execute_request_internal, method, url, base_address, params, req_opts,
193+
usage)
194+
195+
requestor.interpret_response(resp)
196+
end
197+
end
198+
199+
# Sends a request to Stripe REST API
200+
def self.raw_request(method, url, params = {}, opts = {}, base_address: :api)
201+
req = RawRequest.new
202+
req.execute(method, url, base_address: base_address, params: params, opts: opts,
203+
usage: ["raw_request"])
204+
end
205+
206+
def self.deserialize(data, api_mode: :v1)
207+
data = JSON.parse(data) if data.is_a?(String)
208+
Util.convert_to_stripe_object(data, {}, api_mode: api_mode)
209+
end
210+
class << self
211+
extend Gem::Deprecate
212+
deprecate :raw_request, "StripeClient#raw_request", 2024, 9
213+
deprecate :deserialize, "StripeClient#deserialize", 2024, 9
214+
end
162215
end
163216

164217
Stripe.log_level = ENV["STRIPE_LOG"] unless ENV["STRIPE_LOG"].nil?

lib/stripe/api_requestor.rb

Lines changed: 34 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -853,6 +853,40 @@ def self.maybe_gc_connection_managers
853853
when "idempotency_error"
854854
IdempotencyError.new(error_data[:message], **opts)
855855
# switch cases: The beginning of the section generated from our OpenAPI spec
856+
when "already_canceled"
857+
AlreadyCanceledError.new(error_data[:message], **opts)
858+
when "already_exists"
859+
AlreadyExistsError.new(error_data[:message], **opts)
860+
when "blocked_by_stripe"
861+
BlockedByStripeError.new(error_data[:message], **opts)
862+
when "controlled_by_dashboard"
863+
ControlledByDashboardError.new(error_data[:message], **opts)
864+
when "feature_not_enabled"
865+
FeatureNotEnabledError.new(error_data[:message], **opts)
866+
when "financial_account_not_open"
867+
FinancialAccountNotOpenError.new(error_data[:message], **opts)
868+
when "insufficient_funds"
869+
InsufficientFundsError.new(error_data[:message], **opts)
870+
when "invalid_payment_method"
871+
872+
InvalidPaymentMethodError.new(
873+
error_data[:message],
874+
**opts,
875+
invalid_param: error_data[:invalid_param]
876+
)
877+
878+
when "invalid_payout_method"
879+
InvalidPayoutMethodError.new(error_data[:message], **opts)
880+
when "non_zero_balance"
881+
NonZeroBalanceError.new(error_data[:message], **opts)
882+
when "not_cancelable"
883+
NotCancelableError.new(error_data[:message], **opts)
884+
when "quota_exceeded"
885+
QuotaExceededError.new(error_data[:message], **opts)
886+
when "rate_limit"
887+
RateLimitError.new(error_data[:message], **opts)
888+
when "recipient_not_notifiable"
889+
RecipientNotNotifiableError.new(error_data[:message], **opts)
856890
when "temporary_session_expired"
857891
TemporarySessionExpiredError.new(error_data[:message], **opts)
858892
# switch cases: The end of the section generated from our OpenAPI spec

lib/stripe/api_version.rb

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -3,7 +3,6 @@
33

44
module Stripe
55
module ApiVersion
6-
CURRENT = "2025-10-29.clover"
7-
CURRENT_MAJOR = "clover"
6+
CURRENT = "2025-10-29.preview"
87
end
98
end

lib/stripe/errors.rb

Lines changed: 63 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -162,6 +162,69 @@ class UnsupportedResponseTypeError < OAuthError
162162
end
163163

164164
# class definitions: The beginning of the section generated from our OpenAPI spec
165+
class AlreadyCanceledError < StripeError
166+
end
167+
168+
class AlreadyExistsError < StripeError
169+
end
170+
171+
class BlockedByStripeError < StripeError
172+
end
173+
174+
class ControlledByDashboardError < StripeError
175+
end
176+
177+
class FeatureNotEnabledError < StripeError
178+
end
179+
180+
class FinancialAccountNotOpenError < StripeError
181+
end
182+
183+
class InsufficientFundsError < StripeError
184+
end
185+
186+
class InvalidPaymentMethodError < StripeError
187+
attr_reader :invalid_param
188+
189+
def initialize(
190+
message = nil,
191+
http_body: nil,
192+
http_status: nil,
193+
json_body: nil,
194+
http_headers: nil,
195+
code: nil,
196+
invalid_param: nil
197+
)
198+
super(
199+
message,
200+
http_body: http_body,
201+
http_status: http_status,
202+
json_body: json_body,
203+
http_headers: http_headers,
204+
code: code,
205+
)
206+
@invalid_param = invalid_param
207+
end
208+
end
209+
210+
class InvalidPayoutMethodError < StripeError
211+
end
212+
213+
class NonZeroBalanceError < StripeError
214+
end
215+
216+
class NotCancelableError < StripeError
217+
end
218+
219+
class QuotaExceededError < StripeError
220+
end
221+
222+
class RateLimitError < StripeError
223+
end
224+
225+
class RecipientNotNotifiableError < StripeError
226+
end
227+
165228
class TemporarySessionExpiredError < StripeError
166229
end
167230
# class definitions: The end of the section generated from our OpenAPI spec

0 commit comments

Comments
 (0)