stripe 21.0.0 → 21.1.0

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (102) hide show
  1. checksums.yaml +4 -4
  2. data/lib/stripe/api_operations/request.rb +16 -7
  3. data/lib/stripe/api_operations/save.rb +4 -4
  4. data/lib/stripe/api_requestor.rb +54 -34
  5. data/lib/stripe/api_resource.rb +1 -2
  6. data/lib/stripe/api_version.rb +1 -1
  7. data/lib/stripe/connection_manager.rb +3 -0
  8. data/lib/stripe/event_types.rb +20 -0
  9. data/lib/stripe/events/v2_core_account_closed_event.rb +2 -2
  10. data/lib/stripe/events/v2_core_account_including_defaults_updated_event.rb +2 -2
  11. data/lib/stripe/events/v2_core_claimable_sandbox_claimed_event.rb +44 -0
  12. data/lib/stripe/events/v2_core_claimable_sandbox_created_event.rb +44 -0
  13. data/lib/stripe/events/v2_core_claimable_sandbox_expired_event.rb +44 -0
  14. data/lib/stripe/events/v2_core_claimable_sandbox_expiring_event.rb +44 -0
  15. data/lib/stripe/events/v2_core_claimable_sandbox_updated_event.rb +44 -0
  16. data/lib/stripe/object_types.rb +1 -0
  17. data/lib/stripe/params/billing_portal/configuration_create_params.rb +1 -1
  18. data/lib/stripe/params/billing_portal/configuration_update_params.rb +1 -1
  19. data/lib/stripe/params/checkout/session_create_params.rb +8 -1
  20. data/lib/stripe/params/coupon_create_params.rb +1 -1
  21. data/lib/stripe/params/financial_connections/session_create_params.rb +1 -1
  22. data/lib/stripe/params/invoice_item_create_params.rb +1 -1
  23. data/lib/stripe/params/payment_intent_capture_params.rb +663 -1
  24. data/lib/stripe/params/payment_intent_confirm_params.rb +663 -1
  25. data/lib/stripe/params/payment_intent_create_params.rb +664 -2
  26. data/lib/stripe/params/payment_intent_update_params.rb +664 -2
  27. data/lib/stripe/params/payment_link_update_params.rb +4 -0
  28. data/lib/stripe/params/product_create_params.rb +4 -1
  29. data/lib/stripe/params/product_update_params.rb +4 -1
  30. data/lib/stripe/params/quote_create_params.rb +1 -1
  31. data/lib/stripe/params/quote_update_params.rb +1 -1
  32. data/lib/stripe/params/reporting/report_run_create_params.rb +4 -0
  33. data/lib/stripe/params/tax/registration_create_params.rb +13 -1
  34. data/lib/stripe/params/test_helpers/treasury/inbound_transfer_fail_params.rb +23 -1
  35. data/lib/stripe/params/test_helpers/treasury/inbound_transfer_return_inbound_transfer_params.rb +34 -1
  36. data/lib/stripe/params/treasury/inbound_transfer_fail_params.rb +23 -1
  37. data/lib/stripe/params/treasury/inbound_transfer_return_inbound_transfer_params.rb +34 -1
  38. data/lib/stripe/params/v2/core/account_create_params.rb +138 -4
  39. data/lib/stripe/params/v2/core/account_link_create_params.rb +19 -1
  40. data/lib/stripe/params/v2/core/account_update_params.rb +138 -4
  41. data/lib/stripe/params/v2/core/claimable_sandbox_create_params.rb +63 -0
  42. data/lib/stripe/params/v2/core/claimable_sandbox_renew_onboarding_link_params.rb +32 -0
  43. data/lib/stripe/params/v2/core/claimable_sandbox_retrieve_params.rb +17 -0
  44. data/lib/stripe/params/v2/money_management/financial_account_list_params.rb +1 -1
  45. data/lib/stripe/params/v2/money_management/financial_address_create_params.rb +2 -2
  46. data/lib/stripe/params.rb +7 -0
  47. data/lib/stripe/request_options.rb +19 -2
  48. data/lib/stripe/resources/apps/install.rb +2 -2
  49. data/lib/stripe/resources/balance_transaction.rb +1 -1
  50. data/lib/stripe/resources/charge.rb +274 -5
  51. data/lib/stripe/resources/checkout/session.rb +4 -0
  52. data/lib/stripe/resources/confirmation_token.rb +2 -2
  53. data/lib/stripe/resources/coupon.rb +6 -3
  54. data/lib/stripe/resources/dispute.rb +1 -1
  55. data/lib/stripe/resources/event.rb +2 -2
  56. data/lib/stripe/resources/issuing/card.rb +1 -1
  57. data/lib/stripe/resources/payment_attempt_record.rb +4 -1
  58. data/lib/stripe/resources/payment_intent.rb +575 -2
  59. data/lib/stripe/resources/payment_method.rb +2 -2
  60. data/lib/stripe/resources/payment_record.rb +4 -1
  61. data/lib/stripe/resources/product.rb +2 -0
  62. data/lib/stripe/resources/radar/payment_evaluation.rb +1 -1
  63. data/lib/stripe/resources/refund.rb +38 -0
  64. data/lib/stripe/resources/reporting/report_run.rb +2 -0
  65. data/lib/stripe/resources/reserve/hold.rb +1 -1
  66. data/lib/stripe/resources/setup_attempt.rb +2 -2
  67. data/lib/stripe/resources/setup_intent.rb +1 -1
  68. data/lib/stripe/resources/tax/registration.rb +16 -1
  69. data/lib/stripe/resources/treasury/inbound_transfer.rb +35 -7
  70. data/lib/stripe/resources/treasury/outbound_payment.rb +37 -9
  71. data/lib/stripe/resources/treasury/outbound_transfer.rb +37 -9
  72. data/lib/stripe/resources/treasury/received_credit.rb +1 -1
  73. data/lib/stripe/resources/treasury/received_debit.rb +1 -1
  74. data/lib/stripe/resources/v2/core/account.rb +246 -3
  75. data/lib/stripe/resources/v2/core/account_link.rb +18 -1
  76. data/lib/stripe/resources/v2/core/account_person_token.rb +2 -0
  77. data/lib/stripe/resources/v2/core/account_token.rb +3 -1
  78. data/lib/stripe/resources/v2/core/claimable_sandbox.rb +269 -0
  79. data/lib/stripe/resources/v2/core/event_base.rb +8 -25
  80. data/lib/stripe/resources/v2/core/event_notification.rb +32 -0
  81. data/lib/stripe/resources.rb +17 -0
  82. data/lib/stripe/services/apps/install_service.rb +2 -2
  83. data/lib/stripe/services/checkout/session_service.rb +2 -0
  84. data/lib/stripe/services/event_service.rb +1 -1
  85. data/lib/stripe/services/test_helpers/treasury/inbound_transfer_service.rb +3 -3
  86. data/lib/stripe/services/test_helpers/treasury/outbound_payment_service.rb +4 -4
  87. data/lib/stripe/services/test_helpers/treasury/outbound_transfer_service.rb +4 -4
  88. data/lib/stripe/services/test_helpers/treasury/received_credit_service.rb +1 -1
  89. data/lib/stripe/services/test_helpers/treasury/received_debit_service.rb +1 -1
  90. data/lib/stripe/services/v2/core/account_link_service.rb +1 -1
  91. data/lib/stripe/services/v2/core/account_token_service.rb +2 -2
  92. data/lib/stripe/services/v2/core/accounts/person_token_service.rb +2 -1
  93. data/lib/stripe/services/v2/core/claimable_sandbox_service.rb +49 -0
  94. data/lib/stripe/services/v2/core_service.rb +2 -1
  95. data/lib/stripe/services.rb +2 -0
  96. data/lib/stripe/stripe_client.rb +6 -0
  97. data/lib/stripe/stripe_configuration.rb +9 -2
  98. data/lib/stripe/stripe_event_notification_handler.rb +26 -0
  99. data/lib/stripe/stripe_object.rb +22 -9
  100. data/lib/stripe/version.rb +1 -1
  101. data/rbi/stripe.rbi +6888 -221
  102. metadata +12 -2
