stripe-rails 1.10.1 → 2.2.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 +6 -6
- data/Changelog.md +23 -2
- data/Gemfile +3 -3
- data/README.md +44 -6
- data/Rakefile +0 -0
- data/config/routes.rb +0 -1
- data/lib/generators/stripe/install_generator.rb +1 -0
- data/lib/generators/templates/prices.rb +46 -0
- data/lib/stripe/callbacks.rb +1 -4
- 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/stripe-rails.gemspec +2 -2
- 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
- data/test/support/application_system_test_case.rb +2 -7
- metadata +18 -17
- data/app/controllers/stripe/pings_controller.rb +0 -10
- data/app/models/stripe/ping.rb +0 -9
- data/gemfiles/rails4.gemfile +0 -20
- data/test/pings_controller_spec.rb +0 -18
- data/test/support/null_system_test_case.rb +0 -11
@@ -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
|
@@ -1,8 +1,3 @@
|
|
1
|
-
|
2
|
-
|
3
|
-
# For Rails 4 compat
|
4
|
-
SystemTestCaseKlass = defined?(ActionDispatch::SystemTestCase) ? ActionDispatch::SystemTestCase : NullSystemTestCase
|
5
|
-
|
6
|
-
class ApplicationSystemTestCase < SystemTestCaseKlass
|
1
|
+
class ApplicationSystemTestCase < ActionDispatch::SystemTestCase
|
7
2
|
driven_by :selenium_chrome_headless
|
8
|
-
end
|
3
|
+
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:
|
4
|
+
version: 2.2.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: 2020-
|
13
|
+
date: 2020-12-06 00:00:00.000000000 Z
|
14
14
|
dependencies:
|
15
15
|
- !ruby/object:Gem::Dependency
|
16
16
|
name: rails
|
@@ -18,28 +18,28 @@ dependencies:
|
|
18
18
|
requirements:
|
19
19
|
- - ">="
|
20
20
|
- !ruby/object:Gem::Version
|
21
|
-
version: '
|
21
|
+
version: '5.1'
|
22
22
|
type: :runtime
|
23
23
|
prerelease: false
|
24
24
|
version_requirements: !ruby/object:Gem::Requirement
|
25
25
|
requirements:
|
26
26
|
- - ">="
|
27
27
|
- !ruby/object:Gem::Version
|
28
|
-
version: '
|
28
|
+
version: '5.1'
|
29
29
|
- !ruby/object:Gem::Dependency
|
30
30
|
name: stripe
|
31
31
|
requirement: !ruby/object:Gem::Requirement
|
32
32
|
requirements:
|
33
33
|
- - ">="
|
34
34
|
- !ruby/object:Gem::Version
|
35
|
-
version:
|
35
|
+
version: 3.15.0
|
36
36
|
type: :runtime
|
37
37
|
prerelease: false
|
38
38
|
version_requirements: !ruby/object:Gem::Requirement
|
39
39
|
requirements:
|
40
40
|
- - ">="
|
41
41
|
- !ruby/object:Gem::Version
|
42
|
-
version:
|
42
|
+
version: 3.15.0
|
43
43
|
- !ruby/object:Gem::Dependency
|
44
44
|
name: responders
|
45
45
|
requirement: !ruby/object:Gem::Requirement
|
@@ -78,21 +78,19 @@ files:
|
|
78
78
|
- app/assets/stripe/stripe_elements.js
|
79
79
|
- app/controllers/stripe/application_controller.rb
|
80
80
|
- app/controllers/stripe/events_controller.rb
|
81
|
-
- app/controllers/stripe/pings_controller.rb
|
82
81
|
- app/helpers/stripe/javascript_helper.rb
|
83
82
|
- app/models/stripe/event_dispatch.rb
|
84
|
-
- app/models/stripe/ping.rb
|
85
83
|
- app/views/stripe/_elements.html.erb
|
86
84
|
- app/views/stripe/_elements_js.html.erb
|
87
85
|
- app/views/stripe/_js.html.erb
|
88
86
|
- config/locales/en.yml
|
89
87
|
- config/routes.rb
|
90
|
-
- gemfiles/rails4.gemfile
|
91
88
|
- gemfiles/rails51.gemfile
|
92
89
|
- gemfiles/rails52.gemfile
|
93
90
|
- lib/generators/stripe/install_generator.rb
|
94
91
|
- lib/generators/templates/coupons.rb
|
95
92
|
- lib/generators/templates/plans.rb
|
93
|
+
- lib/generators/templates/prices.rb
|
96
94
|
- lib/generators/templates/products.rb
|
97
95
|
- lib/stripe-rails.rb
|
98
96
|
- lib/stripe/billing_tier.rb
|
@@ -103,6 +101,7 @@ files:
|
|
103
101
|
- lib/stripe/current_api_version.rb
|
104
102
|
- lib/stripe/engine.rb
|
105
103
|
- lib/stripe/plans.rb
|
104
|
+
- lib/stripe/prices.rb
|
106
105
|
- lib/stripe/products.rb
|
107
106
|
- lib/stripe/rails.rb
|
108
107
|
- lib/stripe/rails/tasks.rake
|
@@ -141,6 +140,7 @@ files:
|
|
141
140
|
- test/dummy/config/locales/en.yml
|
142
141
|
- test/dummy/config/routes.rb
|
143
142
|
- test/dummy/config/stripe/plans.rb
|
143
|
+
- test/dummy/config/stripe/prices.rb
|
144
144
|
- test/dummy/lib/assets/.gitkeep
|
145
145
|
- test/dummy/lib/dummy/module_with_callbacks.rb
|
146
146
|
- test/dummy/log/.gitkeep
|
@@ -156,23 +156,23 @@ files:
|
|
156
156
|
- test/fixtures/stripe_plans.json
|
157
157
|
- test/fixtures/stripe_plans_headers.json
|
158
158
|
- test/fixtures/stripe_plans_headers_2017.json
|
159
|
+
- test/fixtures/stripe_prices.json
|
159
160
|
- test/invoice.json
|
160
161
|
- test/javascript_helper_spec.rb
|
161
|
-
- test/pings_controller_spec.rb
|
162
162
|
- test/plan_builder_spec.rb
|
163
|
+
- test/price_builder_spec.rb
|
163
164
|
- test/product_builder_spec.rb
|
164
165
|
- test/spec_helper.rb
|
165
166
|
- test/stripe_initializers_spec.rb
|
166
167
|
- test/support/application_system_test_case.rb
|
167
168
|
- test/support/callback_helpers.rb
|
168
169
|
- test/support/fixture_loader.rb
|
169
|
-
- test/support/null_system_test_case.rb
|
170
170
|
- test/testing_spec.rb
|
171
171
|
homepage: https://github.com/tansengming/stripe-rails
|
172
172
|
licenses:
|
173
173
|
- MIT
|
174
174
|
metadata: {}
|
175
|
-
post_install_message:
|
175
|
+
post_install_message:
|
176
176
|
rdoc_options: []
|
177
177
|
require_paths:
|
178
178
|
- lib
|
@@ -187,8 +187,8 @@ required_rubygems_version: !ruby/object:Gem::Requirement
|
|
187
187
|
- !ruby/object:Gem::Version
|
188
188
|
version: '0'
|
189
189
|
requirements: []
|
190
|
-
rubygems_version: 3.1.
|
191
|
-
signing_key:
|
190
|
+
rubygems_version: 3.1.4
|
191
|
+
signing_key:
|
192
192
|
specification_version: 4
|
193
193
|
summary: A gem to integrate stripe into your rails app
|
194
194
|
test_files:
|
@@ -224,6 +224,7 @@ test_files:
|
|
224
224
|
- test/dummy/config/locales/en.yml
|
225
225
|
- test/dummy/config/routes.rb
|
226
226
|
- test/dummy/config/stripe/plans.rb
|
227
|
+
- test/dummy/config/stripe/prices.rb
|
227
228
|
- test/dummy/lib/assets/.gitkeep
|
228
229
|
- test/dummy/lib/dummy/module_with_callbacks.rb
|
229
230
|
- test/dummy/log/.gitkeep
|
@@ -239,15 +240,15 @@ test_files:
|
|
239
240
|
- test/fixtures/stripe_plans.json
|
240
241
|
- test/fixtures/stripe_plans_headers.json
|
241
242
|
- test/fixtures/stripe_plans_headers_2017.json
|
243
|
+
- test/fixtures/stripe_prices.json
|
242
244
|
- test/invoice.json
|
243
245
|
- test/javascript_helper_spec.rb
|
244
|
-
- test/pings_controller_spec.rb
|
245
246
|
- test/plan_builder_spec.rb
|
247
|
+
- test/price_builder_spec.rb
|
246
248
|
- test/product_builder_spec.rb
|
247
249
|
- test/spec_helper.rb
|
248
250
|
- test/stripe_initializers_spec.rb
|
249
251
|
- test/support/application_system_test_case.rb
|
250
252
|
- test/support/callback_helpers.rb
|
251
253
|
- test/support/fixture_loader.rb
|
252
|
-
- test/support/null_system_test_case.rb
|
253
254
|
- test/testing_spec.rb
|
data/app/models/stripe/ping.rb
DELETED
data/gemfiles/rails4.gemfile
DELETED
@@ -1,20 +0,0 @@
|
|
1
|
-
source :rubygems
|
2
|
-
|
3
|
-
gem 'rails', '~> 4.2'
|
4
|
-
gem 'sprockets', '< 4'
|
5
|
-
|
6
|
-
gem 'rake'
|
7
|
-
gem 'responders', '~> 2.0' # to support Rails 4.2
|
8
|
-
gem 'stripe'
|
9
|
-
|
10
|
-
group :test do
|
11
|
-
gem 'mocha'
|
12
|
-
gem 'simplecov', require: false
|
13
|
-
gem 'stripe-ruby-mock'
|
14
|
-
gem 'webmock'
|
15
|
-
# Required for system tests
|
16
|
-
gem 'capybara'
|
17
|
-
gem 'webdrivers'
|
18
|
-
gem 'puma'
|
19
|
-
gem 'selenium-webdriver'
|
20
|
-
end
|
@@ -1,18 +0,0 @@
|
|
1
|
-
require 'spec_helper'
|
2
|
-
|
3
|
-
describe Stripe::PingsController do
|
4
|
-
parallelize_me!
|
5
|
-
include Rack::Test::Methods
|
6
|
-
|
7
|
-
let(:app) { Rails.application }
|
8
|
-
before do
|
9
|
-
header 'Accept', 'application/json'
|
10
|
-
header 'Content-Type', 'application/json'
|
11
|
-
end
|
12
|
-
|
13
|
-
describe 'the ping interface' do
|
14
|
-
subject { get '/stripe/ping' }
|
15
|
-
|
16
|
-
it { _(subject).must_be :ok? }
|
17
|
-
end
|
18
|
-
end
|