spree_store_pickup 1.0.0
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 +7 -0
- data/LICENSE.md +21 -0
- data/README.md +69 -0
- data/Rakefile +21 -0
- data/app/models/spree/payment_method/store_pickup.rb +51 -0
- data/app/models/spree/payment_method_decorator.rb +13 -0
- data/app/views/spree/admin/payment_methods/_store_pickup.html.erb +0 -0
- data/app/views/spree/admin/payment_methods/descriptions/_store_pickup.html.erb +0 -0
- data/app/views/spree/admin/payments/source_views/_store_pickup.html.erb +0 -0
- data/app/views/spree/admin/shipping_methods/_store_pickup_form.html.erb +14 -0
- data/app/views/spree/admin/spree/checkout/payment/_store_pickup.html.erb +0 -0
- data/app/views/spree/checkout/payment/_store_pickup.html.erb +3 -0
- data/config/locales/el.yml +14 -0
- data/config/locales/en.yml +14 -0
- data/config/routes.rb +3 -0
- data/db/migrate/20250601165042_add_store_pickup_to_shipping_methods.rb +5 -0
- data/lib/generators/spree_store_pickup/install/install_generator.rb +20 -0
- data/lib/spree_store_pickup/engine.rb +28 -0
- data/lib/spree_store_pickup/factories.rb +6 -0
- data/lib/spree_store_pickup/version.rb +7 -0
- data/lib/spree_store_pickup.rb +4 -0
- metadata +136 -0
checksums.yaml
ADDED
@@ -0,0 +1,7 @@
|
|
1
|
+
---
|
2
|
+
SHA256:
|
3
|
+
metadata.gz: 2bff3e96a314f62623ba4b7cb4886caa8f1e72a6021676ce7acb56d6d88dc310
|
4
|
+
data.tar.gz: b6b2cd63d857f865380ec10ea1cb0f5faf92b0e9c3791ab1a8831f19c27bcd96
|
5
|
+
SHA512:
|
6
|
+
metadata.gz: 3933568d145fdf4e80de7276b084bf072b6b22be60d782341c8011cc8e47d4c2cc42ba467f5958f34ceef616fdcb5bae184949c89db8417533c2de4faad5376c
|
7
|
+
data.tar.gz: ad4ec212cbb7e3ada8553fa04b362ab10811fbd5cce8702b5f297af6d8338ea47421201c4a4ae85cde1184fa76b09f4e9fb62a49c0c747c5cfd780e3e42ebf83
|
data/LICENSE.md
ADDED
@@ -0,0 +1,21 @@
|
|
1
|
+
# MIT License
|
2
|
+
|
3
|
+
Copyright (c) 2025 OlympusOne
|
4
|
+
|
5
|
+
Permission is hereby granted, free of charge, to any person obtaining a copy
|
6
|
+
of this software and associated documentation files (the "Software"), to deal
|
7
|
+
in the Software without restriction, including without limitation the rights
|
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:
|
11
|
+
|
12
|
+
The above copyright notice and this permission notice shall be included in all
|
13
|
+
copies or substantial portions of the Software.
|
14
|
+
|
15
|
+
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
|
16
|
+
IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
|
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.
|
data/README.md
ADDED
@@ -0,0 +1,69 @@
|
|
1
|
+
# SpreeStorePickup
|
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 option during checkout.
|
4
|
+
|
5
|
+
[](https://badge.fury.io/rb/spree_store_pickup)
|
6
|
+
|
7
|
+
## Installation
|
8
|
+
|
9
|
+
1. Add this extension to your Gemfile with this line:
|
10
|
+
|
11
|
+
```ruby
|
12
|
+
bundle add spree_store_pickup
|
13
|
+
```
|
14
|
+
|
15
|
+
2. Install the migrations:
|
16
|
+
|
17
|
+
```sh
|
18
|
+
bundle exec rake railties:install:migrations FROM=spree_store_pickup
|
19
|
+
```
|
20
|
+
|
21
|
+
3. Run the migrations:
|
22
|
+
|
23
|
+
```sh
|
24
|
+
bundle exec rails db:migrate
|
25
|
+
```
|
26
|
+
|
27
|
+
4. Restart your server
|
28
|
+
|
29
|
+
If your server was running, restart it so that it can find the assets properly.
|
30
|
+
|
31
|
+
## Developing
|
32
|
+
|
33
|
+
1. Create a dummy app
|
34
|
+
|
35
|
+
```bash
|
36
|
+
bundle update
|
37
|
+
bundle exec rake test_app
|
38
|
+
```
|
39
|
+
|
40
|
+
2. Add your new code
|
41
|
+
3. Run tests
|
42
|
+
|
43
|
+
```bash
|
44
|
+
bundle exec rspec
|
45
|
+
```
|
46
|
+
|
47
|
+
When testing your applications integration with this extension you may use it's factories.
|
48
|
+
Simply add this require statement to your spec_helper:
|
49
|
+
|
50
|
+
```ruby
|
51
|
+
require 'spree_store_pickup/factories'
|
52
|
+
```
|
53
|
+
|
54
|
+
## Releasing a new version
|
55
|
+
|
56
|
+
```shell
|
57
|
+
bundle exec gem bump -p -t
|
58
|
+
bundle exec gem release
|
59
|
+
```
|
60
|
+
|
61
|
+
For more options please see [gem-release README](https://github.com/svenfuchs/gem-release)
|
62
|
+
|
63
|
+
## Contributing
|
64
|
+
|
65
|
+
If you'd like to contribute, please take a look at the
|
66
|
+
[instructions](CONTRIBUTING.md) for installing dependencies and crafting a good
|
67
|
+
pull request.
|
68
|
+
|
69
|
+
Copyright (c) 2025 OlympusOne, released under the MIT
|
data/Rakefile
ADDED
@@ -0,0 +1,21 @@
|
|
1
|
+
require 'bundler'
|
2
|
+
Bundler::GemHelper.install_tasks
|
3
|
+
|
4
|
+
require 'rspec/core/rake_task'
|
5
|
+
require 'spree/testing_support/extension_rake'
|
6
|
+
|
7
|
+
RSpec::Core::RakeTask.new
|
8
|
+
|
9
|
+
task :default do
|
10
|
+
if Dir['spec/dummy'].empty?
|
11
|
+
Rake::Task[:test_app].invoke
|
12
|
+
Dir.chdir('../../')
|
13
|
+
end
|
14
|
+
Rake::Task[:spec].invoke
|
15
|
+
end
|
16
|
+
|
17
|
+
desc 'Generates a dummy app for testing'
|
18
|
+
task :test_app do
|
19
|
+
ENV['LIB_NAME'] = 'spree_store_pickup'
|
20
|
+
Rake::Task['extension:test_app'].invoke
|
21
|
+
end
|
@@ -0,0 +1,51 @@
|
|
1
|
+
module Spree
|
2
|
+
class PaymentMethod::StorePickup < Spree::PaymentMethod
|
3
|
+
def method_type
|
4
|
+
type.demodulize.underscore
|
5
|
+
end
|
6
|
+
|
7
|
+
def default_name
|
8
|
+
Spree.t(:store_pickup_method)
|
9
|
+
end
|
10
|
+
|
11
|
+
def source_required?
|
12
|
+
false
|
13
|
+
end
|
14
|
+
|
15
|
+
def auto_capture?
|
16
|
+
false
|
17
|
+
end
|
18
|
+
|
19
|
+
def actions
|
20
|
+
%w[capture void]
|
21
|
+
end
|
22
|
+
|
23
|
+
# Indicates whether its possible to capture the payment
|
24
|
+
def can_capture?(payment)
|
25
|
+
payment.pending?
|
26
|
+
end
|
27
|
+
|
28
|
+
# Indicates whether its possible to void the payment.
|
29
|
+
def can_void?(payment)
|
30
|
+
!payment.void?
|
31
|
+
end
|
32
|
+
|
33
|
+
def capture(*)
|
34
|
+
simulated_successful_billing_response
|
35
|
+
end
|
36
|
+
|
37
|
+
def cancel(*)
|
38
|
+
simulated_successful_billing_response
|
39
|
+
end
|
40
|
+
|
41
|
+
def credit(*)
|
42
|
+
simulated_successful_billing_response
|
43
|
+
end
|
44
|
+
|
45
|
+
private
|
46
|
+
|
47
|
+
def simulated_successful_billing_response
|
48
|
+
ActiveMerchant::Billing::Response.new(true, '', {}, {})
|
49
|
+
end
|
50
|
+
end
|
51
|
+
end
|
@@ -0,0 +1,13 @@
|
|
1
|
+
module Spree
|
2
|
+
module PaymentMethodDecorator
|
3
|
+
def store_pickup?
|
4
|
+
method_type == 'store_pickup'
|
5
|
+
end
|
6
|
+
|
7
|
+
def store_pickup_available?(order)
|
8
|
+
order.shipping_method&.store_pickup?
|
9
|
+
end
|
10
|
+
end
|
11
|
+
end
|
12
|
+
|
13
|
+
Spree::PaymentMethod.prepend Spree::PaymentMethodDecorator
|
File without changes
|
File without changes
|
File without changes
|
@@ -0,0 +1,14 @@
|
|
1
|
+
<div class="card mb-4">
|
2
|
+
<div class="card-header">
|
3
|
+
<h5 class="card-title">
|
4
|
+
<%= Spree.t(:store_pickup) %>
|
5
|
+
</h5>
|
6
|
+
</div>
|
7
|
+
<div class="card-body">
|
8
|
+
<div class="custom-control custom-checkbox">
|
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>
|
13
|
+
</div>
|
14
|
+
</div>
|
File without changes
|
@@ -0,0 +1,14 @@
|
|
1
|
+
---
|
2
|
+
el:
|
3
|
+
activerecord:
|
4
|
+
attributes:
|
5
|
+
spree/shipping_method:
|
6
|
+
store_pickup: Παραλαβή από το κατάστημα
|
7
|
+
spree:
|
8
|
+
store_pickup: Παραλαβή από το κατάστημα
|
9
|
+
store_pickup_method: Παραλαβή από το κατάστημα
|
10
|
+
storefront:
|
11
|
+
checkout:
|
12
|
+
store_pickup_method:
|
13
|
+
title: Παραλαβή από το κατάστημα
|
14
|
+
description: Θα πληρώσετε την παραγγελία σας κατά την παραλαβή της από το κατάστημα.
|
@@ -0,0 +1,14 @@
|
|
1
|
+
---
|
2
|
+
en:
|
3
|
+
activerecord:
|
4
|
+
attributes:
|
5
|
+
spree/shipping_method:
|
6
|
+
store_pickup: Store Pickup
|
7
|
+
spree:
|
8
|
+
store_pickup: Store Pickup
|
9
|
+
store_pickup_method: Store Pickup
|
10
|
+
storefront:
|
11
|
+
checkout:
|
12
|
+
store_pickup_method:
|
13
|
+
title: Store Pickup
|
14
|
+
description: You will pay for your order when you pick it up from the store.
|
data/config/routes.rb
ADDED
@@ -0,0 +1,20 @@
|
|
1
|
+
module SpreeStorePickup
|
2
|
+
module Generators
|
3
|
+
class InstallGenerator < Rails::Generators::Base
|
4
|
+
class_option :migrate, type: :boolean, default: true
|
5
|
+
|
6
|
+
def add_migrations
|
7
|
+
run 'bundle exec rake railties:install:migrations FROM=spree_store_pickup'
|
8
|
+
end
|
9
|
+
|
10
|
+
def run_migrations
|
11
|
+
run_migrations = options[:migrate] || ['', 'y', 'Y'].include?(ask('Would you like to run the migrations now? [Y/n]'))
|
12
|
+
if run_migrations
|
13
|
+
run 'bin/rails db:migrate'
|
14
|
+
else
|
15
|
+
puts 'Skipping rails db:migrate, don\'t forget to run it!'
|
16
|
+
end
|
17
|
+
end
|
18
|
+
end
|
19
|
+
end
|
20
|
+
end
|
@@ -0,0 +1,28 @@
|
|
1
|
+
module SpreeStorePickup
|
2
|
+
class Engine < Rails::Engine
|
3
|
+
require 'spree/core'
|
4
|
+
isolate_namespace Spree
|
5
|
+
engine_name 'spree_store_pickup'
|
6
|
+
|
7
|
+
# use rspec for tests
|
8
|
+
config.generators do |g|
|
9
|
+
g.test_framework :rspec
|
10
|
+
end
|
11
|
+
|
12
|
+
config.after_initialize do |app|
|
13
|
+
app.config.spree.payment_methods << Spree::PaymentMethod::StorePickup
|
14
|
+
|
15
|
+
app.config.spree_admin.shipping_method_form_partials << 'spree/admin/shipping_methods/store_pickup_form'
|
16
|
+
|
17
|
+
Spree::PermittedAttributes.shipping_method_attributes << :store_pickup
|
18
|
+
end
|
19
|
+
|
20
|
+
def self.activate
|
21
|
+
Dir.glob(File.join(File.dirname(__FILE__), '../../app/**/*_decorator*.rb')) do |c|
|
22
|
+
Rails.configuration.cache_classes ? require(c) : load(c)
|
23
|
+
end
|
24
|
+
end
|
25
|
+
|
26
|
+
config.to_prepare(&method(:activate).to_proc)
|
27
|
+
end
|
28
|
+
end
|
@@ -0,0 +1,6 @@
|
|
1
|
+
FactoryBot.define do
|
2
|
+
# Define your Spree extensions Factories within this file to enable applications, and other extensions to use and override them.
|
3
|
+
#
|
4
|
+
# Example adding this to your spec_helper will load these Factories for use:
|
5
|
+
# require 'spree_store_pickup/factories'
|
6
|
+
end
|
metadata
ADDED
@@ -0,0 +1,136 @@
|
|
1
|
+
--- !ruby/object:Gem::Specification
|
2
|
+
name: spree_store_pickup
|
3
|
+
version: !ruby/object:Gem::Version
|
4
|
+
version: 1.0.0
|
5
|
+
platform: ruby
|
6
|
+
authors:
|
7
|
+
- OlympusOne
|
8
|
+
bindir: bin
|
9
|
+
cert_chain: []
|
10
|
+
date: 1980-01-02 00:00:00.000000000 Z
|
11
|
+
dependencies:
|
12
|
+
- !ruby/object:Gem::Dependency
|
13
|
+
name: spree
|
14
|
+
requirement: !ruby/object:Gem::Requirement
|
15
|
+
requirements:
|
16
|
+
- - ">="
|
17
|
+
- !ruby/object:Gem::Version
|
18
|
+
version: 5.0.4
|
19
|
+
type: :runtime
|
20
|
+
prerelease: false
|
21
|
+
version_requirements: !ruby/object:Gem::Requirement
|
22
|
+
requirements:
|
23
|
+
- - ">="
|
24
|
+
- !ruby/object:Gem::Version
|
25
|
+
version: 5.0.4
|
26
|
+
- !ruby/object:Gem::Dependency
|
27
|
+
name: spree_storefront
|
28
|
+
requirement: !ruby/object:Gem::Requirement
|
29
|
+
requirements:
|
30
|
+
- - ">="
|
31
|
+
- !ruby/object:Gem::Version
|
32
|
+
version: 5.0.4
|
33
|
+
type: :runtime
|
34
|
+
prerelease: false
|
35
|
+
version_requirements: !ruby/object:Gem::Requirement
|
36
|
+
requirements:
|
37
|
+
- - ">="
|
38
|
+
- !ruby/object:Gem::Version
|
39
|
+
version: 5.0.4
|
40
|
+
- !ruby/object:Gem::Dependency
|
41
|
+
name: spree_admin
|
42
|
+
requirement: !ruby/object:Gem::Requirement
|
43
|
+
requirements:
|
44
|
+
- - ">="
|
45
|
+
- !ruby/object:Gem::Version
|
46
|
+
version: 5.0.4
|
47
|
+
type: :runtime
|
48
|
+
prerelease: false
|
49
|
+
version_requirements: !ruby/object:Gem::Requirement
|
50
|
+
requirements:
|
51
|
+
- - ">="
|
52
|
+
- !ruby/object:Gem::Version
|
53
|
+
version: 5.0.4
|
54
|
+
- !ruby/object:Gem::Dependency
|
55
|
+
name: spree_extension
|
56
|
+
requirement: !ruby/object:Gem::Requirement
|
57
|
+
requirements:
|
58
|
+
- - ">="
|
59
|
+
- !ruby/object:Gem::Version
|
60
|
+
version: '0'
|
61
|
+
type: :runtime
|
62
|
+
prerelease: false
|
63
|
+
version_requirements: !ruby/object:Gem::Requirement
|
64
|
+
requirements:
|
65
|
+
- - ">="
|
66
|
+
- !ruby/object:Gem::Version
|
67
|
+
version: '0'
|
68
|
+
- !ruby/object:Gem::Dependency
|
69
|
+
name: spree_dev_tools
|
70
|
+
requirement: !ruby/object:Gem::Requirement
|
71
|
+
requirements:
|
72
|
+
- - ">="
|
73
|
+
- !ruby/object:Gem::Version
|
74
|
+
version: '0'
|
75
|
+
type: :development
|
76
|
+
prerelease: false
|
77
|
+
version_requirements: !ruby/object:Gem::Requirement
|
78
|
+
requirements:
|
79
|
+
- - ">="
|
80
|
+
- !ruby/object:Gem::Version
|
81
|
+
version: '0'
|
82
|
+
description: Adds in-store pickup as selectable shipping and payment option during
|
83
|
+
checkout.
|
84
|
+
email: info@olympusone.com
|
85
|
+
executables: []
|
86
|
+
extensions: []
|
87
|
+
extra_rdoc_files: []
|
88
|
+
files:
|
89
|
+
- LICENSE.md
|
90
|
+
- README.md
|
91
|
+
- Rakefile
|
92
|
+
- app/models/spree/payment_method/store_pickup.rb
|
93
|
+
- app/models/spree/payment_method_decorator.rb
|
94
|
+
- app/views/spree/admin/payment_methods/_store_pickup.html.erb
|
95
|
+
- app/views/spree/admin/payment_methods/descriptions/_store_pickup.html.erb
|
96
|
+
- app/views/spree/admin/payments/source_views/_store_pickup.html.erb
|
97
|
+
- app/views/spree/admin/shipping_methods/_store_pickup_form.html.erb
|
98
|
+
- app/views/spree/admin/spree/checkout/payment/_store_pickup.html.erb
|
99
|
+
- app/views/spree/checkout/payment/_store_pickup.html.erb
|
100
|
+
- config/locales/el.yml
|
101
|
+
- config/locales/en.yml
|
102
|
+
- config/routes.rb
|
103
|
+
- db/migrate/20250601165042_add_store_pickup_to_shipping_methods.rb
|
104
|
+
- lib/generators/spree_store_pickup/install/install_generator.rb
|
105
|
+
- lib/spree_store_pickup.rb
|
106
|
+
- lib/spree_store_pickup/engine.rb
|
107
|
+
- lib/spree_store_pickup/factories.rb
|
108
|
+
- lib/spree_store_pickup/version.rb
|
109
|
+
homepage: https://github.com/olympusone/spree_store_pickup
|
110
|
+
licenses:
|
111
|
+
- MIT
|
112
|
+
metadata:
|
113
|
+
bug_tracker_uri: https://github.com/olympusone/spree_store_pickup/issues
|
114
|
+
changelog_uri: https://github.com/olympusone/spree_store_pickup/releases/tag/v1.0.0
|
115
|
+
documentation_uri: https://github.com/olympusone/spree_store_pickup
|
116
|
+
homepage_uri: https://github.com/olympusone/spree_store_pickup
|
117
|
+
source_code_uri: https://github.com/olympusone/spree_store_pickup/tree/v1.0.0
|
118
|
+
rdoc_options: []
|
119
|
+
require_paths:
|
120
|
+
- lib
|
121
|
+
required_ruby_version: !ruby/object:Gem::Requirement
|
122
|
+
requirements:
|
123
|
+
- - ">="
|
124
|
+
- !ruby/object:Gem::Version
|
125
|
+
version: '3.0'
|
126
|
+
required_rubygems_version: !ruby/object:Gem::Requirement
|
127
|
+
requirements:
|
128
|
+
- - ">="
|
129
|
+
- !ruby/object:Gem::Version
|
130
|
+
version: '0'
|
131
|
+
requirements:
|
132
|
+
- none
|
133
|
+
rubygems_version: 3.6.9
|
134
|
+
specification_version: 4
|
135
|
+
summary: Spree Commerce Store Pickup Extension
|
136
|
+
test_files: []
|