spree_store_pickup 1.1.3 → 1.1.5
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/README.md +51 -29
- 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_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 -3
- data/lib/spree_store_pickup/engine.rb +13 -0
- data/lib/spree_store_pickup/version.rb +1 -1
- metadata +15 -11
- data/LICENSE.md +0 -15
checksums.yaml
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
---
|
|
2
2
|
SHA256:
|
|
3
|
-
metadata.gz:
|
|
4
|
-
data.tar.gz:
|
|
3
|
+
metadata.gz: e40d419a0b23912c84cd1c8ff11d46ae8bf5ddf566c25f250629076a3e83f779
|
|
4
|
+
data.tar.gz: eaa9863c7a6ad98622b09d663cd2252e22e7e349cc73f28da0dd5f5325465c23
|
|
5
5
|
SHA512:
|
|
6
|
-
metadata.gz:
|
|
7
|
-
data.tar.gz:
|
|
6
|
+
metadata.gz: 6499218bb5a4c85565ae7d068497ad5e7cacb533a6725a1819b8d9689349b5a38f393fae3dcc54ada5e746f29211b305e8f8517b7f9efcfb261b963e93930910
|
|
7
|
+
data.tar.gz: df3dce901b9da21c1b06500003c4b8789e79939999b50ba21d064ef838b6131969c30a51abc935490b338a6f429fab1b18841f5242bed6a49586e54d8c844fa4
|
data/README.md
CHANGED
|
@@ -1,68 +1,90 @@
|
|
|
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
|
|
|
7
7
|
## Installation
|
|
8
8
|
|
|
9
|
-
1. Add this extension to your Gemfile:
|
|
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.
|
|
15
|
+
2. Run the install generator
|
|
16
16
|
|
|
17
17
|
```bash
|
|
18
|
-
bundle exec
|
|
18
|
+
bundle exec rails g spree_store_pickup:install
|
|
19
19
|
```
|
|
20
20
|
|
|
21
|
-
3.
|
|
21
|
+
3. Restart your server
|
|
22
22
|
|
|
23
|
-
|
|
24
|
-
|
|
25
|
-
|
|
23
|
+
If your server was running, restart it so that it can find the assets properly.
|
|
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
|
|
26
59
|
|
|
27
|
-
|
|
60
|
+
PaymentMethod.prepend PaymentMethodDecorator
|
|
61
|
+
end
|
|
62
|
+
````
|
|
28
63
|
|
|
29
64
|
## Developing
|
|
30
65
|
|
|
31
|
-
1. Create a dummy app
|
|
66
|
+
1. Create a dummy app
|
|
32
67
|
|
|
33
68
|
```bash
|
|
34
69
|
bundle update
|
|
35
70
|
bundle exec rake test_app
|
|
36
71
|
```
|
|
37
72
|
|
|
38
|
-
2. Add code
|
|
73
|
+
2. Add your new code
|
|
39
74
|
|
|
40
|
-
3. Run tests
|
|
75
|
+
3. Run tests
|
|
41
76
|
|
|
42
77
|
```bash
|
|
43
78
|
bundle exec rspec
|
|
44
79
|
```
|
|
45
80
|
|
|
46
|
-
When testing your
|
|
81
|
+
When testing your applications integration with this extension you may use it's factories.
|
|
82
|
+
Simply add this require statement to your spec_helper:
|
|
47
83
|
|
|
48
84
|
```ruby
|
|
49
85
|
require 'spree_store_pickup/factories'
|
|
50
86
|
```
|
|
51
87
|
|
|
52
|
-
## Testing
|
|
53
|
-
|
|
54
|
-
Generate the test app:
|
|
55
|
-
|
|
56
|
-
```bash
|
|
57
|
-
bundle exec rake test_app
|
|
58
|
-
```
|
|
59
|
-
|
|
60
|
-
Then run:
|
|
61
|
-
|
|
62
|
-
```bash
|
|
63
|
-
bundle exec rspec
|
|
64
|
-
```
|
|
65
|
-
|
|
66
88
|
## Releasing a new version
|
|
67
89
|
|
|
68
90
|
```bash
|
|
@@ -78,4 +100,4 @@ If you'd like to contribute, please take a look at the
|
|
|
78
100
|
[instructions](CONTRIBUTING.md) for installing dependencies and crafting a good
|
|
79
101
|
pull request.
|
|
80
102
|
|
|
81
|
-
Copyright (c)
|
|
103
|
+
Copyright (c) 2026 OlympusOne, released under the MIT License.
|
|
@@ -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,8 +1,7 @@
|
|
|
1
1
|
Rails.application.config.after_initialize do
|
|
2
|
-
|
|
2
|
+
Spree.payment_methods << Spree::PaymentMethod::StorePickup
|
|
3
3
|
|
|
4
|
-
|
|
5
|
-
Rails.application.config.spree_admin.shipping_method_form_partials << 'spree/admin/shipping_methods/store_pickup_form'
|
|
4
|
+
Spree.admin.partials.shipping_method_form << 'spree/admin/shipping_methods/store_pickup_form'
|
|
6
5
|
|
|
7
6
|
Spree::PermittedAttributes.shipping_method_attributes << :store_pickup
|
|
8
7
|
end
|
|
@@ -13,6 +13,19 @@ module SpreeStorePickup
|
|
|
13
13
|
SpreeStorePickup::Config = SpreeStorePickup::Configuration.new
|
|
14
14
|
end
|
|
15
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
|
+
|
|
16
29
|
def self.activate
|
|
17
30
|
Dir.glob(File.join(File.dirname(__FILE__), '../../app/**/*_decorator*.rb')) do |c|
|
|
18
31
|
Rails.configuration.cache_classes ? require(c) : load(c)
|
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.1.
|
|
4
|
+
version: 1.1.5
|
|
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.
|
|
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.
|
|
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.
|
|
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.
|
|
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.
|
|
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.
|
|
53
|
+
version: 5.2.0
|
|
54
54
|
- !ruby/object:Gem::Dependency
|
|
55
55
|
name: spree_extension
|
|
56
56
|
requirement: !ruby/object:Gem::Requirement
|
|
@@ -86,9 +86,11 @@ executables: []
|
|
|
86
86
|
extensions: []
|
|
87
87
|
extra_rdoc_files: []
|
|
88
88
|
files:
|
|
89
|
-
- LICENSE.md
|
|
90
89
|
- README.md
|
|
91
90
|
- Rakefile
|
|
91
|
+
- app/assets/config/spree_store_pickup_manifest.js
|
|
92
|
+
- app/javascript/spree_store_pickup/application.js
|
|
93
|
+
- app/javascript/spree_store_pickup/controllers/spree_store_pickup_controller.js
|
|
92
94
|
- app/models/spree/payment_method/store_pickup.rb
|
|
93
95
|
- app/models/spree/payment_method_decorator.rb
|
|
94
96
|
- app/views/spree/admin/payment_methods/_store_pickup.html.erb
|
|
@@ -97,6 +99,8 @@ files:
|
|
|
97
99
|
- app/views/spree/admin/shipping_methods/_store_pickup_form.html.erb
|
|
98
100
|
- app/views/spree/admin/spree/checkout/payment/_store_pickup.html.erb
|
|
99
101
|
- app/views/spree/checkout/payment/_store_pickup.html.erb
|
|
102
|
+
- app/views/spree_store_pickup/_head.html.erb
|
|
103
|
+
- config/importmap.rb
|
|
100
104
|
- config/initializers/spree.rb
|
|
101
105
|
- config/locales/el.yml
|
|
102
106
|
- config/locales/en.yml
|
|
@@ -110,13 +114,13 @@ files:
|
|
|
110
114
|
- lib/spree_store_pickup/version.rb
|
|
111
115
|
homepage: https://github.com/olympusone/spree_store_pickup
|
|
112
116
|
licenses:
|
|
113
|
-
-
|
|
117
|
+
- MIT
|
|
114
118
|
metadata:
|
|
115
119
|
bug_tracker_uri: https://github.com/olympusone/spree_store_pickup/issues
|
|
116
|
-
changelog_uri: https://github.com/olympusone/spree_store_pickup/releases/tag/v1.1.
|
|
120
|
+
changelog_uri: https://github.com/olympusone/spree_store_pickup/releases/tag/v1.1.5
|
|
117
121
|
documentation_uri: https://github.com/olympusone/spree_store_pickup
|
|
118
122
|
homepage_uri: https://github.com/olympusone/spree_store_pickup
|
|
119
|
-
source_code_uri: https://github.com/olympusone/spree_store_pickup/tree/v1.1.
|
|
123
|
+
source_code_uri: https://github.com/olympusone/spree_store_pickup/tree/v1.1.5
|
|
120
124
|
rdoc_options: []
|
|
121
125
|
require_paths:
|
|
122
126
|
- lib
|
data/LICENSE.md
DELETED
|
@@ -1,15 +0,0 @@
|
|
|
1
|
-
# LICENSE
|
|
2
|
-
|
|
3
|
-
Copyright (c) 2025 OlympusOne. All rights reserved.
|
|
4
|
-
|
|
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.
|
|
8
|
-
|
|
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.
|
|
13
|
-
|
|
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/).
|