spree-point-of-sale 1.0.0 → 1.0.1
Sign up to get free protection for your applications and to get access to all the features.
data/README.md
CHANGED
@@ -8,44 +8,53 @@ Apply discount on items, associate the order to customer email and save the deta
|
|
8
8
|
|
9
9
|
Dependencies
|
10
10
|
============
|
11
|
-
1)spree_html_invoice(optional)
|
11
|
+
1) spree_html_invoice (optional)
|
12
12
|
|
13
13
|
By default POS relies on html-invoice to print a receipt. You can configure this away by setting :pos_printing to the url where you want to redirect after print.
|
14
14
|
|
15
|
-
2)barby
|
15
|
+
2) barby
|
16
16
|
|
17
|
-
3)prawn
|
17
|
+
3) prawn
|
18
18
|
|
19
|
-
4)chunky_png
|
19
|
+
4) chunky_png
|
20
20
|
|
21
21
|
|
22
22
|
SET UP
|
23
23
|
=======
|
24
24
|
To your Gemfile add:
|
25
25
|
|
26
|
-
|
26
|
+
Add spree-point-of-sale to your Gemfile:
|
27
27
|
|
28
|
-
|
28
|
+
```ruby
|
29
|
+
gem "spree-point-of-sale", require: 'spree_pos'
|
30
|
+
```
|
31
|
+
|
32
|
+
If you DONT change the :pos_printing config as described above, you must also add
|
29
33
|
|
34
|
+
```ruby
|
30
35
|
gem 'spree_html_invoice' , :git => 'git://github.com/dancinglightning/spree-html-invoice.git'
|
36
|
+
```
|
31
37
|
|
32
|
-
|
38
|
+
```ruby
|
39
|
+
bundle install
|
40
|
+
```
|
33
41
|
|
34
42
|
Finally for migrations, css and javascript do
|
35
43
|
|
36
|
-
|
37
|
-
|
44
|
+
```ruby
|
45
|
+
bundle exec rails g spree_pos:install
|
46
|
+
```
|
38
47
|
|
39
48
|
Configure
|
40
49
|
=========
|
41
50
|
You must configure:
|
42
51
|
|
43
|
-
1)ShippingMethod : Create a shipping method for pos and set it from the admin end via general settings.
|
52
|
+
1) ShippingMethod : Create a shipping method for pos and set it from the admin end via general settings.
|
44
53
|
Usually something like "pickup" with cost 0.
|
45
54
|
|
46
|
-
2)Payment Methods : They can be added under PointOfSale payment method from admin end itself.
|
55
|
+
2) Payment Methods : They can be added under PointOfSale payment method from admin end itself.
|
47
56
|
|
48
|
-
3)Store : Make sure atleast one of your stock locations is marked as store.
|
57
|
+
3) Store : Make sure atleast one of your stock locations is marked as store.
|
49
58
|
|
50
59
|
|
51
60
|
Order
|
@@ -68,4 +77,6 @@ Barcode printing and SKU
|
|
68
77
|
========
|
69
78
|
Barcode printing relies on sku to be provided for variants.
|
70
79
|
|
71
|
-
There are links provided to print barcodes for individual variants in the variants index for a product or barcodes for all variants can be printed from the product listings as well.
|
80
|
+
There are links provided to print barcodes for individual variants in the variants index for a product or barcodes for all variants can be printed from the product listings as well.
|
81
|
+
|
82
|
+
Copyright (c) 2014 Vinsol, released under the New MIT License
|
@@ -2,7 +2,7 @@ class Spree::Admin::PosController < Spree::Admin::BaseController
|
|
2
2
|
before_filter :load_order, :ensure_pos_order, :ensure_unpaid_order, :except => [:new]
|
3
3
|
helper_method :user_stock_locations
|
4
4
|
before_filter :load_variant, :only => [:add, :remove]
|
5
|
-
before_filter :ensure_pos_shipping_method, :only => [:new]
|
5
|
+
before_filter :ensure_active_store, :ensure_pos_shipping_method, :only => [:new]
|
6
6
|
before_filter :ensure_payment_method, :only => [:update_payment]
|
7
7
|
before_filter :ensure_existing_user, :only => [:associate_user]
|
8
8
|
before_filter :check_unpaid_pos_order, :only => :new
|
@@ -137,6 +137,10 @@ class Spree::Admin::PosController < Spree::Admin::BaseController
|
|
137
137
|
redirect_to '/', :flash => { :error => 'No shipping method available for POS orders. Please assign one.'} and return unless Spree::ShippingMethod.where(:name => SpreePos::Config[:pos_shipping]).first
|
138
138
|
end
|
139
139
|
|
140
|
+
def ensure_active_store
|
141
|
+
redirect_to '/', :flash => { :error => 'No active store present. Please assign one.'} and return if Spree::StockLocation.stores.active.blank?
|
142
|
+
end
|
143
|
+
|
140
144
|
def load_order
|
141
145
|
@order = Spree::Order.by_number(params[:number]).includes([{ :line_items => [{ :variant => [:default_price, { :product => [:master] } ] }] } , { :adjustments => :adjustable }] ).first
|
142
146
|
raise "No order found for -#{params[:number]}-" unless @order
|
File without changes
|
@@ -106,10 +106,61 @@ describe Spree::Admin::PosController do
|
|
106
106
|
end
|
107
107
|
end
|
108
108
|
|
109
|
+
describe 'ensure_active_store' do
|
110
|
+
def send_request(params = {})
|
111
|
+
get :new, params.merge!(:use_route => 'spree')
|
112
|
+
end
|
113
|
+
|
114
|
+
context 'store does not exist' do
|
115
|
+
it 'redirects to root' do
|
116
|
+
send_request
|
117
|
+
response.should redirect_to('/')
|
118
|
+
end
|
119
|
+
|
120
|
+
it 'sets the flash message' do
|
121
|
+
send_request
|
122
|
+
flash[:error].should eq('No active store present. Please assign one.')
|
123
|
+
end
|
124
|
+
end
|
125
|
+
|
126
|
+
context 'store does exist' do
|
127
|
+
before do
|
128
|
+
@shipping_method = mock_model(Spree::ShippingMethod, :name => 'pos-shipping')
|
129
|
+
SpreePos::Config[:pos_shipping] = @shipping_method.name
|
130
|
+
@stock_location = mock_model(Spree::StockLocation)
|
131
|
+
@stock_location.stub(:address).and_return(address)
|
132
|
+
@stock_locations = [@stock_location]
|
133
|
+
@stock_locations.stub(:where).with(:id => @stock_location.id.to_s).and_return(@stock_locations)
|
134
|
+
Spree::StockLocation.stub_chain(:active, :stores).and_return(@stock_locations)
|
135
|
+
Spree::ShippingMethod.stub(:where).with(:name => @shipping_method.name).and_return([@shipping_method])
|
136
|
+
end
|
137
|
+
|
138
|
+
it 'does not redirect to root' do
|
139
|
+
send_request
|
140
|
+
response.should_not redirect_to('/')
|
141
|
+
end
|
142
|
+
|
143
|
+
it 'sets no error message for store' do
|
144
|
+
send_request
|
145
|
+
flash[:error].should eq("You have an unpaid/empty order. Please either complete it or update items in the same order.")
|
146
|
+
end
|
147
|
+
|
148
|
+
it 'renders show page' do
|
149
|
+
send_request
|
150
|
+
response.should redirect_to admin_pos_show_order_path(:number => order.number)
|
151
|
+
end
|
152
|
+
end
|
153
|
+
end
|
154
|
+
|
109
155
|
describe 'ensure_pos_shipping_method' do
|
110
156
|
before do
|
111
157
|
@shipping_method = mock_model(Spree::ShippingMethod, :name => 'pos-shipping')
|
112
158
|
SpreePos::Config[:pos_shipping] = @shipping_method.name
|
159
|
+
@stock_location = mock_model(Spree::StockLocation)
|
160
|
+
@stock_location.stub(:address).and_return(address)
|
161
|
+
@stock_locations = [@stock_location]
|
162
|
+
@stock_locations.stub(:where).with(:id => @stock_location.id.to_s).and_return(@stock_locations)
|
163
|
+
Spree::StockLocation.stub_chain(:active, :stores).and_return(@stock_locations)
|
113
164
|
end
|
114
165
|
|
115
166
|
def send_request(params = {})
|
@@ -299,6 +350,11 @@ describe Spree::Admin::PosController do
|
|
299
350
|
@new_order.stub(:assign_shipment_for_pos).and_return(true)
|
300
351
|
@new_order.stub(:associate_user!).and_return(true)
|
301
352
|
@new_order.stub(:save!).and_return(true)
|
353
|
+
@stock_location = mock_model(Spree::StockLocation)
|
354
|
+
@stock_location.stub(:address).and_return(address)
|
355
|
+
@stock_locations = [@stock_location]
|
356
|
+
@stock_locations.stub(:where).with(:id => @stock_location.id.to_s).and_return(@stock_locations)
|
357
|
+
Spree::StockLocation.stub_chain(:active, :stores).and_return(@stock_locations)
|
302
358
|
end
|
303
359
|
|
304
360
|
def send_request(params = {})
|
data/spree-point-of-sale.gemspec
CHANGED
metadata
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: spree-point-of-sale
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 1.0.
|
4
|
+
version: 1.0.1
|
5
5
|
prerelease:
|
6
6
|
platform: ruby
|
7
7
|
authors:
|
@@ -139,7 +139,7 @@ files:
|
|
139
139
|
- db/migrate/20131014053417_add_is_pos_to_spree_orders.rb
|
140
140
|
- db/migrate/20131025110309_add_card_name_to_spree_payments.rb
|
141
141
|
- lib/generators/spree_pos/install/install_generator.rb
|
142
|
-
- lib/
|
142
|
+
- lib/spree-point-of-sale.rb
|
143
143
|
- lib/spree_pos/configuration.rb
|
144
144
|
- lib/spree_pos/engine.rb
|
145
145
|
- spec/constants_spec.rb
|