stripe 4.24.0 → 5.36.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 +169 -0
- data/CODE_OF_CONDUCT.md +77 -0
- data/Gemfile +10 -16
- data/README.md +111 -44
- data/Rakefile +8 -7
- data/VERSION +1 -1
- data/lib/stripe.rb +39 -130
- 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 -12
- 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_resource.rb +12 -3
- data/lib/stripe/connection_manager.rb +179 -0
- data/lib/stripe/error_object.rb +94 -0
- data/lib/stripe/errors.rb +24 -3
- data/lib/stripe/instrumentation.rb +82 -0
- data/lib/stripe/list_object.rb +34 -5
- data/lib/stripe/multipart_encoder.rb +131 -0
- data/lib/stripe/oauth.rb +8 -6
- data/lib/stripe/object_types.rb +12 -1
- data/lib/stripe/resources.rb +12 -1
- data/lib/stripe/resources/account.rb +6 -14
- data/lib/stripe/resources/account_link.rb +2 -1
- data/lib/stripe/resources/alipay_account.rb +1 -1
- data/lib/stripe/resources/apple_pay_domain.rb +2 -1
- data/lib/stripe/resources/application_fee.rb +2 -12
- data/lib/stripe/resources/application_fee_refund.rb +1 -1
- data/lib/stripe/resources/balance.rb +2 -1
- data/lib/stripe/resources/balance_transaction.rb +2 -1
- data/lib/stripe/resources/bank_account.rb +3 -2
- 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 +2 -1
- data/lib/stripe/resources/bitcoin_transaction.rb +1 -1
- data/lib/stripe/resources/capability.rb +1 -1
- data/lib/stripe/resources/card.rb +2 -1
- data/lib/stripe/resources/charge.rb +8 -69
- data/lib/stripe/resources/checkout/session.rb +6 -1
- data/lib/stripe/resources/country_spec.rb +2 -1
- data/lib/stripe/resources/coupon.rb +2 -1
- data/lib/stripe/resources/credit_note.rb +12 -1
- data/lib/stripe/resources/credit_note_line_item.rb +7 -0
- data/lib/stripe/resources/customer.rb +9 -63
- data/lib/stripe/resources/customer_balance_transaction.rb +1 -1
- data/lib/stripe/resources/discount.rb +1 -1
- data/lib/stripe/resources/dispute.rb +2 -7
- data/lib/stripe/resources/ephemeral_key.rb +2 -1
- data/lib/stripe/resources/event.rb +2 -1
- data/lib/stripe/resources/exchange_rate.rb +2 -1
- data/lib/stripe/resources/file.rb +6 -14
- data/lib/stripe/resources/file_link.rb +2 -1
- 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 +8 -2
- data/lib/stripe/resources/invoice_item.rb +2 -1
- data/lib/stripe/resources/invoice_line_item.rb +1 -1
- data/lib/stripe/resources/issuing/authorization.rb +2 -1
- data/lib/stripe/resources/issuing/card.rb +2 -1
- data/lib/stripe/resources/issuing/card_details.rb +1 -1
- data/lib/stripe/resources/issuing/cardholder.rb +2 -1
- data/lib/stripe/resources/issuing/dispute.rb +13 -1
- data/lib/stripe/resources/issuing/transaction.rb +2 -1
- data/lib/stripe/resources/line_item.rb +7 -0
- data/lib/stripe/resources/login_link.rb +1 -1
- data/lib/stripe/resources/mandate.rb +8 -0
- data/lib/stripe/resources/order.rb +2 -9
- data/lib/stripe/resources/order_return.rb +2 -1
- data/lib/stripe/resources/payment_intent.rb +2 -1
- data/lib/stripe/resources/payment_method.rb +2 -1
- data/lib/stripe/resources/payout.rb +10 -5
- data/lib/stripe/resources/person.rb +1 -1
- data/lib/stripe/resources/plan.rb +2 -1
- data/lib/stripe/resources/price.rb +12 -0
- data/lib/stripe/resources/product.rb +2 -1
- data/lib/stripe/resources/promotion_code.rb +12 -0
- data/lib/stripe/resources/quote.rb +95 -0
- data/lib/stripe/resources/radar/early_fraud_warning.rb +2 -1
- data/lib/stripe/resources/radar/value_list.rb +2 -1
- data/lib/stripe/resources/radar/value_list_item.rb +2 -1
- data/lib/stripe/resources/recipient.rb +2 -5
- data/lib/stripe/resources/recipient_transfer.rb +1 -1
- data/lib/stripe/resources/refund.rb +2 -1
- data/lib/stripe/resources/reporting/report_run.rb +2 -1
- data/lib/stripe/resources/reporting/report_type.rb +2 -1
- data/lib/stripe/resources/reversal.rb +1 -1
- data/lib/stripe/resources/review.rb +2 -1
- data/lib/stripe/resources/setup_attempt.rb +10 -0
- data/lib/stripe/resources/setup_intent.rb +2 -1
- data/lib/stripe/resources/sigma/scheduled_query_run.rb +2 -1
- data/lib/stripe/resources/sku.rb +2 -1
- data/lib/stripe/resources/source.rb +11 -10
- data/lib/stripe/resources/source_transaction.rb +1 -1
- data/lib/stripe/resources/subscription.rb +10 -9
- data/lib/stripe/resources/subscription_item.rb +8 -2
- data/lib/stripe/resources/subscription_schedule.rb +2 -1
- data/lib/stripe/resources/tax_code.rb +10 -0
- data/lib/stripe/resources/tax_id.rb +1 -1
- data/lib/stripe/resources/tax_rate.rb +2 -1
- data/lib/stripe/resources/terminal/connection_token.rb +2 -1
- data/lib/stripe/resources/terminal/location.rb +2 -1
- data/lib/stripe/resources/terminal/reader.rb +2 -1
- data/lib/stripe/resources/three_d_secure.rb +2 -1
- data/lib/stripe/resources/token.rb +2 -1
- data/lib/stripe/resources/topup.rb +2 -1
- data/lib/stripe/resources/transfer.rb +2 -6
- data/lib/stripe/resources/usage_record.rb +1 -17
- data/lib/stripe/resources/usage_record_summary.rb +1 -1
- data/lib/stripe/resources/webhook_endpoint.rb +2 -1
- data/lib/stripe/stripe_client.rb +608 -242
- data/lib/stripe/stripe_configuration.rb +194 -0
- data/lib/stripe/stripe_object.rb +30 -25
- data/lib/stripe/stripe_response.rb +87 -27
- data/lib/stripe/util.rb +37 -18
- data/lib/stripe/version.rb +1 -1
- data/lib/stripe/webhook.rb +39 -8
- data/stripe.gemspec +15 -11
- metadata +24 -216
- data/.editorconfig +0 -10
- data/.gitattributes +0 -4
- data/.github/ISSUE_TEMPLATE.md +0 -5
- data/.gitignore +0 -8
- data/.rubocop.yml +0 -43
- data/.rubocop_todo.yml +0 -38
- data/.travis.yml +0 -43
- data/.vscode/extensions.json +0 -7
- data/.vscode/settings.json +0 -8
- data/lib/stripe/resources/issuer_fraud_record.rb +0 -9
- 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 -428
- 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 -621
- 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 -80
- data/test/stripe/checkout/session_test.rb +0 -41
- 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 -269
- data/test/stripe/dispute_test.rb +0 -51
- data/test/stripe/ephemeral_key_test.rb +0 -93
- data/test/stripe/errors_test.rb +0 -20
- 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 -97
- data/test/stripe/file_upload_test.rb +0 -79
- 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 -213
- data/test/stripe/issuer_fraud_record_test.rb +0 -20
- 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 -156
- data/test/stripe/login_link_test.rb +0 -37
- 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 -99
- data/test/stripe/source_transaction_test.rb +0 -19
- data/test/stripe/stripe_client_test.rb +0 -842
- data/test/stripe/stripe_object_test.rb +0 -525
- data/test/stripe/stripe_response_test.rb +0 -49
- 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/usage_record_test.rb +0 -28
- 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 -77
- data/test/stripe_test.rb +0 -63
- data/test/test_data.rb +0 -61
- data/test/test_helper.rb +0 -71
data/lib/stripe/list_object.rb
CHANGED
@@ -7,7 +7,7 @@ module Stripe
|
|
7
7
|
include Stripe::APIOperations::Request
|
8
8
|
include Stripe::APIOperations::Create
|
9
9
|
|
10
|
-
OBJECT_NAME = "list"
|
10
|
+
OBJECT_NAME = "list"
|
11
11
|
|
12
12
|
# This accessor allows a `ListObject` to inherit various filters that were
|
13
13
|
# given to a predecessor. This allows for things like consistent limits,
|
@@ -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
|
|
@@ -83,6 +103,7 @@ module Stripe
|
|
83
103
|
# was given, the default limit will be fetched again.
|
84
104
|
def next_page(params = {}, opts = {})
|
85
105
|
return self.class.empty_list(opts) unless has_more
|
106
|
+
|
86
107
|
last_id = data.last.id
|
87
108
|
|
88
109
|
params = filters.merge(starting_after: last_id).merge(params)
|
@@ -95,6 +116,8 @@ module Stripe
|
|
95
116
|
# This method will try to respect the limit of the current page. If none
|
96
117
|
# was given, the default limit will be fetched again.
|
97
118
|
def previous_page(params = {}, opts = {})
|
119
|
+
return self.class.empty_list(opts) unless has_more
|
120
|
+
|
98
121
|
first_id = data.first.id
|
99
122
|
|
100
123
|
params = filters.merge(ending_before: first_id).merge(params)
|
@@ -106,5 +129,11 @@ module Stripe
|
|
106
129
|
url ||
|
107
130
|
raise(ArgumentError, "List object does not contain a 'url' field.")
|
108
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
|
109
138
|
end
|
110
139
|
end
|
@@ -0,0 +1,131 @@
|
|
1
|
+
# frozen_string_literal: true
|
2
|
+
|
3
|
+
require "securerandom"
|
4
|
+
require "tempfile"
|
5
|
+
|
6
|
+
module Stripe
|
7
|
+
# Encodes parameters into a `multipart/form-data` payload as described by RFC
|
8
|
+
# 2388:
|
9
|
+
#
|
10
|
+
# https://tools.ietf.org/html/rfc2388
|
11
|
+
#
|
12
|
+
# This is most useful for transferring file-like objects.
|
13
|
+
#
|
14
|
+
# Parameters should be added with `#encode`. When ready, use `#body` to get
|
15
|
+
# the encoded result and `#content_type` to get the value that should be
|
16
|
+
# placed in the `Content-Type` header of a subsequent request (which includes
|
17
|
+
# a boundary value).
|
18
|
+
class MultipartEncoder
|
19
|
+
MULTIPART_FORM_DATA = "multipart/form-data"
|
20
|
+
|
21
|
+
# A shortcut for encoding a single set of parameters and finalizing a
|
22
|
+
# result.
|
23
|
+
#
|
24
|
+
# Returns an encoded body and the value that should be set in the content
|
25
|
+
# type header of a subsequent request.
|
26
|
+
def self.encode(params)
|
27
|
+
encoder = MultipartEncoder.new
|
28
|
+
encoder.encode(params)
|
29
|
+
encoder.close
|
30
|
+
[encoder.body, encoder.content_type]
|
31
|
+
end
|
32
|
+
|
33
|
+
# Gets the object's randomly generated boundary string.
|
34
|
+
attr_reader :boundary
|
35
|
+
|
36
|
+
# Initializes a new multipart encoder.
|
37
|
+
def initialize
|
38
|
+
# Kind of weird, but required by Rubocop because the unary plus operator
|
39
|
+
# is considered faster than `Stripe.new`.
|
40
|
+
@body = +""
|
41
|
+
|
42
|
+
# Chose the same number of random bytes that Go uses in its standard
|
43
|
+
# library implementation. Easily enough entropy to ensure that it won't
|
44
|
+
# be present in a file we're sending.
|
45
|
+
@boundary = SecureRandom.hex(30)
|
46
|
+
|
47
|
+
@closed = false
|
48
|
+
@first_field = true
|
49
|
+
end
|
50
|
+
|
51
|
+
# Gets the encoded body. `#close` must be called first.
|
52
|
+
def body
|
53
|
+
raise "object must be closed before getting body" unless @closed
|
54
|
+
|
55
|
+
@body
|
56
|
+
end
|
57
|
+
|
58
|
+
# Finalizes the object by writing the final boundary.
|
59
|
+
def close
|
60
|
+
raise "object already closed" if @closed
|
61
|
+
|
62
|
+
@body << "\r\n"
|
63
|
+
@body << "--#{@boundary}--"
|
64
|
+
|
65
|
+
@closed = true
|
66
|
+
|
67
|
+
nil
|
68
|
+
end
|
69
|
+
|
70
|
+
# Gets the value including boundary that should be put into a multipart
|
71
|
+
# request's `Content-Type`.
|
72
|
+
def content_type
|
73
|
+
"#{MULTIPART_FORM_DATA}; boundary=#{@boundary}"
|
74
|
+
end
|
75
|
+
|
76
|
+
# Encodes a set of parameters to the body.
|
77
|
+
#
|
78
|
+
# Note that parameters are expected to be a hash, but a "flat" hash such
|
79
|
+
# that complex substructures like hashes and arrays have already been
|
80
|
+
# appropriately Stripe-encoded. Pass a complex structure through
|
81
|
+
# `Util.flatten_params` first before handing it off to this method.
|
82
|
+
def encode(params)
|
83
|
+
raise "no more parameters can be written to closed object" if @closed
|
84
|
+
|
85
|
+
params.each do |name, val|
|
86
|
+
if val.is_a?(::File) || val.is_a?(::Tempfile)
|
87
|
+
write_field(name, val.read, filename: ::File.basename(val.path))
|
88
|
+
elsif val.respond_to?(:read)
|
89
|
+
write_field(name, val.read, filename: "blob")
|
90
|
+
else
|
91
|
+
write_field(name, val, filename: nil)
|
92
|
+
end
|
93
|
+
end
|
94
|
+
|
95
|
+
nil
|
96
|
+
end
|
97
|
+
|
98
|
+
#
|
99
|
+
# private
|
100
|
+
#
|
101
|
+
|
102
|
+
# Escapes double quotes so that the given value can be used in a
|
103
|
+
# double-quoted string and replaces any linebreak characters with spaces.
|
104
|
+
private def escape(str)
|
105
|
+
str.gsub('"', "%22").tr("\n", " ").tr("\r", " ")
|
106
|
+
end
|
107
|
+
|
108
|
+
private def write_field(name, data, filename:)
|
109
|
+
if !@first_field
|
110
|
+
@body << "\r\n"
|
111
|
+
else
|
112
|
+
@first_field = false
|
113
|
+
end
|
114
|
+
|
115
|
+
@body << "--#{@boundary}\r\n"
|
116
|
+
|
117
|
+
if filename
|
118
|
+
@body << %(Content-Disposition: form-data) +
|
119
|
+
%(; name="#{escape(name.to_s)}") +
|
120
|
+
%(; filename="#{escape(filename)}"\r\n)
|
121
|
+
@body << %(Content-Type: application/octet-stream\r\n)
|
122
|
+
else
|
123
|
+
@body << %(Content-Disposition: form-data) +
|
124
|
+
%(; name="#{escape(name.to_s)}"\r\n)
|
125
|
+
end
|
126
|
+
|
127
|
+
@body << "\r\n"
|
128
|
+
@body << data.to_s
|
129
|
+
end
|
130
|
+
end
|
131
|
+
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
@@ -19,6 +19,8 @@ module Stripe
|
|
19
19
|
Balance::OBJECT_NAME => Balance,
|
20
20
|
BalanceTransaction::OBJECT_NAME => BalanceTransaction,
|
21
21
|
BankAccount::OBJECT_NAME => BankAccount,
|
22
|
+
BillingPortal::Configuration::OBJECT_NAME => BillingPortal::Configuration,
|
23
|
+
BillingPortal::Session::OBJECT_NAME => BillingPortal::Session,
|
22
24
|
BitcoinReceiver::OBJECT_NAME => BitcoinReceiver,
|
23
25
|
BitcoinTransaction::OBJECT_NAME => BitcoinTransaction,
|
24
26
|
Capability::OBJECT_NAME => Capability,
|
@@ -28,6 +30,7 @@ module Stripe
|
|
28
30
|
CountrySpec::OBJECT_NAME => CountrySpec,
|
29
31
|
Coupon::OBJECT_NAME => Coupon,
|
30
32
|
CreditNote::OBJECT_NAME => CreditNote,
|
33
|
+
CreditNoteLineItem::OBJECT_NAME => CreditNoteLineItem,
|
31
34
|
Customer::OBJECT_NAME => Customer,
|
32
35
|
CustomerBalanceTransaction::OBJECT_NAME => CustomerBalanceTransaction,
|
33
36
|
Discount::OBJECT_NAME => Discount,
|
@@ -38,17 +41,20 @@ module Stripe
|
|
38
41
|
File::OBJECT_NAME => File,
|
39
42
|
File::OBJECT_NAME_ALT => File,
|
40
43
|
FileLink::OBJECT_NAME => FileLink,
|
44
|
+
Identity::VerificationReport::OBJECT_NAME => Identity::VerificationReport,
|
45
|
+
Identity::VerificationSession::OBJECT_NAME => Identity::VerificationSession,
|
41
46
|
Invoice::OBJECT_NAME => Invoice,
|
42
47
|
InvoiceItem::OBJECT_NAME => InvoiceItem,
|
43
48
|
InvoiceLineItem::OBJECT_NAME => InvoiceLineItem,
|
44
|
-
IssuerFraudRecord::OBJECT_NAME => IssuerFraudRecord,
|
45
49
|
Issuing::Authorization::OBJECT_NAME => Issuing::Authorization,
|
46
50
|
Issuing::Card::OBJECT_NAME => Issuing::Card,
|
47
51
|
Issuing::CardDetails::OBJECT_NAME => Issuing::CardDetails,
|
48
52
|
Issuing::Cardholder::OBJECT_NAME => Issuing::Cardholder,
|
49
53
|
Issuing::Dispute::OBJECT_NAME => Issuing::Dispute,
|
50
54
|
Issuing::Transaction::OBJECT_NAME => Issuing::Transaction,
|
55
|
+
LineItem::OBJECT_NAME => LineItem,
|
51
56
|
LoginLink::OBJECT_NAME => LoginLink,
|
57
|
+
Mandate::OBJECT_NAME => Mandate,
|
52
58
|
Order::OBJECT_NAME => Order,
|
53
59
|
OrderReturn::OBJECT_NAME => OrderReturn,
|
54
60
|
PaymentIntent::OBJECT_NAME => PaymentIntent,
|
@@ -56,7 +62,10 @@ module Stripe
|
|
56
62
|
Payout::OBJECT_NAME => Payout,
|
57
63
|
Person::OBJECT_NAME => Person,
|
58
64
|
Plan::OBJECT_NAME => Plan,
|
65
|
+
Price::OBJECT_NAME => Price,
|
59
66
|
Product::OBJECT_NAME => Product,
|
67
|
+
PromotionCode::OBJECT_NAME => PromotionCode,
|
68
|
+
Quote::OBJECT_NAME => Quote,
|
60
69
|
Radar::EarlyFraudWarning::OBJECT_NAME => Radar::EarlyFraudWarning,
|
61
70
|
Radar::ValueList::OBJECT_NAME => Radar::ValueList,
|
62
71
|
Radar::ValueListItem::OBJECT_NAME => Radar::ValueListItem,
|
@@ -68,6 +77,7 @@ module Stripe
|
|
68
77
|
Reversal::OBJECT_NAME => Reversal,
|
69
78
|
Review::OBJECT_NAME => Review,
|
70
79
|
SKU::OBJECT_NAME => SKU,
|
80
|
+
SetupAttempt::OBJECT_NAME => SetupAttempt,
|
71
81
|
SetupIntent::OBJECT_NAME => SetupIntent,
|
72
82
|
Sigma::ScheduledQueryRun::OBJECT_NAME => Sigma::ScheduledQueryRun,
|
73
83
|
Source::OBJECT_NAME => Source,
|
@@ -75,6 +85,7 @@ module Stripe
|
|
75
85
|
Subscription::OBJECT_NAME => Subscription,
|
76
86
|
SubscriptionItem::OBJECT_NAME => SubscriptionItem,
|
77
87
|
SubscriptionSchedule::OBJECT_NAME => SubscriptionSchedule,
|
88
|
+
TaxCode::OBJECT_NAME => TaxCode,
|
78
89
|
TaxId::OBJECT_NAME => TaxId,
|
79
90
|
TaxRate::OBJECT_NAME => TaxRate,
|
80
91
|
Terminal::ConnectionToken::OBJECT_NAME => Terminal::ConnectionToken,
|
data/lib/stripe/resources.rb
CHANGED
@@ -9,6 +9,8 @@ require "stripe/resources/application_fee_refund"
|
|
9
9
|
require "stripe/resources/balance"
|
10
10
|
require "stripe/resources/balance_transaction"
|
11
11
|
require "stripe/resources/bank_account"
|
12
|
+
require "stripe/resources/billing_portal/configuration"
|
13
|
+
require "stripe/resources/billing_portal/session"
|
12
14
|
require "stripe/resources/bitcoin_receiver"
|
13
15
|
require "stripe/resources/bitcoin_transaction"
|
14
16
|
require "stripe/resources/capability"
|
@@ -18,6 +20,7 @@ require "stripe/resources/checkout/session"
|
|
18
20
|
require "stripe/resources/country_spec"
|
19
21
|
require "stripe/resources/coupon"
|
20
22
|
require "stripe/resources/credit_note"
|
23
|
+
require "stripe/resources/credit_note_line_item"
|
21
24
|
require "stripe/resources/customer"
|
22
25
|
require "stripe/resources/customer_balance_transaction"
|
23
26
|
require "stripe/resources/discount"
|
@@ -27,17 +30,20 @@ require "stripe/resources/event"
|
|
27
30
|
require "stripe/resources/exchange_rate"
|
28
31
|
require "stripe/resources/file"
|
29
32
|
require "stripe/resources/file_link"
|
33
|
+
require "stripe/resources/identity/verification_report"
|
34
|
+
require "stripe/resources/identity/verification_session"
|
30
35
|
require "stripe/resources/invoice"
|
31
36
|
require "stripe/resources/invoice_item"
|
32
37
|
require "stripe/resources/invoice_line_item"
|
33
|
-
require "stripe/resources/issuer_fraud_record"
|
34
38
|
require "stripe/resources/issuing/authorization"
|
35
39
|
require "stripe/resources/issuing/card"
|
36
40
|
require "stripe/resources/issuing/card_details"
|
37
41
|
require "stripe/resources/issuing/cardholder"
|
38
42
|
require "stripe/resources/issuing/dispute"
|
39
43
|
require "stripe/resources/issuing/transaction"
|
44
|
+
require "stripe/resources/line_item"
|
40
45
|
require "stripe/resources/login_link"
|
46
|
+
require "stripe/resources/mandate"
|
41
47
|
require "stripe/resources/order"
|
42
48
|
require "stripe/resources/order_return"
|
43
49
|
require "stripe/resources/payment_intent"
|
@@ -45,7 +51,10 @@ require "stripe/resources/payment_method"
|
|
45
51
|
require "stripe/resources/payout"
|
46
52
|
require "stripe/resources/person"
|
47
53
|
require "stripe/resources/plan"
|
54
|
+
require "stripe/resources/price"
|
48
55
|
require "stripe/resources/product"
|
56
|
+
require "stripe/resources/promotion_code"
|
57
|
+
require "stripe/resources/quote"
|
49
58
|
require "stripe/resources/radar/early_fraud_warning"
|
50
59
|
require "stripe/resources/radar/value_list"
|
51
60
|
require "stripe/resources/radar/value_list_item"
|
@@ -56,6 +65,7 @@ require "stripe/resources/reporting/report_run"
|
|
56
65
|
require "stripe/resources/reporting/report_type"
|
57
66
|
require "stripe/resources/reversal"
|
58
67
|
require "stripe/resources/review"
|
68
|
+
require "stripe/resources/setup_attempt"
|
59
69
|
require "stripe/resources/setup_intent"
|
60
70
|
require "stripe/resources/sigma/scheduled_query_run"
|
61
71
|
require "stripe/resources/sku"
|
@@ -64,6 +74,7 @@ require "stripe/resources/source_transaction"
|
|
64
74
|
require "stripe/resources/subscription"
|
65
75
|
require "stripe/resources/subscription_item"
|
66
76
|
require "stripe/resources/subscription_schedule"
|
77
|
+
require "stripe/resources/tax_code"
|
67
78
|
require "stripe/resources/tax_id"
|
68
79
|
require "stripe/resources/tax_rate"
|
69
80
|
require "stripe/resources/terminal/connection_token"
|
@@ -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
|
include Stripe::APIOperations::Save
|
10
11
|
extend Stripe::APIOperations::NestedResource
|
11
12
|
|
12
|
-
OBJECT_NAME = "account"
|
13
|
+
OBJECT_NAME = "account"
|
13
14
|
|
14
15
|
custom_method :reject, http_verb: :post
|
15
16
|
|
@@ -35,10 +36,6 @@ module Stripe
|
|
35
36
|
|
36
37
|
nested_resource_class_methods :login_link, operations: %i[create]
|
37
38
|
|
38
|
-
# This method is deprecated. Please use `#external_account=` instead.
|
39
|
-
save_nested_resource :bank_account
|
40
|
-
deprecate :bank_account=, "#external_account=", 2017, 8
|
41
|
-
|
42
39
|
def resource_url
|
43
40
|
if self["id"]
|
44
41
|
super
|
@@ -48,12 +45,8 @@ module Stripe
|
|
48
45
|
end
|
49
46
|
|
50
47
|
# @override To make id optional
|
51
|
-
def self.retrieve(id =
|
52
|
-
id
|
53
|
-
nil
|
54
|
-
else
|
55
|
-
Util.check_string_argument!(id)
|
56
|
-
end
|
48
|
+
def self.retrieve(id = nil, opts = {})
|
49
|
+
Util.check_string_argument!(id) if id
|
57
50
|
|
58
51
|
# Account used to be a singleton, where this method's signature was
|
59
52
|
# `(opts={})`. For the sake of not breaking folks who pass in an OAuth
|
@@ -68,7 +61,7 @@ module Stripe
|
|
68
61
|
end
|
69
62
|
|
70
63
|
def persons(params = {}, opts = {})
|
71
|
-
resp, opts =
|
64
|
+
resp, opts = execute_resource_request(:get, resource_url + "/persons", params, opts)
|
72
65
|
Util.convert_to_stripe_object(resp.data, opts)
|
73
66
|
end
|
74
67
|
|
@@ -139,11 +132,10 @@ module Stripe
|
|
139
132
|
client_id: client_id,
|
140
133
|
stripe_user_id: id,
|
141
134
|
}
|
135
|
+
opts = @opts.merge(Util.normalize_opts(opts))
|
142
136
|
OAuth.deauthorize(params, opts)
|
143
137
|
end
|
144
138
|
|
145
|
-
ARGUMENT_NOT_PROVIDED = Object.new
|
146
|
-
|
147
139
|
private def serialize_additional_owners(legal_entity, additional_owners)
|
148
140
|
original_value =
|
149
141
|
legal_entity
|