stripe-rails 2.0.0.pre → 2.3.0
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/.github/pull_request_template.md +12 -1
- data/.github/workflows/ruby.yml +4 -1
- data/Changelog.md +28 -1
- data/README.md +44 -6
- data/Rakefile +0 -0
- data/config/routes.rb +0 -1
- data/gemfiles/rails60.gemfile +19 -0
- data/lib/generators/stripe/install_generator.rb +1 -0
- data/lib/generators/templates/prices.rb +46 -0
- data/lib/stripe/callbacks.rb +2 -0
- data/lib/stripe/coupons.rb +2 -1
- data/lib/stripe/engine.rb +5 -5
- data/lib/stripe/prices.rb +189 -0
- data/lib/stripe/rails.rb +1 -0
- data/lib/stripe/rails/tasks.rake +11 -2
- data/lib/stripe/rails/version.rb +1 -1
- data/test/coupon_builder_spec.rb +1 -0
- data/test/dummy/config/stripe/prices.rb +59 -0
- data/test/dummy_apis_controller_spec.rb +1 -1
- data/test/events_controller_spec.rb +22 -3
- data/test/fixtures/stripe_prices.json +7 -0
- data/test/plan_builder_spec.rb +1 -1
- data/test/price_builder_spec.rb +594 -0
- data/test/stripe_initializers_spec.rb +47 -4
- metadata +17 -8
@@ -12,9 +12,10 @@ describe "Configuring the stripe engine" do
|
|
12
12
|
def rerun_initializers!; initializers.each{|init| init.run(app) }; end
|
13
13
|
|
14
14
|
after do
|
15
|
-
Stripe.api_version
|
16
|
-
Stripe.api_base
|
17
|
-
Stripe.api_key
|
15
|
+
Stripe.api_version = nil
|
16
|
+
Stripe.api_base = 'https://api.stripe.com'
|
17
|
+
Stripe.api_key = 'XYZ'
|
18
|
+
ENV['STRIPE_SECRET_KEY'] = 'XYZ'
|
18
19
|
end
|
19
20
|
|
20
21
|
describe 'Stripe configurations' do
|
@@ -40,7 +41,7 @@ describe "Configuring the stripe engine" do
|
|
40
41
|
app.config.stripe.open_timeout = 33
|
41
42
|
app.config.stripe.read_timeout = 88
|
42
43
|
rerun_initializers!
|
43
|
-
end
|
44
|
+
end
|
44
45
|
|
45
46
|
it "reads values that is set in the environment" do
|
46
47
|
subject
|
@@ -56,6 +57,16 @@ describe "Configuring the stripe engine" do
|
|
56
57
|
_(app.config.stripe.signing_secrets.length).must_equal 1
|
57
58
|
end
|
58
59
|
|
60
|
+
it "supports nil signing_secret" do
|
61
|
+
subject
|
62
|
+
|
63
|
+
app.config.stripe.signing_secret = nil
|
64
|
+
rerun_initializers!
|
65
|
+
|
66
|
+
_(app.config.stripe.signing_secret).must_equal nil
|
67
|
+
_(app.config.stripe.signing_secrets).must_equal nil
|
68
|
+
end
|
69
|
+
|
59
70
|
it "supports multiple signing secrets" do
|
60
71
|
subject
|
61
72
|
|
@@ -90,4 +101,36 @@ describe "Configuring the stripe engine" do
|
|
90
101
|
_(-> { subject }).must_output '', warning_msg
|
91
102
|
end
|
92
103
|
end
|
104
|
+
|
105
|
+
describe 'missing stripe.secret_key' do
|
106
|
+
subject do
|
107
|
+
ENV['STRIPE_SECRET_KEY'] = nil
|
108
|
+
Stripe.api_key = nil
|
109
|
+
app.config.stripe.secret_key = nil
|
110
|
+
rerun_initializers!
|
111
|
+
end
|
112
|
+
let(:warning_msg) { /No stripe.com API key was configured for environment test!/ }
|
113
|
+
|
114
|
+
it 'should output a warning' do
|
115
|
+
_(-> { subject }).must_output '', warning_msg
|
116
|
+
end
|
117
|
+
end
|
118
|
+
|
119
|
+
describe 'stripe.ignore_missing_secret_key' do
|
120
|
+
subject do
|
121
|
+
ENV['STRIPE_SECRET_KEY'] = nil
|
122
|
+
Stripe.api_key = nil
|
123
|
+
app.config.stripe.secret_key = nil
|
124
|
+
app.config.stripe.ignore_missing_secret_key = true
|
125
|
+
rerun_initializers!
|
126
|
+
end
|
127
|
+
|
128
|
+
after do
|
129
|
+
app.config.stripe.ignore_missing_secret_key = false
|
130
|
+
end
|
131
|
+
|
132
|
+
it 'should not output a warning' do
|
133
|
+
_(-> { subject }).must_output '', ''
|
134
|
+
end
|
135
|
+
end
|
93
136
|
end
|
metadata
CHANGED
@@ -1,16 +1,16 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: stripe-rails
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 2.
|
4
|
+
version: 2.3.0
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- Charles Lowell
|
8
8
|
- Nola Stowe
|
9
9
|
- SengMing Tan
|
10
|
-
autorequire:
|
10
|
+
autorequire:
|
11
11
|
bindir: bin
|
12
12
|
cert_chain: []
|
13
|
-
date:
|
13
|
+
date: 2021-03-08 00:00:00.000000000 Z
|
14
14
|
dependencies:
|
15
15
|
- !ruby/object:Gem::Dependency
|
16
16
|
name: rails
|
@@ -87,9 +87,11 @@ files:
|
|
87
87
|
- config/routes.rb
|
88
88
|
- gemfiles/rails51.gemfile
|
89
89
|
- gemfiles/rails52.gemfile
|
90
|
+
- gemfiles/rails60.gemfile
|
90
91
|
- lib/generators/stripe/install_generator.rb
|
91
92
|
- lib/generators/templates/coupons.rb
|
92
93
|
- lib/generators/templates/plans.rb
|
94
|
+
- lib/generators/templates/prices.rb
|
93
95
|
- lib/generators/templates/products.rb
|
94
96
|
- lib/stripe-rails.rb
|
95
97
|
- lib/stripe/billing_tier.rb
|
@@ -100,6 +102,7 @@ files:
|
|
100
102
|
- lib/stripe/current_api_version.rb
|
101
103
|
- lib/stripe/engine.rb
|
102
104
|
- lib/stripe/plans.rb
|
105
|
+
- lib/stripe/prices.rb
|
103
106
|
- lib/stripe/products.rb
|
104
107
|
- lib/stripe/rails.rb
|
105
108
|
- lib/stripe/rails/tasks.rake
|
@@ -138,6 +141,7 @@ files:
|
|
138
141
|
- test/dummy/config/locales/en.yml
|
139
142
|
- test/dummy/config/routes.rb
|
140
143
|
- test/dummy/config/stripe/plans.rb
|
144
|
+
- test/dummy/config/stripe/prices.rb
|
141
145
|
- test/dummy/lib/assets/.gitkeep
|
142
146
|
- test/dummy/lib/dummy/module_with_callbacks.rb
|
143
147
|
- test/dummy/log/.gitkeep
|
@@ -153,9 +157,11 @@ files:
|
|
153
157
|
- test/fixtures/stripe_plans.json
|
154
158
|
- test/fixtures/stripe_plans_headers.json
|
155
159
|
- test/fixtures/stripe_plans_headers_2017.json
|
160
|
+
- test/fixtures/stripe_prices.json
|
156
161
|
- test/invoice.json
|
157
162
|
- test/javascript_helper_spec.rb
|
158
163
|
- test/plan_builder_spec.rb
|
164
|
+
- test/price_builder_spec.rb
|
159
165
|
- test/product_builder_spec.rb
|
160
166
|
- test/spec_helper.rb
|
161
167
|
- test/stripe_initializers_spec.rb
|
@@ -167,7 +173,7 @@ homepage: https://github.com/tansengming/stripe-rails
|
|
167
173
|
licenses:
|
168
174
|
- MIT
|
169
175
|
metadata: {}
|
170
|
-
post_install_message:
|
176
|
+
post_install_message:
|
171
177
|
rdoc_options: []
|
172
178
|
require_paths:
|
173
179
|
- lib
|
@@ -178,12 +184,12 @@ required_ruby_version: !ruby/object:Gem::Requirement
|
|
178
184
|
version: '0'
|
179
185
|
required_rubygems_version: !ruby/object:Gem::Requirement
|
180
186
|
requirements:
|
181
|
-
- - "
|
187
|
+
- - ">="
|
182
188
|
- !ruby/object:Gem::Version
|
183
|
-
version:
|
189
|
+
version: '0'
|
184
190
|
requirements: []
|
185
|
-
rubygems_version: 3.
|
186
|
-
signing_key:
|
191
|
+
rubygems_version: 3.2.9
|
192
|
+
signing_key:
|
187
193
|
specification_version: 4
|
188
194
|
summary: A gem to integrate stripe into your rails app
|
189
195
|
test_files:
|
@@ -219,6 +225,7 @@ test_files:
|
|
219
225
|
- test/dummy/config/locales/en.yml
|
220
226
|
- test/dummy/config/routes.rb
|
221
227
|
- test/dummy/config/stripe/plans.rb
|
228
|
+
- test/dummy/config/stripe/prices.rb
|
222
229
|
- test/dummy/lib/assets/.gitkeep
|
223
230
|
- test/dummy/lib/dummy/module_with_callbacks.rb
|
224
231
|
- test/dummy/log/.gitkeep
|
@@ -234,9 +241,11 @@ test_files:
|
|
234
241
|
- test/fixtures/stripe_plans.json
|
235
242
|
- test/fixtures/stripe_plans_headers.json
|
236
243
|
- test/fixtures/stripe_plans_headers_2017.json
|
244
|
+
- test/fixtures/stripe_prices.json
|
237
245
|
- test/invoice.json
|
238
246
|
- test/javascript_helper_spec.rb
|
239
247
|
- test/plan_builder_spec.rb
|
248
|
+
- test/price_builder_spec.rb
|
240
249
|
- test/product_builder_spec.rb
|
241
250
|
- test/spec_helper.rb
|
242
251
|
- test/stripe_initializers_spec.rb
|