solidus_stripe 1.0.0
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +7 -0
- data/.circleci/config.yml +35 -0
- data/.gem_release.yml +8 -0
- data/.gitignore +11 -0
- data/.rspec +1 -0
- data/.rubocop.yml +319 -0
- data/.travis.yml +28 -0
- data/Gemfile +25 -0
- data/LICENSE.md +26 -0
- data/README.md +115 -0
- data/Rakefile +23 -0
- data/app/models/spree/payment_method/stripe_credit_card.rb +136 -0
- data/bin/rails +7 -0
- data/db/migrate/20181010123508_update_stripe_payment_method_type_to_credit_card.rb +21 -0
- data/db/seeds.rb +26 -0
- data/lib/assets/stylesheets/spree/frontend/solidus_stripe.scss +6 -0
- data/lib/generators/solidus_stripe/install/install_generator.rb +46 -0
- data/lib/solidus_stripe.rb +7 -0
- data/lib/solidus_stripe/engine.rb +23 -0
- data/lib/solidus_stripe/version.rb +5 -0
- data/lib/tasks/solidus_stripe/db/seed.rake +14 -0
- data/lib/views/api/spree/api/payments/source_views/_stripe.json.jbuilder +3 -0
- data/lib/views/backend/spree/admin/log_entries/_stripe.html.erb +28 -0
- data/lib/views/backend/spree/admin/payments/source_forms/_stripe.html.erb +1 -0
- data/lib/views/backend/spree/admin/payments/source_views/_stripe.html.erb +1 -0
- data/lib/views/frontend/spree/checkout/existing_payment/_stripe.html.erb +1 -0
- data/lib/views/frontend/spree/checkout/payment/_stripe.html.erb +6 -0
- data/lib/views/frontend/spree/checkout/payment/v2/_javascript.html.erb +77 -0
- data/lib/views/frontend/spree/checkout/payment/v3/_stripe.html.erb +133 -0
- data/solidus_stripe.gemspec +45 -0
- data/spec/features/stripe_checkout_spec.rb +279 -0
- data/spec/models/spree/payment_method/stripe_credit_card_spec.rb +205 -0
- data/spec/spec_helper.rb +20 -0
- metadata +264 -0
checksums.yaml
ADDED
@@ -0,0 +1,7 @@
|
|
1
|
+
---
|
2
|
+
SHA256:
|
3
|
+
metadata.gz: d8af7c603e46ef714bf95c986b68ed93a5658a58e6f8f35b5ea2fa056332dbd1
|
4
|
+
data.tar.gz: 289927edcb12bb159257e8095641e6f3a67c9b50c3fcfd4feed003d7090717ce
|
5
|
+
SHA512:
|
6
|
+
metadata.gz: 60356f5385e7faa6070a810d713f2eaeaac20cceb06d0afab18adb323ed1c3e991ac5e40816f482558a65a5790f2448e3e5d17fb6cecfc13b32107cfed58b019
|
7
|
+
data.tar.gz: abff53f85efcc1cd0a373b997432ec8a38b6dd94fd153f296cf8fe564fbb13d851f67d4c480badcce82fa752167b4c997c0d84376b3f1ed8fd5e3a8ebac7feb8
|
@@ -0,0 +1,35 @@
|
|
1
|
+
version: 2.1
|
2
|
+
|
3
|
+
orbs:
|
4
|
+
# Always take the latest version of the orb, this allows us to
|
5
|
+
# run specs against Solidus supported versions only without the need
|
6
|
+
# to change this configuration every time a Solidus version is released
|
7
|
+
# or goes EOL.
|
8
|
+
solidusio_extensions: solidusio/extensions@volatile
|
9
|
+
|
10
|
+
jobs:
|
11
|
+
run-specs-with-postgres:
|
12
|
+
executor: solidusio_extensions/postgres
|
13
|
+
steps:
|
14
|
+
- solidusio_extensions/run-tests
|
15
|
+
run-specs-with-mysql:
|
16
|
+
executor: solidusio_extensions/mysql
|
17
|
+
steps:
|
18
|
+
- solidusio_extensions/run-tests
|
19
|
+
|
20
|
+
workflows:
|
21
|
+
"Run specs on supported Solidus versions":
|
22
|
+
jobs:
|
23
|
+
- run-specs-with-postgres
|
24
|
+
- run-specs-with-mysql
|
25
|
+
"Weekly run specs against master":
|
26
|
+
triggers:
|
27
|
+
- schedule:
|
28
|
+
cron: "0 0 * * 4" # every Thursday
|
29
|
+
filters:
|
30
|
+
branches:
|
31
|
+
only:
|
32
|
+
- master
|
33
|
+
jobs:
|
34
|
+
- run-specs-with-postgres
|
35
|
+
- run-specs-with-mysql
|
data/.gem_release.yml
ADDED
data/.gitignore
ADDED
data/.rspec
ADDED
@@ -0,0 +1 @@
|
|
1
|
+
--colour
|
data/.rubocop.yml
ADDED
@@ -0,0 +1,319 @@
|
|
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
|
data/.travis.yml
ADDED
@@ -0,0 +1,28 @@
|
|
1
|
+
sudo: required
|
2
|
+
dist: trusty
|
3
|
+
cache: bundler
|
4
|
+
language: ruby
|
5
|
+
addons:
|
6
|
+
chrome: stable
|
7
|
+
rvm:
|
8
|
+
- 2.5.1
|
9
|
+
before_install:
|
10
|
+
- mysql -e "GRANT ALL PRIVILEGES ON *.* TO 'travis'@'%';"
|
11
|
+
before_script:
|
12
|
+
- "export DISPLAY=:99.0"
|
13
|
+
- "sh -e /etc/init.d/xvfb start"
|
14
|
+
- sleep 3 # give xvfb some time to start
|
15
|
+
env:
|
16
|
+
matrix:
|
17
|
+
- SOLIDUS_BRANCH=v2.4 DB=postgres
|
18
|
+
- SOLIDUS_BRANCH=v2.5 DB=postgres
|
19
|
+
- SOLIDUS_BRANCH=v2.6 DB=postgres
|
20
|
+
- SOLIDUS_BRANCH=v2.7 DB=postgres
|
21
|
+
- SOLIDUS_BRANCH=v2.8 DB=postgres
|
22
|
+
- SOLIDUS_BRANCH=master DB=postgres
|
23
|
+
- SOLIDUS_BRANCH=v2.4 DB=mysql
|
24
|
+
- SOLIDUS_BRANCH=v2.5 DB=mysql
|
25
|
+
- SOLIDUS_BRANCH=v2.6 DB=mysql
|
26
|
+
- SOLIDUS_BRANCH=v2.7 DB=mysql
|
27
|
+
- SOLIDUS_BRANCH=v2.8 DB=mysql
|
28
|
+
- SOLIDUS_BRANCH=master DB=mysql
|
data/Gemfile
ADDED
@@ -0,0 +1,25 @@
|
|
1
|
+
# frozen_string_literal: true
|
2
|
+
|
3
|
+
source "https://rubygems.org"
|
4
|
+
|
5
|
+
branch = ENV.fetch('SOLIDUS_BRANCH', 'master')
|
6
|
+
gem "solidus", github: "solidusio/solidus", branch: branch
|
7
|
+
gem "solidus_auth_devise"
|
8
|
+
|
9
|
+
group :test do
|
10
|
+
if branch == 'master' || branch >= "v2.0"
|
11
|
+
gem "rails-controller-testing"
|
12
|
+
end
|
13
|
+
|
14
|
+
gem 'factory_bot', (branch < 'v2.5' ? '4.10.0' : '> 4.10.0')
|
15
|
+
end
|
16
|
+
|
17
|
+
gem 'pg'
|
18
|
+
gem 'mysql2'
|
19
|
+
|
20
|
+
group :development, :test do
|
21
|
+
gem "pry-rails"
|
22
|
+
gem "ffaker"
|
23
|
+
end
|
24
|
+
|
25
|
+
gemspec
|
data/LICENSE.md
ADDED
@@ -0,0 +1,26 @@
|
|
1
|
+
Copyright (c) 2014 Spree Commerce Inc. and other contributors.
|
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 Spree 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.
|