checksums.yaml CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA256:
3
- metadata.gz: b00c4e7c753d094c796b1d224fe4a4fa9bdd787303ca2f16415fa73c786bbbed
4
- data.tar.gz: 141c5154dd3ce9ca7a9a0eb363aa9b568244af3530876af7edb9f4adbd755bd1
3
+ metadata.gz: 69ad86bf401aa57731b2ff471f1b981e318d916ee6c274dc34c00bbd14c8d659
4
+ data.tar.gz: 4b4ff3ce8fa38f510fe7dd43ea699314f3e66078b99a17877a715247f95087ed
5
5
  SHA512:
6
- metadata.gz: 68fa6fd4d491abd1c6becc23d5ee8953819097ac32ebda0fe2a5c9a4f172be5741d3b95e1a692cf0f74f9d66e692b030727172eaf0b05965c4d48bfadb55472c
7
- data.tar.gz: a74024ae2a9cb79c9d9d49dde997f89004f7508df35544a2c0f46aee8003704fb619dd38a6c811db9d24e8d74ec2fe3b3e68a91b6eec84e93606ec4e166fb765
6
+ metadata.gz: 2d49a8bf7a7b6416415be29cddfa07337a9483d7b8894f83a29abe22e1a8ac4349a58802ed02ca7ea3cdcf732209280c9b58f80ab8f85405b943879ac3d0cf67
7
+ data.tar.gz: 186549abd662c01939f2aa279a6a5a136d6bb0f256be5c0b12755347e249e93e63f46db79d1bf259b228906a853b4601bba50e12a57b62a8ac208ee16ae57edc
@@ -5,14 +5,15 @@ module Stripe
5
5
  module Request
6
6
  module ClassMethods
