stripe 20.1.0.pre.alpha.3 → 20.1.0.pre.alpha.4
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_requestor.rb +35 -4
- data/lib/stripe/errors.rb +6 -0
- data/lib/stripe/event_types.rb +4 -0
- data/lib/stripe/events/v2_signals_account_signal_customer_risk_ready_event.rb +44 -0
- data/lib/stripe/object_types.rb +3 -0
- data/lib/stripe/params/account_create_params.rb +3 -3
- data/lib/stripe/params/checkout/session_create_params.rb +397 -3
- data/lib/stripe/params/checkout/session_update_params.rb +1 -1
- data/lib/stripe/params/invoice_create_preview_params.rb +2 -2
- data/lib/stripe/params/issuing/authorization_capture_params.rb +24 -44
- data/lib/stripe/params/issuing/authorization_create_params.rb +8 -0
- data/lib/stripe/params/issuing/transaction_create_force_capture_params.rb +24 -44
- data/lib/stripe/params/issuing/transaction_create_unlinked_refund_params.rb +0 -43
- data/lib/stripe/params/risk/form_retrieve_params.rb +15 -0
- data/lib/stripe/params/risk/form_update_params.rb +190 -0
- data/lib/stripe/params/subscription_schedule_update_params.rb +1 -1
- data/lib/stripe/params/test_helpers/issuing/authorization_capture_params.rb +24 -44
- data/lib/stripe/params/test_helpers/issuing/authorization_create_params.rb +8 -0
- data/lib/stripe/params/test_helpers/issuing/transaction_create_force_capture_params.rb +24 -44
- data/lib/stripe/params/test_helpers/issuing/transaction_create_unlinked_refund_params.rb +0 -43
- data/lib/stripe/params/v2/core/account_create_params.rb +288 -1
- data/lib/stripe/params/v2/core/account_update_params.rb +288 -1
- data/lib/stripe/params/v2/data/operation_search_params.rb +27 -0
- data/lib/stripe/params/v2/signals/account_activity_create_params.rb +65 -0
- data/lib/stripe/params/v2/signals/account_evaluation_create_params.rb +67 -1
- data/lib/stripe/params.rb +9 -0
- data/lib/stripe/resources/account_session.rb +56 -2
- data/lib/stripe/resources/billing/alert_notification.rb +1 -0
- data/lib/stripe/resources/billing_portal/configuration.rb +46 -0
- data/lib/stripe/resources/card.rb +2 -0
- data/lib/stripe/resources/checkout/session.rb +428 -5
- data/lib/stripe/resources/customer.rb +2 -2
- data/lib/stripe/resources/dispute.rb +1 -1
- data/lib/stripe/resources/financial_connections/account.rb +1 -1
- data/lib/stripe/resources/identity/verification_report.rb +1 -20
- data/lib/stripe/resources/invoice.rb +1 -1
- data/lib/stripe/resources/issuing/authorization.rb +20 -0
- data/lib/stripe/resources/order.rb +1 -1
- data/lib/stripe/resources/payment_link.rb +24 -1
- data/lib/stripe/resources/quote_preview_invoice.rb +3 -33
- data/lib/stripe/resources/quote_preview_subscription_schedule.rb +3 -0
- data/lib/stripe/resources/radar/payment_evaluation.rb +1 -1
- data/lib/stripe/resources/refund.rb +14 -0
- data/lib/stripe/resources/risk/form.rb +276 -0
- data/lib/stripe/resources/source.rb +1 -3
- data/lib/stripe/resources/source_mandate_notification.rb +1 -3
- data/lib/stripe/resources/tax/calculation.rb +1 -1
- data/lib/stripe/resources/tax/registration.rb +64 -0
- data/lib/stripe/resources/tax/transaction.rb +1 -1
- data/lib/stripe/resources/token.rb +2 -0
- data/lib/stripe/resources/treasury/credit_reversal.rb +2 -0
- data/lib/stripe/resources/treasury/debit_reversal.rb +2 -0
- data/lib/stripe/resources/treasury/financial_account.rb +2 -0
- data/lib/stripe/resources/treasury/inbound_transfer.rb +2 -0
- data/lib/stripe/resources/treasury/outbound_payment.rb +2 -0
- data/lib/stripe/resources/treasury/outbound_transfer.rb +2 -0
- data/lib/stripe/resources/treasury/received_credit.rb +8 -0
- data/lib/stripe/resources/treasury/received_debit.rb +2 -0
- data/lib/stripe/resources/treasury/transaction.rb +16 -0
- data/lib/stripe/resources/treasury/transaction_entry.rb +16 -0
- data/lib/stripe/resources/v2/core/account.rb +1866 -185
- data/lib/stripe/resources/v2/data/search_result_list.rb +382 -0
- data/lib/stripe/resources/v2/money_management/received_debit.rb +1 -1
- data/lib/stripe/resources/v2/signals/account_activity.rb +80 -0
- data/lib/stripe/resources/v2/signals/account_evaluation.rb +20 -0
- data/lib/stripe/resources/v2/signals/account_signal.rb +32 -0
- data/lib/stripe/resources.rb +12 -0
- data/lib/stripe/services/risk/form_service.rb +47 -0
- data/lib/stripe/services/risk_service.rb +13 -0
- data/lib/stripe/services/test_helpers/customer_service.rb +1 -1
- data/lib/stripe/services/v1_services.rb +2 -1
- data/lib/stripe/services/v2/data/operation_service.rb +22 -0
- data/lib/stripe/services/v2/data_service.rb +2 -1
- data/lib/stripe/services.rb +9 -0
- data/lib/stripe/stripe_client.rb +29 -4
- data/lib/stripe/stripe_event_notification_handler.rb +5 -1
- data/lib/stripe/stripe_service.rb +10 -0
- data/lib/stripe/util.rb +9 -2
- data/lib/stripe/v2_search_result_object.rb +62 -0
- data/lib/stripe/version.rb +1 -1
- data/lib/stripe/webhook.rb +1 -1
- data/lib/stripe/workload_identity_exchange.rb +242 -0
- data/lib/stripe.rb +2 -0
- data/rbi/stripe/stripe_client.rbi +13 -0
- data/rbi/stripe/workload_identity_exchange.rbi +21 -0
- data/rbi/stripe.rbi +5639 -879
- metadata +14 -2
checksums.yaml
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
---
|
|
2
2
|
SHA256:
|
|
3
|
-
metadata.gz:
|
|
4
|
-
data.tar.gz:
|
|
3
|
+
metadata.gz: d71cd26c3b7e58470fe45fd5b67a202423d14b1442b1eef7d438e7043224c330
|
|
4
|
+
data.tar.gz: 3f41a42dbdf2472269069de8bc6f240f2b5e1f720c626cf5ede531ae1dbf161d
|
|
5
5
|
SHA512:
|
|
6
|
-
metadata.gz:
|
|
7
|
-
data.tar.gz:
|
|
6
|
+
metadata.gz: 3a63b8dac31659ff1bad67b0a14ef7a12413700470995a1ba6f70c6fb942b9e327d2c334ac75e64af110ce24e32283bc80b805a1a3c8e0f58780520df396d399
|
|
7
|
+
data.tar.gz: d79e658cd191c1f2fd2cb46716710cc6edd9504758aa7f8bc7dcb7a985f2d2111b71c2b8e5506a9d624973ce195d3bebf6508cdfd2d6fd836d1d37c16f3a9630
|
data/lib/stripe/api_requestor.rb
CHANGED
|
@@ -490,7 +490,12 @@ module Stripe
|
|
|
490
490
|
|
|
491
491
|
api_key ||= opts[:api_key]
|
|
492
492
|
|
|
493
|
-
|
|
493
|
+
if config.authenticator && config.api_key
|
|
494
|
+
raise AuthenticationError,
|
|
495
|
+
"Can't specify both api_key and authenticator."
|
|
496
|
+
end
|
|
497
|
+
|
|
498
|
+
check_api_key!(api_key) if api_key || !config.authenticator
|
|
494
499
|
|
|
495
500
|
body_params = nil
|
|
496
501
|
query_params = nil
|
|
@@ -507,6 +512,8 @@ module Stripe
|
|
|
507
512
|
headers = request_headers(method, api_mode, opts)
|
|
508
513
|
url = api_url(path, base_url)
|
|
509
514
|
|
|
515
|
+
auth_overridden = opts[:api_key] || opts[:headers]&.key?("Authorization")
|
|
516
|
+
|
|
510
517
|
# Merge given query parameters with any already encoded in the path.
|
|
511
518
|
query = query_params ? Util.encode_parameters(query_params, api_mode) : nil
|
|
512
519
|
|
|
@@ -541,7 +548,7 @@ module Stripe
|
|
|
541
548
|
end
|
|
542
549
|
|
|
543
550
|
http_resp =
|
|
544
|
-
execute_request_with_rescues(base_url, headers, api_mode, usage, context) do
|
|
551
|
+
execute_request_with_rescues(base_url, headers, api_mode, usage, context, auth_overridden) do
|
|
545
552
|
self.class
|
|
546
553
|
.default_connection_manager(config)
|
|
547
554
|
.execute_request(method, url,
|
|
@@ -621,8 +628,13 @@ module Stripe
|
|
|
621
628
|
http_status >= 400
|
|
622
629
|
end
|
|
623
630
|
|
|
624
|
-
private def execute_request_with_rescues(base_url, headers, api_mode, usage, context)
|
|
631
|
+
private def execute_request_with_rescues(base_url, headers, api_mode, usage, context, auth_overridden)
|
|
625
632
|
num_retries = 0
|
|
633
|
+
auth_replayed = false
|
|
634
|
+
workload_credentials =
|
|
635
|
+
if !auth_overridden && config.authenticator.is_a?(WorkloadIdentity::Authenticator)
|
|
636
|
+
config.authenticator.credentials
|
|
637
|
+
end
|
|
626
638
|
|
|
627
639
|
begin
|
|
628
640
|
request_start = nil
|
|
@@ -670,6 +682,13 @@ module Stripe
|
|
|
670
682
|
notify_request_end(context, request_duration, http_status, num_retries,
|
|
671
683
|
user_data, resp, headers)
|
|
672
684
|
|
|
685
|
+
if workload_credentials && !auth_replayed && e.is_a?(AuthenticationError) && e.http_status == 401
|
|
686
|
+
auth_replayed = true
|
|
687
|
+
workload_credentials.refresh_token(WorkloadIdentity.extract_bearer_token(headers["Authorization"]))
|
|
688
|
+
headers["Authorization"] = config.authenticator.call
|
|
689
|
+
retry
|
|
690
|
+
end
|
|
691
|
+
|
|
673
692
|
if self.class.should_retry?(e,
|
|
674
693
|
num_retries: num_retries,
|
|
675
694
|
config: config)
|
|
@@ -1018,6 +1037,18 @@ module Stripe
|
|
|
1018
1037
|
message + "\n\n(Network error: #{error.message})"
|
|
1019
1038
|
end
|
|
1020
1039
|
|
|
1040
|
+
private def build_authorization_header(req_opts)
|
|
1041
|
+
return req_opts[:headers]["Authorization"] if req_opts[:headers]&.key?("Authorization")
|
|
1042
|
+
return "Bearer #{req_opts[:api_key]}" if req_opts[:api_key] || !config.authenticator
|
|
1043
|
+
|
|
1044
|
+
value = config.authenticator.call
|
|
1045
|
+
unless value.is_a?(String) && !value.empty?
|
|
1046
|
+
raise AuthenticationError, "The configured authenticator did not return a usable Authorization " \
|
|
1047
|
+
"header value."
|
|
1048
|
+
end
|
|
1049
|
+
value
|
|
1050
|
+
end
|
|
1051
|
+
|
|
1021
1052
|
private def request_headers(method, api_mode, req_opts)
|
|
1022
1053
|
user_agent = "Stripe/#{api_mode} RubyBindings/#{Stripe::VERSION}"
|
|
1023
1054
|
user_agent += " " + format_app_info(Stripe.app_info) unless Stripe.app_info.nil?
|
|
@@ -1027,7 +1058,7 @@ module Stripe
|
|
|
1027
1058
|
|
|
1028
1059
|
headers = {
|
|
1029
1060
|
"User-Agent" => user_agent,
|
|
1030
|
-
"Authorization" =>
|
|
1061
|
+
"Authorization" => build_authorization_header(req_opts),
|
|
1031
1062
|
}
|
|
1032
1063
|
|
|
1033
1064
|
if config.enable_telemetry?
|
data/lib/stripe/errors.rb
CHANGED
|
@@ -49,6 +49,12 @@ module Stripe
|
|
|
49
49
|
class APIConnectionError < StripeError
|
|
50
50
|
end
|
|
51
51
|
|
|
52
|
+
# WorkloadIdentityError is raised when workload identity authentication
|
|
53
|
+
# fails, for example because the identity provider couldn't produce an
|
|
54
|
+
# assertion or the token exchange was rejected
|
|
55
|
+
class WorkloadIdentityError < StripeError
|
|
56
|
+
end
|
|
57
|
+
|
|
52
58
|
# APIError is a generic error that may be raised in cases where none of the
|
|
53
59
|
# other named errors cover the problem. It could also be raised in the case
|
|
54
60
|
# that a new error has been introduced in the API, but this version of the
|
data/lib/stripe/event_types.rb
CHANGED
|
@@ -744,6 +744,8 @@ module Stripe
|
|
|
744
744
|
Events::V2ReportingReportRunUpdatedEvent.lookup_type => Events::V2ReportingReportRunUpdatedEvent,
|
|
745
745
|
Events::V2SignalsAccountEvaluationCompleteEvent.lookup_type =>
|
|
746
746
|
Events::V2SignalsAccountEvaluationCompleteEvent,
|
|
747
|
+
Events::V2SignalsAccountSignalCustomerRiskReadyEvent.lookup_type =>
|
|
748
|
+
Events::V2SignalsAccountSignalCustomerRiskReadyEvent,
|
|
747
749
|
Events::V2SignalsAccountSignalFraudulentMerchantReadyEvent.lookup_type =>
|
|
748
750
|
Events::V2SignalsAccountSignalFraudulentMerchantReadyEvent,
|
|
749
751
|
Events::V2SignalsAccountSignalFraudulentWebsiteReadyEvent.lookup_type =>
|
|
@@ -1645,6 +1647,8 @@ module Stripe
|
|
|
1645
1647
|
Events::V2ReportingReportRunUpdatedEventNotification,
|
|
1646
1648
|
Events::V2SignalsAccountEvaluationCompleteEventNotification.lookup_type =>
|
|
1647
1649
|
Events::V2SignalsAccountEvaluationCompleteEventNotification,
|
|
1650
|
+
Events::V2SignalsAccountSignalCustomerRiskReadyEventNotification.lookup_type =>
|
|
1651
|
+
Events::V2SignalsAccountSignalCustomerRiskReadyEventNotification,
|
|
1648
1652
|
Events::V2SignalsAccountSignalFraudulentMerchantReadyEventNotification.lookup_type =>
|
|
1649
1653
|
Events::V2SignalsAccountSignalFraudulentMerchantReadyEventNotification,
|
|
1650
1654
|
Events::V2SignalsAccountSignalFraudulentWebsiteReadyEventNotification.lookup_type =>
|
|
@@ -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 customer's risk level changes and a new customer risk signal is ready.
|
|
7
|
+
class V2SignalsAccountSignalCustomerRiskReadyEvent < Stripe::V2::Core::Event
|
|
8
|
+
def self.lookup_type
|
|
9
|
+
"v2.signals.account_signal.customer_risk_ready"
|
|
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 customer's risk level changes and a new customer risk signal is ready.
|
|
25
|
+
class V2SignalsAccountSignalCustomerRiskReadyEventNotification < Stripe::V2::Core::EventNotification
|
|
26
|
+
def self.lookup_type
|
|
27
|
+
"v2.signals.account_signal.customer_risk_ready"
|
|
28
|
+
end
|
|
29
|
+
|
|
30
|
+
attr_reader :related_object
|
|
31
|
+
|
|
32
|
+
# Retrieves the AccountSignal 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
|
data/lib/stripe/object_types.rb
CHANGED
|
@@ -171,6 +171,7 @@ module Stripe
|
|
|
171
171
|
Reserve::Release.object_name => Reserve::Release,
|
|
172
172
|
ReserveTransaction.object_name => ReserveTransaction,
|
|
173
173
|
Review.object_name => Review,
|
|
174
|
+
Risk::Form.object_name => Risk::Form,
|
|
174
175
|
RiskSignals.object_name => RiskSignals,
|
|
175
176
|
SetupAttempt.object_name => SetupAttempt,
|
|
176
177
|
SetupIntent.object_name => SetupIntent,
|
|
@@ -230,6 +231,7 @@ module Stripe
|
|
|
230
231
|
def self.v2_object_names_to_classes
|
|
231
232
|
{
|
|
232
233
|
V2::ListObject.object_name => V2::ListObject,
|
|
234
|
+
V2::SearchResultObject.object_name => V2::SearchResultObject,
|
|
233
235
|
|
|
234
236
|
# v2 object classes: The beginning of the section generated from our OpenAPI spec
|
|
235
237
|
V2::Billing::BillSetting.object_name => V2::Billing::BillSetting,
|
|
@@ -290,6 +292,7 @@ module Stripe
|
|
|
290
292
|
V2::Data::ReportRun.object_name => V2::Data::ReportRun,
|
|
291
293
|
V2::Data::Reporting::QueryRun.object_name => V2::Data::Reporting::QueryRun,
|
|
292
294
|
V2::Data::Schema.object_name => V2::Data::Schema,
|
|
295
|
+
V2::Data::SearchResultList.object_name => V2::Data::SearchResultList,
|
|
293
296
|
V2::Extend::Workflow.object_name => V2::Extend::Workflow,
|
|
294
297
|
V2::Extend::WorkflowRun.object_name => V2::Extend::WorkflowRun,
|
|
295
298
|
V2::Iam::ActivityLog.object_name => V2::Iam::ActivityLog,
|
|
@@ -1691,7 +1691,7 @@ module Stripe
|
|
|
1691
1691
|
end
|
|
1692
1692
|
|
|
1693
1693
|
class Fees < ::Stripe::RequestParams
|
|
1694
|
-
#
|
|
1694
|
+
# Controls who pays Stripe fees for direct charges and other pricing-control-eligible Stripe products. Setting `controller.losses.payments=application` requires `controller.fees.payer=application`. For destination charges and separate charges and transfers, Stripe bills the platform regardless of this setting. Defaults to `account`. Learn more about [fee behavior on connected accounts](https://docs.stripe.com/connect/direct-charges-fee-payer-behavior), including application fees and pricing considerations.
|
|
1695
1695
|
attr_accessor :payer
|
|
1696
1696
|
|
|
1697
1697
|
def initialize(payer: nil)
|
|
@@ -1700,7 +1700,7 @@ module Stripe
|
|
|
1700
1700
|
end
|
|
1701
1701
|
|
|
1702
1702
|
class Losses < ::Stripe::RequestParams
|
|
1703
|
-
#
|
|
1703
|
+
# Controls who is responsible for payment-related negative balances on this account. The platform remains liable for negative balances on its own account. To use Stripe negative balance liability, your integration must meet [Managed Risk requirements](https://docs.stripe.com/connect/risk-management/managed-risk). Defaults to `stripe`.
|
|
1704
1704
|
attr_accessor :payments
|
|
1705
1705
|
|
|
1706
1706
|
def initialize(payments: nil)
|
|
@@ -2687,7 +2687,7 @@ module Stripe
|
|
|
2687
2687
|
attr_accessor :capabilities
|
|
2688
2688
|
# Information about the company or business. This field is available for any `business_type`. Once you create an [Account Link](/api/account_links) or [Account Session](/api/account_sessions), this property can only be updated for accounts where [controller.requirement_collection](/api/accounts/object#account_object-controller-requirement_collection) is `application`, which includes Custom accounts.
|
|
2689
2689
|
attr_accessor :company
|
|
2690
|
-
#
|
|
2690
|
+
# Configures the account's Dashboard access, loss liability, requirements collection, and Stripe fee responsibility.
|
|
2691
2691
|
attr_accessor :controller
|
|
2692
2692
|
# The country in which the account holder resides, or in which the business is legally established. This should be an ISO 3166-1 alpha-2 country code. For example, if you are in the United States and the business for which you're creating an account is legally represented in Canada, you would use `CA` as the country for the account being created. Available countries include [Stripe's global markets](https://stripe.com/global) as well as countries where [cross-border payouts](https://stripe.com/docs/connect/cross-border-payouts) are supported.
|
|
2693
2693
|
attr_accessor :country
|