solidus_stripe 1.0.0 → 1.1.0

Sign up to get free protection for your applications and to get access to all the features.
Files changed (43) hide show
  1. checksums.yaml +4 -4
  2. data/.gem_release.yml +2 -5
  3. data/.github/stale.yml +17 -0
  4. data/.gitignore +11 -4
  5. data/.rspec +2 -1
  6. data/.rubocop.yml +2 -319
  7. data/Gemfile +16 -9
  8. data/LICENSE +26 -0
  9. data/README.md +58 -1
  10. data/Rakefile +3 -20
  11. data/app/assets/javascripts/solidus_stripe/stripe-init.js +1 -0
  12. data/app/assets/javascripts/solidus_stripe/stripe-init/base.js +180 -0
  13. data/app/controllers/solidus_stripe/intents_controller.rb +52 -0
  14. data/app/controllers/solidus_stripe/payment_request_controller.rb +42 -0
  15. data/app/controllers/spree/stripe_controller.rb +13 -0
  16. data/app/models/solidus_stripe/address_from_params_service.rb +57 -0
  17. data/app/models/solidus_stripe/prepare_order_for_payment_service.rb +46 -0
  18. data/app/models/solidus_stripe/shipping_rates_service.rb +46 -0
  19. data/app/models/spree/payment_method/stripe_credit_card.rb +57 -8
  20. data/bin/console +17 -0
  21. data/bin/rails +12 -4
  22. data/bin/setup +8 -0
  23. data/config/routes.rb +11 -0
  24. data/lib/assets/stylesheets/spree/frontend/solidus_stripe.scss +5 -0
  25. data/lib/generators/solidus_stripe/install/install_generator.rb +3 -13
  26. data/lib/solidus_stripe/engine.rb +14 -2
  27. data/lib/solidus_stripe/version.rb +1 -1
  28. data/lib/views/frontend/spree/checkout/payment/_stripe.html.erb +2 -0
  29. data/lib/views/frontend/spree/checkout/payment/v2/_javascript.html.erb +13 -12
  30. data/lib/views/frontend/spree/checkout/payment/v3/_elements_js.html.erb +28 -0
  31. data/lib/views/frontend/spree/checkout/payment/v3/_form_elements.html.erb +42 -0
  32. data/lib/views/frontend/spree/checkout/payment/v3/_intents.html.erb +5 -0
  33. data/lib/views/frontend/spree/checkout/payment/v3/_intents_js.html.erb +48 -0
  34. data/lib/views/frontend/spree/checkout/payment/v3/_stripe.html.erb +3 -131
  35. data/lib/views/frontend/spree/orders/_stripe_payment_request_button.html.erb +92 -0
  36. data/solidus_stripe.gemspec +15 -20
  37. data/spec/features/stripe_checkout_spec.rb +196 -35
  38. data/spec/models/solidus_stripe/address_from_params_service_spec.rb +62 -0
  39. data/spec/models/solidus_stripe/prepare_order_for_payment_service_spec.rb +65 -0
  40. data/spec/models/solidus_stripe/shipping_rates_service_spec.rb +54 -0
  41. data/spec/models/spree/payment_method/stripe_credit_card_spec.rb +44 -5
  42. data/spec/spec_helper.rb +9 -7
  43. metadata +38 -136
checksums.yaml CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA256:
3
- metadata.gz: d8af7c603e46ef714bf95c986b68ed93a5658a58e6f8f35b5ea2fa056332dbd1
4
- data.tar.gz: 289927edcb12bb159257e8095641e6f3a67c9b50c3fcfd4feed003d7090717ce
3
+ metadata.gz: 459a3a49020e6a99790377162c45ebea0e978203086fd7f75be294aa151afbf0
4
+ data.tar.gz: 7f3d44ef9f172a3be23a8ee8e8c36942394fd434c7cdf1dcd7cb2d5a03b19fb5
5
5
  SHA512:
