solidus_stripe 4.3.0 → 4.4.1

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
checksums.yaml CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA256:
3
- metadata.gz: b92e606bb4ada8e49087a97ffeff9be982f8cc0110cd7c8c0721d73220adeb3c
4
- data.tar.gz: 6c0b61f704f0faab2e16ef827879e86efde9bf7123eadc7a968c7810452956bc
3
+ metadata.gz: 348461d7e783545d8c247ab5d0793cff60fd7313b6d268ab96d3ef1b8e0b6b2e
4
+ data.tar.gz: 48196238b9bcdb0af904edb0e9dcc0cdb52e2521adb07c3e3a9bf68a8063786a
5
5
  SHA512:
6
- metadata.gz: 0daa283258eb4c1fb7dc0c41444e0e0ebaf8a439a91f7597d1ec4d941c9fd7badc0d043aec6a98e9b2c3e1bef131e4222d9bcc931c508546fee67b7d679a48ad
7
- data.tar.gz: f10627a842fff35f6ef69e7cfcf8643ec4e7fb961cab9f9f2aba28217068afd62babe3d6048396d781794457c3f0fa2bdbad278f2a8865a13b0a41ee4397dd94
6
+ metadata.gz: b98a0822761ab828f600e751287335d251fccd00b0b35bc44a472edd1a63004fda9246576da9444c518cdbb5c3852d96b993cd7232f2e1bc1b39fce6f1bee260
7
+ data.tar.gz: 88b9c12851bca115cd2e3819d58447ce94cb460682a38ebd88843255193fe4bc908fc9f99470174a468be4fd83b6779c457da095a27c638ca37663d165298675
data/.circleci/config.yml CHANGED
@@ -1,6 +1,9 @@
1
1
  version: 2.1
2
2
 
3
3
  orbs:
4
+ # Required for feature specs.
5
+ browser-tools: circleci/browser-tools@1.1
6
+
4
7
  # Always take the latest version of the orb, this allows us to
5
8
  # run specs against Solidus supported versions only without the need
6
9
  # to change this configuration every time a Solidus version is released
@@ -9,15 +12,45 @@ orbs:
9
12
 
10
13
  jobs:
11
14
  run-specs-with-postgres:
12
- executor: solidusio_extensions/postgres
15
+ executor:
16
+ name: solidusio_extensions/postgres
17
+ ruby_version: "3.2"
18
+ environment:
19
+ FRONTEND: "/home/circleci/project/spec/solidus_frontend_app_template.rb"
20
+ AUTHENTICATION: "devise"
13
21
  steps:
14
- - solidusio_extensions/run-tests
22
+ - browser-tools/install-chrome
23
+ - checkout
24
+ - solidusio_extensions/dependencies
25
+ - solidusio_extensions/run-tests-solidus-main
26
+ - solidusio_extensions/store-test-results
27
+
15
28
  run-specs-with-mysql:
16
- executor: solidusio_extensions/mysql
29
+ executor:
30
+ name: solidusio_extensions/mysql
31
+ ruby_version: "3.1"
32
+ environment:
33
+ FRONTEND: "/home/circleci/project/spec/solidus_frontend_app_template.rb"
34
+ steps:
35
+ - browser-tools/install-chrome
36
+ - checkout
37
+ - solidusio_extensions/dependencies
38
+ - solidusio_extensions/run-tests-solidus-current
39
+ - solidusio_extensions/store-test-results
40
+ run-specs-with-sqlite:
41
+ executor:
42
+ name: solidusio_extensions/sqlite
43
+ ruby_version: "3.0"
17
44
  steps:
18
- - solidusio_extensions/run-tests
45
+ - browser-tools/install-chrome
46
+ - checkout
47
+ - solidusio_extensions/dependencies
48
+ - solidusio_extensions/run-tests-solidus-older
49
+ - solidusio_extensions/store-test-results
19
50
  lint-code:
20
- executor: solidusio_extensions/sqlite-memory
51
+ executor:
52
+ name: solidusio_extensions/sqlite-memory
53
+ ruby_version: "3.0"
21
54
  steps:
22
55
  - solidusio_extensions/lint-code
23
56
 
@@ -26,6 +59,8 @@ workflows:
26
59
  jobs:
27
60
  - run-specs-with-postgres
28
61
  - run-specs-with-mysql
62
+ - run-specs-with-sqlite
63
+ - lint-code
29
64
 
30
65
  "Weekly run specs against master":
31
66
  triggers:
data/.github/stale.yml CHANGED
@@ -1,17 +1 @@
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: false
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: stale
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 might 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
1
+ _extends: .github
data/.rubocop.yml CHANGED
@@ -1,3 +1,5 @@
1
+ inherit_from: .rubocop_todo.yml
2
+
1
3
  require:
2
4
  - solidus_dev_support/rubocop
3
5
 
