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.
- checksums.yaml +4 -4
- data/lib/stripe/api_operations/request.rb +16 -7
- data/lib/stripe/api_operations/save.rb +4 -4
- data/lib/stripe/api_requestor.rb +54 -34
- data/lib/stripe/api_resource.rb +1 -2
- data/lib/stripe/api_version.rb +1 -1
- data/lib/stripe/connection_manager.rb +3 -0
- data/lib/stripe/event_types.rb +20 -0
- data/lib/stripe/events/v2_core_account_closed_event.rb +2 -2
- data/lib/stripe/events/v2_core_account_including_defaults_updated_event.rb +2 -2
- data/lib/stripe/events/v2_core_claimable_sandbox_claimed_event.rb +44 -0
- data/lib/stripe/events/v2_core_claimable_sandbox_created_event.rb +44 -0
- data/lib/stripe/events/v2_core_claimable_sandbox_expired_event.rb +44 -0
- data/lib/stripe/events/v2_core_claimable_sandbox_expiring_event.rb +44 -0
- data/lib/stripe/events/v2_core_claimable_sandbox_updated_event.rb +44 -0
- data/lib/stripe/object_types.rb +1 -0
- data/lib/stripe/params/billing_portal/configuration_create_params.rb +1 -1
- data/lib/stripe/params/billing_portal/configuration_update_params.rb +1 -1
- data/lib/stripe/params/checkout/session_create_params.rb +8 -1
- data/lib/stripe/params/coupon_create_params.rb +1 -1
- data/lib/stripe/params/financial_connections/session_create_params.rb +1 -1
- data/lib/stripe/params/invoice_item_create_params.rb +1 -1
- data/lib/stripe/params/payment_intent_capture_params.rb +663 -1
- data/lib/stripe/params/payment_intent_confirm_params.rb +663 -1
- data/lib/stripe/params/payment_intent_create_params.rb +664 -2
- data/lib/stripe/params/payment_intent_update_params.rb +664 -2
- data/lib/stripe/params/payment_link_update_params.rb +4 -0
- data/lib/stripe/params/product_create_params.rb +4 -1
- data/lib/stripe/params/product_update_params.rb +4 -1
- data/lib/stripe/params/quote_create_params.rb +1 -1
- data/lib/stripe/params/quote_update_params.rb +1 -1
- data/lib/stripe/params/reporting/report_run_create_params.rb +4 -0
- data/lib/stripe/params/tax/registration_create_params.rb +13 -1
- data/lib/stripe/params/test_helpers/treasury/inbound_transfer_fail_params.rb +23 -1
- data/lib/stripe/params/test_helpers/treasury/inbound_transfer_return_inbound_transfer_params.rb +34 -1
- data/lib/stripe/params/treasury/inbound_transfer_fail_params.rb +23 -1
- data/lib/stripe/params/treasury/inbound_transfer_return_inbound_transfer_params.rb +34 -1
- data/lib/stripe/params/v2/core/account_create_params.rb +138 -4
- data/lib/stripe/params/v2/core/account_link_create_params.rb +19 -1
- data/lib/stripe/params/v2/core/account_update_params.rb +138 -4
- data/lib/stripe/params/v2/core/claimable_sandbox_create_params.rb +63 -0
- data/lib/stripe/params/v2/core/claimable_sandbox_renew_onboarding_link_params.rb +32 -0
- data/lib/stripe/params/v2/core/claimable_sandbox_retrieve_params.rb +17 -0
- data/lib/stripe/params/v2/money_management/financial_account_list_params.rb +1 -1
- data/lib/stripe/params/v2/money_management/financial_address_create_params.rb +2 -2
- data/lib/stripe/params.rb +7 -0
- data/lib/stripe/request_options.rb +19 -2
- data/lib/stripe/resources/apps/install.rb +2 -2
- data/lib/stripe/resources/balance_transaction.rb +1 -1
- data/lib/stripe/resources/charge.rb +274 -5
- data/lib/stripe/resources/checkout/session.rb +4 -0
- data/lib/stripe/resources/confirmation_token.rb +2 -2
- data/lib/stripe/resources/coupon.rb +6 -3
- data/lib/stripe/resources/dispute.rb +1 -1
- data/lib/stripe/resources/event.rb +2 -2
- data/lib/stripe/resources/issuing/card.rb +1 -1
- data/lib/stripe/resources/payment_attempt_record.rb +4 -1
- data/lib/stripe/resources/payment_intent.rb +575 -2
- data/lib/stripe/resources/payment_method.rb +2 -2
- data/lib/stripe/resources/payment_record.rb +4 -1
- data/lib/stripe/resources/product.rb +2 -0
- data/lib/stripe/resources/radar/payment_evaluation.rb +1 -1
- data/lib/stripe/resources/refund.rb +38 -0
- data/lib/stripe/resources/reporting/report_run.rb +2 -0
- data/lib/stripe/resources/reserve/hold.rb +1 -1
- data/lib/stripe/resources/setup_attempt.rb +2 -2
- data/lib/stripe/resources/setup_intent.rb +1 -1
- data/lib/stripe/resources/tax/registration.rb +16 -1
- data/lib/stripe/resources/treasury/inbound_transfer.rb +35 -7
- data/lib/stripe/resources/treasury/outbound_payment.rb +37 -9
- data/lib/stripe/resources/treasury/outbound_transfer.rb +37 -9
- data/lib/stripe/resources/treasury/received_credit.rb +1 -1
- data/lib/stripe/resources/treasury/received_debit.rb +1 -1
- data/lib/stripe/resources/v2/core/account.rb +246 -3
- data/lib/stripe/resources/v2/core/account_link.rb +18 -1
- data/lib/stripe/resources/v2/core/account_person_token.rb +2 -0
- data/lib/stripe/resources/v2/core/account_token.rb +3 -1
- data/lib/stripe/resources/v2/core/claimable_sandbox.rb +269 -0
- data/lib/stripe/resources/v2/core/event_base.rb +8 -25
- data/lib/stripe/resources/v2/core/event_notification.rb +32 -0
- data/lib/stripe/resources.rb +17 -0
- data/lib/stripe/services/apps/install_service.rb +2 -2
- data/lib/stripe/services/checkout/session_service.rb +2 -0
- data/lib/stripe/services/event_service.rb +1 -1
- data/lib/stripe/services/test_helpers/treasury/inbound_transfer_service.rb +3 -3
- data/lib/stripe/services/test_helpers/treasury/outbound_payment_service.rb +4 -4
- data/lib/stripe/services/test_helpers/treasury/outbound_transfer_service.rb +4 -4
- data/lib/stripe/services/test_helpers/treasury/received_credit_service.rb +1 -1
- data/lib/stripe/services/test_helpers/treasury/received_debit_service.rb +1 -1
- data/lib/stripe/services/v2/core/account_link_service.rb +1 -1
- data/lib/stripe/services/v2/core/account_token_service.rb +2 -2
- data/lib/stripe/services/v2/core/accounts/person_token_service.rb +2 -1
- data/lib/stripe/services/v2/core/claimable_sandbox_service.rb +49 -0
- data/lib/stripe/services/v2/core_service.rb +2 -1
- data/lib/stripe/services.rb +2 -0
- data/lib/stripe/stripe_client.rb +6 -0
- data/lib/stripe/stripe_configuration.rb +9 -2
- data/lib/stripe/stripe_event_notification_handler.rb +26 -0
- data/lib/stripe/stripe_object.rb +22 -9
- data/lib/stripe/version.rb +1 -1
- data/rbi/stripe.rbi +6888 -221
- metadata +12 -2
data/lib/stripe/services.rb
CHANGED
|
@@ -278,6 +278,7 @@ module Stripe
|
|
|
278
278
|
autoload :AccountLinkService, "stripe/services/v2/core/account_link_service"
|
|
279
279
|
autoload :AccountService, "stripe/services/v2/core/account_service"
|
|
280
280
|
autoload :AccountTokenService, "stripe/services/v2/core/account_token_service"
|
|
281
|
+
autoload :ClaimableSandboxService, "stripe/services/v2/core/claimable_sandbox_service"
|
|
281
282
|
autoload :EventDestinationService, "stripe/services/v2/core/event_destination_service"
|
|
282
283
|
autoload :EventService, "stripe/services/v2/core/event_service"
|
|
283
284
|
autoload :VaultService, "stripe/services/v2/core/vault_service"
|
|
@@ -517,6 +518,7 @@ module Stripe
|
|
|
517
518
|
stripe/services/v2/core/account_token_service
|
|
518
519
|
stripe/services/v2/core/accounts/person_service
|
|
519
520
|
stripe/services/v2/core/accounts/person_token_service
|
|
521
|
+
stripe/services/v2/core/claimable_sandbox_service
|
|
520
522
|
stripe/services/v2/core/event_destination_service
|
|
521
523
|
stripe/services/v2/core/event_service
|
|
522
524
|
stripe/services/v2/core/vault/gb_bank_account_service
|
data/lib/stripe/stripe_client.rb
CHANGED
|
@@ -136,6 +136,12 @@ module Stripe
|
|
|
136
136
|
)
|
|
137
137
|
end
|
|
138
138
|
|
|
139
|
+
# The default inspect renders every instance variable, which would
|
|
140
|
+
# include the API key held by the requestor's configuration.
|
|
141
|
+
def inspect
|
|
142
|
+
"#<#{self.class}:0x#{object_id.to_s(16)}>"
|
|
143
|
+
end
|
|
144
|
+
|
|
139
145
|
def notification_handler(webhook_secret, &fallback_callback)
|
|
140
146
|
::Stripe::StripeEventNotificationHandler.new(self, webhook_secret, &fallback_callback)
|
|
141
147
|
end
|
|
@@ -86,6 +86,12 @@ module Stripe
|
|
|
86
86
|
meter_events: @meter_events_base, }
|
|
87
87
|
end
|
|
88
88
|
|
|
89
|
+
# The default inspect renders every instance variable, which would
|
|
90
|
+
# include the API key and any proxy credentials.
|
|
91
|
+
def inspect
|
|
92
|
+
"#<#{self.class}:0x#{object_id.to_s(16)}>"
|
|
93
|
+
end
|
|
94
|
+
|
|
89
95
|
def log_level=(val)
|
|
90
96
|
# Backwards compatibility for values that we briefly allowed
|
|
91
97
|
if val == "debug"
|
|
@@ -199,10 +205,11 @@ module Stripe
|
|
|
199
205
|
enable_telemetry
|
|
200
206
|
end
|
|
201
207
|
|
|
202
|
-
#
|
|
203
|
-
#
|
|
208
|
+
# Identifies connection configuration, excluding authorization selectors
|
|
209
|
+
# that are sent in headers on each request.
|
|
204
210
|
def key
|
|
205
211
|
instance_variables
|
|
212
|
+
.reject { |variable| %i[@stripe_account @stripe_context].include?(variable) }
|
|
206
213
|
.collect { |variable| instance_variable_get(variable) }
|
|
207
214
|
.join
|
|
208
215
|
end
|
|
@@ -22,6 +22,12 @@ module Stripe
|
|
|
22
22
|
@pre_handle_callback = nil
|
|
23
23
|
end
|
|
24
24
|
|
|
25
|
+
# The default inspect renders every instance variable, which would
|
|
26
|
+
# include the client's API key and the webhook secret.
|
|
27
|
+
def inspect
|
|
28
|
+
"#<#{self.class}:0x#{object_id.to_s(16)}>"
|
|
29
|
+
end
|
|
30
|
+
|
|
25
31
|
def registered_event_types
|
|
26
32
|
@registered_handlers.keys.sort
|
|
27
33
|
end
|
|
@@ -1243,6 +1249,26 @@ module Stripe
|
|
|
1243
1249
|
register("v2.core.account_person.updated", &callback)
|
|
1244
1250
|
end
|
|
1245
1251
|
|
|
1252
|
+
def on_v2_core_claimable_sandbox_claimed(&callback)
|
|
1253
|
+
register("v2.core.claimable_sandbox.claimed", &callback)
|
|
1254
|
+
end
|
|
1255
|
+
|
|
1256
|
+
def on_v2_core_claimable_sandbox_created(&callback)
|
|
1257
|
+
register("v2.core.claimable_sandbox.created", &callback)
|
|
1258
|
+
end
|
|
1259
|
+
|
|
1260
|
+
def on_v2_core_claimable_sandbox_expired(&callback)
|
|
1261
|
+
register("v2.core.claimable_sandbox.expired", &callback)
|
|
1262
|
+
end
|
|
1263
|
+
|
|
1264
|
+
def on_v2_core_claimable_sandbox_expiring(&callback)
|
|
1265
|
+
register("v2.core.claimable_sandbox.expiring", &callback)
|
|
1266
|
+
end
|
|
1267
|
+
|
|
1268
|
+
def on_v2_core_claimable_sandbox_updated(&callback)
|
|
1269
|
+
register("v2.core.claimable_sandbox.updated", &callback)
|
|
1270
|
+
end
|
|
1271
|
+
|
|
1246
1272
|
def on_v2_core_event_destination_ping(&callback)
|
|
1247
1273
|
register("v2.core.event_destination.ping", &callback)
|
|
1248
1274
|
end
|
data/lib/stripe/stripe_object.rb
CHANGED
|
@@ -77,7 +77,7 @@ module Stripe
|
|
|
77
77
|
def initialize(id = nil, opts = {}, api_mode = :v1, requestor = nil)
|
|
78
78
|
@api_mode = api_mode
|
|
79
79
|
id, @retrieve_params = Util.normalize_id(id)
|
|
80
|
-
@opts = Util.normalize_opts(opts)
|
|
80
|
+
@opts = RequestOptions.snapshot_authorization_selectors(Util.normalize_opts(opts))
|
|
81
81
|
@original_values = {}
|
|
82
82
|
@values = {}
|
|
83
83
|
# This really belongs in APIResource, but not putting it there allows us
|
|
@@ -92,9 +92,11 @@ module Stripe
|
|
|
92
92
|
|
|
93
93
|
def self.construct_from(values, opts = {}, last_response = nil, api_mode = :v1, requestor = nil)
|
|
94
94
|
values = Stripe::Util.symbolize_names(values)
|
|
95
|
+
requestor ||= APIRequestor.active_requestor
|
|
95
96
|
|
|
96
97
|
# work around protected #initialize_from for now
|
|
97
|
-
new(values[:id]).send(:initialize_from, values, opts, last_response,
|
|
98
|
+
new(values[:id], opts, api_mode, requestor).send(:initialize_from, values, opts, last_response,
|
|
99
|
+
api_mode: api_mode, requestor: requestor)
|
|
98
100
|
end
|
|
99
101
|
|
|
100
102
|
# Determines the equality of two Stripe objects. Stripe objects are
|
|
@@ -257,19 +259,25 @@ module Stripe
|
|
|
257
259
|
# TODO: (major) Remove the :client option. This is not explicitly supported as a user-specified option.
|
|
258
260
|
opts.delete(:client)
|
|
259
261
|
|
|
262
|
+
scope = RequestOptions.authorization_scope(@requestor.config, opts)
|
|
263
|
+
|
|
260
264
|
# Serialized objects often land in caches and queues that aren't
|
|
261
265
|
# protected like secrets, so never write the API key out. Nested
|
|
262
266
|
# StripeObjects are dumped through this method too.
|
|
263
267
|
opts[:api_key] = RequestOptions::API_KEY_SERIALIZATION_CONSTANT
|
|
264
|
-
[@values, opts]
|
|
268
|
+
[@values, opts, scope, @api_mode]
|
|
265
269
|
end
|
|
266
270
|
|
|
267
271
|
# Implements custom decoding for Ruby's Marshal. Consumes data that's
|
|
268
272
|
# produced by #marshal_dump.
|
|
269
273
|
def marshal_load(data, api_mode: :v1)
|
|
270
|
-
values, opts = data
|
|
271
|
-
|
|
272
|
-
|
|
274
|
+
values, opts, scope, stored_api_mode = data
|
|
275
|
+
api_mode = stored_api_mode || api_mode
|
|
276
|
+
requestor = APIRequestor.active_requestor
|
|
277
|
+
# Older cache entries lack scope metadata and retain their legacy binding.
|
|
278
|
+
requestor = requestor.with_authorization_scope(scope) if scope
|
|
279
|
+
initialize(values[:id], {}, api_mode, requestor)
|
|
280
|
+
initialize_from(values, opts, api_mode: api_mode, requestor: requestor)
|
|
273
281
|
end
|
|
274
282
|
|
|
275
283
|
# Implements custom encoding for YAML (Psych). Without it, Psych dumps
|
|
@@ -553,12 +561,17 @@ module Stripe
|
|
|
553
561
|
# * +:opts:+ Options for StripeObject like an API key.
|
|
554
562
|
# * +:partial:+ Indicates that the re-initialization should not attempt to
|
|
555
563
|
# remove accessors.
|
|
556
|
-
protected def initialize_from(values, opts, last_response = nil, api_mode:, requestor:
|
|
564
|
+
protected def initialize_from(values, opts, last_response = nil, api_mode:, requestor:)
|
|
565
|
+
raise ArgumentError, "requestor must not be nil" if requestor.nil?
|
|
566
|
+
|
|
557
567
|
@api_mode = api_mode
|
|
558
568
|
@last_response = last_response
|
|
569
|
+
@opts = RequestOptions.snapshot_authorization_selectors(Util.normalize_opts(opts))
|
|
559
570
|
@requestor = requestor
|
|
560
|
-
|
|
561
|
-
|
|
571
|
+
if requestor.is_a?(APIRequestor)
|
|
572
|
+
scope = RequestOptions.authorization_scope(requestor.config, @opts)
|
|
573
|
+
@requestor = requestor.with_authorization_scope(scope)
|
|
574
|
+
end
|
|
562
575
|
|
|
563
576
|
# the `#send` is here so that we can keep this method private
|
|
564
577
|
@original_values = self.class.send(:deep_copy, values, api_mode: api_mode)
|
data/lib/stripe/version.rb
CHANGED