6
- metadata.gz: 60356f5385e7faa6070a810d713f2eaeaac20cceb06d0afab18adb323ed1c3e991ac5e40816f482558a65a5790f2448e3e5d17fb6cecfc13b32107cfed58b019
7
- data.tar.gz: abff53f85efcc1cd0a373b997432ec8a38b6dd94fd153f296cf8fe564fbb13d851f67d4c480badcce82fa752167b4c997c0d84376b3f1ed8fd5e3a8ebac7feb8
6
+ metadata.gz: c142ae59d658d72d1c804168e41bf154455a08ba544bd6649cc4567488175feeb43bb6df97d7f158c59e56ac52b2d60ebe2097db503e3c80429616e2efb8542d
7
+ data.tar.gz: 93db6e85098c0eb727a46dc11c2ab1e9f72d3260768c2b8bad70006264ffad64f0067c37c582ccbc9e6e422214f641f9122a494a5d4f133c736d6a4b41115a88
data/.gem_release.yml CHANGED
@@ -1,8 +1,5 @@
1
1
  bump:
2
+ recurse: false
2
3
  file: 'lib/solidus_stripe/version.rb'
3
4
  message: Bump Solidus Stripe to %{version}
4
- commit: true
5
- push: true
6
-
7
- tag:
8
- push: true
5
+ tag: true
data/.github/stale.yml ADDED
@@ -0,0 +1,17 @@
1
+ # Number of days of inactivity before an issue becomes stale
2
+ daysUntilStale: 60
3
+ # Number of days of inactivity before a stale issue is closed
4
+ daysUntilClose: 7
5
+ # Issues with these labels will never be considered stale
6
+ exemptLabels:
7
+ - pinned
8
+ - security
9
+ # Label to use when marking an issue as stale
10
+ staleLabel: wontfix
11
+ # Comment to post when marking an issue as stale. Set to `false` to disable
12
+ markComment: >
13
+ This issue has been automatically marked as stale because it has not had
14
+ recent activity. It will be closed if no further activity occurs. Thank you
15
+ for your contributions.
16
+ # Comment to post when closing a stale issue. Set to `false` to disable
17
+ closeComment: false
data/.gitignore CHANGED
@@ -1,11 +1,18 @@
1
+ *.gem
1
2
  \#*
2
3
  *~
3
4
  .#*
4
5
  .DS_Store
5
- tmp
6
- spec/dummy
7
- Gemfile.lock
6
+ .idea
7
+ .project
8
+ .ruby-version
8
9
  .rvmrc
10
+ .sass-cache
9
11
  coverage
10
- .ruby-version
12
+ Gemfile.lock
13
+ tmp
14
+ nbproject
11
15
  pkg