7
7
  def execute_resource_request(method, url, base_address = :api,
8
- params = {}, opts = {}, usage = [])
8
+ params = {}, opts = {}, usage = [], requestor: nil)
9
9
  execute_resource_request_internal(
10
- :execute_request, method, url, base_address, params, opts, usage
10
+ :execute_request, method, url, base_address, params, opts, usage,
11
+ requestor: requestor || APIRequestor.active_requestor
11
12
  )
12
13
  end
13
14
 
14
15
  def execute_resource_request_stream(method, url, base_address = :api,
15
- params = {}, opts = {}, usage = [],
16
+ params = {}, opts = {}, usage = [], requestor: nil,
16
17
  &read_body_chunk_block)
17
18
  execute_resource_request_internal(
18
19
  :execute_request_stream,
@@ -22,6 +23,7 @@ module Stripe
22
23
  params,
23
24
  opts,
24
25
  usage,
26
+ requestor: requestor || APIRequestor.active_requestor,
25
27
  &read_body_chunk_block
26
28
  )
27
29
  end
@@ -33,6 +35,7 @@ module Stripe
33
35
  private def execute_resource_request_internal(client_request_method_sym,
34
36
  method, url, base_address,
35
37
  params, opts, usage,
38
+ requestor:,
36
39
  &read_body_chunk_block)
37
40
  params = params.to_h if params.is_a?(Stripe::RequestParams)
38
41
  params ||= {}
@@ -43,7 +46,7 @@ module Stripe
43
46
  opts = Util.normalize_opts(opts)
44
47
  req_opts = RequestOptions.extract_opts_from_hash(opts)
45
48
 
