stripe 5.28.0 → 5.38.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 +46 -0
- data/Gemfile +0 -1
- data/README.md +5 -1
- data/VERSION +1 -1
- data/lib/stripe/api_operations/request.rb +35 -2
- data/lib/stripe/api_resource.rb +8 -0
- data/lib/stripe/connection_manager.rb +27 -10
- data/lib/stripe/error_object.rb +2 -3
- data/lib/stripe/instrumentation.rb +3 -1
- data/lib/stripe/oauth.rb +4 -3
- data/lib/stripe/object_types.rb +7 -1
- data/lib/stripe/resources/account.rb +3 -8
- data/lib/stripe/resources/application_fee_refund.rb +2 -1
- data/lib/stripe/resources/billing_portal/configuration.rb +14 -0
- data/lib/stripe/resources/bitcoin_transaction.rb +3 -2
- data/lib/stripe/resources/capability.rb +2 -1
- data/lib/stripe/resources/credit_note_line_item.rb +1 -0
- data/lib/stripe/resources/customer.rb +6 -1
- data/lib/stripe/resources/customer_balance_transaction.rb +3 -2
- data/lib/stripe/resources/file.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_line_item.rb +1 -0
- data/lib/stripe/resources/line_item.rb +1 -0
- data/lib/stripe/resources/login_link.rb +1 -0
- data/lib/stripe/resources/person.rb +1 -0
- data/lib/stripe/resources/quote.rb +105 -0
- data/lib/stripe/resources/reversal.rb +3 -2
- data/lib/stripe/resources/tax_code.rb +10 -0
- data/lib/stripe/resources/tax_id.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.rb +6 -0
- data/lib/stripe/stripe_client.rb +242 -111
- data/lib/stripe/stripe_configuration.rb +25 -9
- data/lib/stripe/stripe_object.rb +23 -0
- data/lib/stripe/stripe_response.rb +80 -52
- data/lib/stripe/util.rb +15 -7
- data/lib/stripe/version.rb +1 -1
- data/lib/stripe.rb +23 -22
- data/stripe.gemspec +9 -2
- metadata +8 -192
- data/.editorconfig +0 -10
- data/.gitattributes +0 -4
- data/.github/ISSUE_TEMPLATE.md +0 -5
- data/.gitignore +0 -8
- data/.rubocop.yml +0 -80
- data/.rubocop_todo.yml +0 -33
- data/.travis.yml +0 -38
- data/.vscode/extensions.json +0 -7
- data/.vscode/settings.json +0 -8
- 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 -646
- 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/billing_portal/session_test.rb +0 -18
- data/test/stripe/capability_test.rb +0 -45
- data/test/stripe/charge_test.rb +0 -64
- data/test/stripe/checkout/session_test.rb +0 -53
- data/test/stripe/connection_manager_test.rb +0 -167
- 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 -90
- data/test/stripe/customer_balance_transaction_test.rb +0 -37
- data/test/stripe/customer_card_test.rb +0 -48
- 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 -53
- 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/instrumentation_test.rb +0 -74
- 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 -74
- data/test/stripe/issuing/cardholder_test.rb +0 -53
- data/test/stripe/issuing/dispute_test.rb +0 -54
- data/test/stripe/issuing/transaction_test.rb +0 -48
- data/test/stripe/list_object_test.rb +0 -202
- data/test/stripe/login_link_test.rb +0 -37
- data/test/stripe/mandate_test.rb +0 -14
- data/test/stripe/multipart_encoder_test.rb +0 -130
- data/test/stripe/oauth_test.rb +0 -104
- 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 -72
- data/test/stripe/person_test.rb +0 -46
- data/test/stripe/plan_test.rb +0 -98
- data/test/stripe/price_test.rb +0 -48
- data/test/stripe/product_test.rb +0 -58
- data/test/stripe/promotion_code_test.rb +0 -42
- 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_attempt_test.rb +0 -16
- 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 -119
- data/test/stripe/stripe_client_test.rb +0 -1291
- data/test/stripe/stripe_configuration_test.rb +0 -131
- data/test/stripe/stripe_object_test.rb +0 -500
- data/test/stripe/stripe_response_test.rb +0 -95
- data/test/stripe/subscription_item_test.rb +0 -84
- 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 -29
- data/test/stripe/util_test.rb +0 -402
- data/test/stripe/webhook_endpoint_test.rb +0 -59
- data/test/stripe/webhook_test.rb +0 -135
- data/test/stripe_mock.rb +0 -78
- data/test/stripe_test.rb +0 -132
- data/test/test_data.rb +0 -61
- data/test/test_helper.rb +0 -77
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA256:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: 1c7a2e67a4d91e1a22dff9303644b5f2efb74675bce05e364fff8d287f3fa8bd
|
4
|
+
data.tar.gz: a560d866c948d0bbc8f3389571c313da67a26650a771159fa785d7a1e3beccc9
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: a257d84bec5ef9fe3005b362da5c5194a71e257e77baa71c5872b990fefc3e3ee7cc26201d773cf4f5ca29af0fd8b2d3f3b047e11a833c51aba7bca2f6b3947a
|
7
|
+
data.tar.gz: eae3ef2579f9ce37a5e447cd46ca67bdfebc2324e5767cc0925d7f2bee5d8f289a69512ff9221cb28bdd9c4ec39a8cea1f7b5af14b67d18b2fa8a3c9ce7dbb47
|
data/CHANGELOG.md
CHANGED
@@ -1,5 +1,51 @@
|
|
1
1
|
# Changelog
|
2
2
|
|
3
|
+
## 5.38.0 - 2021-08-10
|
4
|
+
* [#993](https://github.com/stripe/stripe-ruby/pull/993) Add `request_id` to RequestEndEvent
|
5
|
+
* [#991](https://github.com/stripe/stripe-ruby/pull/991) Codegen more files
|
6
|
+
* [#989](https://github.com/stripe/stripe-ruby/pull/989) Remove unused API error types from docs.
|
7
|
+
|
8
|
+
## 5.37.0 - 2021-07-14
|
9
|
+
* [#988](https://github.com/stripe/stripe-ruby/pull/988) API Updates
|
10
|
+
* Add support for `list_computed_upfront_line_items` method on resource `Quote`
|
11
|
+
|
12
|
+
## 5.36.0 - 2021-07-09
|
13
|
+
* [#987](https://github.com/stripe/stripe-ruby/pull/987) Add support for `Quote` API
|
14
|
+
|
15
|
+
## 5.35.0 - 2021-06-30
|
16
|
+
* [#985](https://github.com/stripe/stripe-ruby/pull/985) Update normalize_opts to use dup instead of clone.
|
17
|
+
* [#982](https://github.com/stripe/stripe-ruby/pull/982) Deprecate travis
|
18
|
+
* [#983](https://github.com/stripe/stripe-ruby/pull/983) Add support for making a request and receiving the response as a stream.
|
19
|
+
|
20
|
+
## 5.34.0 - 2021-06-04
|
21
|
+
* [#981](https://github.com/stripe/stripe-ruby/pull/981) API Updates
|
22
|
+
* Add support for `TaxCode` API.
|
23
|
+
|
24
|
+
## 5.33.0 - 2021-05-19
|
25
|
+
* [#979](https://github.com/stripe/stripe-ruby/pull/979) Add support for the Identify VerificationSession and VerificationReport APIs
|
26
|
+
|
27
|
+
## 5.32.1 - 2021-04-05
|
28
|
+
* Correct use of regexp `match` in gemspec for old versions of Ruby
|
29
|
+
|
30
|
+
## 5.32.0 - 2021-04-05
|
31
|
+
* [#973](https://github.com/stripe/stripe-ruby/pull/973) Reduce packed gem size
|
32
|
+
|
33
|
+
## 5.31.0 - 2021-04-02
|
34
|
+
* [#968](https://github.com/stripe/stripe-ruby/pull/968) Allow StripeClient to be configured per instance
|
35
|
+
* [#971](https://github.com/stripe/stripe-ruby/pull/971) On config change, only clear connection managers for changed config
|
36
|
+
* [#972](https://github.com/stripe/stripe-ruby/pull/972) Rename `Stripe.configuration` to `Stripe.config`
|
37
|
+
* [#970](https://github.com/stripe/stripe-ruby/pull/970) Reserve some critical field names when adding `StripeObject` accessors
|
38
|
+
* [#967](https://github.com/stripe/stripe-ruby/pull/967) CI: github actions
|
39
|
+
|
40
|
+
## 5.30.0 - 2021-02-22
|
41
|
+
* [#965](https://github.com/stripe/stripe-ruby/pull/965) Add support for the Billing Portal Configuration API
|
42
|
+
|
43
|
+
## 5.29.1 - 2021-02-09
|
44
|
+
* [#964](https://github.com/stripe/stripe-ruby/pull/964) Fix return value of `Customer#delete_discount`
|
45
|
+
|
46
|
+
## 5.29.0 - 2021-01-05
|
47
|
+
* [#952](https://github.com/stripe/stripe-ruby/pull/952) Allow client_id configuration on instance config
|
48
|
+
|
3
49
|
## 5.28.0 - 2020-10-14
|
4
50
|
* [#950](https://github.com/stripe/stripe-ruby/pull/950) Add configuration option for `write_timeout` for connections on Ruby 2.6+
|
5
51
|
|
data/Gemfile
CHANGED
data/README.md
CHANGED
@@ -2,7 +2,6 @@
|
|
2
2
|
|
3
3
|
[![Gem Version](https://badge.fury.io/rb/stripe.svg)](https://badge.fury.io/rb/stripe)
|
4
4
|
[![Build Status](https://travis-ci.org/stripe/stripe-ruby.svg?branch=master)](https://travis-ci.org/stripe/stripe-ruby)
|
5
|
-
[![Coverage Status](https://coveralls.io/repos/github/stripe/stripe-ruby/badge.svg?branch=master)](https://coveralls.io/github/stripe/stripe-ruby?branch=master)
|
6
5
|
|
7
6
|
The Stripe Ruby library provides convenient access to the Stripe API from
|
8
7
|
applications written in the Ruby language. It includes a pre-defined set of
|
@@ -21,6 +20,9 @@ The library also provides other features. For example:
|
|
21
20
|
|
22
21
|
See the [Ruby API docs](https://stripe.com/docs/api/ruby#intro).
|
23
22
|
|
23
|
+
See [video demonstrations][youtube-playlist] covering how to use the library.
|
24
|
+
|
25
|
+
|
24
26
|
## Installation
|
25
27
|
|
26
28
|
You don't need this source code unless you want to modify the gem. If you just
|
@@ -250,6 +252,7 @@ a success or error. Receives `RequestEndEvent` with the following properties:
|
|
250
252
|
- `path`: Request path. (`String`)
|
251
253
|
- `user_data`: A hash on which users may have set arbitrary data in
|
252
254
|
`request_begin`. See above for more information. (`Hash`)
|
255
|
+
- `request_id`. HTTP request identifier.
|
253
256
|
|
254
257
|
#### Example
|
255
258
|
|
@@ -340,6 +343,7 @@ Update the bundled [stripe-mock] by editing the version number found in
|
|
340
343
|
[idempotency-keys]: https://stripe.com/docs/api/ruby#idempotent_requests
|
341
344
|
[stripe-mock]: https://github.com/stripe/stripe-mock
|
342
345
|
[versioning]: https://stripe.com/docs/api/ruby#versioning
|
346
|
+
[youtube-playlist]: https://www.youtube.com/playlist?list=PLy1nL-pvL2M50RmP6ie-gdcSnfOuQCRYk
|
343
347
|
|
344
348
|
<!--
|
345
349
|
# vim: set tw=79:
|
data/VERSION
CHANGED
@@ -1 +1 @@
|
|
1
|
-
5.
|
1
|
+
5.38.0
|
@@ -6,6 +6,28 @@ module Stripe
|
|
6
6
|
module ClassMethods
|
7
7
|
def execute_resource_request(method, url,
|
8
8
|
params = {}, opts = {})
|
9
|
+
execute_resource_request_internal(
|
10
|
+
:execute_request, method, url, params, opts
|
11
|
+
)
|
12
|
+
end
|
13
|
+
|
14
|
+
def execute_resource_request_stream(method, url,
|
15
|
+
params = {}, opts = {},
|
16
|
+
&read_body_chunk_block)
|
17
|
+
execute_resource_request_internal(
|
18
|
+
:execute_request_stream,
|
19
|
+
method,
|
20
|
+
url,
|
21
|
+
params,
|
22
|
+
opts,
|
23
|
+
&read_body_chunk_block
|
24
|
+
)
|
25
|
+
end
|
26
|
+
|
27
|
+
private def execute_resource_request_internal(client_request_method_sym,
|
28
|
+
method, url,
|
29
|
+
params, opts,
|
30
|
+
&read_body_chunk_block)
|
9
31
|
params ||= {}
|
10
32
|
|
11
33
|
error_on_invalid_params(params)
|
@@ -22,10 +44,12 @@ module Stripe
|
|
22
44
|
client = headers.delete(:client)
|
23
45
|
# Assume all remaining opts must be headers
|
24
46
|
|
25
|
-
resp, opts[:api_key] = client.
|
47
|
+
resp, opts[:api_key] = client.send(
|
48
|
+
client_request_method_sym,
|
26
49
|
method, url,
|
27
50
|
api_base: api_base, api_key: api_key,
|
28
|
-
headers: headers, params: params
|
51
|
+
headers: headers, params: params,
|
52
|
+
&read_body_chunk_block
|
29
53
|
)
|
30
54
|
|
31
55
|
# Hash#select returns an array before 1.9
|
@@ -89,6 +113,15 @@ module Stripe
|
|
89
113
|
self.class.execute_resource_request(method, url, params, opts)
|
90
114
|
end
|
91
115
|
|
116
|
+
protected def execute_resource_request_stream(method, url,
|
117
|
+
params = {}, opts = {},
|
118
|
+
&read_body_chunk_block)
|
119
|
+
opts = @opts.merge(Util.normalize_opts(opts))
|
120
|
+
self.class.execute_resource_request_stream(
|
121
|
+
method, url, params, opts, &read_body_chunk_block
|
122
|
+
)
|
123
|
+
end
|
124
|
+
|
92
125
|
# See notes on `alias` above.
|
93
126
|
alias request execute_resource_request
|
94
127
|
end
|
data/lib/stripe/api_resource.rb
CHANGED
@@ -115,5 +115,13 @@ module Stripe
|
|
115
115
|
Util.convert_to_stripe_object(resp.data, opts)
|
116
116
|
end
|
117
117
|
end
|
118
|
+
|
119
|
+
protected def request_stream(method:, path:, params:, opts: {},
|
120
|
+
&read_body_chunk_block)
|
121
|
+
resp, = execute_resource_request_stream(
|
122
|
+
method, path, params, opts, &read_body_chunk_block
|
123
|
+
)
|
124
|
+
resp
|
125
|
+
end
|
118
126
|
end
|
119
127
|
end
|
@@ -15,8 +15,10 @@ module Stripe
|
|
15
15
|
# by `StripeClient` to determine whether a connection manager should be
|
16
16
|
# garbage collected or not.
|
17
17
|
attr_reader :last_used
|
18
|
+
attr_reader :config
|
18
19
|
|
19
|
-
def initialize
|
20
|
+
def initialize(config = Stripe.config)
|
21
|
+
@config = config
|
20
22
|
@active_connections = {}
|
21
23
|
@last_used = Util.monotonic_time
|
22
24
|
|
@@ -64,7 +66,8 @@ module Stripe
|
|
64
66
|
|
65
67
|
# Executes an HTTP request to the given URI with the given method. Also
|
66
68
|
# allows a request body, headers, and query string to be specified.
|
67
|
-
def execute_request(method, uri, body: nil, headers: nil, query: nil
|
69
|
+
def execute_request(method, uri, body: nil, headers: nil, query: nil,
|
70
|
+
&block)
|
68
71
|
# Perform some basic argument validation because it's easy to get
|
69
72
|
# confused between strings and hashes for things like body and query
|
70
73
|
# parameters.
|
@@ -90,8 +93,22 @@ module Stripe
|
|
90
93
|
u.path
|
91
94
|
end
|
92
95
|
|
96
|
+
method_name = method.to_s.upcase
|
97
|
+
has_response_body = method_name != "HEAD"
|
98
|
+
request = Net::HTTPGenericRequest.new(
|
99
|
+
method_name,
|
100
|
+
(body ? true : false),
|
101
|
+
has_response_body,
|
102
|
+
path,
|
103
|
+
headers
|
104
|
+
)
|
105
|
+
|
93
106
|
@mutex.synchronize do
|
94
|
-
|
107
|
+
# The block parameter is special here. If a block is provided, the block
|
108
|
+
# is invoked with the Net::HTTPResponse. However, the body will not have
|
109
|
+
# been read yet in the block, and can be streamed by calling
|
110
|
+
# HTTPResponse#read_body.
|
111
|
+
connection.request(request, body, &block)
|
95
112
|
end
|
96
113
|
end
|
97
114
|
|
@@ -117,17 +134,17 @@ module Stripe
|
|
117
134
|
# reused Go's default for `DefaultTransport`.
|
118
135
|
connection.keep_alive_timeout = 30
|
119
136
|
|
120
|
-
connection.open_timeout =
|
121
|
-
connection.read_timeout =
|
137
|
+
connection.open_timeout = config.open_timeout
|
138
|
+
connection.read_timeout = config.read_timeout
|
122
139
|
if connection.respond_to?(:write_timeout=)
|
123
|
-
connection.write_timeout =
|
140
|
+
connection.write_timeout = config.write_timeout
|
124
141
|
end
|
125
142
|
|
126
143
|
connection.use_ssl = uri.scheme == "https"
|
127
144
|
|
128
|
-
if
|
145
|
+
if config.verify_ssl_certs
|
129
146
|
connection.verify_mode = OpenSSL::SSL::VERIFY_PEER
|
130
|
-
connection.cert_store =
|
147
|
+
connection.cert_store = config.ca_store
|
131
148
|
else
|
132
149
|
connection.verify_mode = OpenSSL::SSL::VERIFY_NONE
|
133
150
|
warn_ssl_verify_none
|
@@ -141,10 +158,10 @@ module Stripe
|
|
141
158
|
# out those pieces to make passing them into a new connection a little less
|
142
159
|
# ugly.
|
143
160
|
private def proxy_parts
|
144
|
-
if
|
161
|
+
if config.proxy.nil?
|
145
162
|
[nil, nil, nil, nil]
|
146
163
|
else
|
147
|
-
u = URI.parse(
|
164
|
+
u = URI.parse(config.proxy)
|
148
165
|
[u.host, u.port, u.user, u.password]
|
149
166
|
end
|
150
167
|
end
|
data/lib/stripe/error_object.rb
CHANGED
@@ -69,9 +69,8 @@ module Stripe
|
|
69
69
|
@values[:source]
|
70
70
|
end
|
71
71
|
|
72
|
-
# The type of error returned. One of `
|
73
|
-
# `
|
74
|
-
# `invalid_request_error`, or `rate_limit_error`.
|
72
|
+
# The type of error returned. One of `api_error`, `card_error`,
|
73
|
+
# `idempotency_error`, or `invalid_request_error`.
|
75
74
|
def type
|
76
75
|
@values[:type]
|
77
76
|
end
|
@@ -32,6 +32,7 @@ module Stripe
|
|
32
32
|
attr_reader :method
|
33
33
|
attr_reader :num_retries
|
34
34
|
attr_reader :path
|
35
|
+
attr_reader :request_id
|
35
36
|
|
36
37
|
# Arbitrary user-provided data in the form of a Ruby hash that's passed
|
37
38
|
# from subscribers on `request_begin` to subscribers on `request_end`.
|
@@ -40,12 +41,13 @@ module Stripe
|
|
40
41
|
attr_reader :user_data
|
41
42
|
|
42
43
|
def initialize(duration:, http_status:, method:, num_retries:, path:,
|
43
|
-
user_data: nil)
|
44
|
+
request_id:, user_data: nil)
|
44
45
|
@duration = duration
|
45
46
|
@http_status = http_status
|
46
47
|
@method = method
|
47
48
|
@num_retries = num_retries
|
48
49
|
@path = path
|
50
|
+
@request_id = request_id
|
49
51
|
@user_data = user_data
|
50
52
|
freeze
|
51
53
|
end
|
data/lib/stripe/oauth.rb
CHANGED
@@ -7,8 +7,8 @@ module Stripe
|
|
7
7
|
|
8
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]
|
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
|
@@ -19,6 +20,7 @@ module Stripe
|
|
19
20
|
Balance::OBJECT_NAME => Balance,
|
20
21
|
BalanceTransaction::OBJECT_NAME => BalanceTransaction,
|
21
22
|
BankAccount::OBJECT_NAME => BankAccount,
|
23
|
+
BillingPortal::Configuration::OBJECT_NAME => BillingPortal::Configuration,
|
22
24
|
BillingPortal::Session::OBJECT_NAME => BillingPortal::Session,
|
23
25
|
BitcoinReceiver::OBJECT_NAME => BitcoinReceiver,
|
24
26
|
BitcoinTransaction::OBJECT_NAME => BitcoinTransaction,
|
@@ -40,6 +42,8 @@ module Stripe
|
|
40
42
|
File::OBJECT_NAME => File,
|
41
43
|
File::OBJECT_NAME_ALT => File,
|
42
44
|
FileLink::OBJECT_NAME => FileLink,
|
45
|
+
Identity::VerificationReport::OBJECT_NAME => Identity::VerificationReport,
|
46
|
+
Identity::VerificationSession::OBJECT_NAME => Identity::VerificationSession,
|
43
47
|
Invoice::OBJECT_NAME => Invoice,
|
44
48
|
InvoiceItem::OBJECT_NAME => InvoiceItem,
|
45
49
|
InvoiceLineItem::OBJECT_NAME => InvoiceLineItem,
|
@@ -62,6 +66,7 @@ module Stripe
|
|
62
66
|
Price::OBJECT_NAME => Price,
|
63
67
|
Product::OBJECT_NAME => Product,
|
64
68
|
PromotionCode::OBJECT_NAME => PromotionCode,
|
69
|
+
Quote::OBJECT_NAME => Quote,
|
65
70
|
Radar::EarlyFraudWarning::OBJECT_NAME => Radar::EarlyFraudWarning,
|
66
71
|
Radar::ValueList::OBJECT_NAME => Radar::ValueList,
|
67
72
|
Radar::ValueListItem::OBJECT_NAME => Radar::ValueListItem,
|
@@ -72,15 +77,16 @@ module Stripe
|
|
72
77
|
Reporting::ReportType::OBJECT_NAME => Reporting::ReportType,
|
73
78
|
Reversal::OBJECT_NAME => Reversal,
|
74
79
|
Review::OBJECT_NAME => Review,
|
75
|
-
SKU::OBJECT_NAME => SKU,
|
76
80
|
SetupAttempt::OBJECT_NAME => SetupAttempt,
|
77
81
|
SetupIntent::OBJECT_NAME => SetupIntent,
|
78
82
|
Sigma::ScheduledQueryRun::OBJECT_NAME => Sigma::ScheduledQueryRun,
|
83
|
+
SKU::OBJECT_NAME => SKU,
|
79
84
|
Source::OBJECT_NAME => Source,
|
80
85
|
SourceTransaction::OBJECT_NAME => SourceTransaction,
|
81
86
|
Subscription::OBJECT_NAME => Subscription,
|
82
87
|
SubscriptionItem::OBJECT_NAME => SubscriptionItem,
|
83
88
|
SubscriptionSchedule::OBJECT_NAME => SubscriptionSchedule,
|
89
|
+
TaxCode::OBJECT_NAME => TaxCode,
|
84
90
|
TaxId::OBJECT_NAME => TaxId,
|
85
91
|
TaxRate::OBJECT_NAME => TaxRate,
|
86
92
|
Terminal::ConnectionToken::OBJECT_NAME => Terminal::ConnectionToken,
|
@@ -45,12 +45,8 @@ module Stripe
|
|
45
45
|
end
|
46
46
|
|
47
47
|
# @override To make id optional
|
48
|
-
def self.retrieve(id =
|
49
|
-
id
|
50
|
-
nil
|
51
|
-
else
|
52
|
-
Util.check_string_argument!(id)
|
53
|
-
end
|
48
|
+
def self.retrieve(id = nil, opts = {})
|
49
|
+
Util.check_string_argument!(id) if id
|
54
50
|
|
55
51
|
# Account used to be a singleton, where this method's signature was
|
56
52
|
# `(opts={})`. For the sake of not breaking folks who pass in an OAuth
|
@@ -136,11 +132,10 @@ module Stripe
|
|
136
132
|
client_id: client_id,
|
137
133
|
stripe_user_id: id,
|
138
134
|
}
|
135
|
+
opts = @opts.merge(Util.normalize_opts(opts))
|
139
136
|
OAuth.deauthorize(params, opts)
|
140
137
|
end
|
141
138
|
|
142
|
-
ARGUMENT_NOT_PROVIDED = Object.new
|
143
|
-
|
144
139
|
private def serialize_additional_owners(legal_entity, additional_owners)
|
145
140
|
original_value =
|
146
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
|
|
@@ -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
|
@@ -28,9 +28,14 @@ module Stripe
|
|
28
28
|
alias detach_source delete_source
|
29
29
|
end
|
30
30
|
|
31
|
+
# Deletes a discount associated with the customer.
|
32
|
+
#
|
33
|
+
# Returns the deleted discount. The customer object is not updated,
|
34
|
+
# so you must call `refresh` on it to get a new version with the
|
35
|
+
# discount removed.
|
31
36
|
def delete_discount
|
32
37
|
resp, opts = execute_resource_request(:delete, resource_url + "/discount")
|
33
|
-
|
38
|
+
Util.convert_to_stripe_object(resp.data, opts)
|
34
39
|
end
|
35
40
|
end
|
36
41
|
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
|
@@ -25,8 +25,9 @@ module Stripe
|
|
25
25
|
end
|
26
26
|
end
|
27
27
|
|
28
|
+
config = opts[:client]&.config || Stripe.config
|
28
29
|
opts = {
|
29
|
-
api_base:
|
30
|
+
api_base: config.uploads_base,
|
30
31
|
content_type: MultipartEncoder::MULTIPART_FORM_DATA,
|
31
32
|
}.merge(Util.normalize_opts(opts))
|
32
33
|
super
|
@@ -0,0 +1,35 @@
|
|
1
|
+
# File generated from our OpenAPI spec
|
2
|
+
# frozen_string_literal: true
|
3
|
+
|
4
|
+
module Stripe
|
5
|
+
module Identity
|
6
|
+
class VerificationSession < APIResource
|
7
|
+
extend Stripe::APIOperations::Create
|
8
|
+
extend Stripe::APIOperations::List
|
9
|
+
include Stripe::APIOperations::Save
|
10
|
+
|
11
|
+
OBJECT_NAME = "identity.verification_session"
|
12
|
+
|
13
|
+
custom_method :cancel, http_verb: :post
|
14
|
+
custom_method :redact, http_verb: :post
|
15
|
+
|
16
|
+
def cancel(params = {}, opts = {})
|
17
|
+
request_stripe_object(
|
18
|
+
method: :post,
|
19
|
+
path: resource_url + "/cancel",
|
20
|
+
params: params,
|
21
|
+
opts: opts
|
22
|
+
)
|
23
|
+
end
|
24
|
+
|
25
|
+
def redact(params = {}, opts = {})
|
26
|
+
request_stripe_object(
|
27
|
+
method: :post,
|
28
|
+
path: resource_url + "/redact",
|
29
|
+
params: params,
|
30
|
+
opts: opts
|
31
|
+
)
|
32
|
+
end
|
33
|
+
end
|
34
|
+
end
|
35
|
+
end
|