16
+ *.swp
17
+ spec/dummy
18
+ spec/examples.txt
data/.rspec CHANGED
@@ -1 +1,2 @@
1
- --colour
1
+ --color
2
+ --require spec_helper
data/.rubocop.yml CHANGED
@@ -1,319 +1,2 @@
1
- # Relaxed.Ruby.Style
2
-
3
- AllCops:
4
- Exclude:
5
- - 'spec/dummy/**/*'
6
- - 'bin/**'
7
- TargetRubyVersion: 2.4
8
-
9
- # Sometimes I believe this reads better
10
- # This also causes spacing issues on multi-line fixes
11
- Style/BracesAroundHashParameters:
12
- Enabled: false
13
-
14
- # We use class vars and will have to continue doing so for compatability
15
- Style/ClassVars:
16
- Enabled: false
17
-
18
- # We need these names for backwards compatability
19
- Naming/PredicateName:
20
- Enabled: false
21
-
22
- Naming/AccessorMethodName:
23
- Enabled: false
24
-
25
- # This has been used for customization
26
- Style/MutableConstant:
27
- Enabled: false
28
-
29
- Style/ClassAndModuleChildren:
30
- Enabled: false
31
-
32
- Style/EmptyElse:
33
- Enabled: false
34
-
35
- Style/GuardClause:
36
- Enabled: false
37
-
38
- Style/Next:
39
- Enabled: false
40
-
41
- Style/NumericPredicate:
42
- Enabled: false
43
-
44
- Style/WordArray:
45
- Enabled: false
46
-
47
- Style/ConditionalAssignment:
48
- Enabled: false
49
-
50
- Performance/Count:
51
- Enabled: false
52
-
53
- Style/RaiseArgs:
54
- Enabled: false
55
-
56
- Naming/BinaryOperatorParameterName:
57
- Enabled: false
58
-
59
- # We can use good judgement here
60
- Style/RegexpLiteral:
61
- Enabled: false
62
-
63
- # Unicode comments are useful
64
- Style/AsciiComments:
65
- Enabled: false
66
-
67
- Layout/EndAlignment:
68
- Enabled: false
69
-
70
- Layout/ElseAlignment:
71
- Enabled: false
72
-
73
- Layout/IndentationWidth:
74
- Enabled: false
75
-
76
- Layout/AlignParameters:
77
- Enabled: false
78
-
79
- Layout/ClosingParenthesisIndentation:
80
- Enabled: false
81
-
82
- Layout/MultilineMethodCallIndentation:
83
- Enabled: false
84
-
85
- Layout/IndentFirstArrayElement:
86
- Enabled: false
87
-
88
- Layout/IndentFirstHashElement:
89
- Enabled: false
90
-
91
- Layout/AlignHash:
92
- Enabled: false
93
-
94
- Style/TrailingCommaInArguments:
95
- Enabled: false
96
-
97
- Style/TrailingCommaInArrayLiteral:
98
- Enabled: false
99
-
100
- Style/TrailingCommaInHashLiteral:
101
- Enabled: false
102
-
103
- # Symbol Arrays are ok and the %i syntax widely unknown
104
- Style/SymbolArray:
105
- Enabled: false
106
-
107
- Rails/DynamicFindBy:
108
- Whitelist:
109
- - find_by_param
110
- - find_by_param!
111
-
112
- # We use a lot of
113
- #
114
- # expect {
115
- # something
116
- # }.to { happen }
117
- #
118
- # syntax in the specs files.
119
- Lint/AmbiguousBlockAssociation:
120
- Exclude:
121
- - '*/spec/**/*'
122
- - 'spec/**/*' # For the benefit of apps that inherit from this config
123
-
124
- # We use eval to add common_spree_dependencies into the Gemfiles of each of our gems
125
- Security/Eval:
126
- Exclude:
127
- - 'Gemfile'
128
- - 'common_spree_dependencies.rb'
129
- - '*/Gemfile'
130
-
131
- Naming/VariableNumber:
132
- Enabled: false
133
-
134
- # Write empty methods as you wish.
135
- Style/EmptyMethod:
136
- Enabled: false
137
-
138
- # From http://relaxed.ruby.style/
139
-
140
- Style/Alias:
141
- Enabled: false
142
- StyleGuide: http://relaxed.ruby.style/#stylealias
143
-
144
- Style/BeginBlock:
145
- Enabled: false
146
- StyleGuide: http://relaxed.ruby.style/#stylebeginblock
147
-
148
- Style/BlockDelimiters:
149
- Enabled: false
150
- StyleGuide: http://relaxed.ruby.style/#styleblockdelimiters
151
-
152
- Style/Documentation:
153
- Enabled: false
154
- StyleGuide: http://relaxed.ruby.style/#styledocumentation
155
-
156
- Layout/DotPosition:
157
- Enabled: false
158
- StyleGuide: http://relaxed.ruby.style/#styledotposition
159
-
160
- Style/DoubleNegation:
161
- Enabled: false
162
- StyleGuide: http://relaxed.ruby.style/#styledoublenegation
163
-
164
- Style/EndBlock:
165
- Enabled: false
166
- StyleGuide: http://relaxed.ruby.style/#styleendblock
167
-
168
- Style/FormatString:
169
- Enabled: false
170
- StyleGuide: http://relaxed.ruby.style/#styleformatstring
171
-
172
- Style/IfUnlessModifier:
173
- Enabled: false
174
- StyleGuide: http://relaxed.ruby.style/#styleifunlessmodifier
175
-
176
- Style/Lambda:
177
- Enabled: false
178
- StyleGuide: http://relaxed.ruby.style/#stylelambda
179
-
180
- Style/ModuleFunction:
181
- Enabled: false
182
- StyleGuide: http://relaxed.ruby.style/#stylemodulefunction
183
-
184
- Style/MultilineBlockChain:
185
- Enabled: false
186
- StyleGuide: http://relaxed.ruby.style/#stylemultilineblockchain
187
-
188
- Style/NegatedIf:
189
- Enabled: false
190
- StyleGuide: http://relaxed.ruby.style/#stylenegatedif
191
-
192
- Style/NegatedWhile:
193
- Enabled: false
194
- StyleGuide: http://relaxed.ruby.style/#stylenegatedwhile
195
-
196
- Style/ParallelAssignment:
197
- Enabled: false
198
- StyleGuide: http://relaxed.ruby.style/#styleparallelassignment
199
-
200
- Style/PercentLiteralDelimiters:
201
- Enabled: false
202
- StyleGuide: http://relaxed.ruby.style/#stylepercentliteraldelimiters
203
-
204
- Style/PerlBackrefs:
205
- Enabled: false
206
- StyleGuide: http://relaxed.ruby.style/#styleperlbackrefs
207
-
208
- Style/Semicolon:
209
- Enabled: false
210
- StyleGuide: http://relaxed.ruby.style/#stylesemicolon
211
-
212
- Style/SignalException:
213
- Enabled: false
214
- StyleGuide: http://relaxed.ruby.style/#stylesignalexception
215
-
216
- Style/SingleLineBlockParams:
217
- Enabled: false
218
- StyleGuide: http://relaxed.ruby.style/#stylesinglelineblockparams
219
-
220
- Style/SingleLineMethods:
221
- Enabled: false
222
- StyleGuide: http://relaxed.ruby.style/#stylesinglelinemethods
223
-
224
- Layout/SpaceBeforeBlockBraces:
225
- Enabled: false
226
- StyleGuide: http://relaxed.ruby.style/#stylespacebeforeblockbraces
227
-
228
- Layout/SpaceInsideParens:
229
- Enabled: false
230
- StyleGuide: http://relaxed.ruby.style/#stylespaceinsideparens
231
-
232
- Style/SpecialGlobalVars:
233
- Enabled: false
234
- StyleGuide: http://relaxed.ruby.style/#stylespecialglobalvars
235
-
236
- Style/StringLiterals:
237
- Enabled: false
238
- StyleGuide: http://relaxed.ruby.style/#stylestringliterals
239
-
240
- Style/SymbolProc:
241
- Enabled: false
242
-
243
- Style/TernaryParentheses:
244
- Enabled: false
245
-
246
- Style/WhileUntilModifier:
247
- Enabled: false
248
- StyleGuide: http://relaxed.ruby.style/#stylewhileuntilmodifier
249
-
250
- Lint/AmbiguousRegexpLiteral:
251
- Enabled: false
252
- StyleGuide: http://relaxed.ruby.style/#lintambiguousregexpliteral
253
-
254
- Lint/AssignmentInCondition:
255
- Enabled: false
256
- StyleGuide: http://relaxed.ruby.style/#lintassignmentincondition
257
-
258
- Metrics/AbcSize:
259
- Enabled: false
260
-
261
- Metrics/BlockNesting:
262
- Enabled: false
263
-
264
- Metrics/ClassLength:
265
- Enabled: false
266
-
267
- Metrics/ModuleLength:
268
- Enabled: false
269
-
270
- Metrics/BlockLength:
271
- Enabled: false
272
-
273
- Metrics/CyclomaticComplexity:
274
- Enabled: false
275
-
276
- Metrics/LineLength:
277
- Enabled: false
278
-
279
- Metrics/MethodLength:
280
- Enabled: false
281
-
282
- Metrics/ParameterLists:
283
- Enabled: false
284
-
285
- Metrics/PerceivedComplexity:
286
- Enabled: false
287
-
288
- Bundler/OrderedGems:
289
- Enabled: false
290
-
291
- Style/NumericLiterals:
292
- Enabled: false
293
-
294
- Style/FrozenStringLiteralComment:
295
- Enabled: true
296
- EnforcedStyle: always
297
-
298
- # json.() is idiomatic in jbuilder files
299
- Style/LambdaCall:
300
- Enabled: false
301
-
302
- Naming/UncommunicativeMethodParamName:
303
- AllowedNames:
304
- - id
305
- - to
306
- - _
307
-
308
- # Rubocop doesn't understand side-effects
309
- Style/IdenticalConditionalBranches:
310
- Enabled: false
311
-
312
- Naming/MemoizedInstanceVariableName:
313
- Enabled: false
314
-
315
- Lint/UselessComparison:
316
- Enabled: false
317
-
318
- Lint/HandleExceptions:
319
- Enabled: false
1
+ require:
2
+ - solidus_dev_support/rubocop
data/Gemfile CHANGED
@@ -1,25 +1,32 @@
1
1
  # frozen_string_literal: true
