Skip to content

Commit bef6f5c

Browse files
Merge upstream and update generated code for v2398 and 45096b135975ad0adc73ef036d92e191dbd74fd4
2 parents f250b14 + fcedaaa commit bef6f5c

37 files changed

Lines changed: 1291 additions & 358 deletions

CHANGELOG.md

Lines changed: 12 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,17 @@
11
# Changelog
22

3+
## 19.5.0 - 2026-08-10
4+
* [#1932](https://github.com/stripe/stripe-ruby/pull/1932) Handle break in auto-paging blocks
5+
- Rescues `LocalJumpError` to prevent crash when calling `break` inside an `auto_paging_each`
6+
* [#1927](https://github.com/stripe/stripe-ruby/pull/1927) Surface `object` property on `EventNotification`
7+
* [#1918](https://github.com/stripe/stripe-ruby/pull/1918) add/adjust event parsing helpers
8+
9+
- Added methods that return their respective `Event`/`EventNotification` class instances without verifying authenticity. Use them when you've previously verified an event (e.g. you verified, put the event in a queue, and are now processing). Supports events from [AWS EventBridge](https://docs.stripe.com/event-destinations/eventbridge) and [Azure Event Grid](https://docs.stripe.com/event-destinations/eventgrid) natively.
10+
- `Webhook#construct_event_without_verification(payload)`
11+
- `StripeClient#parse_event_notification_without_verification(payload)`
12+
* [#1924](https://github.com/stripe/stripe-ruby/pull/1924) Discard the connection when a request is interrupted
13+
- Fix connection reuse after a request is interrupted by a non-StandardError exception (e.g. from rack-timeout), which could cause subsequent requests to receive a previous request's response
14+
315
## 19.5.0-beta.1 - 2026-07-29
416
This release changes the pinned API version to 2026-07-29.preview.
517

CODEGEN_VERSION

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1 +1 @@
1-
44014016ec56efb57a8cf6d0ee0771c2e6b4eebe
1+
45096b135975ad0adc73ef036d92e191dbd74fd4

OPENAPI_VERSION

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1 +1 @@
1-
v2349
1+
v2398

lib/stripe.rb

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -34,6 +34,7 @@
3434
require "stripe/object_types"
3535
require "stripe/event_types"
3636
require "stripe/request_options"
37+
require "stripe/v2_type_coercion"
3738
require "stripe/request_params"
3839
require "stripe/stripe_context"
3940
require "stripe/util"

lib/stripe/api_version.rb

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -4,5 +4,6 @@
44
module Stripe
55
module ApiVersion
66
CURRENT = "2026-07-29.preview"
7+
CURRENT_MAJOR = ""
78
end
89
end

lib/stripe/list_object.rb

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -85,6 +85,10 @@ def auto_paging_each(&blk)
8585
end
8686

8787
break if page.empty?
88+
rescue LocalJumpError => e
89+
raise unless e.reason == :break
90+
91+
break
8892
end
8993
end
9094

lib/stripe/params/price_create_params.rb

Lines changed: 19 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -319,6 +319,25 @@ def initialize(
319319

320320
def self.field_encodings
321321
@field_encodings = {
322+
currency_options: {
323+
kind: :array,
324+
element: {
325+
kind: :object,
326+
fields: {
327+
tiers: {
328+
kind: :array,
329+
element: {
330+
kind: :object,
331+
fields: {
332+
flat_amount_decimal: :decimal_string,
333+
unit_amount_decimal: :decimal_string,
334+
},
335+
},
336+
},
337+
unit_amount_decimal: :decimal_string,
338+
},
339+
},
340+
},
322341
tiers: {
323342
kind: :array,
324343
element: {

lib/stripe/params/product_create_params.rb

Lines changed: 47 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -165,7 +165,28 @@ def initialize(
165165
end
166166

167167
def self.field_encodings
168-
@field_encodings = { unit_amount_decimal: :decimal_string }
168+
@field_encodings = {
169+
currency_options: {
170+
kind: :array,
171+
element: {
172+
kind: :object,
173+
fields: {
174+
tiers: {
175+
kind: :array,
176+
element: {
177+
kind: :object,
178+
fields: {
179+
flat_amount_decimal: :decimal_string,
180+
unit_amount_decimal: :decimal_string,
181+
},
182+
},
183+
},
184+
unit_amount_decimal: :decimal_string,
185+
},
186+
},
187+
},
188+
unit_amount_decimal: :decimal_string,
189+
}
169190
end
170191
end
171192

@@ -285,7 +306,31 @@ def initialize(
285306

286307
def self.field_encodings
287308
@field_encodings = {
288-
default_price_data: { kind: :object, fields: { unit_amount_decimal: :decimal_string } },
309+
default_price_data: {
310+
kind: :object,
311+
fields: {
312+
currency_options: {
313+
kind: :array,
314+
element: {
315+
kind: :object,
316+
fields: {
317+
tiers: {
318+
kind: :array,
319+
element: {
320+
kind: :object,
321+
fields: {
322+
flat_amount_decimal: :decimal_string,
323+
unit_amount_decimal: :decimal_string,
324+
},
325+
},
326+
},
327+
unit_amount_decimal: :decimal_string,
328+
},
329+
},
330+
},
331+
unit_amount_decimal: :decimal_string,
332+
},
333+
},
289334
}
290335
end
291336
end

lib/stripe/request_params.rb

Lines changed: 1 addition & 56 deletions
Original file line numberDiff line numberDiff line change
@@ -1,8 +1,6 @@
11
# frozen_string_literal: true
22
# typed: true
33

4-
require "bigdecimal"
5-
64
module Stripe
75
# For internal use only. Does not provide a stable API and may be broken
86
# with future non-major changes.
@@ -64,61 +62,8 @@ def self.field_encodings
6462
@field_encodings ||= {}
6563
end
6664

67-
# Recursively coerce a value based on its field encoding schema.
68-
# Handles :int64_string leaves, { kind: :object, fields: ... } nesting,
69-
# and { kind: :array, element: ... } for arrays.
7065
def self.coerce_value(value, encoding)
71-
return value if value.nil?
72-
73-
case encoding
74-
when :int64_string
75-
coerce_int64_string(value)
76-
when :decimal_string
77-
coerce_decimal_string(value)
78-
when Hash
79-
coerce_composite(value, encoding)
80-
else
81-
value
82-
end
83-
end
84-
85-
private_class_method def self.coerce_int64_string(value)
86-
case value
87-
when Integer then value.to_s
88-
when Array then value.map { |v| v.is_a?(Integer) ? v.to_s : v }
89-
else value
90-
end
91-
end
92-
93-
private_class_method def self.coerce_decimal_string(value)
94-
case value
95-
when BigDecimal then value.to_s("F")
96-
when Integer, Float then value.to_s
97-
when Array then value.map { |v| coerce_decimal_string(v) }
98-
else value
99-
end
100-
end
101-
102-
private_class_method def self.coerce_composite(value, encoding)
103-
case encoding[:kind]
104-
when :object
105-
coerce_object(value, encoding[:fields] || {})
106-
when :array
107-
return value unless value.is_a?(Array)
108-
109-
value.map { |v| coerce_value(v, encoding[:element]) }
110-
else
111-
value
112-
end
113-
end
114-
115-
private_class_method def self.coerce_object(value, fields_schema)
116-
return value unless value.is_a?(Hash)
117-
118-
value.each_with_object({}) do |(k, v), result|
119-
field_encoding = fields_schema[k.to_sym]
120-
result[k] = field_encoding ? coerce_value(v, field_encoding) : v
121-
end
66+
V2TypeCoercion.coerce_value(value, encoding, direction: :encode)
12267
end
12368

12469
# Coerce a plain Hash using this class's field_encodings.

lib/stripe/resources/checkout/session.rb

Lines changed: 4 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -2637,7 +2637,10 @@ def self.field_remappings
26372637

26382638
def self.field_encodings
26392639
@field_encodings = {
2640-
currency_conversion: { kind: :object, fields: { fx_rate: :decimal_string } },
2640+
currency_conversion: {
2641+
kind: :nullable,
2642+
inner: { kind: :object, fields: { fx_rate: :decimal_string } },
2643+
},
26412644
}
26422645
end
26432646
end

0 commit comments

Comments
 (0)