solidus_stripe 4.2.0 → 4.3.0
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/.circleci/config.yml +5 -0
- data/.gem_release.yml +1 -1
- data/.github/stale.yml +4 -4
- data/.github_changelog_generator +2 -0
- data/.gitignore +3 -2
- data/.rubocop.yml +1 -3
- data/CHANGELOG.md +94 -17
- data/Gemfile +3 -9
- data/LICENSE +2 -1
- data/README.md +52 -47
- data/app/assets/javascripts/spree/frontend/solidus_stripe/stripe-cart-page-checkout.js +1 -0
- data/app/assets/javascripts/spree/frontend/solidus_stripe/stripe-payment-request-button-shared.js +2 -1
- data/app/controllers/solidus_stripe/payment_request_controller.rb +11 -1
- data/app/decorators/models/spree/refund_decorator.rb +1 -1
- data/app/models/solidus_stripe/address_from_params_service.rb +20 -8
- data/app/models/solidus_stripe/create_intents_payment_service.rb +2 -1
- data/app/models/spree/payment_method/stripe_credit_card.rb +26 -4
- data/bin/rails +4 -12
- data/bin/rails-engine +13 -0
- data/bin/rails-sandbox +16 -0
- data/bin/sandbox +2 -0
- data/config/locales/en.yml +5 -0
- data/lib/generators/solidus_stripe/install/install_generator.rb +1 -5
- data/lib/solidus_stripe/configuration.rb +21 -0
- data/lib/solidus_stripe/engine.rb +3 -14
- data/lib/solidus_stripe/testing_support/card_input_helper.rb +34 -0
- data/lib/solidus_stripe/{factories.rb → testing_support/factories.rb} +0 -0
- data/lib/solidus_stripe/version.rb +1 -1
- data/lib/solidus_stripe.rb +5 -5
- data/lib/views/frontend/spree/checkout/payment/v2/_javascript.html.erb +1 -1
- data/lib/views/frontend/spree/checkout/payment/v3/_form_elements.html.erb +2 -1
- data/solidus_stripe.gemspec +5 -5
- data/spec/features/stripe_checkout_spec.rb +31 -111
- data/spec/models/solidus_stripe/address_from_params_service_spec.rb +17 -6
- data/spec/models/solidus_stripe/create_intents_payment_service_spec.rb +1 -1
- data/spec/models/spree/payment_method/stripe_credit_card_spec.rb +29 -0
- data/spec/requests/payment_requests_spec.rb +152 -0
- data/spec/spec_helper.rb +16 -5
- data/spec/support/solidus_address_helper.rb +2 -2
- metadata +24 -16
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA256:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: b92e606bb4ada8e49087a97ffeff9be982f8cc0110cd7c8c0721d73220adeb3c
|
4
|
+
data.tar.gz: 6c0b61f704f0faab2e16ef827879e86efde9bf7123eadc7a968c7810452956bc
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: 0daa283258eb4c1fb7dc0c41444e0e0ebaf8a439a91f7597d1ec4d941c9fd7badc0d043aec6a98e9b2c3e1bef131e4222d9bcc931c508546fee67b7d679a48ad
|
7
|
+
data.tar.gz: f10627a842fff35f6ef69e7cfcf8643ec4e7fb961cab9f9f2aba28217068afd62babe3d6048396d781794457c3f0fa2bdbad278f2a8865a13b0a41ee4397dd94
|
data/.circleci/config.yml
CHANGED
@@ -16,12 +16,17 @@ jobs:
|
|
16
16
|
executor: solidusio_extensions/mysql
|
17
17
|
steps:
|
18
18
|
- solidusio_extensions/run-tests
|
19
|
+
lint-code:
|
20
|
+
executor: solidusio_extensions/sqlite-memory
|
21
|
+
steps:
|
22
|
+
- solidusio_extensions/lint-code
|
19
23
|
|
20
24
|
workflows:
|
21
25
|
"Run specs on supported Solidus versions":
|
22
26
|
jobs:
|
23
27
|
- run-specs-with-postgres
|
24
28
|
- run-specs-with-mysql
|
29
|
+
|
25
30
|
"Weekly run specs against master":
|
26
31
|
triggers:
|
27
32
|
- schedule:
|
data/.gem_release.yml
CHANGED
data/.github/stale.yml
CHANGED
@@ -1,17 +1,17 @@
|
|
1
1
|
# Number of days of inactivity before an issue becomes stale
|
2
2
|
daysUntilStale: 60
|
3
3
|
# Number of days of inactivity before a stale issue is closed
|
4
|
-
daysUntilClose:
|
4
|
+
daysUntilClose: false
|
5
5
|
# Issues with these labels will never be considered stale
|
6
6
|
exemptLabels:
|
7
7
|
- pinned
|
8
8
|
- security
|
9
9
|
# Label to use when marking an issue as stale
|
10
|
-
staleLabel:
|
10
|
+
staleLabel: stale
|
11
11
|
# Comment to post when marking an issue as stale. Set to `false` to disable
|
12
12
|
markComment: >
|
13
13
|
This issue has been automatically marked as stale because it has not had
|
14
|
-
recent activity. It
|
14
|
+
recent activity. It might be closed if no further activity occurs. Thank you
|
15
15
|
for your contributions.
|
16
16
|
# Comment to post when closing a stale issue. Set to `false` to disable
|
17
|
-
closeComment: false
|
17
|
+
closeComment: false
|
data/.gitignore
CHANGED
data/.rubocop.yml
CHANGED
data/CHANGELOG.md
CHANGED
@@ -1,15 +1,69 @@
|
|
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
|
+
|
3
58
|
## [v4.1.0](https://github.com/solidusio/solidus_stripe/tree/v4.1.0) (2020-07-01)
|
4
59
|
|
5
|
-
[Full Changelog](https://github.com/solidusio/solidus_stripe/compare/
|
60
|
+
[Full Changelog](https://github.com/solidusio/solidus_stripe/compare/v3.2.1...v4.1.0)
|
6
61
|
|
7
62
|
**Fixed bugs:**
|
8
63
|
|
9
64
|
- Card name ignored when adding new card to an order during checkout [\#68](https://github.com/solidusio/solidus_stripe/issues/68)
|
10
65
|
- Try to find address state also by name [\#65](https://github.com/solidusio/solidus_stripe/pull/65) ([spaghetticode](https://github.com/spaghetticode))
|
11
66
|
- Fix order cancel with Payment Intents captured payment [\#57](https://github.com/solidusio/solidus_stripe/pull/57) ([spaghetticode](https://github.com/spaghetticode))
|
12
|
-
- \[ADMIN\] Order cancel doen't work with Payment Intents captured payments [\#56](https://github.com/solidusio/solidus_stripe/issues/56)
|
13
67
|
|
14
68
|
**Merged pull requests:**
|
15
69
|
|
@@ -20,6 +74,14 @@
|
|
20
74
|
- Update gemspec URLs [\#54](https://github.com/solidusio/solidus_stripe/pull/54) ([elia](https://github.com/elia))
|
21
75
|
- fix typo [\#51](https://github.com/solidusio/solidus_stripe/pull/51) ([ccarruitero](https://github.com/ccarruitero))
|
22
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
|
+
|
23
85
|
**Closed issues:**
|
24
86
|
|
25
87
|
- Could not find generator 'solidus\_stripe:install' [\#60](https://github.com/solidusio/solidus_stripe/issues/60)
|
@@ -29,41 +91,56 @@
|
|
29
91
|
|
30
92
|
## [v4.0.0](https://github.com/solidusio/solidus_stripe/tree/v4.0.0) (2020-04-29)
|
31
93
|
|
32
|
-
[Full Changelog](https://github.com/solidusio/solidus_stripe/compare/v3.
|
94
|
+
[Full Changelog](https://github.com/solidusio/solidus_stripe/compare/v3.2.0...v4.0.0)
|
33
95
|
|
34
96
|
**Fixed bugs:**
|
35
97
|
|
36
|
-
- Duplicates charges with Payment Intents [\#44](https://github.com/solidusio/solidus_stripe/issues/44)
|
37
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
|
+
|
38
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)
|
39
128
|
- Create a single charge when using Stripe Payment Intents [\#45](https://github.com/solidusio/solidus_stripe/pull/45) ([spaghetticode](https://github.com/spaghetticode))
|
40
129
|
|
41
130
|
**Closed issues:**
|
42
131
|
|
43
|
-
- Custom stripe element field options \(e.g for showing a credit card icon\) [\#41](https://github.com/solidusio/solidus_stripe/issues/41)
|
44
132
|
- Stripe Elements submit button stuck in disabled state. [\#39](https://github.com/solidusio/solidus_stripe/issues/39)
|
45
133
|
- Visa credit card type is blank [\#36](https://github.com/solidusio/solidus_stripe/issues/36)
|
46
134
|
- Pay with Apple Pay from cart page [\#23](https://github.com/solidusio/solidus_stripe/issues/23)
|
47
|
-
- Clearer documentation on how to implement [\#15](https://github.com/solidusio/solidus_stripe/issues/15)
|
48
135
|
|
49
136
|
**Merged pull requests:**
|
50
137
|
|
51
|
-
- Relax solidus\_support dependency [\#48](https://github.com/solidusio/solidus_stripe/pull/48) ([kennyadsl](https://github.com/kennyadsl))
|
52
|
-
- Replace deprecated route `/stripe/confirm\_payment` [\#46](https://github.com/solidusio/solidus_stripe/pull/46) ([spaghetticode](https://github.com/spaghetticode))
|
53
138
|
- Custom Stripe Elements field options [\#42](https://github.com/solidusio/solidus_stripe/pull/42) ([stuffmatic](https://github.com/stuffmatic))
|
54
139
|
- Improve the way Stripe Elements validation errors are displayed [\#40](https://github.com/solidusio/solidus_stripe/pull/40) ([stuffmatic](https://github.com/stuffmatic))
|
55
140
|
- Fix stripe-to-solidus card type mapping [\#38](https://github.com/solidusio/solidus_stripe/pull/38) ([stuffmatic](https://github.com/stuffmatic))
|
56
141
|
- Add hook to provide custom Stripe Elements options [\#37](https://github.com/solidusio/solidus_stripe/pull/37) ([stuffmatic](https://github.com/stuffmatic))
|
57
142
|
- Change order description that we pass to Stripe [\#35](https://github.com/solidusio/solidus_stripe/pull/35) ([kennyadsl](https://github.com/kennyadsl))
|
58
143
|
|
59
|
-
## [v3.2.1](https://github.com/solidusio/solidus_stripe/tree/v3.2.1) (2020-06-29)
|
60
|
-
|
61
|
-
[Full Changelog](https://github.com/solidusio/solidus_stripe/compare/v3.2.0...v3.2.1)
|
62
|
-
|
63
|
-
**Merged pull requests:**
|
64
|
-
|
65
|
-
- Relax solidus\_support version dependency [\#70](https://github.com/solidusio/solidus_stripe/pull/70) ([spaghetticode](https://github.com/spaghetticode))
|
66
|
-
|
67
144
|
## [v3.0.0](https://github.com/solidusio/solidus_stripe/tree/v3.0.0) (2020-03-11)
|
68
145
|
|
69
146
|
[Full Changelog](https://github.com/solidusio/solidus_stripe/compare/v2.1.0...v3.0.0)
|
@@ -111,7 +188,7 @@
|
|
111
188
|
**Merged pull requests:**
|
112
189
|
|
113
190
|
- Remove ERB from Elements and Intents JS code [\#28](https://github.com/solidusio/solidus_stripe/pull/28) ([spaghetticode](https://github.com/spaghetticode))
|
114
|
-
- Remove `
|
191
|
+
- Remove `update_attributes!` deprecation [\#24](https://github.com/solidusio/solidus_stripe/pull/24) ([spaghetticode](https://github.com/spaghetticode))
|
115
192
|
- Add solidus\_dev\_support gem [\#21](https://github.com/solidusio/solidus_stripe/pull/21) ([spaghetticode](https://github.com/spaghetticode))
|
116
193
|
- Fix reusing cards with Stripe v3 [\#17](https://github.com/solidusio/solidus_stripe/pull/17) ([kennyadsl](https://github.com/kennyadsl))
|
117
194
|
- Extension maintenance [\#14](https://github.com/solidusio/solidus_stripe/pull/14) ([kennyadsl](https://github.com/kennyadsl))
|
data/Gemfile
CHANGED
@@ -1,10 +1,10 @@
|
|
1
1
|
# frozen_string_literal: true
|
2
2
|
|
3
|
-
source
|
3
|
+
source 'https://rubygems.org'
|
4
4
|
git_source(:github) { |repo| "https://github.com/#{repo}.git" }
|
5
5
|
|
6
6
|
branch = ENV.fetch('SOLIDUS_BRANCH', 'master')
|
7
|
-
gem
|
7
|
+
gem 'solidus', github: 'solidusio/solidus', branch: branch
|
8
8
|
|
9
9
|
# Needed to help Bundler figure out how to resolve dependencies,
|
10
10
|
# otherwise it takes forever to resolve them.
|
@@ -12,7 +12,7 @@ gem "solidus", github: "solidusio/solidus", branch: branch
|
|
12
12
|
gem 'rails', '>0.a'
|
13
13
|
|
14
14
|
# Provides basic authentication functionality for testing parts of your engine
|
15
|
-
gem
|
15
|
+
gem 'solidus_auth_devise'
|
16
16
|
|
17
17
|
case ENV['DB']
|
18
18
|
when 'mysql'
|
@@ -23,12 +23,6 @@ else
|
|
23
23
|
gem 'sqlite3'
|
24
24
|
end
|
25
25
|
|
26
|
-
group :development, :test do
|
27
|
-
gem "pry-rails"
|
28
|
-
gem "ffaker"
|
29
|
-
gem "rails-controller-testing"
|
30
|
-
end
|
31
|
-
|
32
26
|
gemspec
|
33
27
|
|
34
28
|
# Use a local Gemfile to include development dependencies that might not be
|
data/LICENSE
CHANGED
@@ -1,4 +1,5 @@
|
|
1
1
|
Copyright (c) 2014 Spree Commerce Inc. and other contributors.
|
2
|
+
Copyright (c) 2021 Solidus Team and other contributors.
|
2
3
|
All rights reserved.
|
3
4
|
|
4
5
|
Redistribution and use in source and binary forms, with or without modification,
|
@@ -9,7 +10,7 @@ are permitted provided that the following conditions are met:
|
|
9
10
|
* Redistributions in binary form must reproduce the above copyright notice,
|
10
11
|
this list of conditions and the following disclaimer in the documentation
|
11
12
|
and/or other materials provided with the distribution.
|
12
|
-
* Neither the name
|
13
|
+
* Neither the name Solidus nor the names of its contributors may be used to
|
13
14
|
endorse or promote products derived from this software without specific
|
14
15
|
prior written permission.
|
15
16
|
|
data/README.md
CHANGED
@@ -1,7 +1,7 @@
|
|
1
|
-
Solidus Stripe
|
2
|
-
===============
|
1
|
+
# Solidus Stripe
|
3
2
|
|
4
|
-
[![CircleCI](https://circleci.com/gh/solidusio/solidus_stripe.svg?style=
|
3
|
+
[![CircleCI](https://circleci.com/gh/solidusio/solidus_stripe.svg?style=shield)](https://circleci.com/gh/solidusio/solidus_stripe)
|
4
|
+
[![codecov](https://codecov.io/gh/solidusio/solidus_stripe/branch/master/graph/badge.svg)](https://codecov.io/gh/solidusio/solidus_stripe)
|
5
5
|
|
6
6
|
Stripe Payment Method for Solidus. It works as a wrapper for the ActiveMerchant Stripe gateway.
|
7
7
|
|
@@ -10,18 +10,11 @@ Stripe Payment Method for Solidus. It works as a wrapper for the ActiveMerchant
|
|
10
10
|
Installation
|
11
11
|
------------
|
12
12
|
|
13
|
-
|
14
|
-
|
15
|
-
```ruby
|
16
|
-
gem 'solidus_stripe', '~> 3.0'
|
17
|
-
```
|
18
|
-
|
19
|
-
Then run from the command line:
|
13
|
+
Run from the command line:
|
20
14
|
|
21
15
|
```shell
|
22
|
-
bundle
|
16
|
+
bundle add solidus_stripe
|
23
17
|
bundle exec rails g solidus_stripe:install
|
24
|
-
bundle exec rails db:migrate
|
25
18
|
```
|
26
19
|
|
27
20
|
Usage
|
@@ -56,9 +49,7 @@ Spree.config do |config|
|
|
56
49
|
publishable_key: ENV['STRIPE_PUBLISHABLE_KEY'],
|
57
50
|
stripe_country: 'US',
|
58
51
|
v3_elements: false,
|
59
|
-
v3_intents: false
|
60
|
-
server: Rails.env.production? ? 'production' : 'test',
|
61
|
-
test_mode: !Rails.env.production?
|
52
|
+
v3_intents: false
|
62
53
|
)
|
63
54
|
end
|
64
55
|
```
|
@@ -82,7 +73,7 @@ account. Conversely, if you need to disable the button you can simply remove
|
|
82
73
|
the `stripe_country` preference.
|
83
74
|
|
84
75
|
Please refer to Stripe official
|
85
|
-
[documentation](https://stripe.com/docs/
|
76
|
+
[documentation](https://stripe.com/docs/payments/payment-intents)
|
86
77
|
for further instructions on how to make this work properly.
|
87
78
|
|
88
79
|
The following configuration will use both Payment Intents and the
|
@@ -100,9 +91,7 @@ Spree.config do |config|
|
|
100
91
|
publishable_key: ENV['STRIPE_PUBLISHABLE_KEY'],
|
101
92
|
stripe_country: 'US',
|
102
93
|
v3_elements: false,
|
103
|
-
v3_intents: true
|
104
|
-
server: Rails.env.production? ? 'production' : 'test',
|
105
|
-
test_mode: !Rails.env.production?
|
94
|
+
v3_intents: true
|
106
95
|
)
|
107
96
|
end
|
108
97
|
```
|
@@ -263,52 +252,68 @@ SolidusStripe.Payment.prototype.elementsBaseOptions = function () {
|
|
263
252
|
};
|
264
253
|
```
|
265
254
|
|
266
|
-
|
267
|
-
Migrating from solidus_gateway
|
268
|
-
------------------------------
|
255
|
+
## Migrating from solidus_gateway
|
269
256
|
|
270
257
|
If you were previously using `solidus_gateway` gem you might want to
|
271
258
|
check out our [Wiki page](https://github.com/solidusio/solidus_stripe/wiki/Migrating-from-solidus_gateway)
|
272
259
|
that describes how to handle this migration.
|
273
260
|
|
274
|
-
|
275
|
-
-------
|
261
|
+
## Development
|
276
262
|
|
277
|
-
|
278
|
-
|
263
|
+
### Testing the extension
|
264
|
+
|
265
|
+
First bundle your dependencies, then run `bin/rake`. `bin/rake` will default to building the dummy
|
266
|
+
app if it does not exist, then it will run specs. The dummy app can be regenerated by using
|
267
|
+
`bin/rake extension:test_app`.
|
279
268
|
|
280
269
|
```shell
|
281
|
-
|
270
|
+
bin/rake
|
282
271
|
```
|
283
272
|
|
284
|
-
|
285
|
-
---------
|
273
|
+
To run [Rubocop](https://github.com/bbatsov/rubocop) static code analysis run
|
286
274
|
|
287
|
-
|
288
|
-
|
275
|
+
```shell
|
276
|
+
bundle exec rubocop
|
277
|
+
```
|
289
278
|
|
290
|
-
|
291
|
-
|
292
|
-
can simply run:
|
279
|
+
When testing your application's integration with this extension you may use its factories.
|
280
|
+
Simply add this require statement to your spec_helper:
|
293
281
|
|
294
|
-
```
|
295
|
-
|
282
|
+
```ruby
|
283
|
+
require '<%= file_name %>/factories'
|
296
284
|
```
|
297
285
|
|
298
|
-
|
286
|
+
### Running the sandbox
|
299
287
|
|
300
|
-
|
301
|
-
|
302
|
-
|
303
|
-
- push the tag to the upstream remote
|
304
|
-
- release the new version on RubyGems
|
288
|
+
To run this extension in a sandboxed Solidus application, you can run `bin/sandbox`. The path for
|
289
|
+
the sandbox app is `./sandbox` and `bin/rails` will forward any Rails commands to
|
290
|
+
`sandbox/bin/rails`.
|
305
291
|
|
306
|
-
|
292
|
+
Here's an example:
|
307
293
|
|
308
294
|
```
|
309
|
-
|
310
|
-
|
311
|
-
|
295
|
+
$ bin/rails server
|
296
|
+
=> Booting Puma
|
297
|
+
=> Rails 6.0.2.1 application starting in development
|
298
|
+
* Listening on tcp://127.0.0.1:3000
|
299
|
+
Use Ctrl-C to stop
|
300
|
+
```
|
301
|
+
|
302
|
+
### Updating the changelog
|
303
|
+
|
304
|
+
Before and after releases the changelog should be updated to reflect the up-to-date status of
|
305
|
+
the project:
|
306
|
+
|
307
|
+
```shell
|
308
|
+
bin/rake changelog
|
309
|
+
git add CHANGELOG.md
|
310
|
+
git commit -m "Update the changelog"
|
312
311
|
```
|
313
312
|
|
314
|
-
|
313
|
+
### Releasing new versions
|
314
|
+
|
315
|
+
Please refer to the dedicated [page](https://github.com/solidusio/solidus/wiki/How-to-release-extensions) on Solidus wiki.
|
316
|
+
|
317
|
+
## License
|
318
|
+
Copyright (c) 2014 Spree Commerce Inc., released under the New BSD License
|
319
|
+
Copyright (c) 2021 Solidus Team, released under the New BSD License
|
@@ -53,6 +53,7 @@ SolidusStripe.CartPageCheckout.prototype.onPrPayment = function(payment) {
|
|
53
53
|
shipping_option: payment.shippingOption,
|
54
54
|
email: payment.payerEmail,
|
55
55
|
name: payment.payerName,
|
56
|
+
phone: payment.payerPhone,
|
56
57
|
authenticity_token: this.authToken
|
57
58
|
})
|
58
59
|
}).then(function(response) {
|
data/app/assets/javascripts/spree/frontend/solidus_stripe/stripe-payment-request-button-shared.js
CHANGED
@@ -22,6 +22,7 @@
|
|
22
22
|
},
|
23
23
|
requestPayerName: true,
|
24
24
|
requestPayerEmail: true,
|
25
|
+
requestPayerPhone: true,
|
25
26
|
requestShipping: config.requestShipping,
|
26
27
|
shippingOptions: []
|
27
28
|
});
|
@@ -50,7 +51,7 @@
|
|
50
51
|
};
|
51
52
|
paymentRequest.on('paymentmethod', onPrPaymentMethod.bind(this));
|
52
53
|
|
53
|
-
onShippingAddressChange = function(ev) {
|
54
|
+
var onShippingAddressChange = function(ev) {
|
54
55
|
var showError = this.showError.bind(this);
|
55
56
|
|
56
57
|
fetch('/stripe/shipping_rates', {
|
@@ -22,7 +22,7 @@ module SolidusStripe
|
|
22
22
|
current_order.restart_checkout_flow
|
23
23
|
|
24
24
|
address = SolidusStripe::AddressFromParamsService.new(
|
25
|
-
|
25
|
+
shipping_address_from_params,
|
26
26
|
spree_current_user
|
27
27
|
).call
|
28
28
|
|
@@ -38,5 +38,15 @@ module SolidusStripe
|
|
38
38
|
render json: { success: false, error: address.errors.full_messages.to_sentence }, status: 500
|
39
39
|
end
|
40
40
|
end
|
41
|
+
|
42
|
+
private
|
43
|
+
|
44
|
+
def shipping_address_from_params
|
45
|
+
return {} unless params[:shipping_address]
|
46
|
+
return params[:shipping_address] if params.dig(:shipping_address, :phone).present?
|
47
|
+
|
48
|
+
params[:shipping_address][:phone] = params[:phone]
|
49
|
+
params[:shipping_address]
|
50
|
+
end
|
41
51
|
end
|
42
52
|
end
|
@@ -26,14 +26,26 @@ module SolidusStripe
|
|
26
26
|
lines = address_params[:addressLine]
|
27
27
|
names = address_params[:recipient].split(' ')
|
28
28
|
|
29
|
-
|
30
|
-
|
31
|
-
|
32
|
-
|
33
|
-
|
34
|
-
|
35
|
-
|
36
|
-
|
29
|
+
name_attributes = if SolidusSupport.combined_first_and_last_name_in_address? && Spree::Address.column_names.include?("name")
|
30
|
+
{
|
31
|
+
name: address_params[:recipient]
|
32
|
+
}
|
33
|
+
else
|
34
|
+
{
|
35
|
+
firstname: names.first,
|
36
|
+
lastname: names.last,
|
37
|
+
}
|
38
|
+
end
|
39
|
+
|
40
|
+
attributes
|
41
|
+
.merge!(name_attributes)
|
42
|
+
.merge!(
|
43
|
+
state_id: state&.id,
|
44
|
+
phone: phone,
|
45
|
+
address1: lines.first,
|
46
|
+
address2: lines.second
|
47
|
+
)
|
48
|
+
.reject! { |_, value| value.blank? }
|
37
49
|
end
|
38
50
|
end
|
39
51
|
end
|
@@ -102,7 +102,8 @@ module SolidusStripe
|
|
102
102
|
end
|
103
103
|
|
104
104
|
def address_full_name
|
105
|
-
current_order.bill_address&.
|
105
|
+
bill_address_name = SolidusSupport.combined_first_and_last_name_in_address? ? current_order.bill_address&.name : current_order.bill_address&.full_name
|
106
|
+
bill_address_name || form_data[:recipient]
|
106
107
|
end
|
107
108
|
|
108
109
|
def update_stripe_payment_description
|
@@ -87,10 +87,13 @@ module Spree
|
|
87
87
|
|
88
88
|
def try_void(payment)
|
89
89
|
if v3_intents? && payment.completed?
|
90
|
-
payment
|
91
|
-
|
92
|
-
|
93
|
-
|
90
|
+
refund = perform_refund(payment)
|
91
|
+
|
92
|
+
if refund.respond_to?(:perform_response)
|
93
|
+
refund.perform_response
|
94
|
+
else
|
95
|
+
refund.response
|
96
|
+
end
|
94
97
|
else
|
95
98
|
void(payment.response_code, nil, nil)
|
96
99
|
end
|
@@ -152,6 +155,7 @@ module Spree
|
|
152
155
|
options[:description] = "Solidus Order ID: #{transaction_options[:order_id]}"
|
153
156
|
options[:currency] = transaction_options[:currency]
|
154
157
|
options[:off_session] = true if v3_intents?
|
158
|
+
options[:statement_descriptor_suffix] = transaction_options[:statement_descriptor_suffix] if transaction_options[:statement_descriptor_suffix]
|
155
159
|
|
156
160
|
if customer = creditcard.gateway_customer_profile_id
|
157
161
|
options[:customer] = customer
|
@@ -190,6 +194,24 @@ module Spree
|
|
190
194
|
source.cc_type = CARD_TYPE_MAPPING[source.cc_type] if CARD_TYPE_MAPPING.include?(source.cc_type)
|
191
195
|
source
|
192
196
|
end
|
197
|
+
|
198
|
+
def perform_refund(payment)
|
199
|
+
refund = payment.refunds.build(
|
200
|
+
amount: payment.credit_allowed,
|
201
|
+
reason: payment_intents_refund_reason
|
202
|
+
)
|
203
|
+
|
204
|
+
if refund.respond_to?(:perform_after_create)
|
205
|
+
refund.perform_after_create = false
|
206
|
+
refund.save!
|
207
|
+
refund.perform!
|
208
|
+
else
|
209
|
+
refund.save!
|
210
|
+
refund.perform! if Gem::Requirement.new('>= 3.0.0.alpha').satisfied_by?(Spree.solidus_gem_version)
|
211
|
+
end
|
212
|
+
|
213
|
+
refund
|
214
|
+
end
|
193
215
|
end
|
194
216
|
end
|
195
217
|
end
|
data/bin/rails
CHANGED
@@ -1,15 +1,7 @@
|
|
1
1
|
#!/usr/bin/env ruby
|
2
2
|
|
3
|
-
|
4
|
-
|
5
|
-
|
6
|
-
|
7
|
-
unless File.exist? "#{app_root}/bin/rails"
|
8
|
-
system "bin/rake", app_root or begin # rubocop:disable Style/AndOr
|
9
|
-
warn "Automatic creation of the dummy app failed"
|
10
|
-
exit 1
|
11
|
-
end
|
3
|
+
if %w[g generate].include? ARGV.first
|
4
|
+
exec "#{__dir__}/rails-engine", *ARGV
|
5
|
+
else
|
6
|
+
exec "#{__dir__}/rails-sandbox", *ARGV
|
12
7
|
end
|
13
|
-
|
14
|
-
Dir.chdir app_root
|
15
|
-
exec 'bin/rails', *ARGV
|