data/.rubocop_todo.yml ADDED
@@ -0,0 +1,298 @@
1
+ # This configuration was generated by
2
+ # `rubocop --auto-gen-config`
3
+ # on 2022-08-30 14:09:43 UTC using RuboCop version 1.35.1.
4
+ # The point is for the user to remove these configuration records
5
+ # one by one as the offenses are removed from the code base.
6
+ # Note that changes in the inspected code, or installation of new
7
+ # versions of RuboCop, may require this file to be generated again.
8
+
9
+ # Offense count: 1
10
+ # This cop supports safe autocorrection (--autocorrect).
11
+ # Configuration parameters: TreatCommentsAsGroupSeparators, ConsiderPunctuation, Include.
12
+ # Include: **/*.gemspec
13
+ Gemspec/OrderedDependencies:
14
+ Exclude:
15
+ - 'solidus_stripe.gemspec'
16
+
17
+ # Offense count: 3
18
+ # This cop supports safe autocorrection (--autocorrect).
19
+ # Configuration parameters: EnforcedStyle, IndentationWidth.
20
+ # SupportedStyles: with_first_argument, with_fixed_indentation
21
+ Layout/ArgumentAlignment:
22
+ Exclude:
23
+ - 'spec/models/spree/payment_method/stripe_credit_card_spec.rb'
24
+
25
+ # Offense count: 2
26
+ # This cop supports safe autocorrection (--autocorrect).
27
+ Layout/ClosingParenthesisIndentation:
28
+ Exclude:
29
+ - 'spec/requests/payment_requests_spec.rb'
30
+
31
+ # Offense count: 2
32
+ # This cop supports safe autocorrection (--autocorrect).
33
+ Layout/ElseAlignment:
34
+ Exclude:
35
+ - 'app/models/solidus_stripe/address_from_params_service.rb'
36
+ - 'spec/models/solidus_stripe/address_from_params_service_spec.rb'
37
+
38
+ # Offense count: 2
39
+ # This cop supports safe autocorrection (--autocorrect).
40
+ # Configuration parameters: EnforcedStyleAlignWith, Severity.
41
+ # SupportedStylesAlignWith: keyword, variable, start_of_line
42
+ Layout/EndAlignment:
43
+ Exclude:
44
+ - 'app/models/solidus_stripe/address_from_params_service.rb'
45
+ - 'spec/models/solidus_stripe/address_from_params_service_spec.rb'
46
+
47
+ # Offense count: 2
48
+ # This cop supports safe autocorrection (--autocorrect).
49
+ # Configuration parameters: Width, AllowedPatterns, IgnoredPatterns.
50
+ Layout/IndentationWidth:
51
+ Exclude:
52
+ - 'app/models/solidus_stripe/address_from_params_service.rb'
53
+ - 'spec/models/solidus_stripe/address_from_params_service_spec.rb'
54
+
55
+ # Offense count: 2
56
+ # This cop supports safe autocorrection (--autocorrect).
57
+ # Configuration parameters: EnforcedStyle.
58
+ # SupportedStyles: symmetrical, new_line, same_line
59
+ Layout/MultilineMethodCallBraceLayout:
60
+ Exclude:
61
+ - 'spec/models/spree/payment_method/stripe_credit_card_spec.rb'
62
+
63
+ # Offense count: 1
64
+ # This cop supports safe autocorrection (--autocorrect).
65
+ # Configuration parameters: EnforcedStyle, IndentationWidth.
66
+ # SupportedStyles: aligned, indented, indented_relative_to_receiver
67
+ Layout/MultilineMethodCallIndentation:
68
+ Exclude:
69
+ - 'spec/models/solidus_stripe/prepare_order_for_payment_service_spec.rb'
70
+
71
+ # Offense count: 1
72
+ # This cop supports safe autocorrection (--autocorrect).
73
+ # Configuration parameters: EnforcedStyle, EnforcedStyleForEmptyBrackets.
74
+ # SupportedStyles: space, no_space, compact
75
+ # SupportedStylesForEmptyBrackets: space, no_space
76
+ Layout/SpaceInsideArrayLiteralBrackets:
77
+ Exclude:
78
+ - 'spec/models/solidus_stripe/address_from_params_service_spec.rb'
79
+
80
+ # Offense count: 5
81
+ # Configuration parameters: AllowedMethods, AllowedPatterns, IgnoredMethods.
82
+ Lint/AmbiguousBlockAssociation:
83
+ Exclude:
84
+ - 'spec/models/solidus_stripe/create_intents_payment_service_spec.rb'
85
+ - 'spec/models/solidus_stripe/prepare_order_for_payment_service_spec.rb'
86
+ - 'spec/requests/payment_requests_spec.rb'
87
+
88
+ # Offense count: 2
89
+ # This cop supports safe autocorrection (--autocorrect).
90
+ Lint/RedundantCopDisableDirective:
91
+ Exclude:
92
+ - 'bin/sandbox_rails'
93
+ - 'lib/generators/solidus_stripe/install/install_generator.rb'
94
+
95
+ # Offense count: 10
96
+ RSpec/AnyInstance:
97
+ Exclude:
98
+ - 'spec/models/solidus_stripe/create_intents_payment_service_spec.rb'
99
+ - 'spec/requests/payment_requests_spec.rb'
100
+
101
+ # Offense count: 6
102
+ # Configuration parameters: Prefixes.
103
+ # Prefixes: when, with, without
104
+ RSpec/ContextWording:
105
+ Exclude:
106
+ - 'spec/models/spree/payment_method/stripe_credit_card_spec.rb'
107
+
108
+ # Offense count: 8
109
+ # This cop supports unsafe autocorrection (--autocorrect-all).
110
+ # Configuration parameters: EnforcedStyle.
111
+ # SupportedStyles: method_call, block
112
+ RSpec/ExpectChange:
113
+ Exclude:
114
+ - 'spec/models/solidus_stripe/create_intents_payment_service_spec.rb'
115
+ - 'spec/models/solidus_stripe/prepare_order_for_payment_service_spec.rb'
116
+ - 'spec/models/spree/payment_method/stripe_credit_card_spec.rb'
117
+
118
+ # Offense count: 6
119
+ RSpec/ExpectInHook:
120
+ Exclude:
121
+ - 'spec/features/stripe_checkout_spec.rb'
122
+
123
+ # Offense count: 1
124
+ # This cop supports safe autocorrection (--autocorrect).
125
+ RSpec/LeadingSubject:
126
+ Exclude:
127
+ - 'spec/models/solidus_stripe/address_from_params_service_spec.rb'
128
+
129
+ # Offense count: 2
130
+ RSpec/LetSetup:
131
+ Exclude:
132
+ - 'spec/models/solidus_stripe/prepare_order_for_payment_service_spec.rb'
133
+ - 'spec/models/spree/payment_method/stripe_credit_card_spec.rb'
134
+
135
+ # Offense count: 9
136
+ # Configuration parameters: .
137
+ # SupportedStyles: have_received, receive
138
+ RSpec/MessageSpies:
139
+ EnforcedStyle: receive
140
+
141
+ # Offense count: 13
142
+ RSpec/MultipleExpectations:
143
+ Max: 15
144
+
145
+ # Offense count: 40
146
+ # Configuration parameters: AllowSubject.
147
+ RSpec/MultipleMemoizedHelpers:
148
+ Max: 11
149
+
150
+ # Offense count: 47
151
+ # Configuration parameters: IgnoreSharedExamples.
152
+ RSpec/NamedSubject:
153
+ Exclude:
154
+ - 'spec/models/solidus_stripe/address_from_params_service_spec.rb'
155
+ - 'spec/models/solidus_stripe/create_intents_payment_service_spec.rb'
156
+ - 'spec/models/solidus_stripe/prepare_order_for_payment_service_spec.rb'
157
+ - 'spec/models/solidus_stripe/shipping_rates_service_spec.rb'
158
+ - 'spec/models/spree/payment_method/stripe_credit_card_spec.rb'
159
+
160
+ # Offense count: 13
161
+ RSpec/NestedGroups:
162
+ Max: 5
163
+
164
+ # Offense count: 2
165
+ RSpec/RepeatedExampleGroupBody:
166
+ Exclude:
167
+ - 'spec/models/spree/payment_method/stripe_credit_card_spec.rb'
168
+
169
+ # Offense count: 3
170
+ # This cop supports safe autocorrection (--autocorrect).
171
+ # Configuration parameters: EnforcedStyle.
172
+ # SupportedStyles: and_return, block
173
+ RSpec/ReturnFromStub:
174
+ Exclude:
175
+ - 'spec/models/solidus_stripe/create_intents_payment_service_spec.rb'
176
+ - 'spec/models/spree/payment_method/stripe_credit_card_spec.rb'
177
+
178
+ # Offense count: 4
179
+ RSpec/StubbedMock:
180
+ Exclude:
181
+ - 'spec/models/spree/payment_method/stripe_credit_card_spec.rb'
182
+
183
+ # Offense count: 3
184
+ RSpec/SubjectStub:
185
+ Exclude:
186
+ - 'spec/models/spree/payment_method/stripe_credit_card_spec.rb'
187
+
188
+ # Offense count: 12
189
+ # Configuration parameters: IgnoreNameless, IgnoreSymbolicNames.
190
+ RSpec/VerifiedDoubles:
191
+ Exclude:
192
+ - 'spec/models/solidus_stripe/create_intents_payment_service_spec.rb'
193
+ - 'spec/models/solidus_stripe/prepare_order_for_payment_service_spec.rb'
194
+ - 'spec/models/spree/payment_method/stripe_credit_card_spec.rb'
195
+
196
+ # Offense count: 1
197
+ # This cop supports safe autocorrection (--autocorrect).
198
+ # Configuration parameters: EnforceForPrefixed.
199
+ Rails/Delegate:
200
+ Exclude:
201
+ - 'app/models/spree/payment_method/stripe_credit_card.rb'
202
+
203
+ # Offense count: 1
204
+ # This cop supports unsafe autocorrection (--autocorrect-all).
205
+ # Configuration parameters: Whitelist, AllowedMethods, AllowedReceivers.
206
+ # Whitelist: find_by_sql
207
+ # AllowedMethods: find_by_sql
208
+ # AllowedReceivers: Gem::Specification
209
+ Rails/DynamicFindBy:
210
+ Exclude:
211
+ - 'app/models/solidus_stripe/address_from_params_service.rb'
212
+
213
+ # Offense count: 1
214
+ # This cop supports safe autocorrection (--autocorrect).
215
+ # Configuration parameters: Include, IgnoredMethods.
216
+ # Include: app/models/**/*.rb
217
+ # IgnoredMethods: order, limit, select, lock
218
+ Rails/FindEach:
219
+ Exclude:
220
+ - 'app/models/solidus_stripe/create_intents_payment_service.rb'
221
+
222
+ # Offense count: 5
223
+ # This cop supports unsafe autocorrection (--autocorrect-all).
224
+ # Configuration parameters: Include.
225
+ # Include: app/**/*.rb, config/**/*.rb, db/**/*.rb, lib/**/*.rb
226
+ Rails/Output:
227
+ Exclude:
228
+ - 'db/seeds.rb'
229
+
230
+ # Offense count: 3
231
+ # Configuration parameters: ForbiddenMethods, AllowedMethods.
232
+ # ForbiddenMethods: decrement!, decrement_counter, increment!, increment_counter, insert, insert!, insert_all, insert_all!, toggle!, touch, touch_all, update_all, update_attribute, update_column, update_columns, update_counters, upsert, upsert_all
233
+ Rails/SkipsModelValidations:
234
+ Exclude:
235
+ - 'db/migrate/20181010123508_update_stripe_payment_method_type_to_credit_card.rb'
236
+ - 'spec/models/solidus_stripe/shipping_rates_service_spec.rb'
237
+
238
+ # Offense count: 1
239
+ # This cop supports safe autocorrection (--autocorrect).
240
+ # Configuration parameters: EnforcedStyle, SingleLineConditionsOnly, IncludeTernaryExpressions.
241
+ # SupportedStyles: assign_to_condition, assign_inside_condition
242
+ Style/ConditionalAssignment:
243
+ Exclude:
244
+ - 'app/models/spree/payment_method/stripe_credit_card.rb'
245
+
246
+ # Offense count: 1
247
+ # This cop supports safe autocorrection (--autocorrect).
248
+ Style/ExplicitBlockArgument:
249
+ Exclude:
250
+ - 'spec/features/stripe_checkout_spec.rb'
251
+
252
+ # Offense count: 2
253
+ # Configuration parameters: MinBodyLength, AllowConsecutiveConditionals.
254
+ Style/GuardClause:
255
+ Exclude:
256
+ - 'app/decorators/models/spree/order_update_attributes_decorator.rb'
257
+ - 'app/models/solidus_stripe/create_intents_payment_service.rb'
258
+
259
+ # Offense count: 1
260
+ # This cop supports safe autocorrection (--autocorrect).
261
+ Style/MultilineIfModifier:
262
+ Exclude:
263
+ - 'app/models/spree/payment_method/stripe_credit_card.rb'
264
+
265
+ # Offense count: 1
266
+ # This cop supports unsafe autocorrection (--autocorrect-all).
267
+ # Configuration parameters: EnforcedStyle.
268
+ # SupportedStyles: literals, strict
269
+ Style/MutableConstant:
270
+ Exclude:
271
+ - 'app/models/spree/payment_method/stripe_credit_card.rb'
272
+
273
+ # Offense count: 2
274
+ # This cop supports safe autocorrection (--autocorrect).
275
+ # Configuration parameters: AllowedMethods.
276
+ # AllowedMethods: be, be_a, be_an, be_between, be_falsey, be_kind_of, be_instance_of, be_truthy, be_within, eq, eql, end_with, include, match, raise_error, respond_to, start_with
277
+ Style/NestedParenthesizedCalls:
278
+ Exclude:
279
+ - 'lib/solidus_stripe/testing_support/card_input_helper.rb'
280
+
281
+ # Offense count: 1
282
+ # This cop supports safe autocorrection (--autocorrect).
283
+ Style/RedundantBegin:
284
+ Exclude:
285
+ - 'app/models/solidus_stripe/address_from_params_service.rb'
286
+
287
+ # Offense count: 1
288
+ # This cop supports unsafe autocorrection (--autocorrect-all).
289
+ Style/RedundantInterpolation:
290
+ Exclude:
291
+ - 'lib/solidus_stripe/testing_support/card_input_helper.rb'
292
+
293
+ # Offense count: 19
294
+ # This cop supports safe autocorrection (--autocorrect).
295
+ # Configuration parameters: AllowHeredoc, AllowURI, URISchemes, IgnoreCopDirectives, AllowedPatterns, IgnoredPatterns.
296
+ # URISchemes: http, https
297
+ Layout/LineLength:
298
+ Max: 163
data/CHANGELOG.md CHANGED
@@ -1,233 +1,3 @@
1
1
  # Changelog