2
2
 
3
3
  source "https://rubygems.org"
4
+ git_source(:github) { |repo| "https://github.com/#{repo}.git" }
4
5
 
5
6
  branch = ENV.fetch('SOLIDUS_BRANCH', 'master')
6
7
  gem "solidus", github: "solidusio/solidus", branch: branch
7
- gem "solidus_auth_devise"
8
8
 
9
- group :test do
10
- if branch == 'master' || branch >= "v2.0"
11
- gem "rails-controller-testing"
12
- end
9
+ # Needed to help Bundler figure out how to resolve dependencies,
10
+ # otherwise it takes forever to resolve them.
11
+ # See https://github.com/bundler/bundler/issues/6677
12
+ gem 'rails', '>0.a'
13
13
 
14
- gem 'factory_bot', (branch < 'v2.5' ? '4.10.0' : '> 4.10.0')
15
- end
14
+ # Provides basic authentication functionality for testing parts of your engine
15
+ gem "solidus_auth_devise"
16
16
 
17
- gem 'pg'
18
- gem 'mysql2'
17
+ case ENV['DB']
18
+ when 'mysql'
19
+ gem 'mysql2'
20
+ when 'postgresql'
21
+ gem 'pg'
22
+ else
23
+ gem 'sqlite3'
24
+ end
19
25
 
20
26
  group :development, :test do
21
27
  gem "pry-rails"
22
28
  gem "ffaker"
29
+ gem "rails-controller-testing"
23
30
  end
24
31
 
25
32
  gemspec
data/LICENSE ADDED
@@ -0,0 +1,26 @@
1
+ Copyright (c) 2020 Solidus Team
2
+ All rights reserved.
3
+
4
+ Redistribution and use in source and binary forms, with or without modification,
5
+ are permitted provided that the following conditions are met:
6
+
7
+ * Redistributions of source code must retain the above copyright notice,
8
+ this list of conditions and the following disclaimer.
9
+ * Redistributions in binary form must reproduce the above copyright notice,
10
+ this list of conditions and the following disclaimer in the documentation
11
+ and/or other materials provided with the distribution.
12
+ * Neither the name Solidus nor the names of its contributors may be used to
13
+ endorse or promote products derived from this software without specific
14
+ prior written permission.
15
+
16
+ THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
17
+ "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
18
+ LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR
19
+ A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR
20
+ CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL,
21
+ EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO,
22
+ PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR
23
+ PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF
24
+ LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING
25
+ NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS
26
+ SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.