46
- APIRequestor.active_requestor.send(
49
+ requestor.send(
47
50
  client_request_method_sym,
48
51
  method, url,
49
52
  base_address,
@@ -75,7 +78,11 @@ module Stripe
75
78
  params = {}, opts = {}, usage = [])
76
79
  RequestOptions.assert_api_key_attached!(@opts[:api_key])
77
80
  opts = @opts.merge(Util.normalize_opts(opts))
78
- self.class.execute_resource_request(method, url, base_address, params, opts, usage)
81
+ self.class.send(
82
+ :execute_resource_request_internal,
83
+ :execute_request, method, url, base_address, params, opts, usage,
84
+ requestor: @requestor
85
+ )
79
86
  end
80
87
 
81
88
  protected def execute_resource_request_stream(method, url, base_address = :api,
@@ -83,8 +90,10 @@ module Stripe
83
90
  &read_body_chunk_block)
84
91
  RequestOptions.assert_api_key_attached!(@opts[:api_key])
85
92
  opts = @opts.merge(Util.normalize_opts(opts))
86
- self.class.execute_resource_request_stream(
87
- method, url, base_address, params, opts, usage, &read_body_chunk_block
93
+ self.class.send(
94
+ :execute_resource_request_internal,
95
+ :execute_request_stream, method, url, base_address, params, opts, usage,
96
+ requestor: @requestor, &read_body_chunk_block
88
97
  )
89
98
  end
90
99
 
@@ -66,10 +66,10 @@ module Stripe
66
66
  # generated a uri for this object with an identifier baked in
67
67
  values.delete(:id)
68
68
  opts = Util.normalize_opts(opts)
69
- APIRequestor.active_requestor.execute_request_initialize_from(:post, save_url, :api, self,
70
- params: values,
71
- opts: RequestOptions.extract_opts_from_hash(opts),
72
- usage: ["save"])
69
+ @requestor.execute_request_initialize_from(:post, save_url, :api, self,
70
+ params: values,
71
+ opts: RequestOptions.extract_opts_from_hash(opts),
72
+ usage: ["save"])
73
73
  end
74
74
  extend Gem::Deprecate
75
75
  deprecate :save, "the `update` class method (for examples " \
@@ -34,6 +34,30 @@ module Stripe
34
34
 
35
35
  attr_reader :config, :options
36
36
 
37
+ # Snapshot authorization defaults while retaining the transport's telemetry.
38
+ def with_authorization_scope(scope)
39
+ scope = RequestOptions.snapshot_authorization_selectors(scope)
40
+ dup.tap do |requestor|
41
+ requestor.instance_variable_set(:@config, config.reverse_duplicate_merge(scope))
42
+ end
43
+ end
44
+
45
+ # The default inspect renders every instance variable, which would
46
+ # include the API key held by the configuration.
47
+ def inspect
48
+ "#<#{self.class}:0x#{object_id.to_s(16)}>"
49
+ end
50
+
51
+ # Implements custom encoding for YAML (Psych). Without it, Psych dumps
52
+ # every instance variable, including the API key and any proxy
53
+ # credentials in the configuration. Clients reach the configuration
54
+ # through their requestor, so this also keeps it out of their YAML dumps.
55
+ def encode_with(coder)
56
+ (instance_variables - [:@config]).each do |ivar|
57
+ coder[ivar.to_s.delete_prefix("@")] = instance_variable_get(ivar)
58
+ end
59
+ end
60
+
37
61
  # Gets a currently active `APIRequestor`. Set for the current thread when
38
62
  # `APIRequestor#request` is being run so that API operations being executed
39
63
  # inside of that block can find the currently active requestor. It's reset to
@@ -173,22 +197,22 @@ module Stripe
173
197
  # charge, resp = client.request { Charge.create }
174
198
  #
175
199
  def request
176
- old_api_requestor = self.class.current_thread_context.active_requestor
177
- self.class.current_thread_context.active_requestor = self
178
-
179
- if self.class.current_thread_context.last_responses&.key?(object_id)
180
- raise "calls to APIRequestor#request cannot be nested within a thread"
181
- end
182
-
183
- self.class.current_thread_context.last_responses ||= {}
184
- self.class.current_thread_context.last_responses[object_id] = nil
200
+ context = self.class.current_thread_context
201
+ old_api_requestor = context.active_requestor
202
+ block_id = Object.new
203
+ context.request_block_stack ||= []
204
+ context.last_responses ||= {}
205
+ context.request_block_stack.push(block_id)
206
+ context.last_responses[block_id] = nil
207
+ context.active_requestor = self
185
208
 
186
209
  begin
187
210
  res = yield
188
- [res, self.class.current_thread_context.last_responses[object_id]]
211
+ [res, context.last_responses[block_id]]
189
212
  ensure
190
- self.class.current_thread_context.active_requestor = old_api_requestor
191
- self.class.current_thread_context.last_responses.delete(object_id)
213
+ context.active_requestor = old_api_requestor
214
+ context.last_responses.delete(block_id)
215
+ context.request_block_stack.pop
192
216
  end
193
217
  end
194
218
  extend Gem::Deprecate
@@ -207,11 +231,6 @@ module Stripe
207
231
 
208
232
  resp = interpret_response(http_resp)
209
233
 
210
- # If being called from `APIRequestor#request`, put the last response in
211
- # thread-local memory so that it can be returned to the user. Don't store
212
- # anything otherwise so that we don't leak memory.
213
- store_last_response(object_id, resp)
214
-
215
234
  api_mode = Util.get_api_mode(path)
216
235
  Util.convert_to_stripe_object_with_params(resp.data, params, RequestOptions.persistable(req_opts), resp,
217
236
  api_mode: api_mode, requestor: self,
@@ -250,11 +269,6 @@ module Stripe
250
269
 
251
270
  resp = interpret_response(http_resp)
252
271
 
253
- # If being called from `APIRequestor#request`, put the last response in
254
- # thread-local memory so that it can be returned to the user. Don't store
255
- # anything otherwise so that we don't leak memory.
256
- store_last_response(object_id, resp)
257
-
258
272
  if Util.object_name_matches_class?(resp.data[:object], object.class)
259
273
  object.send(:initialize_from,
260
274
  resp.data, RequestOptions.persistable(req_opts), resp,
@@ -267,7 +281,9 @@ module Stripe
267
281
  end
268
282
 
269
283
  def interpret_response(http_resp)
270
- StripeResponse.from_net_http(http_resp)
284
+ resp = StripeResponse.from_net_http(http_resp)
285
+ store_last_response(resp)
286
+ resp
271
287
  rescue JSON::ParserError
272
288
  raise general_api_error(http_resp.code.to_i, http_resp.body)
273
289
  end
@@ -301,18 +317,18 @@ module Stripe
301
317
  # response body at this point and so return a response object containing
302
318
  # only the headers. This is because the body was consumed by the block.
303
319
  resp = StripeHeadersOnlyResponse.from_net_http(http_resp)
320
+ store_last_response(resp)
304
321
 
305
322
  [resp, api_key]
306
323
  end
307
324
 
308
- def store_last_response(object_id, resp)
309
- return unless last_response_has_key?(object_id)
310
-
311
- self.class.current_thread_context.last_responses[object_id] = resp
312
- end
325
+ def store_last_response(resp)
326
+ context = self.class.current_thread_context
327
+ # Responses belong to the innermost request block, regardless of which requestor sent the request.
328
+ block_id = context.request_block_stack&.last
329
+ return unless block_id
313
330
 
314
- def last_response_has_key?(object_id)
315
- self.class.current_thread_context.last_responses&.key?(object_id)
331
+ context.last_responses[block_id] = resp
316
332
  end
317
333
 
318
334
  #
@@ -391,12 +407,16 @@ module Stripe
391
407
  # the user hasn't specified their own.
392
408
  attr_accessor :default_requestor
393
409
 
394
- # A temporary map of object IDs to responses from last executed API
395
- # calls. Used to return a responses from calls to `APIRequestor#request`.
410
+ # A stack of unique block IDs keeps nested request blocks isolated,
411
+ # including blocks using the same requestor.
412
+ attr_accessor :request_block_stack
413
+
414
+ # A temporary map of block IDs to responses from last executed API
415
+ # calls. Used to return responses from calls to `APIRequestor#request`.
396
416
  #
397
417
  # Stored in the thread data to make the use of a single `APIRequestor`
398
- # object safe across multiple threads. Stored as a map so that multiple
399
- # `APIRequestor` objects can run concurrently on the same thread.
418
+ # object safe across multiple threads. Each nested block has its own
419
+ # response entry, independent of the requestors used to make requests.
400
420
  #
401
421
  # Responses are only left in as long as they're needed, which means
402
422
  # they're removed as soon as a call leaves `APIRequestor#request`, and
@@ -130,8 +130,7 @@ module Stripe
130
130
  end
131
131
 
132
132
  def request_stripe_object(method:, path:, params:, base_address: :api, opts: {})
133
- requestor = instance_variable_defined?(:@requestor) && @requestor ? @requestor : APIRequestor.active_requestor
134
- requestor.execute_request_initialize_from(method, path, base_address, self, params: params, opts: opts)
133
+ @requestor.execute_request_initialize_from(method, path, base_address, self, params: params, opts: opts)
135
134
  end
136
135
 
137
136
  protected def request_stream(method:, path:, params:, base_address: :api, opts: {},
@@ -3,7 +3,7 @@
3
3
 
4
4
  module Stripe
5
5
  module ApiVersion
6
- CURRENT = "2026-10-28.endive"
6
+ CURRENT = "2026-11-18.endive"
7
7
  CURRENT_MAJOR = "endive"
8
8
  end
9
9
  end
@@ -183,6 +183,9 @@ module Stripe
183
183
  # reused Go's default for `DefaultTransport`.
184
184
  connection.keep_alive_timeout = 30
185
185
 
186
+ # stripe-ruby owns retries; prevent Net::HTTP from retrying beneath SDK instrumentation.
187
+ connection.max_retries = 0 if connection.respond_to?(:max_retries=)
188
+
186
189
  connection.open_timeout = config.open_timeout
187
190
  connection.read_timeout = config.read_timeout
188
191
  connection.write_timeout = config.write_timeout if connection.respond_to?(:write_timeout=)
@@ -418,6 +418,16 @@ module Stripe
418
418
  Events::V2CoreAccountPersonDeletedEvent.lookup_type => Events::V2CoreAccountPersonDeletedEvent,
419
419
  Events::V2CoreAccountPersonUpdatedEvent.lookup_type => Events::V2CoreAccountPersonUpdatedEvent,
420
420
  Events::V2CoreAccountUpdatedEvent.lookup_type => Events::V2CoreAccountUpdatedEvent,
421
+ Events::V2CoreClaimableSandboxClaimedEvent.lookup_type =>
422
+ Events::V2CoreClaimableSandboxClaimedEvent,
423
+ Events::V2CoreClaimableSandboxCreatedEvent.lookup_type =>
424
+ Events::V2CoreClaimableSandboxCreatedEvent,
425
+ Events::V2CoreClaimableSandboxExpiredEvent.lookup_type =>
426
+ Events::V2CoreClaimableSandboxExpiredEvent,
427
+ Events::V2CoreClaimableSandboxExpiringEvent.lookup_type =>
428
+ Events::V2CoreClaimableSandboxExpiringEvent,
429
+ Events::V2CoreClaimableSandboxUpdatedEvent.lookup_type =>
430
+ Events::V2CoreClaimableSandboxUpdatedEvent,
421
431
  Events::V2CoreEventDestinationPingEvent.lookup_type => Events::V2CoreEventDestinationPingEvent,
422
432
  Events::V2MoneyManagementAdjustmentCreatedEvent.lookup_type =>
423
433
  Events::V2MoneyManagementAdjustmentCreatedEvent,
@@ -1021,6 +1031,16 @@ module Stripe
1021
1031
  Events::V2CoreAccountPersonUpdatedEventNotification,
1022
1032
  Events::V2CoreAccountUpdatedEventNotification.lookup_type =>
1023
1033
  Events::V2CoreAccountUpdatedEventNotification,
1034
+ Events::V2CoreClaimableSandboxClaimedEventNotification.lookup_type =>
1035
+ Events::V2CoreClaimableSandboxClaimedEventNotification,
1036
+ Events::V2CoreClaimableSandboxCreatedEventNotification.lookup_type =>
1037
+ Events::V2CoreClaimableSandboxCreatedEventNotification,
1038
+ Events::V2CoreClaimableSandboxExpiredEventNotification.lookup_type =>
1039
+ Events::V2CoreClaimableSandboxExpiredEventNotification,
1040
+ Events::V2CoreClaimableSandboxExpiringEventNotification.lookup_type =>
1041
+ Events::V2CoreClaimableSandboxExpiringEventNotification,
1042
+ Events::V2CoreClaimableSandboxUpdatedEventNotification.lookup_type =>
1043
+ Events::V2CoreClaimableSandboxUpdatedEventNotification,
1024
1044
  Events::V2CoreEventDestinationPingEventNotification.lookup_type =>
1025
1045
  Events::V2CoreEventDestinationPingEventNotification,
1026
1046
  Events::V2MoneyManagementAdjustmentCreatedEventNotification.lookup_type =>
@@ -3,7 +3,7 @@
3
3
 
4
4
  module Stripe
5
5
  module Events
6
- # This event occurs when an account is closed.
6
+ # Occurs when an Account is closed.
7
7
  class V2CoreAccountClosedEvent < Stripe::V2::Core::Event
8
8
  def self.lookup_type
9
9
  "v2.core.account.closed"
@@ -21,7 +21,7 @@ module Stripe
21
21
  attr_reader :related_object
22
22
  end
23
23
 
24
- # This event occurs when an account is closed.
24
+ # Occurs when an Account is closed.
25
25
  class V2CoreAccountClosedEventNotification < Stripe::V2::Core::EventNotification
26
26
  def self.lookup_type
27
27
  "v2.core.account.closed"
@@ -3,7 +3,7 @@
3
3
 
4
4
  module Stripe
5
5
  module Events
6
- # This event occurs when account defaults are created or updated.
6
+ # Occurs when an Account's defaults are created or updated.
7
7
  class V2CoreAccountIncludingDefaultsUpdatedEvent < Stripe::V2::Core::Event
8
8
  def self.lookup_type
9
9
  "v2.core.account[defaults].updated"
@@ -21,7 +21,7 @@ module Stripe
21
21
  attr_reader :related_object
22
22
  end
23
23
 
24
- # This event occurs when account defaults are created or updated.
24
+ # Occurs when an Account's defaults are created or updated.
25
25
  class V2CoreAccountIncludingDefaultsUpdatedEventNotification < Stripe::V2::Core::EventNotification
26
26
  def self.lookup_type
27
27
  "v2.core.account[defaults].updated"
@@ -0,0 +1,44 @@
1
+ # File generated from our OpenAPI spec
2
+ # frozen_string_literal: true
3
+
4
+ module Stripe
5
+ module Events
6
+ # Occurs when a claimable sandbox is claimed.
7
+ class V2CoreClaimableSandboxClaimedEvent < Stripe::V2::Core::Event
8
+ def self.lookup_type
9
+ "v2.core.claimable_sandbox.claimed"
10
+ end
11
+
12
+ # Retrieves the related object from the API. Makes an API request on every call.
13
+ def fetch_related_object
14
+ _request(
15
+ method: :get,
16
+ path: related_object.url,
17
+ base_address: :api,
18
+ opts: { stripe_context: context, "Stripe-Request-Trigger": "event=#{id}" }
19
+ )
20
+ end
21
+ attr_reader :related_object
22
+ end
23
+
24
+ # Occurs when a claimable sandbox is claimed.
25
+ class V2CoreClaimableSandboxClaimedEventNotification < Stripe::V2::Core::EventNotification
26
+ def self.lookup_type
27
+ "v2.core.claimable_sandbox.claimed"
28
+ end
29
+
30
+ attr_reader :related_object
31
+
32
+ # Retrieves the ClaimableSandbox related to this EventNotification from the Stripe API. Makes an API request on every call.
33
+ def fetch_related_object
34
+ resp = @client.raw_request(
35
+ :get,
36
+ related_object.url,
37
+ opts: { stripe_context: context, "Stripe-Request-Trigger": "event=#{id}" },
38
+ usage: ["fetch_related_object"]
39
+ )
40
+ @client.deserialize(resp.http_body, api_mode: Util.get_api_mode(related_object.url))
41
+ end
42
+ end
43
+ end
44
+ end
@@ -0,0 +1,44 @@
1
+ # File generated from our OpenAPI spec
2
+ # frozen_string_literal: true
3
+
4
+ module Stripe
5
+ module Events
6
+ # Occurs when a claimable sandbox is created.
7
+ class V2CoreClaimableSandboxCreatedEvent < Stripe::V2::Core::Event
8
+ def self.lookup_type
9
+ "v2.core.claimable_sandbox.created"
10
+ end
11
+
12
+ # Retrieves the related object from the API. Makes an API request on every call.
13
+ def fetch_related_object
14
+ _request(
15
+ method: :get,
16
+ path: related_object.url,
17
+ base_address: :api,
18
+ opts: { stripe_context: context, "Stripe-Request-Trigger": "event=#{id}" }
19
+ )
20
+ end
21
+ attr_reader :related_object
22
+ end
23
+
24
+ # Occurs when a claimable sandbox is created.
25
+ class V2CoreClaimableSandboxCreatedEventNotification < Stripe::V2::Core::EventNotification
26
+ def self.lookup_type
27
+ "v2.core.claimable_sandbox.created"
28
+ end
29
+
30
+ attr_reader :related_object
31
+
32
+ # Retrieves the ClaimableSandbox related to this EventNotification from the Stripe API. Makes an API request on every call.
33
+ def fetch_related_object
34
+ resp = @client.raw_request(
35
+ :get,
36
+ related_object.url,
37
+ opts: { stripe_context: context, "Stripe-Request-Trigger": "event=#{id}" },
38
+ usage: ["fetch_related_object"]
39
+ )
40
+ @client.deserialize(resp.http_body, api_mode: Util.get_api_mode(related_object.url))
41
+ end
42
+ end
43
+ end
44
+ end
@@ -0,0 +1,44 @@
1
+ # File generated from our OpenAPI spec
2
+ # frozen_string_literal: true
3
+
4
+ module Stripe
5
+ module Events
6
+ # Occurs when a claimable sandbox expires.
7
+ class V2CoreClaimableSandboxExpiredEvent < Stripe::V2::Core::Event
8
+ def self.lookup_type
9
+ "v2.core.claimable_sandbox.expired"
10
+ end
11
+
12
+ # Retrieves the related object from the API. Makes an API request on every call.
13
+ def fetch_related_object
14
+ _request(
15
+ method: :get,
16
+ path: related_object.url,
17
+ base_address: :api,
18
+ opts: { stripe_context: context, "Stripe-Request-Trigger": "event=#{id}" }
19
+ )
20
+ end
21
+ attr_reader :related_object
22
+ end
23
+
24
+ # Occurs when a claimable sandbox expires.
25
+ class V2CoreClaimableSandboxExpiredEventNotification < Stripe::V2::Core::EventNotification
26
+ def self.lookup_type
27
+ "v2.core.claimable_sandbox.expired"
28
+ end
29
+
30
+ attr_reader :related_object
31
+
32
+ # Retrieves the ClaimableSandbox related to this EventNotification from the Stripe API. Makes an API request on every call.
33
+ def fetch_related_object
34
+ resp = @client.raw_request(
35
+ :get,
36
+ related_object.url,
37
+ opts: { stripe_context: context, "Stripe-Request-Trigger": "event=#{id}" },
38
+ usage: ["fetch_related_object"]
39
+ )
40
+ @client.deserialize(resp.http_body, api_mode: Util.get_api_mode(related_object.url))
41
+ end
42
+ end
43
+ end
44
+ end
@@ -0,0 +1,44 @@
1
+ # File generated from our OpenAPI spec
2
+ # frozen_string_literal: true
3
+
4
+ module Stripe
5
+ module Events
6
+ # Occurs when a claimable sandbox is expiring in 7 days.
7
+ class V2CoreClaimableSandboxExpiringEvent < Stripe::V2::Core::Event
8
+ def self.lookup_type
9
+ "v2.core.claimable_sandbox.expiring"
10
+ end
11
+
12
+ # Retrieves the related object from the API. Makes an API request on every call.
13
+ def fetch_related_object
14
+ _request(
15
+ method: :get,
16
+ path: related_object.url,
17
+ base_address: :api,
18
+ opts: { stripe_context: context, "Stripe-Request-Trigger": "event=#{id}" }
19
+ )
20
+ end
21
+ attr_reader :related_object
22
+ end
23
+
24
+ # Occurs when a claimable sandbox is expiring in 7 days.
25
+ class V2CoreClaimableSandboxExpiringEventNotification < Stripe::V2::Core::EventNotification
26
+ def self.lookup_type
27
+ "v2.core.claimable_sandbox.expiring"
28
+ end
29
+
30
+ attr_reader :related_object
31
+
32
+ # Retrieves the ClaimableSandbox related to this EventNotification from the Stripe API. Makes an API request on every call.
33
+ def fetch_related_object
34
+ resp = @client.raw_request(
35
+ :get,
36
+ related_object.url,
37
+ opts: { stripe_context: context, "Stripe-Request-Trigger": "event=#{id}" },
38
+ usage: ["fetch_related_object"]
39
+ )
40
+ @client.deserialize(resp.http_body, api_mode: Util.get_api_mode(related_object.url))
41
+ end
42
+ end
43
+ end
44
+ end
@@ -0,0 +1,44 @@
1
+ # File generated from our OpenAPI spec
2
+ # frozen_string_literal: true
3
+
4
+ module Stripe
5
+ module Events
6
+ # Occurs when a claimable sandbox object is updated.
7
+ class V2CoreClaimableSandboxUpdatedEvent < Stripe::V2::Core::Event
8
+ def self.lookup_type
9
+ "v2.core.claimable_sandbox.updated"
10
+ end
11
+
12
+ # Retrieves the related object from the API. Makes an API request on every call.
13
+ def fetch_related_object
14
+ _request(
15
+ method: :get,
16
+ path: related_object.url,
17
+ base_address: :api,
18
+ opts: { stripe_context: context, "Stripe-Request-Trigger": "event=#{id}" }
19
+ )
20
+ end
21
+ attr_reader :related_object
22
+ end
23
+
24
+ # Occurs when a claimable sandbox object is updated.
25
+ class V2CoreClaimableSandboxUpdatedEventNotification < Stripe::V2::Core::EventNotification
26
+ def self.lookup_type
27
+ "v2.core.claimable_sandbox.updated"
28
+ end
29
+
30
+ attr_reader :related_object
31
+
32
+ # Retrieves the ClaimableSandbox related to this EventNotification from the Stripe API. Makes an API request on every call.
33
+ def fetch_related_object
34
+ resp = @client.raw_request(
35
+ :get,
36
+ related_object.url,
37
+ opts: { stripe_context: context, "Stripe-Request-Trigger": "event=#{id}" },
38
+ usage: ["fetch_related_object"]
39
+ )
40
+ @client.deserialize(resp.http_body, api_mode: Util.get_api_mode(related_object.url))
41
+ end
42
+ end
43
+ end
44
+ end
@@ -184,6 +184,7 @@ module Stripe
184
184
  V2::Core::AccountPerson.object_name => V2::Core::AccountPerson,
185
185
  V2::Core::AccountPersonToken.object_name => V2::Core::AccountPersonToken,
186
186
  V2::Core::AccountToken.object_name => V2::Core::AccountToken,
187
+ V2::Core::ClaimableSandbox.object_name => V2::Core::ClaimableSandbox,
187
188
  V2::Core::Event.object_name => V2::Core::Event,
188
189
  V2::Core::EventDestination.object_name => V2::Core::EventDestination,
189
190
  V2::Core::Vault::GbBankAccount.object_name => V2::Core::Vault::GbBankAccount,
@@ -173,7 +173,7 @@ module Stripe
173
173
  attr_accessor :enabled
174
174
  # The list of up to 10 products that support subscription updates.
175
175
  attr_accessor :products
176
- # Determines how to handle prorations resulting from subscription updates. Valid values are `none`, `create_prorations`, and `always_invoice`.
176
+ # Determines how to handle prorations resulting from subscription updates. Valid values are `none`, `create_prorations`, and `always_invoice`. Defaults to `none`.
177
177
  attr_accessor :proration_behavior
178
178
  # Setting to control when an update should be scheduled at the end of the period instead of applying immediately.
179
179
  attr_accessor :schedule_at_period_end
@@ -173,7 +173,7 @@ module Stripe
173
173
  attr_accessor :enabled
174
174
  # The list of up to 10 products that support subscription updates.
175
175
  attr_accessor :products
176
- # Determines how to handle prorations resulting from subscription updates. Valid values are `none`, `create_prorations`, and `always_invoice`.
176
+ # Determines how to handle prorations resulting from subscription updates. Valid values are `none`, `create_prorations`, and `always_invoice`. If omitted, the proration behavior is unchanged.
177
177
  attr_accessor :proration_behavior
178
178
  # Setting to control when an update should be scheduled at the end of the period instead of applying immediately.
179
179
  attr_accessor :schedule_at_period_end
@@ -47,6 +47,12 @@ module Stripe
47
47
  @type = type
48
48
  end
49
49
  end
50
+ # Controls how much address information Checkout collects when [automatic_tax](https://stripe.com/docs/api/checkout/sessions/object#checkout_session_object-automatic_tax-enabled) is enabled.
51
+ #
52
+ # Defaults to `full`, which collects the address fields needed for the most accurate tax calculation. Set to `minimal` to collect only the fields required for tax in the buyer's country, accepting potentially less precise tax calculation in exchange for a streamlined form.
53
+ #
54
+ # Only honored when `automatic_tax.enabled` is `true`, `billing_address_collection` is `auto`, the resolved tax address source is the session billing address, and `ui_mode` is `form`.
55
+ attr_accessor :address_collection_precision
50
56
  # Set to `true` to [calculate tax automatically](https://docs.stripe.com/tax) using the customer's location.
51
57
  #
52
58
  # Enabling this parameter causes Checkout to collect any billing address information necessary for tax calculation.
@@ -54,7 +60,8 @@ module Stripe
54
60
  # The account that's liable for tax. If set, the business address and tax registrations required to perform the tax calculation are loaded from this account. The tax transaction is returned in the report of the connected account.
55
61
  attr_accessor :liability
56
62
 
57
- def initialize(enabled: nil, liability: nil)
63
+ def initialize(address_collection_precision: nil, enabled: nil, liability: nil)
64
+ @address_collection_precision = address_collection_precision
58
65
  @enabled = enabled
59
66
  @liability = liability
60
67
  end
@@ -4,7 +4,7 @@
4
4
  module Stripe
5
5
  class CouponCreateParams < ::Stripe::RequestParams
6
6
  class AppliesTo < ::Stripe::RequestParams
7
- # An array of Product IDs that this Coupon will apply to.
7
+ # An array of up to 100 Product IDs that this Coupon will apply to.
8
8
  attr_accessor :products
9
9
 
10
10
  def initialize(products: nil)
@@ -25,7 +25,7 @@ module Stripe
25
25
  class Filters < ::Stripe::RequestParams
26
26
  # Restricts the Session to subcategories of accounts that can be linked. Valid subcategories are: `checking`, `savings`, `mortgage`, `line_of_credit`, `credit_card`.
27
27
  attr_accessor :account_subcategories
28
- # Country from which to collect accounts.
28
+ # Country from which to collect accounts. Supported values are `US` and `CA`.
29
29
  attr_accessor :country
30
30
  # Whether the session should require payment method support and successful account number retrieval before completion.
31
31
  attr_accessor :require_payment_method_support