spree_store_pickup 1.0.1 → 1.1.4
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 +4 -4
- data/LICENSE.md +11 -17
- data/README.md +49 -15
- data/app/assets/config/spree_store_pickup_manifest.js +5 -0
- data/app/javascript/spree_store_pickup/application.js +16 -0
- data/app/javascript/spree_store_pickup/controllers/spree_store_pickup_controller.js +7 -0
- data/app/models/spree/payment_method/store_pickup.rb +4 -0
- data/app/models/spree/payment_method_decorator.rb +2 -2
- data/app/views/spree/admin/shipping_methods/_store_pickup_form.html.erb +1 -5
- data/app/views/spree_store_pickup/_head.html.erb +1 -0
- data/config/importmap.rb +6 -0
- data/config/initializers/spree.rb +2 -2
- data/lib/spree_store_pickup/configuration.rb +13 -0
- data/lib/spree_store_pickup/engine.rb +17 -0
- data/lib/spree_store_pickup/version.rb +1 -1
- data/lib/spree_store_pickup.rb +1 -0
- metadata +16 -10
checksums.yaml
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
---
|
|
2
2
|
SHA256:
|
|
3
|
-
metadata.gz:
|
|
4
|
-
data.tar.gz:
|
|
3
|
+
metadata.gz: d02ed985c2068cff724a0e6f46d67839695b2b61d34200955475959e5a27719f
|
|
4
|
+
data.tar.gz: 6710d56720b1beab6a6876549ee05f89d24ad9969cfa5c3e7ab1e25cf378d31f
|
|
5
5
|
SHA512:
|
|
6
|
-
metadata.gz:
|
|
7
|
-
data.tar.gz:
|
|
6
|
+
metadata.gz: 85d9824885ed2706e53b8dd0916a51070609b808597de131a1d649a2d02ab708ad99cecefd47d9dad8e28d8ce060db0626e808e6da22dfa2ec7c43aa6f32ed41
|
|
7
|
+
data.tar.gz: 44c0ff744bcdc62683045652a3d020422ec80b2db76bfbb6e6f970d4c06a1ecb14e2bc77d82a772c225c225b1e2ea6bbb46cb729dfa40f220e0ad5fcec4715ef
|
data/LICENSE.md
CHANGED
|
@@ -1,21 +1,15 @@
|
|
|
1
|
-
#
|
|
1
|
+
# LICENSE
|
|
2
2
|
|
|
3
|
-
Copyright (c) 2025 OlympusOne
|
|
3
|
+
Copyright (c) 2025 OlympusOne. All rights reserved.
|
|
4
4
|
|
|
5
|
-
|
|
6
|
-
|
|
7
|
-
|
|
8
|
-
to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
|
|
9
|
-
copies of the Software, and to permit persons to whom the Software is
|
|
10
|
-
furnished to do so, subject to the following conditions:
|
|
5
|
+
This program is free software: you can redistribute it and/or modify it under the terms of the
|
|
6
|
+
GNU Affero General Public License as published by the Free Software Foundation, either
|
|
7
|
+
version 3 of the License, or any later version.
|
|
11
8
|
|
|
12
|
-
|
|
13
|
-
|
|
9
|
+
This program is distributed in the hope that it will be useful,
|
|
10
|
+
but WITHOUT ANY WARRANTY; without even the implied warranty of
|
|
11
|
+
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
|
12
|
+
GNU Affero General Public License for more details.
|
|
14
13
|
|
|
15
|
-
|
|
16
|
-
|
|
17
|
-
FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
|
|
18
|
-
AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
|
|
19
|
-
LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
|
|
20
|
-
OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
|
|
21
|
-
SOFTWARE.
|
|
14
|
+
You should have received a copy of the GNU Affero General Public License
|
|
15
|
+
along with this program. If not, see [https://www.gnu.org/licenses/](https://www.gnu.org/licenses/).
|
data/README.md
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
|
-
#
|
|
1
|
+
# Spree Store Pickup
|
|
2
2
|
|
|
3
|
-
This is a Store Pickup extension for [Spree Commerce](https://spreecommerce.org), an open source e-commerce platform built with Ruby on Rails. Adds in-store pickup as selectable shipping and payment
|
|
3
|
+
This is a Store Pickup extension for [Spree Commerce](https://spreecommerce.org), an open source e-commerce platform built with Ruby on Rails. Adds in-store pickup as selectable shipping and payment method during checkout.
|
|
4
4
|
|
|
5
5
|
[](https://badge.fury.io/rb/spree_store_pickup)
|
|
6
6
|
|
|
@@ -8,26 +8,59 @@ This is a Store Pickup extension for [Spree Commerce](https://spreecommerce.org)
|
|
|
8
8
|
|
|
9
9
|
1. Add this extension to your Gemfile with this line:
|
|
10
10
|
|
|
11
|
-
```
|
|
11
|
+
```bash
|
|
12
12
|
bundle add spree_store_pickup
|
|
13
13
|
```
|
|
14
14
|
|
|
15
|
-
2.
|
|
16
|
-
|
|
17
|
-
```sh
|
|
18
|
-
bundle exec rake railties:install:migrations FROM=spree_store_pickup
|
|
19
|
-
```
|
|
20
|
-
|
|
21
|
-
3. Run the migrations:
|
|
15
|
+
2. Run the install generator
|
|
22
16
|
|
|
23
|
-
```
|
|
24
|
-
bundle exec rails
|
|
17
|
+
```bash
|
|
18
|
+
bundle exec rails g spree_store_pickup:install
|
|
25
19
|
```
|
|
26
20
|
|
|
27
|
-
|
|
21
|
+
3. Restart your server
|
|
28
22
|
|
|
29
23
|
If your server was running, restart it so that it can find the assets properly.
|
|
30
24
|
|
|
25
|
+
## Usage
|
|
26
|
+
|
|
27
|
+
1. Create (or enable) a Shipping Method that represents in‑store pickup. The generator creates a shipping method with a `store_pickup` type. Ensure the shipping method you want to use returns `true` for `store_pickup?`.
|
|
28
|
+
2. Create a Payment Method for store pickup (e.g. name: "Pay In Store") whose `method_type` is `store_pickup`.
|
|
29
|
+
3. By default this gem only provides helpers:
|
|
30
|
+
* `payment_method.store_pickup?`
|
|
31
|
+
* `payment_method.store_pickup_available?(order)` (true when the order's selected shipping method is store pickup)
|
|
32
|
+
4. If you want the Store Pickup payment method to be shown ONLY when the shipping method is store pickup, add a decorator in your host app:
|
|
33
|
+
|
|
34
|
+
````ruby
|
|
35
|
+
module Spree
|
|
36
|
+
module PaymentMethodDecorator
|
|
37
|
+
# Customize availability combining store pickup (and optionally COD) logic.
|
|
38
|
+
def available_for_order?(order)
|
|
39
|
+
return false unless super
|
|
40
|
+
|
|
41
|
+
# If shipping method is store pickup, only allow the store pickup payment method.
|
|
42
|
+
if store_pickup_available?(order)
|
|
43
|
+
return store_pickup?
|
|
44
|
+
end
|
|
45
|
+
|
|
46
|
+
# Example integration with a COD payment gem (optional):
|
|
47
|
+
if respond_to?(:cod_payment_available?) && cod_payment_available?(order)
|
|
48
|
+
return cod_payment?
|
|
49
|
+
end
|
|
50
|
+
|
|
51
|
+
# Hide specialized methods when their conditions are not met.
|
|
52
|
+
if store_pickup? || (respond_to?(:cod_payment?) && cod_payment?)
|
|
53
|
+
return false
|
|
54
|
+
end
|
|
55
|
+
|
|
56
|
+
true
|
|
57
|
+
end
|
|
58
|
+
end
|
|
59
|
+
|
|
60
|
+
PaymentMethod.prepend PaymentMethodDecorator
|
|
61
|
+
end
|
|
62
|
+
````
|
|
63
|
+
|
|
31
64
|
## Developing
|
|
32
65
|
|
|
33
66
|
1. Create a dummy app
|
|
@@ -38,6 +71,7 @@ This is a Store Pickup extension for [Spree Commerce](https://spreecommerce.org)
|
|
|
38
71
|
```
|
|
39
72
|
|
|
40
73
|
2. Add your new code
|
|
74
|
+
|
|
41
75
|
3. Run tests
|
|
42
76
|
|
|
43
77
|
```bash
|
|
@@ -53,7 +87,7 @@ require 'spree_store_pickup/factories'
|
|
|
53
87
|
|
|
54
88
|
## Releasing a new version
|
|
55
89
|
|
|
56
|
-
```
|
|
90
|
+
```bash
|
|
57
91
|
bundle exec gem bump -p -t
|
|
58
92
|
bundle exec gem release
|
|
59
93
|
```
|
|
@@ -66,4 +100,4 @@ If you'd like to contribute, please take a look at the
|
|
|
66
100
|
[instructions](CONTRIBUTING.md) for installing dependencies and crafting a good
|
|
67
101
|
pull request.
|
|
68
102
|
|
|
69
|
-
Copyright (c) 2025 OlympusOne, released under the
|
|
103
|
+
Copyright (c) 2025 OlympusOne, released under the AGPL-3.0 or later.
|
|
@@ -0,0 +1,16 @@
|
|
|
1
|
+
import '@hotwired/turbo-rails'
|
|
2
|
+
import { Application } from '@hotwired/stimulus'
|
|
3
|
+
|
|
4
|
+
let application
|
|
5
|
+
|
|
6
|
+
if (typeof window.Stimulus === "undefined") {
|
|
7
|
+
application = Application.start()
|
|
8
|
+
application.debug = false
|
|
9
|
+
window.Stimulus = application
|
|
10
|
+
} else {
|
|
11
|
+
application = window.Stimulus
|
|
12
|
+
}
|
|
13
|
+
|
|
14
|
+
import SpreeStorePickupController from 'spree_store_pickup/controllers/spree_store_pickup_controller'
|
|
15
|
+
|
|
16
|
+
application.register('spree_store_pickup', SpreeStorePickupController)
|
|
@@ -5,10 +5,6 @@
|
|
|
5
5
|
</h5>
|
|
6
6
|
</div>
|
|
7
7
|
<div class="card-body">
|
|
8
|
-
|
|
9
|
-
<%= f.check_box :store_pickup, class: 'custom-control-input' %>
|
|
10
|
-
<%= f.label :store_pickup, class: 'custom-control-label font-weight-semibold' %>
|
|
11
|
-
<%= f.error_message_on :store_pickup %>
|
|
12
|
-
</div>
|
|
8
|
+
<%= f.spree_check_box :store_pickup %>
|
|
13
9
|
</div>
|
|
14
10
|
</div>
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
<%= javascript_import_module_tag 'application-spree-store-pickup' %>
|
data/config/importmap.rb
ADDED
|
@@ -0,0 +1,6 @@
|
|
|
1
|
+
pin 'application-spree-store-pickup', to: 'spree_store_pickup/application.js', preload: false
|
|
2
|
+
|
|
3
|
+
pin_all_from SpreeStorePickup::Engine.root.join('app/javascript/spree_store_pickup/controllers'),
|
|
4
|
+
under: 'spree_store_pickup/controllers',
|
|
5
|
+
to: 'spree_store_pickup/controllers',
|
|
6
|
+
preload: 'application-spree-store-pickup'
|
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
Rails.application.config.after_initialize do
|
|
2
|
-
|
|
2
|
+
Spree.payment_methods << Spree::PaymentMethod::StorePickup
|
|
3
3
|
|
|
4
|
-
|
|
4
|
+
Spree.admin.partials.shipping_method_form << 'spree/admin/shipping_methods/store_pickup_form'
|
|
5
5
|
|
|
6
6
|
Spree::PermittedAttributes.shipping_method_attributes << :store_pickup
|
|
7
7
|
end
|
|
@@ -0,0 +1,13 @@
|
|
|
1
|
+
module SpreeStorePickup
|
|
2
|
+
class Configuration < Spree::Preferences::Configuration
|
|
3
|
+
|
|
4
|
+
# Some example preferences are shown below, for more information visit:
|
|
5
|
+
# https://docs.spreecommerce.org/developer/contributing/creating-an-extension
|
|
6
|
+
|
|
7
|
+
# preference :enabled, :boolean, default: true
|
|
8
|
+
# preference :dark_chocolate, :boolean, default: true
|
|
9
|
+
# preference :color, :string, default: 'Red'
|
|
10
|
+
# preference :favorite_number, :integer
|
|
11
|
+
# preference :supported_locales, :array, default: [:en]
|
|
12
|
+
end
|
|
13
|
+
end
|
|
@@ -9,6 +9,23 @@ module SpreeStorePickup
|
|
|
9
9
|
g.test_framework :rspec
|
|
10
10
|
end
|
|
11
11
|
|
|
12
|
+
initializer 'spree_store_pickup.environment', before: :load_config_initializers do |_app|
|
|
13
|
+
SpreeStorePickup::Config = SpreeStorePickup::Configuration.new
|
|
14
|
+
end
|
|
15
|
+
|
|
16
|
+
initializer 'spree_store_pickup.assets' do |app|
|
|
17
|
+
app.config.assets.paths << root.join('app/javascript')
|
|
18
|
+
app.config.assets.paths << root.join('vendor/javascript')
|
|
19
|
+
app.config.assets.paths << root.join('vendor/stylesheets')
|
|
20
|
+
app.config.assets.precompile += %w[spree_store_pickup_manifest]
|
|
21
|
+
end
|
|
22
|
+
|
|
23
|
+
initializer 'spree_store_pickup.importmap', before: 'importmap' do |app|
|
|
24
|
+
app.config.importmap.paths << root.join('config/importmap.rb')
|
|
25
|
+
# https://github.com/rails/importmap-rails?tab=readme-ov-file#sweeping-the-cache-in-development-and-test
|
|
26
|
+
app.config.importmap.cache_sweepers << root.join('app/javascript')
|
|
27
|
+
end
|
|
28
|
+
|
|
12
29
|
def self.activate
|
|
13
30
|
Dir.glob(File.join(File.dirname(__FILE__), '../../app/**/*_decorator*.rb')) do |c|
|
|
14
31
|
Rails.configuration.cache_classes ? require(c) : load(c)
|
data/lib/spree_store_pickup.rb
CHANGED
metadata
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
|
2
2
|
name: spree_store_pickup
|
|
3
3
|
version: !ruby/object:Gem::Version
|
|
4
|
-
version: 1.
|
|
4
|
+
version: 1.1.4
|
|
5
5
|
platform: ruby
|
|
6
6
|
authors:
|
|
7
7
|
- OlympusOne
|
|
@@ -15,42 +15,42 @@ dependencies:
|
|
|
15
15
|
requirements:
|
|
16
16
|
- - ">="
|
|
17
17
|
- !ruby/object:Gem::Version
|
|
18
|
-
version: 5.0
|
|
18
|
+
version: 5.2.0
|
|
19
19
|
type: :runtime
|
|
20
20
|
prerelease: false
|
|
21
21
|
version_requirements: !ruby/object:Gem::Requirement
|
|
22
22
|
requirements:
|
|
23
23
|
- - ">="
|
|
24
24
|
- !ruby/object:Gem::Version
|
|
25
|
-
version: 5.0
|
|
25
|
+
version: 5.2.0
|
|
26
26
|
- !ruby/object:Gem::Dependency
|
|
27
27
|
name: spree_storefront
|
|
28
28
|
requirement: !ruby/object:Gem::Requirement
|
|
29
29
|
requirements:
|
|
30
30
|
- - ">="
|
|
31
31
|
- !ruby/object:Gem::Version
|
|
32
|
-
version: 5.0
|
|
32
|
+
version: 5.2.0
|
|
33
33
|
type: :runtime
|
|
34
34
|
prerelease: false
|
|
35
35
|
version_requirements: !ruby/object:Gem::Requirement
|
|
36
36
|
requirements:
|
|
37
37
|
- - ">="
|
|
38
38
|
- !ruby/object:Gem::Version
|
|
39
|
-
version: 5.0
|
|
39
|
+
version: 5.2.0
|
|
40
40
|
- !ruby/object:Gem::Dependency
|
|
41
41
|
name: spree_admin
|
|
42
42
|
requirement: !ruby/object:Gem::Requirement
|
|
43
43
|
requirements:
|
|
44
44
|
- - ">="
|
|
45
45
|
- !ruby/object:Gem::Version
|
|
46
|
-
version: 5.0
|
|
46
|
+
version: 5.2.0
|
|
47
47
|
type: :runtime
|
|
48
48
|
prerelease: false
|
|
49
49
|
version_requirements: !ruby/object:Gem::Requirement
|
|
50
50
|
requirements:
|
|
51
51
|
- - ">="
|
|
52
52
|
- !ruby/object:Gem::Version
|
|
53
|
-
version: 5.0
|
|
53
|
+
version: 5.2.0
|
|
54
54
|
- !ruby/object:Gem::Dependency
|
|
55
55
|
name: spree_extension
|
|
56
56
|
requirement: !ruby/object:Gem::Requirement
|
|
@@ -89,6 +89,9 @@ files:
|
|
|
89
89
|
- LICENSE.md
|
|
90
90
|
- README.md
|
|
91
91
|
- Rakefile
|
|
92
|
+
- app/assets/config/spree_store_pickup_manifest.js
|
|
93
|
+
- app/javascript/spree_store_pickup/application.js
|
|
94
|
+
- app/javascript/spree_store_pickup/controllers/spree_store_pickup_controller.js
|
|
92
95
|
- app/models/spree/payment_method/store_pickup.rb
|
|
93
96
|
- app/models/spree/payment_method_decorator.rb
|
|
94
97
|
- app/views/spree/admin/payment_methods/_store_pickup.html.erb
|
|
@@ -97,6 +100,8 @@ files:
|
|
|
97
100
|
- app/views/spree/admin/shipping_methods/_store_pickup_form.html.erb
|
|
98
101
|
- app/views/spree/admin/spree/checkout/payment/_store_pickup.html.erb
|
|
99
102
|
- app/views/spree/checkout/payment/_store_pickup.html.erb
|
|
103
|
+
- app/views/spree_store_pickup/_head.html.erb
|
|
104
|
+
- config/importmap.rb
|
|
100
105
|
- config/initializers/spree.rb
|
|
101
106
|
- config/locales/el.yml
|
|
102
107
|
- config/locales/en.yml
|
|
@@ -104,18 +109,19 @@ files:
|
|
|
104
109
|
- db/migrate/20250601165042_add_store_pickup_to_shipping_methods.rb
|
|
105
110
|
- lib/generators/spree_store_pickup/install/install_generator.rb
|
|
106
111
|
- lib/spree_store_pickup.rb
|
|
112
|
+
- lib/spree_store_pickup/configuration.rb
|
|
107
113
|
- lib/spree_store_pickup/engine.rb
|
|
108
114
|
- lib/spree_store_pickup/factories.rb
|
|
109
115
|
- lib/spree_store_pickup/version.rb
|
|
110
116
|
homepage: https://github.com/olympusone/spree_store_pickup
|
|
111
117
|
licenses:
|
|
112
|
-
-
|
|
118
|
+
- AGPL-3.0-or-later
|
|
113
119
|
metadata:
|
|
114
120
|
bug_tracker_uri: https://github.com/olympusone/spree_store_pickup/issues
|
|
115
|
-
changelog_uri: https://github.com/olympusone/spree_store_pickup/releases/tag/v1.
|
|
121
|
+
changelog_uri: https://github.com/olympusone/spree_store_pickup/releases/tag/v1.1.4
|
|
116
122
|
documentation_uri: https://github.com/olympusone/spree_store_pickup
|
|
117
123
|
homepage_uri: https://github.com/olympusone/spree_store_pickup
|
|
118
|
-
source_code_uri: https://github.com/olympusone/spree_store_pickup/tree/v1.
|
|
124
|
+
source_code_uri: https://github.com/olympusone/spree_store_pickup/tree/v1.1.4
|
|
119
125
|
rdoc_options: []
|
|
120
126
|
require_paths:
|
|
121
127
|
- lib
|