stripe 5.1.0 → 5.55.0
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/CHANGELOG.md +241 -17
- data/CODE_OF_CONDUCT.md +77 -0
- data/Gemfile +9 -5
- data/Makefile +7 -0
- data/README.md +105 -37
- data/VERSION +1 -1
- data/lib/stripe/api_operations/create.rb +1 -1
- data/lib/stripe/api_operations/delete.rb +7 -3
- data/lib/stripe/api_operations/list.rb +1 -6
- data/lib/stripe/api_operations/nested_resource.rb +29 -26
- data/lib/stripe/api_operations/request.rb +82 -6
- data/lib/stripe/api_operations/save.rb +7 -4
- data/lib/stripe/api_operations/search.rb +19 -0
- data/lib/stripe/api_resource.rb +13 -19
- data/lib/stripe/api_resource_test_helpers.rb +47 -0
- data/lib/stripe/connection_manager.rb +85 -26
- data/lib/stripe/error_object.rb +2 -3
- data/lib/stripe/errors.rb +9 -1
- data/lib/stripe/instrumentation.rb +84 -0
- data/lib/stripe/list_object.rb +32 -4
- data/lib/stripe/oauth.rb +8 -6
- data/lib/stripe/object_types.rb +26 -1
- data/lib/stripe/resources/account.rb +5 -9
- data/lib/stripe/resources/account_link.rb +1 -0
- data/lib/stripe/resources/apple_pay_domain.rb +1 -0
- data/lib/stripe/resources/application_fee.rb +1 -0
- data/lib/stripe/resources/application_fee_refund.rb +2 -1
- data/lib/stripe/resources/balance.rb +1 -0
- data/lib/stripe/resources/balance_transaction.rb +1 -0
- data/lib/stripe/resources/bank_account.rb +2 -1
- data/lib/stripe/resources/billing_portal/configuration.rb +14 -0
- data/lib/stripe/resources/billing_portal/session.rb +12 -0
- data/lib/stripe/resources/bitcoin_receiver.rb +1 -0
- data/lib/stripe/resources/bitcoin_transaction.rb +3 -2
- data/lib/stripe/resources/capability.rb +2 -1
- data/lib/stripe/resources/card.rb +1 -0
- data/lib/stripe/resources/cash_balance.rb +22 -0
- data/lib/stripe/resources/charge.rb +10 -0
- data/lib/stripe/resources/checkout/session.rb +16 -0
- data/lib/stripe/resources/country_spec.rb +1 -0
- data/lib/stripe/resources/coupon.rb +1 -0
- data/lib/stripe/resources/credit_note.rb +11 -0
- data/lib/stripe/resources/credit_note_line_item.rb +8 -0
- data/lib/stripe/resources/customer.rb +41 -2
- data/lib/stripe/resources/customer_balance_transaction.rb +3 -2
- data/lib/stripe/resources/discount.rb +1 -0
- data/lib/stripe/resources/dispute.rb +1 -0
- data/lib/stripe/resources/ephemeral_key.rb +1 -0
- data/lib/stripe/resources/event.rb +1 -0
- data/lib/stripe/resources/exchange_rate.rb +1 -0
- data/lib/stripe/resources/file.rb +3 -1
- data/lib/stripe/resources/file_link.rb +1 -0
- data/lib/stripe/resources/financial_connections/account.rb +31 -0
- data/lib/stripe/resources/financial_connections/account_owner.rb +10 -0
- data/lib/stripe/resources/financial_connections/account_ownership.rb +10 -0
- data/lib/stripe/resources/financial_connections/session.rb +12 -0
- data/lib/stripe/resources/funding_instructions.rb +16 -0
- data/lib/stripe/resources/identity/verification_report.rb +12 -0
- data/lib/stripe/resources/identity/verification_session.rb +35 -0
- data/lib/stripe/resources/invoice.rb +12 -2
- data/lib/stripe/resources/invoice_item.rb +1 -0
- data/lib/stripe/resources/invoice_line_item.rb +1 -0
- data/lib/stripe/resources/issuing/authorization.rb +1 -0
- data/lib/stripe/resources/issuing/card.rb +1 -0
- data/lib/stripe/resources/issuing/card_details.rb +2 -1
- data/lib/stripe/resources/issuing/cardholder.rb +1 -0
- data/lib/stripe/resources/issuing/dispute.rb +12 -0
- data/lib/stripe/resources/issuing/transaction.rb +1 -0
- data/lib/stripe/resources/line_item.rb +8 -0
- data/lib/stripe/resources/login_link.rb +1 -0
- data/lib/stripe/resources/mandate.rb +8 -0
- data/lib/stripe/resources/order.rb +1 -0
- data/lib/stripe/resources/order_return.rb +1 -0
- data/lib/stripe/resources/payment_intent.rb +40 -0
- data/lib/stripe/resources/payment_link.rb +23 -0
- data/lib/stripe/resources/payment_method.rb +1 -0
- data/lib/stripe/resources/payout.rb +11 -0
- data/lib/stripe/resources/person.rb +1 -0
- data/lib/stripe/resources/plan.rb +1 -0
- data/lib/stripe/resources/price.rb +21 -0
- data/lib/stripe/resources/product.rb +10 -0
- data/lib/stripe/resources/promotion_code.rb +12 -0
- data/lib/stripe/resources/quote.rb +105 -0
- data/lib/stripe/resources/radar/early_fraud_warning.rb +1 -0
- data/lib/stripe/resources/radar/value_list.rb +1 -0
- data/lib/stripe/resources/radar/value_list_item.rb +1 -0
- data/lib/stripe/resources/recipient.rb +1 -0
- data/lib/stripe/resources/refund.rb +31 -0
- data/lib/stripe/resources/reporting/report_run.rb +1 -0
- data/lib/stripe/resources/reporting/report_type.rb +1 -0
- data/lib/stripe/resources/reversal.rb +3 -2
- data/lib/stripe/resources/review.rb +1 -0
- data/lib/stripe/resources/setup_attempt.rb +10 -0
- data/lib/stripe/resources/setup_intent.rb +11 -0
- data/lib/stripe/resources/shipping_rate.rb +12 -0
- data/lib/stripe/resources/sigma/scheduled_query_run.rb +1 -0
- data/lib/stripe/resources/sku.rb +1 -0
- data/lib/stripe/resources/source.rb +10 -3
- data/lib/stripe/resources/source_transaction.rb +1 -0
- data/lib/stripe/resources/subscription.rb +10 -0
- data/lib/stripe/resources/subscription_item.rb +7 -1
- data/lib/stripe/resources/subscription_schedule.rb +1 -0
- data/lib/stripe/resources/tax_code.rb +10 -0
- data/lib/stripe/resources/tax_id.rb +1 -0
- data/lib/stripe/resources/tax_rate.rb +1 -0
- data/lib/stripe/resources/terminal/configuration.rb +15 -0
- data/lib/stripe/resources/terminal/connection_token.rb +1 -0
- data/lib/stripe/resources/terminal/location.rb +1 -0
- data/lib/stripe/resources/terminal/reader.rb +61 -0
- data/lib/stripe/resources/test_helpers/test_clock.rb +25 -0
- data/lib/stripe/resources/three_d_secure.rb +1 -0
- data/lib/stripe/resources/token.rb +1 -0
- data/lib/stripe/resources/topup.rb +1 -0
- data/lib/stripe/resources/transfer.rb +1 -0
- data/lib/stripe/resources/usage_record.rb +1 -0
- data/lib/stripe/resources/usage_record_summary.rb +1 -0
- data/lib/stripe/resources/webhook_endpoint.rb +1 -0
- data/lib/stripe/resources.rb +23 -0
- data/lib/stripe/search_result_object.rb +86 -0
- data/lib/stripe/stripe_client.rb +412 -146
- data/lib/stripe/stripe_configuration.rb +194 -0
- data/lib/stripe/stripe_object.rb +26 -2
- data/lib/stripe/stripe_response.rb +80 -52
- data/lib/stripe/util.rb +74 -7
- data/lib/stripe/version.rb +1 -1
- data/lib/stripe/webhook.rb +38 -7
- data/lib/stripe.rb +39 -168
- data/stripe.gemspec +12 -5
- metadata +36 -186
- data/.editorconfig +0 -10
- data/.gitattributes +0 -4
- data/.github/ISSUE_TEMPLATE.md +0 -5
- data/.gitignore +0 -8
- data/.rubocop.yml +0 -56
- data/.rubocop_todo.yml +0 -39
- data/.travis.yml +0 -39
- data/.vscode/extensions.json +0 -7
- data/.vscode/settings.json +0 -8
- data/test/api_stub_helpers.rb +0 -1
- data/test/openapi/README.md +0 -9
- data/test/stripe/account_link_test.rb +0 -18
- data/test/stripe/account_test.rb +0 -412
- data/test/stripe/alipay_account_test.rb +0 -37
- data/test/stripe/api_operations_test.rb +0 -80
- data/test/stripe/api_resource_test.rb +0 -613
- data/test/stripe/apple_pay_domain_test.rb +0 -46
- data/test/stripe/application_fee_refund_test.rb +0 -37
- data/test/stripe/application_fee_test.rb +0 -58
- data/test/stripe/balance_test.rb +0 -13
- data/test/stripe/balance_transaction_test.rb +0 -20
- data/test/stripe/bank_account_test.rb +0 -36
- data/test/stripe/capability_test.rb +0 -45
- data/test/stripe/charge_test.rb +0 -64
- data/test/stripe/checkout/session_test.rb +0 -41
- data/test/stripe/connection_manager_test.rb +0 -138
- data/test/stripe/country_spec_test.rb +0 -20
- data/test/stripe/coupon_test.rb +0 -61
- data/test/stripe/credit_note_test.rb +0 -61
- data/test/stripe/customer_balance_transaction_test.rb +0 -37
- data/test/stripe/customer_card_test.rb +0 -42
- data/test/stripe/customer_test.rb +0 -226
- data/test/stripe/dispute_test.rb +0 -51
- data/test/stripe/ephemeral_key_test.rb +0 -93
- data/test/stripe/errors_test.rb +0 -41
- data/test/stripe/exchange_rate_test.rb +0 -20
- data/test/stripe/file_link_test.rb +0 -41
- data/test/stripe/file_test.rb +0 -87
- data/test/stripe/invoice_item_test.rb +0 -66
- data/test/stripe/invoice_line_item_test.rb +0 -8
- data/test/stripe/invoice_test.rb +0 -229
- data/test/stripe/issuing/authorization_test.rb +0 -72
- data/test/stripe/issuing/card_test.rb +0 -62
- data/test/stripe/issuing/cardholder_test.rb +0 -53
- data/test/stripe/issuing/dispute_test.rb +0 -45
- data/test/stripe/issuing/transaction_test.rb +0 -48
- data/test/stripe/list_object_test.rb +0 -140
- data/test/stripe/login_link_test.rb +0 -37
- data/test/stripe/multipart_encoder_test.rb +0 -130
- data/test/stripe/oauth_test.rb +0 -88
- data/test/stripe/order_return_test.rb +0 -21
- data/test/stripe/order_test.rb +0 -82
- data/test/stripe/payment_intent_test.rb +0 -107
- data/test/stripe/payment_method_test.rb +0 -84
- data/test/stripe/payout_test.rb +0 -57
- data/test/stripe/person_test.rb +0 -46
- data/test/stripe/plan_test.rb +0 -98
- data/test/stripe/product_test.rb +0 -59
- data/test/stripe/radar/early_fraud_warning_test.rb +0 -22
- data/test/stripe/radar/value_list_item_test.rb +0 -48
- data/test/stripe/radar/value_list_test.rb +0 -61
- data/test/stripe/recipient_test.rb +0 -62
- data/test/stripe/refund_test.rb +0 -39
- data/test/stripe/reporting/report_run_test.rb +0 -33
- data/test/stripe/reporting/report_type_test.rb +0 -22
- data/test/stripe/reversal_test.rb +0 -43
- data/test/stripe/review_test.rb +0 -27
- data/test/stripe/setup_intent_test.rb +0 -84
- data/test/stripe/sigma/scheduled_query_run_test.rb +0 -22
- data/test/stripe/sku_test.rb +0 -60
- data/test/stripe/source_test.rb +0 -81
- data/test/stripe/source_transaction_test.rb +0 -19
- data/test/stripe/stripe_client_test.rb +0 -1039
- data/test/stripe/stripe_object_test.rb +0 -497
- data/test/stripe/stripe_response_test.rb +0 -95
- data/test/stripe/subscription_item_test.rb +0 -75
- data/test/stripe/subscription_schedule_test.rb +0 -82
- data/test/stripe/subscription_test.rb +0 -80
- data/test/stripe/tax_id_test.rb +0 -31
- data/test/stripe/tax_rate_test.rb +0 -43
- data/test/stripe/terminal/connection_token_test.rb +0 -16
- data/test/stripe/terminal/location_test.rb +0 -68
- data/test/stripe/terminal/reader_test.rb +0 -62
- data/test/stripe/three_d_secure_test.rb +0 -23
- data/test/stripe/topup_test.rb +0 -62
- data/test/stripe/transfer_test.rb +0 -88
- data/test/stripe/usage_record_summary_test.rb +0 -19
- data/test/stripe/util_test.rb +0 -402
- data/test/stripe/webhook_endpoint_test.rb +0 -59
- data/test/stripe/webhook_test.rb +0 -96
- data/test/stripe_mock.rb +0 -78
- data/test/stripe_test.rb +0 -50
- data/test/test_data.rb +0 -61
- data/test/test_helper.rb +0 -76
@@ -0,0 +1,84 @@
|
|
1
|
+
# frozen_string_literal: true
|
2
|
+
|
3
|
+
module Stripe
|
4
|
+
class Instrumentation
|
5
|
+
# Event emitted on `request_begin` callback.
|
6
|
+
class RequestBeginEvent
|
7
|
+
attr_reader :method
|
8
|
+
attr_reader :path
|
9
|
+
|
10
|
+
# Arbitrary user-provided data in the form of a Ruby hash that's passed
|
11
|
+
# from subscribers on `request_begin` to subscribers on `request_end`.
|
12
|
+
# `request_begin` subscribers can set keys which will then be available
|
13
|
+
# in `request_end`.
|
14
|
+
#
|
15
|
+
# Note that all subscribers of `request_begin` share the same object, so
|
16
|
+
# they must be careful to set unique keys so as to not conflict with data
|
17
|
+
# set by other subscribers.
|
18
|
+
attr_reader :user_data
|
19
|
+
|
20
|
+
def initialize(method:, path:, user_data:)
|
21
|
+
@method = method
|
22
|
+
@path = path
|
23
|
+
@user_data = user_data
|
24
|
+
freeze
|
25
|
+
end
|
26
|
+
end
|
27
|
+
|
28
|
+
# Event emitted on `request_end` callback.
|
29
|
+
class RequestEndEvent
|
30
|
+
attr_reader :duration
|
31
|
+
attr_reader :http_status
|
32
|
+
attr_reader :method
|
33
|
+
attr_reader :num_retries
|
34
|
+
attr_reader :path
|
35
|
+
attr_reader :request_id
|
36
|
+
|
37
|
+
# Arbitrary user-provided data in the form of a Ruby hash that's passed
|
38
|
+
# from subscribers on `request_begin` to subscribers on `request_end`.
|
39
|
+
# `request_begin` subscribers can set keys which will then be available
|
40
|
+
# in `request_end`.
|
41
|
+
attr_reader :user_data
|
42
|
+
|
43
|
+
def initialize(duration:, http_status:, method:, num_retries:, path:,
|
44
|
+
request_id:, user_data: nil)
|
45
|
+
@duration = duration
|
46
|
+
@http_status = http_status
|
47
|
+
@method = method
|
48
|
+
@num_retries = num_retries
|
49
|
+
@path = path
|
50
|
+
@request_id = request_id
|
51
|
+
@user_data = user_data
|
52
|
+
freeze
|
53
|
+
end
|
54
|
+
end
|
55
|
+
|
56
|
+
# This class was renamed for consistency. This alias is here for backwards
|
57
|
+
# compatibility.
|
58
|
+
RequestEvent = RequestEndEvent
|
59
|
+
|
60
|
+
# Returns true if there are a non-zero number of subscribers on the given
|
61
|
+
# topic, and false otherwise.
|
62
|
+
def self.any_subscribers?(topic)
|
63
|
+
!subscribers[topic].empty?
|
64
|
+
end
|
65
|
+
|
66
|
+
def self.subscribe(topic, name = rand, &block)
|
67
|
+
subscribers[topic][name] = block
|
68
|
+
name
|
69
|
+
end
|
70
|
+
|
71
|
+
def self.unsubscribe(topic, name)
|
72
|
+
subscribers[topic].delete(name)
|
73
|
+
end
|
74
|
+
|
75
|
+
def self.notify(topic, event)
|
76
|
+
subscribers[topic].each_value { |subscriber| subscriber.call(event) }
|
77
|
+
end
|
78
|
+
|
79
|
+
def self.subscribers
|
80
|
+
@subscribers ||= Hash.new { |hash, key| hash[key] = {} }
|
81
|
+
end
|
82
|
+
private_class_method :subscribers
|
83
|
+
end
|
84
|
+
end
|
data/lib/stripe/list_object.rb
CHANGED
@@ -51,6 +51,16 @@ module Stripe
|
|
51
51
|
# Iterates through each resource in all pages, making additional fetches to
|
52
52
|
# the API as necessary.
|
53
53
|
#
|
54
|
+
# The default iteration direction is forwards according to Stripe's API
|
55
|
+
# "natural" ordering direction -- newer objects first, and moving towards
|
56
|
+
# older objects.
|
57
|
+
#
|
58
|
+
# However, if the initial list object was fetched using an `ending_before`
|
59
|
+
# cursor (and only `ending_before`, `starting_after` cannot also be
|
60
|
+
# included), the method assumes that the user is trying to iterate
|
61
|
+
# backwards compared to natural ordering and returns results that way --
|
62
|
+
# older objects first, and moving towards newer objects.
|
63
|
+
#
|
54
64
|
# Note that this method will make as many API calls as necessary to fetch
|
55
65
|
# all resources. For more granular control, please see +each+ and
|
56
66
|
# +next_page+.
|
@@ -59,8 +69,18 @@ module Stripe
|
|
59
69
|
|
60
70
|
page = self
|
61
71
|
loop do
|
62
|
-
|
63
|
-
|
72
|
+
# Backward iterating activates if we have an `ending_before` constraint
|
73
|
+
# and _just_ an `ending_before` constraint. If `starting_after` was
|
74
|
+
# also used, we iterate forwards normally.
|
75
|
+
if filters.include?(:ending_before) &&
|
76
|
+
!filters.include?(:starting_after)
|
77
|
+
page.reverse_each(&blk)
|
78
|
+
page = page.previous_page
|
79
|
+
else
|
80
|
+
page.each(&blk)
|
81
|
+
page = page.next_page
|
82
|
+
end
|
83
|
+
|
64
84
|
break if page.empty?
|
65
85
|
end
|
66
86
|
end
|
@@ -72,8 +92,8 @@ module Stripe
|
|
72
92
|
|
73
93
|
def retrieve(id, opts = {})
|
74
94
|
id, retrieve_params = Util.normalize_id(id)
|
75
|
-
|
76
|
-
|
95
|
+
url = "#{resource_url}/#{CGI.escape(id)}"
|
96
|
+
resp, opts = execute_resource_request(:get, url, retrieve_params, opts)
|
77
97
|
Util.convert_to_stripe_object(resp.data, opts)
|
78
98
|
end
|
79
99
|
|
@@ -96,6 +116,8 @@ module Stripe
|
|
96
116
|
# This method will try to respect the limit of the current page. If none
|
97
117
|
# was given, the default limit will be fetched again.
|
98
118
|
def previous_page(params = {}, opts = {})
|
119
|
+
return self.class.empty_list(opts) unless has_more
|
120
|
+
|
99
121
|
first_id = data.first.id
|
100
122
|
|
101
123
|
params = filters.merge(ending_before: first_id).merge(params)
|
@@ -107,5 +129,11 @@ module Stripe
|
|
107
129
|
url ||
|
108
130
|
raise(ArgumentError, "List object does not contain a 'url' field.")
|
109
131
|
end
|
132
|
+
|
133
|
+
# Iterates through each resource in the page represented by the current
|
134
|
+
# `ListObject` in reverse.
|
135
|
+
def reverse_each(&blk)
|
136
|
+
data.reverse_each(&blk)
|
137
|
+
end
|
110
138
|
end
|
111
139
|
end
|
data/lib/stripe/oauth.rb
CHANGED
@@ -5,10 +5,10 @@ module Stripe
|
|
5
5
|
module OAuthOperations
|
6
6
|
extend APIOperations::Request::ClassMethods
|
7
7
|
|
8
|
-
def self.
|
8
|
+
def self.execute_resource_request(method, url, params, opts)
|
9
9
|
opts = Util.normalize_opts(opts)
|
10
|
-
opts[:client] ||= StripeClient.active_client
|
11
|
-
opts[:api_base] ||=
|
10
|
+
opts[:client] ||= opts[:client] || StripeClient.active_client
|
11
|
+
opts[:api_base] ||= opts[:client].config.connect_base
|
12
12
|
|
13
13
|
super(method, url, params, opts)
|
14
14
|
end
|
@@ -29,7 +29,8 @@ module Stripe
|
|
29
29
|
end
|
30
30
|
|
31
31
|
def self.authorize_url(params = {}, opts = {})
|
32
|
-
|
32
|
+
client = opts[:client] || StripeClient.active_client
|
33
|
+
base = opts[:connect_base] || client.config.connect_base
|
33
34
|
|
34
35
|
path = "/oauth/authorize"
|
35
36
|
path = "/express" + path if opts[:express]
|
@@ -43,7 +44,8 @@ module Stripe
|
|
43
44
|
|
44
45
|
def self.token(params = {}, opts = {})
|
45
46
|
opts = Util.normalize_opts(opts)
|
46
|
-
|
47
|
+
opts[:api_key] = params[:client_secret] if params[:client_secret]
|
48
|
+
resp, opts = OAuthOperations.execute_resource_request(
|
47
49
|
:post, "/oauth/token", params, opts
|
48
50
|
)
|
49
51
|
# This is just going to return a generic StripeObject, but that's okay
|
@@ -53,7 +55,7 @@ module Stripe
|
|
53
55
|
def self.deauthorize(params = {}, opts = {})
|
54
56
|
opts = Util.normalize_opts(opts)
|
55
57
|
params[:client_id] = get_client_id(params)
|
56
|
-
resp, opts = OAuthOperations.
|
58
|
+
resp, opts = OAuthOperations.execute_resource_request(
|
57
59
|
:post, "/oauth/deauthorize", params, opts
|
58
60
|
)
|
59
61
|
# This is just going to return a generic StripeObject, but that's okay
|
data/lib/stripe/object_types.rb
CHANGED
@@ -1,3 +1,4 @@
|
|
1
|
+
# File generated from our OpenAPI spec
|
1
2
|
# frozen_string_literal: true
|
2
3
|
|
3
4
|
# rubocop:disable Metrics/MethodLength
|
@@ -8,6 +9,7 @@ module Stripe
|
|
8
9
|
{
|
9
10
|
# data structures
|
10
11
|
ListObject::OBJECT_NAME => ListObject,
|
12
|
+
SearchResultObject::OBJECT_NAME => SearchResultObject,
|
11
13
|
|
12
14
|
# business objects
|
13
15
|
Account::OBJECT_NAME => Account,
|
@@ -19,15 +21,19 @@ module Stripe
|
|
19
21
|
Balance::OBJECT_NAME => Balance,
|
20
22
|
BalanceTransaction::OBJECT_NAME => BalanceTransaction,
|
21
23
|
BankAccount::OBJECT_NAME => BankAccount,
|
24
|
+
BillingPortal::Configuration::OBJECT_NAME => BillingPortal::Configuration,
|
25
|
+
BillingPortal::Session::OBJECT_NAME => BillingPortal::Session,
|
22
26
|
BitcoinReceiver::OBJECT_NAME => BitcoinReceiver,
|
23
27
|
BitcoinTransaction::OBJECT_NAME => BitcoinTransaction,
|
24
28
|
Capability::OBJECT_NAME => Capability,
|
25
29
|
Card::OBJECT_NAME => Card,
|
30
|
+
CashBalance::OBJECT_NAME => CashBalance,
|
26
31
|
Charge::OBJECT_NAME => Charge,
|
27
32
|
Checkout::Session::OBJECT_NAME => Checkout::Session,
|
28
33
|
CountrySpec::OBJECT_NAME => CountrySpec,
|
29
34
|
Coupon::OBJECT_NAME => Coupon,
|
30
35
|
CreditNote::OBJECT_NAME => CreditNote,
|
36
|
+
CreditNoteLineItem::OBJECT_NAME => CreditNoteLineItem,
|
31
37
|
Customer::OBJECT_NAME => Customer,
|
32
38
|
CustomerBalanceTransaction::OBJECT_NAME => CustomerBalanceTransaction,
|
33
39
|
Discount::OBJECT_NAME => Discount,
|
@@ -38,6 +44,14 @@ module Stripe
|
|
38
44
|
File::OBJECT_NAME => File,
|
39
45
|
File::OBJECT_NAME_ALT => File,
|
40
46
|
FileLink::OBJECT_NAME => FileLink,
|
47
|
+
FinancialConnections::Account::OBJECT_NAME => FinancialConnections::Account,
|
48
|
+
FinancialConnections::AccountOwner::OBJECT_NAME => FinancialConnections::AccountOwner,
|
49
|
+
FinancialConnections::AccountOwnership::OBJECT_NAME =>
|
50
|
+
FinancialConnections::AccountOwnership,
|
51
|
+
FinancialConnections::Session::OBJECT_NAME => FinancialConnections::Session,
|
52
|
+
FundingInstructions::OBJECT_NAME => FundingInstructions,
|
53
|
+
Identity::VerificationReport::OBJECT_NAME => Identity::VerificationReport,
|
54
|
+
Identity::VerificationSession::OBJECT_NAME => Identity::VerificationSession,
|
41
55
|
Invoice::OBJECT_NAME => Invoice,
|
42
56
|
InvoiceItem::OBJECT_NAME => InvoiceItem,
|
43
57
|
InvoiceLineItem::OBJECT_NAME => InvoiceLineItem,
|
@@ -47,15 +61,21 @@ module Stripe
|
|
47
61
|
Issuing::Cardholder::OBJECT_NAME => Issuing::Cardholder,
|
48
62
|
Issuing::Dispute::OBJECT_NAME => Issuing::Dispute,
|
49
63
|
Issuing::Transaction::OBJECT_NAME => Issuing::Transaction,
|
64
|
+
LineItem::OBJECT_NAME => LineItem,
|
50
65
|
LoginLink::OBJECT_NAME => LoginLink,
|
66
|
+
Mandate::OBJECT_NAME => Mandate,
|
51
67
|
Order::OBJECT_NAME => Order,
|
52
68
|
OrderReturn::OBJECT_NAME => OrderReturn,
|
53
69
|
PaymentIntent::OBJECT_NAME => PaymentIntent,
|
70
|
+
PaymentLink::OBJECT_NAME => PaymentLink,
|
54
71
|
PaymentMethod::OBJECT_NAME => PaymentMethod,
|
55
72
|
Payout::OBJECT_NAME => Payout,
|
56
73
|
Person::OBJECT_NAME => Person,
|
57
74
|
Plan::OBJECT_NAME => Plan,
|
75
|
+
Price::OBJECT_NAME => Price,
|
58
76
|
Product::OBJECT_NAME => Product,
|
77
|
+
PromotionCode::OBJECT_NAME => PromotionCode,
|
78
|
+
Quote::OBJECT_NAME => Quote,
|
59
79
|
Radar::EarlyFraudWarning::OBJECT_NAME => Radar::EarlyFraudWarning,
|
60
80
|
Radar::ValueList::OBJECT_NAME => Radar::ValueList,
|
61
81
|
Radar::ValueListItem::OBJECT_NAME => Radar::ValueListItem,
|
@@ -66,19 +86,24 @@ module Stripe
|
|
66
86
|
Reporting::ReportType::OBJECT_NAME => Reporting::ReportType,
|
67
87
|
Reversal::OBJECT_NAME => Reversal,
|
68
88
|
Review::OBJECT_NAME => Review,
|
69
|
-
|
89
|
+
SetupAttempt::OBJECT_NAME => SetupAttempt,
|
70
90
|
SetupIntent::OBJECT_NAME => SetupIntent,
|
91
|
+
ShippingRate::OBJECT_NAME => ShippingRate,
|
71
92
|
Sigma::ScheduledQueryRun::OBJECT_NAME => Sigma::ScheduledQueryRun,
|
93
|
+
SKU::OBJECT_NAME => SKU,
|
72
94
|
Source::OBJECT_NAME => Source,
|
73
95
|
SourceTransaction::OBJECT_NAME => SourceTransaction,
|
74
96
|
Subscription::OBJECT_NAME => Subscription,
|
75
97
|
SubscriptionItem::OBJECT_NAME => SubscriptionItem,
|
76
98
|
SubscriptionSchedule::OBJECT_NAME => SubscriptionSchedule,
|
99
|
+
TaxCode::OBJECT_NAME => TaxCode,
|
77
100
|
TaxId::OBJECT_NAME => TaxId,
|
78
101
|
TaxRate::OBJECT_NAME => TaxRate,
|
102
|
+
Terminal::Configuration::OBJECT_NAME => Terminal::Configuration,
|
79
103
|
Terminal::ConnectionToken::OBJECT_NAME => Terminal::ConnectionToken,
|
80
104
|
Terminal::Location::OBJECT_NAME => Terminal::Location,
|
81
105
|
Terminal::Reader::OBJECT_NAME => Terminal::Reader,
|
106
|
+
TestHelpers::TestClock::OBJECT_NAME => TestHelpers::TestClock,
|
82
107
|
ThreeDSecure::OBJECT_NAME => ThreeDSecure,
|
83
108
|
Token::OBJECT_NAME => Token,
|
84
109
|
Topup::OBJECT_NAME => Topup,
|
@@ -1,3 +1,4 @@
|
|
1
|
+
# File generated from our OpenAPI spec
|
1
2
|
# frozen_string_literal: true
|
2
3
|
|
3
4
|
module Stripe
|
@@ -44,12 +45,8 @@ module Stripe
|
|
44
45
|
end
|
45
46
|
|
46
47
|
# @override To make id optional
|
47
|
-
def self.retrieve(id =
|
48
|
-
id
|
49
|
-
nil
|
50
|
-
else
|
51
|
-
Util.check_string_argument!(id)
|
52
|
-
end
|
48
|
+
def self.retrieve(id = nil, opts = {})
|
49
|
+
Util.check_string_argument!(id) if id
|
53
50
|
|
54
51
|
# Account used to be a singleton, where this method's signature was
|
55
52
|
# `(opts={})`. For the sake of not breaking folks who pass in an OAuth
|
@@ -64,7 +61,7 @@ module Stripe
|
|
64
61
|
end
|
65
62
|
|
66
63
|
def persons(params = {}, opts = {})
|
67
|
-
resp, opts =
|
64
|
+
resp, opts = execute_resource_request(:get, resource_url + "/persons", params, opts)
|
68
65
|
Util.convert_to_stripe_object(resp.data, opts)
|
69
66
|
end
|
70
67
|
|
@@ -135,11 +132,10 @@ module Stripe
|
|
135
132
|
client_id: client_id,
|
136
133
|
stripe_user_id: id,
|
137
134
|
}
|
135
|
+
opts = @opts.merge(Util.normalize_opts(opts))
|
138
136
|
OAuth.deauthorize(params, opts)
|
139
137
|
end
|
140
138
|
|
141
|
-
ARGUMENT_NOT_PROVIDED = Object.new
|
142
|
-
|
143
139
|
private def serialize_additional_owners(legal_entity, additional_owners)
|
144
140
|
original_value =
|
145
141
|
legal_entity
|
@@ -1,9 +1,10 @@
|
|
1
|
+
# File generated from our OpenAPI spec
|
1
2
|
# frozen_string_literal: true
|
2
3
|
|
3
4
|
module Stripe
|
4
5
|
class ApplicationFeeRefund < APIResource
|
5
|
-
include Stripe::APIOperations::Save
|
6
6
|
extend Stripe::APIOperations::List
|
7
|
+
include Stripe::APIOperations::Save
|
7
8
|
|
8
9
|
OBJECT_NAME = "fee_refund"
|
9
10
|
|
@@ -1,3 +1,4 @@
|
|
1
|
+
# File generated from our OpenAPI spec
|
1
2
|
# frozen_string_literal: true
|
2
3
|
|
3
4
|
module Stripe
|
@@ -9,7 +10,7 @@ module Stripe
|
|
9
10
|
OBJECT_NAME = "bank_account"
|
10
11
|
|
11
12
|
def verify(params = {}, opts = {})
|
12
|
-
resp, opts =
|
13
|
+
resp, opts = execute_resource_request(:post, resource_url + "/verify", params, opts)
|
13
14
|
initialize_from(resp.data, opts)
|
14
15
|
end
|
15
16
|
|
@@ -0,0 +1,14 @@
|
|
1
|
+
# File generated from our OpenAPI spec
|
2
|
+
# frozen_string_literal: true
|
3
|
+
|
4
|
+
module Stripe
|
5
|
+
module BillingPortal
|
6
|
+
class Configuration < APIResource
|
7
|
+
extend Stripe::APIOperations::Create
|
8
|
+
extend Stripe::APIOperations::List
|
9
|
+
include Stripe::APIOperations::Save
|
10
|
+
|
11
|
+
OBJECT_NAME = "billing_portal.configuration"
|
12
|
+
end
|
13
|
+
end
|
14
|
+
end
|
@@ -1,9 +1,10 @@
|
|
1
|
+
# File generated from our OpenAPI spec
|
1
2
|
# frozen_string_literal: true
|
2
3
|
|
3
4
|
module Stripe
|
5
|
+
# Directly retrieving BitcoinTransactions is deprecated. Please use
|
6
|
+
# the Sources API instead: https://stripe.com/docs/sources/bitcoin
|
4
7
|
class BitcoinTransaction < APIResource
|
5
|
-
# Directly retrieving BitcoinTransactions is deprecated. Please use the
|
6
|
-
# Sources API instead: https://stripe.com/docs/sources/bitcoin
|
7
8
|
extend Stripe::APIOperations::List
|
8
9
|
|
9
10
|
OBJECT_NAME = "bitcoin_transaction"
|
@@ -1,3 +1,4 @@
|
|
1
|
+
# File generated from our OpenAPI spec
|
1
2
|
# frozen_string_literal: true
|
2
3
|
|
3
4
|
module Stripe
|
@@ -26,7 +27,7 @@ module Stripe
|
|
26
27
|
def self.update(_id, _params = nil, _opts = nil)
|
27
28
|
raise NotImplementedError,
|
28
29
|
"Capabilities cannot be updated without an account ID. Update a " \
|
29
|
-
"capability using Account.update_capability('account_id', " \
|
30
|
+
"capability using `Account.update_capability('account_id', " \
|
30
31
|
"'capability_id', update_params)`"
|
31
32
|
end
|
32
33
|
end
|
@@ -0,0 +1,22 @@
|
|
1
|
+
# File generated from our OpenAPI spec
|
2
|
+
# frozen_string_literal: true
|
3
|
+
|
4
|
+
module Stripe
|
5
|
+
class CashBalance < APIResource
|
6
|
+
OBJECT_NAME = "cash_balance"
|
7
|
+
|
8
|
+
def resource_url
|
9
|
+
if !respond_to?(:customer) || customer.nil?
|
10
|
+
raise NotImplementedError,
|
11
|
+
"Customer Cash Balance cannot be accessed without a customer ID."
|
12
|
+
end
|
13
|
+
"#{Customer.resource_url}/#{CGI.escape(customer)}/cash_balance"
|
14
|
+
end
|
15
|
+
|
16
|
+
def self.retrieve(_id, _opts = {})
|
17
|
+
raise NotImplementedError,
|
18
|
+
"Customer Cash Balance cannot be retrieved without a customer ID. " \
|
19
|
+
"Retrieve a Customer Cash Balance using `Customer.retrieve_cash_balance('cus_123')`"
|
20
|
+
end
|
21
|
+
end
|
22
|
+
end
|
@@ -1,9 +1,11 @@
|
|
1
|
+
# File generated from our OpenAPI spec
|
1
2
|
# frozen_string_literal: true
|
2
3
|
|
3
4
|
module Stripe
|
4
5
|
class Charge < APIResource
|
5
6
|
extend Stripe::APIOperations::Create
|
6
7
|
extend Stripe::APIOperations::List
|
8
|
+
extend Stripe::APIOperations::Search
|
7
9
|
include Stripe::APIOperations::Save
|
8
10
|
|
9
11
|
OBJECT_NAME = "charge"
|
@@ -18,5 +20,13 @@ module Stripe
|
|
18
20
|
opts: opts
|
19
21
|
)
|
20
22
|
end
|
23
|
+
|
24
|
+
def self.search(params = {}, opts = {})
|
25
|
+
_search("/v1/charges/search", params, opts)
|
26
|
+
end
|
27
|
+
|
28
|
+
def self.search_auto_paging_each(params = {}, opts = {}, &blk)
|
29
|
+
search(params, opts).auto_paging_each(&blk)
|
30
|
+
end
|
21
31
|
end
|
22
32
|
end
|
@@ -1,11 +1,27 @@
|
|
1
|
+
# File generated from our OpenAPI spec
|
1
2
|
# frozen_string_literal: true
|
2
3
|
|
3
4
|
module Stripe
|
4
5
|
module Checkout
|
5
6
|
class Session < APIResource
|
6
7
|
extend Stripe::APIOperations::Create
|
8
|
+
extend Stripe::APIOperations::List
|
9
|
+
extend Stripe::APIOperations::NestedResource
|
7
10
|
|
8
11
|
OBJECT_NAME = "checkout.session"
|
12
|
+
|
13
|
+
custom_method :expire, http_verb: :post
|
14
|
+
|
15
|
+
nested_resource_class_methods :line_item, operations: %i[list]
|
16
|
+
|
17
|
+
def expire(params = {}, opts = {})
|
18
|
+
request_stripe_object(
|
19
|
+
method: :post,
|
20
|
+
path: resource_url + "/expire",
|
21
|
+
params: params,
|
22
|
+
opts: opts
|
23
|
+
)
|
24
|
+
end
|
9
25
|
end
|
10
26
|
end
|
11
27
|
end
|
@@ -1,3 +1,4 @@
|
|
1
|
+
# File generated from our OpenAPI spec
|
1
2
|
# frozen_string_literal: true
|
2
3
|
|
3
4
|
module Stripe
|
@@ -18,5 +19,15 @@ module Stripe
|
|
18
19
|
opts: opts
|
19
20
|
)
|
20
21
|
end
|
22
|
+
|
23
|
+
def self.preview(params, opts = {})
|
24
|
+
resp, opts = execute_resource_request(:get, resource_url + "/preview", params, opts)
|
25
|
+
Util.convert_to_stripe_object(resp.data, opts)
|
26
|
+
end
|
27
|
+
|
28
|
+
def self.list_preview_line_items(params, opts = {})
|
29
|
+
resp, opts = execute_resource_request(:get, resource_url + "/preview/lines", params, opts)
|
30
|
+
Util.convert_to_stripe_object(resp.data, opts)
|
31
|
+
end
|
21
32
|
end
|
22
33
|
end
|
@@ -1,3 +1,4 @@
|
|
1
|
+
# File generated from our OpenAPI spec
|
1
2
|
# frozen_string_literal: true
|
2
3
|
|
3
4
|
module Stripe
|
@@ -5,16 +6,41 @@ module Stripe
|
|
5
6
|
extend Stripe::APIOperations::Create
|
6
7
|
include Stripe::APIOperations::Delete
|
7
8
|
extend Stripe::APIOperations::List
|
9
|
+
extend Stripe::APIOperations::Search
|
8
10
|
include Stripe::APIOperations::Save
|
9
11
|
extend Stripe::APIOperations::NestedResource
|
10
12
|
|
11
13
|
OBJECT_NAME = "customer"
|
12
14
|
|
15
|
+
custom_method :create_funding_instructions, http_verb: :post, http_path: "funding_instructions"
|
16
|
+
custom_method :list_payment_methods, http_verb: :get, http_path: "payment_methods"
|
17
|
+
|
18
|
+
nested_resource_class_methods :cash_balance,
|
19
|
+
operations: %i[retrieve update],
|
20
|
+
resource_plural: "cash_balance"
|
13
21
|
nested_resource_class_methods :balance_transaction,
|
14
22
|
operations: %i[create retrieve update list]
|
15
23
|
nested_resource_class_methods :tax_id,
|
16
24
|
operations: %i[create retrieve delete list]
|
17
25
|
|
26
|
+
def create_funding_instructions(params = {}, opts = {})
|
27
|
+
request_stripe_object(
|
28
|
+
method: :post,
|
29
|
+
path: resource_url + "/funding_instructions",
|
30
|
+
params: params,
|
31
|
+
opts: opts
|
32
|
+
)
|
33
|
+
end
|
34
|
+
|
35
|
+
def list_payment_methods(params = {}, opts = {})
|
36
|
+
request_stripe_object(
|
37
|
+
method: :get,
|
38
|
+
path: resource_url + "/payment_methods",
|
39
|
+
params: params,
|
40
|
+
opts: opts
|
41
|
+
)
|
42
|
+
end
|
43
|
+
|
18
44
|
custom_method :delete_discount, http_verb: :delete, http_path: "discount"
|
19
45
|
|
20
46
|
save_nested_resource :source
|
@@ -27,9 +53,22 @@ module Stripe
|
|
27
53
|
alias detach_source delete_source
|
28
54
|
end
|
29
55
|
|
56
|
+
# Deletes a discount associated with the customer.
|
57
|
+
#
|
58
|
+
# Returns the deleted discount. The customer object is not updated,
|
59
|
+
# so you must call `refresh` on it to get a new version with the
|
60
|
+
# discount removed.
|
30
61
|
def delete_discount
|
31
|
-
resp, opts =
|
32
|
-
|
62
|
+
resp, opts = execute_resource_request(:delete, resource_url + "/discount")
|
63
|
+
Util.convert_to_stripe_object(resp.data, opts)
|
64
|
+
end
|
65
|
+
|
66
|
+
def self.search(params = {}, opts = {})
|
67
|
+
_search("/v1/customers/search", params, opts)
|
68
|
+
end
|
69
|
+
|
70
|
+
def self.search_auto_paging_each(params = {}, opts = {}, &blk)
|
71
|
+
search(params, opts).auto_paging_each(&blk)
|
33
72
|
end
|
34
73
|
end
|
35
74
|
end
|
@@ -1,3 +1,4 @@
|
|
1
|
+
# File generated from our OpenAPI spec
|
1
2
|
# frozen_string_literal: true
|
2
3
|
|
3
4
|
module Stripe
|
@@ -18,13 +19,13 @@ module Stripe
|
|
18
19
|
def self.retrieve(_id, _opts = {})
|
19
20
|
raise NotImplementedError,
|
20
21
|
"Customer Balance Transactions cannot be retrieved without a customer ID. " \
|
21
|
-
"Retrieve a Customer Balance Transaction using Customer.retrieve_balance_transaction('cus_123', 'cbtxn_123')"
|
22
|
+
"Retrieve a Customer Balance Transaction using `Customer.retrieve_balance_transaction('cus_123', 'cbtxn_123')`"
|
22
23
|
end
|
23
24
|
|
24
25
|
def self.update(_id, _params = nil, _opts = nil)
|
25
26
|
raise NotImplementedError,
|
26
27
|
"Customer Balance Transactions cannot be retrieved without a customer ID. " \
|
27
|
-
"Update a Customer Balance Transaction using Customer.update_balance_transaction('cus_123', 'cbtxn_123', params)"
|
28
|
+
"Update a Customer Balance Transaction using `Customer.update_balance_transaction('cus_123', 'cbtxn_123', params)`"
|
28
29
|
end
|
29
30
|
end
|
30
31
|
end
|