stripe 5.20.0 → 5.24.0
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/.rubocop.yml +4 -4
- data/.travis.yml +1 -1
- data/CHANGELOG.md +16 -0
- data/VERSION +1 -1
- data/lib/stripe.rb +32 -166
- 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 -1
- data/lib/stripe/api_operations/nested_resource.rb +6 -5
- data/lib/stripe/api_operations/request.rb +19 -3
- data/lib/stripe/api_operations/save.rb +7 -4
- data/lib/stripe/api_resource.rb +4 -3
- data/lib/stripe/list_object.rb +2 -2
- data/lib/stripe/oauth.rb +3 -3
- data/lib/stripe/object_types.rb +3 -0
- data/lib/stripe/resources.rb +3 -0
- data/lib/stripe/resources/account.rb +2 -1
- 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/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/session.rb +1 -0
- data/lib/stripe/resources/bitcoin_receiver.rb +1 -0
- data/lib/stripe/resources/card.rb +1 -0
- data/lib/stripe/resources/charge.rb +1 -0
- data/lib/stripe/resources/checkout/session.rb +4 -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 +3 -2
- data/lib/stripe/resources/customer.rb +2 -1
- 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 +1 -0
- data/lib/stripe/resources/file_link.rb +1 -0
- data/lib/stripe/resources/invoice.rb +3 -2
- data/lib/stripe/resources/invoice_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/cardholder.rb +1 -0
- data/lib/stripe/resources/issuing/dispute.rb +1 -0
- data/lib/stripe/resources/issuing/transaction.rb +1 -0
- data/lib/stripe/resources/line_item.rb +7 -0
- data/lib/stripe/resources/mandate.rb +1 -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 +1 -0
- data/lib/stripe/resources/payment_method.rb +1 -0
- data/lib/stripe/resources/payout.rb +1 -0
- data/lib/stripe/resources/plan.rb +1 -0
- data/lib/stripe/resources/price.rb +12 -0
- data/lib/stripe/resources/product.rb +1 -0
- data/lib/stripe/resources/promotion_code.rb +12 -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 +1 -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/review.rb +1 -0
- data/lib/stripe/resources/setup_intent.rb +1 -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 +4 -3
- data/lib/stripe/resources/subscription.rb +1 -0
- data/lib/stripe/resources/subscription_item.rb +2 -1
- data/lib/stripe/resources/subscription_schedule.rb +1 -0
- data/lib/stripe/resources/tax_rate.rb +1 -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 +1 -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/webhook_endpoint.rb +1 -0
- data/lib/stripe/stripe_configuration.rb +167 -0
- data/lib/stripe/stripe_object.rb +1 -1
- data/lib/stripe/version.rb +1 -1
- data/test/stripe/account_link_test.rb +3 -3
- data/test/stripe/checkout/session_test.rb +12 -0
- data/test/stripe/price_test.rb +48 -0
- data/test/stripe/promotion_code_test.rb +42 -0
- data/test/stripe/stripe_configuration_test.rb +128 -0
- data/test/stripe/subscription_item_test.rb +1 -1
- data/test/stripe_test.rb +88 -19
- data/test/test_helper.rb +1 -1
- metadata +12 -2
@@ -0,0 +1,128 @@
|
|
1
|
+
# frozen_string_literal: true
|
2
|
+
|
3
|
+
require ::File.expand_path("../test_helper", __dir__)
|
4
|
+
|
5
|
+
module Stripe
|
6
|
+
class StripeConfigurationTest < Test::Unit::TestCase
|
7
|
+
context ".setup" do
|
8
|
+
should "initialize a new configuration with defaults" do
|
9
|
+
config = Stripe::StripeConfiguration.setup
|
10
|
+
|
11
|
+
assert_equal Stripe::DEFAULT_CA_BUNDLE_PATH, config.ca_bundle_path
|
12
|
+
assert_equal true, config.enable_telemetry
|
13
|
+
assert_equal true, config.verify_ssl_certs
|
14
|
+
assert_equal 2, config.max_network_retry_delay
|
15
|
+
assert_equal 0.5, config.initial_network_retry_delay
|
16
|
+
assert_equal 0, config.max_network_retries
|
17
|
+
assert_equal 30, config.open_timeout
|
18
|
+
assert_equal 80, config.read_timeout
|
19
|
+
assert_equal "https://api.stripe.com", config.api_base
|
20
|
+
assert_equal "https://connect.stripe.com", config.connect_base
|
21
|
+
assert_equal "https://files.stripe.com", config.uploads_base
|
22
|
+
end
|
23
|
+
|
24
|
+
should "allow for overrides when a block is passed" do
|
25
|
+
config = Stripe::StripeConfiguration.setup do |c|
|
26
|
+
c.open_timeout = 100
|
27
|
+
c.read_timeout = 100
|
28
|
+
end
|
29
|
+
|
30
|
+
assert_equal 100, config.open_timeout
|
31
|
+
assert_equal 100, config.read_timeout
|
32
|
+
end
|
33
|
+
end
|
34
|
+
|
35
|
+
context "#reverse_duplicate_merge" do
|
36
|
+
should "return a duplicate object with overrides" do
|
37
|
+
config = Stripe::StripeConfiguration.setup do |c|
|
38
|
+
c.open_timeout = 100
|
39
|
+
end
|
40
|
+
|
41
|
+
duped_config = config.reverse_duplicate_merge(read_timeout: 500)
|
42
|
+
|
43
|
+
assert_equal config.open_timeout, duped_config.open_timeout
|
44
|
+
assert_equal 500, duped_config.read_timeout
|
45
|
+
end
|
46
|
+
end
|
47
|
+
|
48
|
+
context "#max_network_retries=" do
|
49
|
+
should "coerce the option into an integer" do
|
50
|
+
config = Stripe::StripeConfiguration.setup
|
51
|
+
|
52
|
+
config.max_network_retries = "10"
|
53
|
+
assert_equal 10, config.max_network_retries
|
54
|
+
end
|
55
|
+
end
|
56
|
+
|
57
|
+
context "#log_level=" do
|
58
|
+
should "be backwards compatible with old values" do
|
59
|
+
config = Stripe::StripeConfiguration.setup
|
60
|
+
|
61
|
+
config.log_level = "debug"
|
62
|
+
assert_equal Stripe::LEVEL_DEBUG, config.log_level
|
63
|
+
|
64
|
+
config.log_level = "info"
|
65
|
+
assert_equal Stripe::LEVEL_INFO, config.log_level
|
66
|
+
end
|
67
|
+
|
68
|
+
should "raise an error if the value isn't valid" do
|
69
|
+
config = Stripe::StripeConfiguration.setup
|
70
|
+
|
71
|
+
assert_raises ArgumentError do
|
72
|
+
config.log_level = "Foo"
|
73
|
+
end
|
74
|
+
end
|
75
|
+
end
|
76
|
+
|
77
|
+
context "options that require all connection managers to be cleared" do
|
78
|
+
should "clear when setting allow ca_bundle_path" do
|
79
|
+
config = Stripe::StripeConfiguration.setup
|
80
|
+
|
81
|
+
StripeClient.expects(:clear_all_connection_managers)
|
82
|
+
config.ca_bundle_path = "/path/to/ca/bundle"
|
83
|
+
end
|
84
|
+
|
85
|
+
should "clear when setting open timeout" do
|
86
|
+
config = Stripe::StripeConfiguration.setup
|
87
|
+
|
88
|
+
StripeClient.expects(:clear_all_connection_managers)
|
89
|
+
config.open_timeout = 10
|
90
|
+
end
|
91
|
+
|
92
|
+
should "clear when setting read timeout" do
|
93
|
+
config = Stripe::StripeConfiguration.setup
|
94
|
+
|
95
|
+
StripeClient.expects(:clear_all_connection_managers)
|
96
|
+
config.read_timeout = 10
|
97
|
+
end
|
98
|
+
|
99
|
+
should "clear when setting uploads_base" do
|
100
|
+
config = Stripe::StripeConfiguration.setup
|
101
|
+
|
102
|
+
StripeClient.expects(:clear_all_connection_managers)
|
103
|
+
config.uploads_base = "https://other.stripe.com"
|
104
|
+
end
|
105
|
+
|
106
|
+
should "clearn when setting api_base to be configured" do
|
107
|
+
config = Stripe::StripeConfiguration.setup
|
108
|
+
|
109
|
+
StripeClient.expects(:clear_all_connection_managers)
|
110
|
+
config.api_base = "https://other.stripe.com"
|
111
|
+
end
|
112
|
+
|
113
|
+
should "clear when setting connect_base" do
|
114
|
+
config = Stripe::StripeConfiguration.setup
|
115
|
+
|
116
|
+
StripeClient.expects(:clear_all_connection_managers)
|
117
|
+
config.connect_base = "https://other.stripe.com"
|
118
|
+
end
|
119
|
+
|
120
|
+
should "clear when setting verify_ssl_certs" do
|
121
|
+
config = Stripe::StripeConfiguration.setup
|
122
|
+
|
123
|
+
StripeClient.expects(:clear_all_connection_managers)
|
124
|
+
config.verify_ssl_certs = false
|
125
|
+
end
|
126
|
+
end
|
127
|
+
end
|
128
|
+
end
|
data/test/stripe_test.rb
CHANGED
@@ -23,28 +23,97 @@ class StripeTest < Test::Unit::TestCase
|
|
23
23
|
end
|
24
24
|
end
|
25
25
|
|
26
|
-
|
27
|
-
|
28
|
-
|
29
|
-
|
30
|
-
|
31
|
-
|
32
|
-
|
26
|
+
context "forwardable configurations" do
|
27
|
+
context "internal configurations" do
|
28
|
+
should "return the certificate store" do
|
29
|
+
assert Stripe.ca_store.is_a?(OpenSSL::X509::Store)
|
30
|
+
end
|
31
|
+
|
32
|
+
should "return the max_network_retry_delay" do
|
33
|
+
assert_equal 2, Stripe.max_network_retry_delay
|
34
|
+
end
|
35
|
+
|
36
|
+
should "return the initial_network_retry_delay" do
|
37
|
+
assert_equal 0.5, Stripe.initial_network_retry_delay
|
38
|
+
end
|
33
39
|
end
|
34
|
-
end
|
35
40
|
|
36
|
-
|
37
|
-
|
38
|
-
|
39
|
-
Stripe.
|
40
|
-
assert_equal 99, Stripe.max_network_retries
|
41
|
-
ensure
|
42
|
-
Stripe.max_network_retries = old
|
41
|
+
should "allow ca_bundle_path to be configured" do
|
42
|
+
Stripe::StripeClient.expects(:clear_all_connection_managers)
|
43
|
+
Stripe.ca_bundle_path = "/path/to/ca/bundle"
|
44
|
+
assert_equal "/path/to/ca/bundle", Stripe.ca_bundle_path
|
43
45
|
end
|
44
|
-
end
|
45
46
|
|
46
|
-
|
47
|
-
|
48
|
-
|
47
|
+
should "allow open timeout to be configured" do
|
48
|
+
Stripe.open_timeout = 10
|
49
|
+
assert_equal 10, Stripe.open_timeout
|
50
|
+
end
|
51
|
+
|
52
|
+
should "allow read timeout to be configured" do
|
53
|
+
Stripe.read_timeout = 10
|
54
|
+
assert_equal 10, Stripe.read_timeout
|
55
|
+
end
|
56
|
+
|
57
|
+
should "allow api_key to be configured" do
|
58
|
+
Stripe.api_key = "sk_local_test"
|
59
|
+
assert_equal "sk_local_test", Stripe.api_key
|
60
|
+
end
|
61
|
+
|
62
|
+
should "allow stripe_account to be configured" do
|
63
|
+
Stripe.stripe_account = "acct_1234"
|
64
|
+
assert_equal "acct_1234", Stripe.stripe_account
|
65
|
+
end
|
66
|
+
|
67
|
+
should "allow enable_telemetry to be configured" do
|
68
|
+
begin
|
69
|
+
old = Stripe.enable_telemetry?
|
70
|
+
|
71
|
+
Stripe.enable_telemetry = false
|
72
|
+
assert_equal false, Stripe.enable_telemetry?
|
73
|
+
ensure
|
74
|
+
Stripe.enable_telemetry = old
|
75
|
+
end
|
76
|
+
end
|
77
|
+
|
78
|
+
should "allow log_level to be configured" do
|
79
|
+
Stripe.log_level = "debug"
|
80
|
+
assert_equal ::Logger::DEBUG, Stripe.log_level
|
81
|
+
end
|
82
|
+
|
83
|
+
should "allow logger to be configured" do
|
84
|
+
logger = Object.new
|
85
|
+
Stripe.logger = logger
|
86
|
+
assert_equal logger, Stripe.logger
|
87
|
+
end
|
88
|
+
|
89
|
+
should "allow proxy to be configured" do
|
90
|
+
Stripe.proxy = "http://proxy"
|
91
|
+
assert_equal "http://proxy", Stripe.proxy
|
92
|
+
end
|
93
|
+
|
94
|
+
should "allow uploads_base to be configured" do
|
95
|
+
Stripe.uploads_base = "https://other.stripe.com"
|
96
|
+
assert_equal "https://other.stripe.com", Stripe.uploads_base
|
97
|
+
end
|
98
|
+
|
99
|
+
should "allow api_base to be configured" do
|
100
|
+
Stripe.api_base = "https://other.stripe.com"
|
101
|
+
assert_equal "https://other.stripe.com", Stripe.api_base
|
102
|
+
end
|
103
|
+
|
104
|
+
should "allow connect_base to be configured" do
|
105
|
+
Stripe.connect_base = "https://other.stripe.com"
|
106
|
+
assert_equal "https://other.stripe.com", Stripe.connect_base
|
107
|
+
end
|
108
|
+
|
109
|
+
should "allow verify_ssl_certs to be configured" do
|
110
|
+
Stripe.verify_ssl_certs = false
|
111
|
+
assert_equal false, Stripe.verify_ssl_certs
|
112
|
+
end
|
113
|
+
|
114
|
+
should "allow client_id to be configured" do
|
115
|
+
Stripe.client_id = "client"
|
116
|
+
assert_equal "client", Stripe.client_id
|
117
|
+
end
|
49
118
|
end
|
50
119
|
end
|
data/test/test_helper.rb
CHANGED
@@ -16,7 +16,7 @@ require ::File.expand_path("test_data", __dir__)
|
|
16
16
|
require ::File.expand_path("stripe_mock", __dir__)
|
17
17
|
|
18
18
|
# If changing this number, please also change it in `.travis.yml`.
|
19
|
-
MOCK_MINIMUM_VERSION = "0.
|
19
|
+
MOCK_MINIMUM_VERSION = "0.95.0"
|
20
20
|
MOCK_PORT = Stripe::StripeMock.start
|
21
21
|
|
22
22
|
# Disable all real network connections except those that are outgoing to
|
metadata
CHANGED
@@ -1,14 +1,14 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: stripe
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 5.
|
4
|
+
version: 5.24.0
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- Stripe
|
8
8
|
autorequire:
|
9
9
|
bindir: bin
|
10
10
|
cert_chain: []
|
11
|
-
date: 2020-
|
11
|
+
date: 2020-08-26 00:00:00.000000000 Z
|
12
12
|
dependencies: []
|
13
13
|
description: Stripe is the easiest way to accept payments online. See https://stripe.com
|
14
14
|
for details.
|
@@ -93,6 +93,7 @@ files:
|
|
93
93
|
- lib/stripe/resources/issuing/cardholder.rb
|
94
94
|
- lib/stripe/resources/issuing/dispute.rb
|
95
95
|
- lib/stripe/resources/issuing/transaction.rb
|
96
|
+
- lib/stripe/resources/line_item.rb
|
96
97
|
- lib/stripe/resources/login_link.rb
|
97
98
|
- lib/stripe/resources/mandate.rb
|
98
99
|
- lib/stripe/resources/order.rb
|
@@ -102,7 +103,9 @@ files:
|
|
102
103
|
- lib/stripe/resources/payout.rb
|
103
104
|
- lib/stripe/resources/person.rb
|
104
105
|
- lib/stripe/resources/plan.rb
|
106
|
+
- lib/stripe/resources/price.rb
|
105
107
|
- lib/stripe/resources/product.rb
|
108
|
+
- lib/stripe/resources/promotion_code.rb
|
106
109
|
- lib/stripe/resources/radar/early_fraud_warning.rb
|
107
110
|
- lib/stripe/resources/radar/value_list.rb
|
108
111
|
- lib/stripe/resources/radar/value_list_item.rb
|
@@ -135,6 +138,7 @@ files:
|
|
135
138
|
- lib/stripe/resources/webhook_endpoint.rb
|
136
139
|
- lib/stripe/singleton_api_resource.rb
|
137
140
|
- lib/stripe/stripe_client.rb
|
141
|
+
- lib/stripe/stripe_configuration.rb
|
138
142
|
- lib/stripe/stripe_object.rb
|
139
143
|
- lib/stripe/stripe_response.rb
|
140
144
|
- lib/stripe/util.rb
|
@@ -191,7 +195,9 @@ files:
|
|
191
195
|
- test/stripe/payout_test.rb
|
192
196
|
- test/stripe/person_test.rb
|
193
197
|
- test/stripe/plan_test.rb
|
198
|
+
- test/stripe/price_test.rb
|
194
199
|
- test/stripe/product_test.rb
|
200
|
+
- test/stripe/promotion_code_test.rb
|
195
201
|
- test/stripe/radar/early_fraud_warning_test.rb
|
196
202
|
- test/stripe/radar/value_list_item_test.rb
|
197
203
|
- test/stripe/radar/value_list_test.rb
|
@@ -206,6 +212,7 @@ files:
|
|
206
212
|
- test/stripe/sku_test.rb
|
207
213
|
- test/stripe/source_test.rb
|
208
214
|
- test/stripe/stripe_client_test.rb
|
215
|
+
- test/stripe/stripe_configuration_test.rb
|
209
216
|
- test/stripe/stripe_object_test.rb
|
210
217
|
- test/stripe/stripe_response_test.rb
|
211
218
|
- test/stripe/subscription_item_test.rb
|
@@ -307,7 +314,9 @@ test_files:
|
|
307
314
|
- test/stripe/payout_test.rb
|
308
315
|
- test/stripe/person_test.rb
|
309
316
|
- test/stripe/plan_test.rb
|
317
|
+
- test/stripe/price_test.rb
|
310
318
|
- test/stripe/product_test.rb
|
319
|
+
- test/stripe/promotion_code_test.rb
|
311
320
|
- test/stripe/radar/early_fraud_warning_test.rb
|
312
321
|
- test/stripe/radar/value_list_item_test.rb
|
313
322
|
- test/stripe/radar/value_list_test.rb
|
@@ -322,6 +331,7 @@ test_files:
|
|
322
331
|
- test/stripe/sku_test.rb
|
323
332
|
- test/stripe/source_test.rb
|
324
333
|
- test/stripe/stripe_client_test.rb
|
334
|
+
- test/stripe/stripe_configuration_test.rb
|
325
335
|
- test/stripe/stripe_object_test.rb
|
326
336
|
- test/stripe/stripe_response_test.rb
|
327
337
|
- test/stripe/subscription_item_test.rb
|