2
2
 
3
- ## [v4.3.0](https://github.com/solidusio/solidus_stripe/tree/v4.3.0) (2021-10-19)
4
-
5
- [Full Changelog](https://github.com/solidusio/solidus_stripe/compare/v4.2.0...v4.3.0)
6
-
7
- **Implemented enhancements:**
8
-
9
- - Remove Solidus 2.x deprecation to allow 3.0 usage [\#99](https://github.com/solidusio/solidus_stripe/pull/99) ([kennyadsl](https://github.com/kennyadsl))
10
- - Update gem with the latest dev\_support [\#97](https://github.com/solidusio/solidus_stripe/pull/97) ([kennyadsl](https://github.com/kennyadsl))
11
-
12
- **Fixed bugs:**
13
-
14
- - Fix 3DS iframe selection [\#86](https://github.com/solidusio/solidus_stripe/pull/86) ([spaghetticode](https://github.com/spaghetticode))
15
-
16
- **Closed issues:**
17
-
18
- - Could not create payment [\#111](https://github.com/solidusio/solidus_stripe/issues/111)
19
- - statement\_descriptor\_suffix [\#107](https://github.com/solidusio/solidus_stripe/issues/107)
20
- - Shipping cost payment refund rejected from Stripe API because of negative charge value [\#101](https://github.com/solidusio/solidus_stripe/issues/101)
21
- - Remove Solidus 2.x deprecations [\#98](https://github.com/solidusio/solidus_stripe/issues/98)
22
- - about LICENSE [\#59](https://github.com/solidusio/solidus_stripe/issues/59)
23
-
24
- **Merged pull requests:**
25
-
26
- - Add statement\_descriptor\_suffix support to options\_for\_purchase\_or\_auth [\#106](https://github.com/solidusio/solidus_stripe/pull/106) ([torukMnk](https://github.com/torukMnk))
27
- - Update install instructions [\#105](https://github.com/solidusio/solidus_stripe/pull/105) ([kennyadsl](https://github.com/kennyadsl))
28
- - Allow Solidus 3 [\#104](https://github.com/solidusio/solidus_stripe/pull/104) ([kennyadsl](https://github.com/kennyadsl))
29
- - Bump minimum solidus\_support version requirement [\#102](https://github.com/solidusio/solidus_stripe/pull/102) ([filippoliverani](https://github.com/filippoliverani))
30
- - Relax Ruby required version to support Ruby 3.0+ [\#96](https://github.com/solidusio/solidus_stripe/pull/96) ([filippoliverani](https://github.com/filippoliverani))
31
- - Update refund\_decorator.rb prepend namespacing [\#91](https://github.com/solidusio/solidus_stripe/pull/91) ([brchristian](https://github.com/brchristian))
32
- - Retrieve phone number paying with digital wallets [\#90](https://github.com/solidusio/solidus_stripe/pull/90) ([kennyadsl](https://github.com/kennyadsl))
33
- - Fix Intents API link in README [\#87](https://github.com/solidusio/solidus_stripe/pull/87) ([kennyadsl](https://github.com/kennyadsl))
34
- - Add missing 'var' [\#85](https://github.com/solidusio/solidus_stripe/pull/85) ([willread](https://github.com/willread))
35
- - Fixes Rails 6.1 load warnings [\#84](https://github.com/solidusio/solidus_stripe/pull/84) ([marcrohloff](https://github.com/marcrohloff))
36
- - Dedupe common code in stripe\_checkout\_spec.rb [\#80](https://github.com/solidusio/solidus_stripe/pull/80) ([brchristian](https://github.com/brchristian))
37
- - Refactor spec with fill\_in\_card helper [\#78](https://github.com/solidusio/solidus_stripe/pull/78) ([brchristian](https://github.com/brchristian))
38
- - Fix non-breaking space character in comment [\#76](https://github.com/solidusio/solidus_stripe/pull/76) ([brchristian](https://github.com/brchristian))
39
- - Fix Copyright in README [\#73](https://github.com/solidusio/solidus_stripe/pull/73) ([kennyadsl](https://github.com/kennyadsl))
40
- - Remove server and test\_mode from README [\#66](https://github.com/solidusio/solidus_stripe/pull/66) ([adammathys](https://github.com/adammathys))
41
-
42
- ## [v4.2.0](https://github.com/solidusio/solidus_stripe/tree/v4.2.0) (2020-07-20)
43
-
44
- [Full Changelog](https://github.com/solidusio/solidus_stripe/compare/v4.1.0...v4.2.0)
45
-
46
- **Fixed bugs:**
47
-
48
- - Fix StripeCreditCard\#try\_void with Elements/V2 API [\#75](https://github.com/solidusio/solidus_stripe/pull/75) ([spaghetticode](https://github.com/spaghetticode))
49
-
50
- **Closed issues:**
51
-
52
- - A token may not be passed in as a PaymentMethod. Instead, create a PaymentMethod or convert your token to a PaymentMethod by setting the `card[token]` parameter to [\#71](https://github.com/solidusio/solidus_stripe/issues/71)
53
-
54
- **Merged pull requests:**
55
-
56
- - Fix 3DS modal amount verification [\#72](https://github.com/solidusio/solidus_stripe/pull/72) ([spaghetticode](https://github.com/spaghetticode))
57
-
58
- ## [v4.1.0](https://github.com/solidusio/solidus_stripe/tree/v4.1.0) (2020-07-01)
59
-
60
- [Full Changelog](https://github.com/solidusio/solidus_stripe/compare/v3.2.1...v4.1.0)
61
-
62
- **Fixed bugs:**
63
-
64
- - Card name ignored when adding new card to an order during checkout [\#68](https://github.com/solidusio/solidus_stripe/issues/68)
65
- - Try to find address state also by name [\#65](https://github.com/solidusio/solidus_stripe/pull/65) ([spaghetticode](https://github.com/spaghetticode))
66
- - Fix order cancel with Payment Intents captured payment [\#57](https://github.com/solidusio/solidus_stripe/pull/57) ([spaghetticode](https://github.com/spaghetticode))
67
-
68
- **Merged pull requests:**
69
-
70
- - Save correct cardholder name in Spree::CreditCard [\#69](https://github.com/solidusio/solidus_stripe/pull/69) ([spaghetticode](https://github.com/spaghetticode))
71
- - Update Readme [\#63](https://github.com/solidusio/solidus_stripe/pull/63) ([aleph1ow](https://github.com/aleph1ow))
72
- - Remove credit cards image [\#62](https://github.com/solidusio/solidus_stripe/pull/62) ([aleph1ow](https://github.com/aleph1ow))
73
- - Remove Stripe::CardError leftover [\#58](https://github.com/solidusio/solidus_stripe/pull/58) ([spaghetticode](https://github.com/spaghetticode))
74
- - Update gemspec URLs [\#54](https://github.com/solidusio/solidus_stripe/pull/54) ([elia](https://github.com/elia))
75
- - fix typo [\#51](https://github.com/solidusio/solidus_stripe/pull/51) ([ccarruitero](https://github.com/ccarruitero))
76
-
77
- ## [v3.2.1](https://github.com/solidusio/solidus_stripe/tree/v3.2.1) (2020-06-29)
78
-
79
- [Full Changelog](https://github.com/solidusio/solidus_stripe/compare/v4.0.0...v3.2.1)
80
-
81
- **Fixed bugs:**
82
-
83
- - \[ADMIN\] Order cancel doen't work with Payment Intents captured payments [\#56](https://github.com/solidusio/solidus_stripe/issues/56)
84
-
85
- **Closed issues:**
86
-
87
- - Could not find generator 'solidus\_stripe:install' [\#60](https://github.com/solidusio/solidus_stripe/issues/60)
88
- - Payment Intent creation exception handling with class not present in the gem [\#55](https://github.com/solidusio/solidus_stripe/issues/55)
89
- - Using static credentials [\#52](https://github.com/solidusio/solidus_stripe/issues/52)
90
- - Auto capture behavior in v4.0.0 [\#50](https://github.com/solidusio/solidus_stripe/issues/50)
91
-
92
- ## [v4.0.0](https://github.com/solidusio/solidus_stripe/tree/v4.0.0) (2020-04-29)
93
-
94
- [Full Changelog](https://github.com/solidusio/solidus_stripe/compare/v3.2.0...v4.0.0)
95
-
96
- **Fixed bugs:**
97
-
98
- - Fix for 3D-Secure payments on cart page checkout [\#49](https://github.com/solidusio/solidus_stripe/pull/49) ([spaghetticode](https://github.com/spaghetticode))
99
-
100
- **Closed issues:**
101
-
102
- - Custom stripe element field options \(e.g for showing a credit card icon\) [\#41](https://github.com/solidusio/solidus_stripe/issues/41)
103
- - Clearer documentation on how to implement [\#15](https://github.com/solidusio/solidus_stripe/issues/15)
104
-
105
- **Merged pull requests:**
106
-
107
- - Relax solidus\_support dependency [\#48](https://github.com/solidusio/solidus_stripe/pull/48) ([kennyadsl](https://github.com/kennyadsl))
108
-
109
- ## [v3.2.0](https://github.com/solidusio/solidus_stripe/tree/v3.2.0) (2020-04-10)
110
-
111
- [Full Changelog](https://github.com/solidusio/solidus_stripe/compare/v3.1.0...v3.2.0)
112
-
113
- **Fixed bugs:**
114
-
115
- - Send form data also when paying with payment request button [\#47](https://github.com/solidusio/solidus_stripe/pull/47) ([spaghetticode](https://github.com/spaghetticode))
116
-
117
- **Merged pull requests:**
118
-
119
- - Replace deprecated route `/stripe/confirm_payment` [\#46](https://github.com/solidusio/solidus_stripe/pull/46) ([spaghetticode](https://github.com/spaghetticode))
120
-
121
- ## [v3.1.0](https://github.com/solidusio/solidus_stripe/tree/v3.1.0) (2020-04-10)
122
-
123
- [Full Changelog](https://github.com/solidusio/solidus_stripe/compare/v3.0.0...v3.1.0)
124
-
125
- **Fixed bugs:**
126
-
127
- - Duplicates charges with Payment Intents [\#44](https://github.com/solidusio/solidus_stripe/issues/44)
128
- - Create a single charge when using Stripe Payment Intents [\#45](https://github.com/solidusio/solidus_stripe/pull/45) ([spaghetticode](https://github.com/spaghetticode))
129
-
130
- **Closed issues:**
131
-
132
- - Stripe Elements submit button stuck in disabled state. [\#39](https://github.com/solidusio/solidus_stripe/issues/39)
133
- - Visa credit card type is blank [\#36](https://github.com/solidusio/solidus_stripe/issues/36)
134
- - Pay with Apple Pay from cart page [\#23](https://github.com/solidusio/solidus_stripe/issues/23)
135
-
136
- **Merged pull requests:**
137
-
138
- - Custom Stripe Elements field options [\#42](https://github.com/solidusio/solidus_stripe/pull/42) ([stuffmatic](https://github.com/stuffmatic))
139
- - Improve the way Stripe Elements validation errors are displayed [\#40](https://github.com/solidusio/solidus_stripe/pull/40) ([stuffmatic](https://github.com/stuffmatic))
140
- - Fix stripe-to-solidus card type mapping [\#38](https://github.com/solidusio/solidus_stripe/pull/38) ([stuffmatic](https://github.com/stuffmatic))
141
- - Add hook to provide custom Stripe Elements options [\#37](https://github.com/solidusio/solidus_stripe/pull/37) ([stuffmatic](https://github.com/stuffmatic))
142
- - Change order description that we pass to Stripe [\#35](https://github.com/solidusio/solidus_stripe/pull/35) ([kennyadsl](https://github.com/kennyadsl))
143
-
144
- ## [v3.0.0](https://github.com/solidusio/solidus_stripe/tree/v3.0.0) (2020-03-11)
145
-
146
- [Full Changelog](https://github.com/solidusio/solidus_stripe/compare/v2.1.0...v3.0.0)
147
-
148
- **Implemented enhancements:**
149
-
150
- - Rename v3/stripe partial as v3/elements [\#30](https://github.com/solidusio/solidus_stripe/pull/30) ([spaghetticode](https://github.com/spaghetticode))
151
-
152
- **Merged pull requests:**
153
-
154
- - Allow to customize Stripe Elements styles via JS [\#34](https://github.com/solidusio/solidus_stripe/pull/34) ([spaghetticode](https://github.com/spaghetticode))
155
- - Stop injecting css in host app while installing [\#33](https://github.com/solidusio/solidus_stripe/pull/33) ([kennyadsl](https://github.com/kennyadsl))
156
- - Manage Stripe V3 JS code via Sprokets [\#32](https://github.com/solidusio/solidus_stripe/pull/32) ([spaghetticode](https://github.com/spaghetticode))
157
-
158
- ## [v2.1.0](https://github.com/solidusio/solidus_stripe/tree/v2.1.0) (2020-03-11)
159
-
160
- [Full Changelog](https://github.com/solidusio/solidus_stripe/compare/v2.0.0...v2.1.0)
161
-
162
- **Closed issues:**
163
-
164
- - Preference :stripe\_country is not defined on Spree::PaymentMethod::StripeCreditCard \(RuntimeError\) [\#27](https://github.com/solidusio/solidus_stripe/issues/27)
165
-
166
- **Merged pull requests:**
167
-
168
- - Refactor Stripe V3 Intents, Elements and cart checkout JS code [\#31](https://github.com/solidusio/solidus_stripe/pull/31) ([spaghetticode](https://github.com/spaghetticode))
169
-
170
- ## [v2.0.0](https://github.com/solidusio/solidus_stripe/tree/v2.0.0) (2020-03-03)
171
-
172
- [Full Changelog](https://github.com/solidusio/solidus_stripe/compare/v1.2.0...v2.0.0)
173
-
174
- **Implemented enhancements:**
175
-
176
- - Add support for Apple Pay through Stripe Payment Request Button [\#22](https://github.com/solidusio/solidus_stripe/issues/22)
177
- - Cart page payment with Stripe payment request button \(Apple/Google Pay\) [\#29](https://github.com/solidusio/solidus_stripe/pull/29) ([spaghetticode](https://github.com/spaghetticode))
178
- - Allow Apple Pay and Google Pay via Payment Request Button [\#25](https://github.com/solidusio/solidus_stripe/pull/25) ([spaghetticode](https://github.com/spaghetticode))
179
- - Use Payment Intents API with Active Merchant [\#20](https://github.com/solidusio/solidus_stripe/pull/20) ([spaghetticode](https://github.com/spaghetticode))
180
-
181
- **Closed issues:**
182
-
183
- - Handling of Strong Customer Authentication \(SCA\) [\#18](https://github.com/solidusio/solidus_stripe/issues/18)
184
- - Stripe checkout fails when using a stored credit card number [\#16](https://github.com/solidusio/solidus_stripe/issues/16)
185
- - Better PCI-Compliance with stripe.js version 3 [\#5](https://github.com/solidusio/solidus_stripe/issues/5)
186
- - No gem found [\#4](https://github.com/solidusio/solidus_stripe/issues/4)
187
-
188
- **Merged pull requests:**
189
-
190
- - Remove ERB from Elements and Intents JS code [\#28](https://github.com/solidusio/solidus_stripe/pull/28) ([spaghetticode](https://github.com/spaghetticode))
191
- - Remove `update_attributes!` deprecation [\#24](https://github.com/solidusio/solidus_stripe/pull/24) ([spaghetticode](https://github.com/spaghetticode))
192
- - Add solidus\_dev\_support gem [\#21](https://github.com/solidusio/solidus_stripe/pull/21) ([spaghetticode](https://github.com/spaghetticode))
193
- - Fix reusing cards with Stripe v3 [\#17](https://github.com/solidusio/solidus_stripe/pull/17) ([kennyadsl](https://github.com/kennyadsl))
194
- - Extension maintenance [\#14](https://github.com/solidusio/solidus_stripe/pull/14) ([kennyadsl](https://github.com/kennyadsl))
195
- - Update README installation instructions [\#13](https://github.com/solidusio/solidus_stripe/pull/13) ([hashrocketeer](https://github.com/hashrocketeer))
196
- - Use preferred\_v3\_elements instead of preferences\[:v3\_elements\] [\#12](https://github.com/solidusio/solidus_stripe/pull/12) ([ChristianRimondi](https://github.com/ChristianRimondi))
197
- - Remove `Spree.t` in favor of `I18n.t` [\#11](https://github.com/solidusio/solidus_stripe/pull/11) ([spaghetticode](https://github.com/spaghetticode))
198
- - Remove Capybara deprecation warning [\#10](https://github.com/solidusio/solidus_stripe/pull/10) ([spaghetticode](https://github.com/spaghetticode))
199
- - Add Stripe.js V3 with Elements [\#9](https://github.com/solidusio/solidus_stripe/pull/9) ([spaghetticode](https://github.com/spaghetticode))
200
- - Remove unused CircleCI config [\#8](https://github.com/solidusio/solidus_stripe/pull/8) ([aitbw](https://github.com/aitbw))
201
- - Add Rubocop for linting [\#7](https://github.com/solidusio/solidus_stripe/pull/7) ([aitbw](https://github.com/aitbw))
202
- - Allow creating seeds with the install command [\#6](https://github.com/solidusio/solidus_stripe/pull/6) ([kennyadsl](https://github.com/kennyadsl))
203
- - Add Solidus v2.8 to Travis config [\#3](https://github.com/solidusio/solidus_stripe/pull/3) ([aitbw](https://github.com/aitbw))
204
- - Update README.md [\#2](https://github.com/solidusio/solidus_stripe/pull/2) ([brchristian](https://github.com/brchristian))
205
- - Add missing API partial for stripe gateway [\#1](https://github.com/solidusio/solidus_stripe/pull/1) ([jontarg](https://github.com/jontarg))
206
-
207
- ## [v1.2.0](https://github.com/solidusio/solidus_stripe/tree/v1.2.0) (2017-07-24)
208
-
209
- [Full Changelog](https://github.com/solidusio/solidus_stripe/compare/v1.1.1...v1.2.0)
210
-
211
- ## [v1.1.1](https://github.com/solidusio/solidus_stripe/tree/v1.1.1) (2016-09-22)
212
-
213
- [Full Changelog](https://github.com/solidusio/solidus_stripe/compare/v1.1.0...v1.1.1)
214
-
215
- ## [v1.1.0](https://github.com/solidusio/solidus_stripe/tree/v1.1.0) (2016-07-26)
216
-
217
- [Full Changelog](https://github.com/solidusio/solidus_stripe/compare/v1.0.1...v1.1.0)
218
-
219
- ## [v1.0.1](https://github.com/solidusio/solidus_stripe/tree/v1.0.1) (2016-01-13)
220
-
221
- [Full Changelog](https://github.com/solidusio/solidus_stripe/compare/v0.9.0...v1.0.1)
222
-
223
- ## [v0.9.0](https://github.com/solidusio/solidus_stripe/tree/v0.9.0) (2015-08-28)
224
-
225
- [Full Changelog](https://github.com/solidusio/solidus_stripe/compare/v1.0.0...v0.9.0)
226
-
227
- ## [v1.0.0](https://github.com/solidusio/solidus_stripe/tree/v1.0.0) (2015-08-27)
228
-
229
- [Full Changelog](https://github.com/solidusio/solidus_stripe/compare/c20c3f69811d68c374ffedc2e20c1bc6bdb45f95...v1.0.0)
230
-
231
-
232
-
233
- \* *This Changelog was automatically generated by [github_changelog_generator](https://github.com/github-changelog-generator/github-changelog-generator)*
3
+ See https://github.com/solidusio/solidus_stripe/releases.
data/Gemfile CHANGED
@@ -6,6 +6,11 @@ git_source(:github) { |repo| "https://github.com/#{repo}.git" }
6
6
  branch = ENV.fetch('SOLIDUS_BRANCH', 'master')
7
7
  gem 'solidus', github: 'solidusio/solidus', branch: branch
8
8
 
9
+ # The solidus_frontend gem has been pulled out since v3.2
10
+ if (branch == 'master') || (branch >= 'v3.2')
11
+ gem 'solidus_frontend', github: 'solidusio/solidus_frontend', branch: branch
12
+ end
13
+
9
14
  # Needed to help Bundler figure out how to resolve dependencies,
10
15
  # otherwise it takes forever to resolve them.
11
16
  # See https://github.com/bundler/bundler/issues/6677
@@ -14,7 +19,7 @@ gem 'rails', '>0.a'
14
19
  # Provides basic authentication functionality for testing parts of your engine
15
20
  gem 'solidus_auth_devise'
16
21
 
17
- case ENV['DB']
22
+ case ENV.fetch('DB', nil)
18
23
  when 'mysql'
19
24
  gem 'mysql2'
20
25
  when 'postgresql'
data/README.md CHANGED
@@ -5,10 +5,8 @@
5
5
 
6
6
  Stripe Payment Method for Solidus. It works as a wrapper for the ActiveMerchant Stripe gateway.
7
7
 
8
- ---
8
+ ## Installation
9
9
 
10
- Installation
11
- ------------
12
10
 
13
11
  Run from the command line:
14
12
 
@@ -38,11 +36,8 @@ variables you can create the following static configuration:
38
36
 
39
37
  ```ruby
40
38
  # config/initializers/spree.rb
41
-
42
- Spree.config do |config|
43
- # ...
44
-
45
- config.static_model_preferences.add(
39
+ Rails.application.config.to_prepare do
40
+ Spree::Config.static_model_preferences.add(
46
41
  Spree::PaymentMethod::StripeCreditCard,
47
42
  'stripe_env_credentials',
48
43
  secret_key: ENV['STRIPE_SECRET_KEY'],
@@ -277,10 +272,17 @@ bundle exec rubocop
277
272
  ```
278
273
 
279
274
  When testing your application's integration with this extension you may use its factories.
280
- Simply add this require statement to your spec_helper:
275
+ Simply add this require statement to your `spec/spec_helper.rb`:
276
+
277
+ ```ruby
278
+ require 'solidus_stripe/testing_support/factories'
279
+ ```
280
+
281
+ Or, if you are using `FactoryBot.definition_file_paths`, you can load Solidus core
282
+ factories along with this extension's factories using this statement:
281
283
 
282
284
  ```ruby
283
- require '<%= file_name %>/factories'
285
+ SolidusDevSupport::TestingSupport::Factories.load_for(SolidusStripe::Engine)
284
286
  ```
285
287
 
286
288
  ### Running the sandbox
data/Rakefile CHANGED
@@ -1,6 +1,49 @@
1
1
  # frozen_string_literal: true
2
2
 
3
+ # Don't build a dummy app with solidus_bolt enabled
4
+ ENV['SKIP_SOLIDUS_BOLT'] = 'true'
5
+
3
6
  require 'solidus_dev_support/rake_tasks'
4
7
  SolidusDevSupport::RakeTasks.install
5
8
 
6
- task default: 'extension:specs'
9
+ require 'bundler/gem_tasks'
10
+
11
+ # Override the default dummy app generation task to
12
+ # make it compatible with all the supported Solidus versions.
13
+ Rake::Task['extension:test_app'].clear
14
+ task 'extension:test_app' do # rubocop:disable Rails/RakeEnvironment
15
+ Spree::DummyGeneratorHelper.inject_extension_requirements = true
16
+
17
+ require 'solidus_stripe'
18
+
19
+ Rails.env = ENV["RAILS_ENV"] = 'test'
20
+
21
+ Spree::DummyGenerator.start ["--lib-name=solidus_stripe"]
22
+
23
+ # While the dummy app is generated the current directory
24
+ # within ruby is changed to that of the dummy app.
25
+ sh({
26
+ 'FRONTEND' => ENV['FRONTEND'] || "#{__dir__}/spec/solidus_frontend_app_template.rb",
27
+ }, [
28
+ 'bin/rails',
29
+ 'generate',
30
+ 'solidus:install',
31
+ Dir.pwd, # use the current dir as Rails.root
32
+ "--auto-accept",
33
+ "--authentication=none",
34
+ "--payment-method=none",
35
+ "--migrate=false",
36
+ "--seed=false",
37
+ "--sample=false",
38
+ "--user-class=Spree::LegacyUser",
39
+ ].shelljoin)
40
+
41
+ puts "Setting up dummy database..."
42
+ sh "bin/rails db:environment:set RAILS_ENV=test"
43
+ sh "bin/rails db:drop db:create db:migrate VERBOSE=false RAILS_ENV=test"
44
+
45
+ puts 'Running extension installation generator...'
46
+ sh "bin/rails generate solidus_stripe:install --auto-run-migrations"
47
+ end
48
+
49
+ task default: ['extension:specs']
@@ -19,7 +19,7 @@ module SolidusStripe
19
19
  if create_payment_service.call
20
20
  render json: { success: true }
21
21
  else
22
- render json: { error: "Could not create payment" }, status: 500
22
+ render json: { error: "Could not create payment" }, status: :internal_server_error
23
23
  end
24
24
  end
25
25
 
@@ -45,7 +45,7 @@ module SolidusStripe
45
45
  stripe_payment_intent_id: response['id']
46
46
  }
47
47
  else
48
- render json: { error: response['error']['message'] }, status: 500
48
+ render json: { error: response['error']['message'] }, status: :internal_server_error
49
49
  end
50
50
  end
51
51
 
@@ -14,7 +14,7 @@ module SolidusStripe
14
14
  if rates.any?
15
15
  render json: { success: true, shipping_rates: rates }
16
16
  else
17
- render json: { success: false, error: 'No shipping method available for that address' }, status: 500
17
+ render json: { success: false, error: 'No shipping method available for that address' }, status: :internal_server_error
18
18
  end
19
19
  end
20
20
 
@@ -32,10 +32,10 @@ module SolidusStripe
32
32
  if current_order.payment?
33
33
  render json: { success: true }
34
34
  else
35
- render json: { success: false, error: 'Order not ready for payment. Try manual checkout.' }, status: 500
35
+ render json: { success: false, error: 'Order not ready for payment. Try manual checkout.' }, status: :internal_server_error
36
36
  end
37
37
  else
38
- render json: { success: false, error: address.errors.full_messages.to_sentence }, status: 500
38
+ render json: { success: false, error: address.errors.full_messages.to_sentence }, status: :internal_server_error
39
39
  end
40
40
  end
41
41
 
@@ -61,20 +61,29 @@ module Spree
61
61
  true
62
62
  end
63
63
 
64
+ def non_fractional_money(money, currency)
65
+ amount = money.is_a?(Integer) ? money : money.cents
66
+ Spree::Money.new((amount * 100), { currency: currency })
67
+ end
68
+
69
+ def localize(money, currency)
70
+ ActiveMerchant::Billing::Gateway.currencies_without_fractions.include?(currency) ? non_fractional_money(money, currency) : money
71
+ end
72
+
64
73
  def purchase(money, creditcard, transaction_options)
65
- gateway.purchase(*options_for_purchase_or_auth(money, creditcard, transaction_options))
74
+ gateway.purchase(*options_for_purchase_or_auth(localize(money, transaction_options[:currency]), creditcard, transaction_options))
66
75
  end
67
76
 
68
77
  def authorize(money, creditcard, transaction_options)
69
- gateway.authorize(*options_for_purchase_or_auth(money, creditcard, transaction_options))
78
+ gateway.authorize(*options_for_purchase_or_auth(localize(money, transaction_options[:currency]), creditcard, transaction_options))
70
79
  end
71
80
 
72
81
  def capture(money, response_code, transaction_options)
73
- gateway.capture(money, response_code, transaction_options)
82
+ gateway.capture(localize(money, transaction_options[:currency]), response_code, transaction_options)
74
83
  end
75
84
 
76
- def credit(money, _creditcard, response_code, _transaction_options)
77
- gateway.refund(money, response_code, {})
85
+ def credit(money, _creditcard, response_code, transaction_options)
86
+ gateway.refund(localize(money, transaction_options[:currency]), response_code, {})
78
87
  end
79
88
 
80
89
  def void(response_code, _creditcard, _transaction_options)
@@ -112,7 +121,7 @@ module Spree
112
121
  }.merge! address_for(payment)
113
122
 
114
123
  source = update_source!(payment.source)
115
- if source.number.blank? && source.gateway_payment_profile_id.present?
124
+ if reuse_existing_source?(source)
116
125
  if v3_intents?
117
126
  creditcard = ActiveMerchant::Billing::StripeGateway::StripePaymentToken.new('id' => source.gateway_payment_profile_id)
118
127
  else
@@ -124,7 +133,7 @@ module Spree
124
133
 
125
134
  response = gateway.store(creditcard, options)
126
135
  if response.success?
127
- if v3_intents?
136
+ if v3_intents? && reuse_existing_source?(source)
128
137
  payment.source.update!(
129
138
  cc_type: payment.source.cc_type,
130
139
  gateway_customer_profile_id: response.params['customer'],
@@ -212,6 +221,10 @@ module Spree
212
221
 
213
222
  refund
214
223
  end
224
+
225
+ def reuse_existing_source?(source)
226
+ source.number.blank? && source.gateway_payment_profile_id.present?
227
+ end
215
228
  end
216
229
  end
217
230
  end
data/bin/sandbox CHANGED
@@ -67,7 +67,7 @@ unbundled bundle install --gemfile Gemfile
67
67
 
68
68
  unbundled bundle exec rake db:drop db:create
69
69
 
70
- unbundled bundle exec rails generate spree:install \
70
+ unbundled bundle exec rails generate solidus:install \
71
71
  --auto-accept \
72
72
  --user_class=Spree::User \
73
73
  --enforce_available_locales=true \
@@ -14,7 +14,7 @@ module SolidusStripe
14
14
  end
15
15
 
16
16
  def run_migrations
17
- run_migrations = options[:auto_run_migrations] || ['', 'y', 'Y'].include?(ask('Would you like to run the migrations now? [Y/n]')) # rubocop:disable Layout/LineLength
17
+ run_migrations = options[:auto_run_migrations] || ENV['CI'] || ['', 'y', 'Y'].include?(ask('Would you like to run the migrations now? [Y/n]')) # rubocop:disable Layout/LineLength
18
18
  if run_migrations
19
19
  run 'bin/rails db:migrate'
20
20
  else
@@ -2,7 +2,7 @@
2
2
 
3
3
  module SolidusStripe
4
4
  class Configuration
5
- # Define here the settings for this extensions, e.g.:
5
+ # Define here the settings for this extension, e.g.:
6
6
  #
7
7
  # attr_accessor :my_setting
8
8
  end
@@ -1,5 +1,5 @@
1
1
  # frozen_string_literal: true
2
2
 
3
3
  module SolidusStripe
4
- VERSION = '4.3.0'
4
+ VERSION = '4.4.1'
5
5
  end
@@ -17,7 +17,7 @@ Gem::Specification.new do |spec|
17
17
  spec.metadata['source_code_uri'] = 'https://github.com/solidusio/solidus_stripe'
18
18
  spec.metadata['changelog_uri'] = 'https://github.com/solidusio/solidus_stripe/blob/master/CHANGELOG.md'
19
19
 
20
- spec.required_ruby_version = '>= 2.4.0'
20
+ spec.required_ruby_version = Gem::Requirement.new('>= 2.5')
21
21
 
22
22
  # Specify which files should be added to the gem when it is released.
23
23
  # The `git ls-files -z` loads the files in the RubyGem that have been added into git.
@@ -29,9 +29,10 @@ Gem::Specification.new do |spec|
29
29
  spec.executables = files.grep(%r{^exe/}) { |f| File.basename(f) }
30
30
  spec.require_paths = ["lib"]
31
31
 
32
- spec.add_dependency 'solidus_core', ['>= 2.3', '< 4']
32
+ spec.add_dependency 'solidus_core', ['>= 3', '< 5']
33
33
  spec.add_dependency 'solidus_support', '~> 0.8'
34
34
  spec.add_dependency 'activemerchant', '>= 1.105'
35
+ spec.add_dependency 'rexml'
35
36
 
36
- spec.add_development_dependency 'solidus_dev_support', '~> 2.3'
37
+ spec.add_development_dependency 'solidus_dev_support', '~> 2.5'
37
38
  end
@@ -23,7 +23,7 @@ RSpec.describe "Stripe checkout", type: :feature do
23
23
 
24
24
  FactoryBot.create(:product, name: "DL-44")
25
25
 
26
- visit spree.root_path
26
+ visit '/'
27
27
  click_link "DL-44"
28
28
  click_button "Add To Cart"
29
29
 
@@ -85,7 +85,7 @@ RSpec.describe "Stripe checkout", type: :feature do
85
85
  click_button "Place Order"
86
86
  expect(page).to have_content("Your order has been processed successfully")
87
87
 
88
- visit spree.root_path
88
+ visit '/'
89
89
  click_link "DL-44"
90
90
  click_button "Add To Cart"
91
91
 
@@ -207,7 +207,7 @@ RSpec.describe "Stripe checkout", type: :feature do
207
207
  click_button "Place Order"
208
208
  expect(page).to have_content("Your order has been processed successfully")
209
209
 
210
- visit spree.root_path
210
+ visit '/'
211
211
  click_link "DL-44"
212
212
  click_button "Add To Cart"
213
213
 
@@ -266,7 +266,7 @@ RSpec.describe "Stripe checkout", type: :feature do
266
266
  end
267
267
 
268
268
  page.accept_alert do
269
- find('input[value="Cancel"]').click
269
+ click_on "Cancel"
270
270
  end
271
271
 
272
272
  expect(page).to have_content "Order canceled"
@@ -315,21 +315,21 @@ RSpec.describe "Stripe checkout", type: :feature do
315
315
  click_button 'Complete authentication'
316
316
  end
317
317
 
318
- expect(page).to have_content "Your card was declined."
318
+ expect(page).to have_content "Your card has been declined."
319
319
  end
320
320
  end
321
321
 
322
322
  context "when reusing a card" do
323
323
  stub_authorization!
324
324
 
325
- it "succesfully creates a second payment that can be captured in the backend" do
325
+ it "successfully creates a second payment that can be captured in the backend" do
326
326
  authenticate_3d_secure_card(card_3d_secure)
327
327
 
328
328
  expect(page).to have_current_path("/checkout/confirm")
329
329
  click_button "Place Order"
330
330
  expect(page).to have_content("Your order has been processed successfully")
331
331
 
332
- visit spree.root_path
332
+ visit '/'
333
333
  click_link "DL-44"
334
334
  click_button "Add To Cart"
335
335
 
@@ -388,7 +388,7 @@ RSpec.describe "Stripe checkout", type: :feature do
388
388
  end
389
389
 
390
390
  page.accept_alert do
391
- find('input[value="Cancel"]').click
391
+ click_on "Cancel"
392
392
  end
393
393
 
394
394
  expect(page).to have_content "Order canceled"
@@ -26,12 +26,12 @@ RSpec.describe SolidusStripe::CreateIntentsPaymentService do
26
26
  stripe_payment_intent_id: intent_id,
27
27
  form_data: {
28
28
  addressLine: ["31 Cotton Rd"],
29
- city: "San Diego",
30
- country: "US",
29
+ city: order.bill_address.city,
30
+ country: order.bill_address.country.iso,
31
+ region: order.bill_address.state.abbr,
31
32
  phone: "+188836412312",
32
33
  postalCode: "12345",
33
34
  recipient: "James Edwards",
34
- region: "CA"
35
35
  }
36
36
  }
37
37
  end
@@ -102,7 +102,7 @@ RSpec.describe SolidusStripe::CreateIntentsPaymentService do
102
102
  end
103
103
 
104
104
  before do
105
- response = double(success?: true, authorization: payment.response_code)
105
+ response = ActiveMerchant::Billing::Response.new(true, nil, {}, authorization: payment.response_code)
106
106
  allow_any_instance_of(Spree::PaymentMethod::StripeCreditCard).to receive(:void) { response }
107
107
  end
108
108
 
@@ -171,6 +171,16 @@ describe Spree::PaymentMethod::StripeCreditCard do
171
171
  end
172
172
  end
173
173
 
174
+ context 'purchasing with fractionless currency' do
175
+ after do
176
+ subject.purchase(1999, 'credit card', { currency: 'JPY' })
177
+ end
178
+
179
+ it 'send the payment to the gateway' do
180
+ expect(gateway).to receive(:purchase).with('money', 'cc', 'opts')
181
+ end
182
+ end
183
+
174
184
  context 'authorizing' do
175
185
  after do
176
186
  subject.authorize(19.99, 'credit card', {})
@@ -181,6 +191,16 @@ describe Spree::PaymentMethod::StripeCreditCard do
181
191
  end
182
192
  end
183
193
 
194
+ context 'authorizing with fractionless currency' do
195
+ after do
196
+ subject.authorize(1999, 'credit card', { currency: 'JPY' })
197
+ end
198
+
199
+ it 'send the authorization to the gateway' do
200
+ expect(gateway).to receive(:authorize).with('money', 'cc', 'opts')
201
+ end
202
+ end
203
+
184
204
  context 'capturing' do
185
205
  after do
186
206
  subject.capture(1234, 'response_code', {})
@@ -195,6 +215,20 @@ describe Spree::PaymentMethod::StripeCreditCard do
195
215
  end
196
216
  end
197
217
 
218
+ context 'capturing with fractionless currency' do
219
+ after do
220
+ subject.capture(1234, 'response_code', { currency: 'JPY' })
221
+ end
222
+
223
+ it 'amount not converted to cents' do
224
+ expect(gateway).to receive(:capture).with(Spree::Money.new(123_400, { currency: 'JPY' }), anything, anything)
225
+ end
226
+
227
+ it 'use the response code as the authorization' do
228
+ expect(gateway).to receive(:capture).with(anything, 'response_code', anything)
229
+ end
230
+ end
231
+
198
232
  context 'capture with payment class' do
199
233
  let(:payment_method) do
200
234
  payment_method = described_class.new(active: true)
@@ -228,10 +262,14 @@ describe Spree::PaymentMethod::StripeCreditCard do
228
262
  end
229
263
 
230
264
  let!(:success_response) do
231
- double('success_response', success?: true,
232
- authorization: '123',
233
- avs_result: { 'code' => 'avs-code' },
234
- cvv_result: { 'code' => 'cvv-code', 'message' => "CVV Result" })
265
+ ActiveMerchant::Billing::Response.new(
266
+ true,
267
+ nil,
268
+ {},
269
+ avs_result: { 'code' => 'avs-code' },
270
+ cvv_result: 'cvv-code',
271
+ authorization: '123',
272
+ )
235
273
  end
236
274
 
237
275
  after do
@@ -0,0 +1,17 @@
1
+ # frozen_string_literal: true
2
+
3
+ create_file "public/robots.txt"
4
+ bundle_command "add solidus_frontend --github solidusio/solidus_frontend --branch #{ENV['SOLIDUS_BRANCH'] || 'main'}"
5
+ generate "solidus_frontend:install --auto-accept"
6
+ empty_directory 'lib/generators/solidus_frontend/install'
7
+
8
+ create_file 'lib/generators/solidus_frontend/install/install_generator.rb', <<-CODE
9
+ puts "SolidusFrontend::Generators::InstallGenerator was disabled."
10
+ module SolidusFrontend
11
+ module Generators
12
+ class InstallGenerator < Rails::Generators::Base
13
+ class_option :auto_accept, type: :boolean, default: false
14
+ end
15
+ end
16
+ end
17
+ CODE
metadata CHANGED
@@ -1,14 +1,14 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: solidus_stripe
3
3
  version: !ruby/object:Gem::Version
4
- version: 4.3.0
4
+ version: 4.4.1
5
5
  platform: ruby
6
6
  authors:
7
7
  - Solidus Team
8
8
  autorequire:
9
9
  bindir: exe
10
10
  cert_chain: []
11
- date: 2021-10-19 00:00:00.000000000 Z
11
+ date: 2023-05-26 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: solidus_core
@@ -16,20 +16,20 @@ dependencies:
16
16
  requirements:
17
17
  - - ">="
18
18
  - !ruby/object:Gem::Version
19
- version: '2.3'
19
+ version: '3'
20
20
  - - "<"
21
21
  - !ruby/object:Gem::Version
22
- version: '4'
22
+ version: '5'
23
23
  type: :runtime
24
24
  prerelease: false
25
25
  version_requirements: !ruby/object:Gem::Requirement
26
26
  requirements:
27
27
  - - ">="
28
28
  - !ruby/object:Gem::Version
29
- version: '2.3'
29
+ version: '3'
30
30
  - - "<"
31
31
  - !ruby/object:Gem::Version
32
- version: '4'
32
+ version: '5'
33
33
  - !ruby/object:Gem::Dependency
34
34
  name: solidus_support
35
35
  requirement: !ruby/object:Gem::Requirement
@@ -58,20 +58,34 @@ dependencies:
58
58
  - - ">="
59
59
  - !ruby/object:Gem::Version
60
60
  version: '1.105'
61
+ - !ruby/object:Gem::Dependency
62
+ name: rexml
63
+ requirement: !ruby/object:Gem::Requirement
64
+ requirements:
65
+ - - ">="
66
+ - !ruby/object:Gem::Version
67
+ version: '0'
68
+ type: :runtime
69
+ prerelease: false
70
+ version_requirements: !ruby/object:Gem::Requirement
71
+ requirements:
72
+ - - ">="
73
+ - !ruby/object:Gem::Version
74
+ version: '0'
61
75
  - !ruby/object:Gem::Dependency
62
76
  name: solidus_dev_support
63
77
  requirement: !ruby/object:Gem::Requirement
64
78
  requirements:
65
79
  - - "~>"
66
80
  - !ruby/object:Gem::Version
67
- version: '2.3'
81
+ version: '2.5'
68
82
  type: :development
69
83
  prerelease: false
70
84
  version_requirements: !ruby/object:Gem::Requirement
71
85
  requirements:
72
86
  - - "~>"
73
87
  - !ruby/object:Gem::Version
74
- version: '2.3'
88
+ version: '2.5'
75
89
  description: Stripe Payment Method for Solidus
76
90
  email: contact@solidus.io
77
91
  executables: []
@@ -85,6 +99,7 @@ files:
85
99
  - ".gitignore"
86
100
  - ".rspec"
87
101
  - ".rubocop.yml"
102
+ - ".rubocop_todo.yml"
88
103
  - ".travis.yml"
89
104
  - CHANGELOG.md
90
105
  - Gemfile
@@ -151,6 +166,7 @@ files:
151
166
  - spec/models/solidus_stripe/shipping_rates_service_spec.rb
152
167
  - spec/models/spree/payment_method/stripe_credit_card_spec.rb
153
168
  - spec/requests/payment_requests_spec.rb
169
+ - spec/solidus_frontend_app_template.rb
154
170
  - spec/spec_helper.rb
155
171
  - spec/support/solidus_address_helper.rb
156
172
  homepage: https://github.com/solidusio/solidus_stripe#readme
@@ -168,14 +184,14 @@ required_ruby_version: !ruby/object:Gem::Requirement
168
184
  requirements:
169
185
  - - ">="
170
186
  - !ruby/object:Gem::Version
171
- version: 2.4.0
187
+ version: '2.5'
172
188
  required_rubygems_version: !ruby/object:Gem::Requirement
173
189
  requirements:
174
190
  - - ">="
175
191
  - !ruby/object:Gem::Version
176
192
  version: '0'
177
193
  requirements: []
178
- rubygems_version: 3.2.20
194
+ rubygems_version: 3.4.10
179
195
  signing_key:
180
196
  specification_version: 4
181
197
  summary: Stripe Payment Method for Solidus
@@ -187,5 +203,6 @@ test_files:
187
203
  - spec/models/solidus_stripe/shipping_rates_service_spec.rb
188
204
  - spec/models/spree/payment_method/stripe_credit_card_spec.rb
189
205
  - spec/requests/payment_requests_spec.rb
206
+ - spec/solidus_frontend_app_template.rb
190
207
  - spec/spec_helper.rb
191
208
  - spec/support/solidus_address_helper.rb