shoppe 0.0.18 → 0.0.19

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.
Files changed (63) hide show
  1. checksums.yaml +4 -4
  2. data/app/assets/stylesheets/shoppe/application.scss +1 -0
  3. data/app/assets/stylesheets/shoppe/sub.scss +2 -1
  4. data/app/controllers/shoppe/countries_controller.rb +47 -0
  5. data/app/controllers/shoppe/orders_controller.rb +4 -0
  6. data/app/models/shoppe/order.rb +1 -1
  7. data/app/models/shoppe/order/actions.rb +18 -14
  8. data/app/models/shoppe/order/delivery.rb +24 -6
  9. data/app/models/shoppe/order_item.rb +1 -1
  10. data/app/models/shoppe/product.rb +0 -8
  11. data/app/models/shoppe/tax_rate.rb +3 -0
  12. data/app/views/layouts/shoppe/application.html.haml +1 -0
  13. data/app/views/shoppe/countries/_form.html.haml +31 -0
  14. data/app/views/shoppe/countries/edit.html.haml +5 -0
  15. data/app/views/shoppe/countries/index.html.haml +25 -0
  16. data/app/views/shoppe/countries/new.html.haml +5 -0
  17. data/app/views/shoppe/orders/_order_details.html.haml +51 -0
  18. data/app/views/shoppe/orders/_order_items.html.haml +38 -0
  19. data/app/views/shoppe/orders/_payments_form.html.haml +15 -0
  20. data/app/views/shoppe/orders/_payments_table.html.haml +37 -0
  21. data/app/views/shoppe/orders/_search_form.html.haml +24 -0
  22. data/app/views/shoppe/orders/_status_bar.html.haml +25 -0
  23. data/app/views/shoppe/orders/index.html.haml +2 -27
  24. data/app/views/shoppe/orders/show.html.haml +5 -168
  25. data/app/views/shoppe/shared/error.html.haml +3 -1
  26. data/config/routes.rb +1 -0
  27. data/db/seeds.rb +10 -26
  28. data/lib/shoppe.rb +0 -5
  29. data/lib/shoppe/error.rb +21 -0
  30. data/lib/shoppe/errors/inappropriate_delivery_service.rb +0 -5
  31. data/lib/shoppe/errors/insufficient_stock_to_fulfil.rb +0 -4
  32. data/lib/shoppe/errors/not_enough_stock.rb +0 -4
  33. data/lib/shoppe/errors/payment_declined.rb +1 -10
  34. data/lib/shoppe/errors/refund_failed.rb +0 -9
  35. data/lib/shoppe/errors/unorderable_item.rb +0 -5
  36. data/lib/shoppe/version.rb +1 -1
  37. data/test/app/log/development.log +2934 -0
  38. data/test/app/tmp/cache/assets/development/sass/ae14d07da246951103a34baf6ced4dbc454e5f8d/dialog.scssc +0 -0
  39. data/test/app/tmp/cache/assets/development/sass/edac894564dae62b78e653a08d1c41f10ade93f9/application.scssc +0 -0
  40. data/test/app/tmp/cache/assets/development/sass/edac894564dae62b78e653a08d1c41f10ade93f9/dialog.scssc +0 -0
  41. data/test/app/tmp/cache/assets/development/sprockets/08eabc96013073092a91d64aaf3da292 +0 -0
  42. data/test/app/tmp/cache/assets/development/sprockets/0a6bca3e510625f255083bd154cc470b +0 -0
  43. data/test/app/tmp/cache/assets/development/sprockets/267ddf6307abe4d3de2ad900609a6c33 +0 -0
  44. data/test/app/tmp/cache/assets/development/sprockets/2c9164359b1d599a71cebf132035ed6d +0 -0
  45. data/test/app/tmp/cache/assets/development/sprockets/322295abdd8625fcce4da08f9565cc63 +0 -0
  46. data/test/app/tmp/cache/assets/development/sprockets/445cd520fe49b793bd58dfe8ed70d16e +0 -0
  47. data/test/app/tmp/cache/assets/development/sprockets/4df1915796b86f6133a3c75bb30be02a +0 -0
  48. data/test/app/tmp/cache/assets/development/sprockets/5f32b259cbcc52156d2fe21c185d9390 +0 -0
  49. data/test/app/tmp/cache/assets/development/sprockets/71293acda556db2f1dd4f22e3f607f57 +0 -0
  50. data/test/app/tmp/cache/assets/development/sprockets/7938636d16e11b754d4dd046b89863c4 +0 -0
  51. data/test/app/tmp/cache/assets/development/sprockets/7de0e84287a67005fed3fea41ee2c0e9 +0 -0
  52. data/test/app/tmp/cache/assets/development/sprockets/8b6802665cb32689236636d16a1f04e3 +0 -0
  53. data/test/app/tmp/cache/assets/development/sprockets/a7e398541852f6f05ecc5888932a0138 +0 -0
  54. data/test/app/tmp/cache/assets/development/sprockets/accc4dc17ef18d0b510917a005340da5 +0 -0
  55. data/test/app/tmp/cache/assets/development/sprockets/af89877010f84851c64ea77c06baf4ba +0 -0
  56. data/test/app/tmp/cache/assets/development/sprockets/b519a4f6c5b5a0d9236bdca14e0eb00d +0 -0
  57. data/test/app/tmp/cache/assets/development/sprockets/b9ad7ea18b7e55c3626a15d1dae142ed +0 -0
  58. data/test/app/tmp/cache/assets/development/sprockets/c76e2374fc93583d158883980db69094 +0 -0
  59. data/test/app/tmp/cache/assets/development/sprockets/cf45ce1c68370bf536616d1dd87fb89d +0 -0
  60. data/test/app/tmp/cache/assets/development/sprockets/d7feb1bb9d1746a4c653985285f727cd +0 -0
  61. data/test/app/tmp/cache/assets/development/sprockets/e60289d4f6dc2754610af229263c914b +0 -0
  62. data/test/app/tmp/cache/assets/development/sprockets/edf3c55a27678996371bffe56298925b +0 -0
  63. metadata +44 -2
@@ -0,0 +1,24 @@
1
+ .orderSearch{:style => action_name == 'search' ? "display:block" : ''}
2
+ = search_form_for @query, :url => search_orders_path, :html => { :method => :post } do |f|
3
+ %dl.left
4
+ %dt= f.label :id_eq, "Order Number"
5
+ %dd= f.text_field :id_eq
6
+ %dt= f.label :first_name_or_last_name_or_company_cont, "Customer"
7
+ %dd= f.text_field :first_name_or_last_name_or_company_cont
8
+ %dt= f.label :address1_or_address2_or_address3_or_address4_or_postcode_cont, "Billing Address"
9
+ %dd= f.text_field :billing_address1_or_billing_address2_or_billing_address3_or_billing_address4_or_billing_postcode_cont
10
+ %dt= f.label :consignment_number_cont, "Consignment Number"
11
+ %dd= f.text_field :consignment_number_cont
12
+ %dt= f.label :received_at_eq, "Received between"
13
+ %dd
14
+ = f.text_field :received_at_gteq, :class => 'small'
15
+ →
16
+ = f.text_field :received_at_lteq, :class => 'small'
17
+ %dl.right
18
+ %dt= f.label :email_address_cont, "E-Mail Address"
19
+ %dd= f.text_field :email_address_cont
20
+ %dt= f.label :phone_number_cont, "Phone Number"
21
+ %dd= f.text_field :phone_number_cont
22
+ %dt= f.label :status_eq, "Status"
23
+ %dd= f.select :status_eq, [nil] + Shoppe::Order::STATUSES.map { |s| [s.humanize, s]}
24
+ %dd= f.submit "Search", :class => 'button green button'
@@ -0,0 +1,25 @@
1
+ .status-bar
2
+ %ul
3
+ - if @order.received?
4
+ %li.received
5
+ %h4 Order Received
6
+ %p on #{@order.received_at.to_s(:short)} from #{@order.ip_address}
7
+
8
+ - if @order.accepted?
9
+ %li.accepted
10
+ %h4 Order Accepted
11
+ %p on #{@order.accepted_at.to_s(:short)} by #{@order.accepter.try(:short_name) || 'Unknown'}
12
+
13
+ - elsif @order.rejected?
14
+ %li.rejected
15
+ %h4 Order rejected
16
+ %p on #{@order.rejected_at.to_s(:short)} by #{@order.rejecter.try(:short_name) || 'Unknown'}
17
+
18
+ - if @order.shipped?
19
+ %li.shipped
20
+ %h4 Order Shipped
21
+ %p on #{@order.shipped_at.to_s(:short)} by #{@order.shipper.try(:short_name) || 'Unknown'}
22
+ - if @order.courier_tracking_url
23
+ %p= link_to "Tracking URL", @order.courier_tracking_url
24
+ - else
25
+ %p Consignment # <b>#{@order.consignment_number}</b>
@@ -5,33 +5,8 @@
5
5
  %h2.orders
6
6
  Orders
7
7
  %span= page_entries_info @orders
8
-
9
- .orderSearch{:style => action_name == 'search' ? "display:block" : ''}
10
- = search_form_for @query, :url => search_orders_path, :html => { :method => :post } do |f|
11
- %dl.left
12
- %dt= f.label :id_eq, "Order Number"
13
- %dd= f.text_field :id_eq
14
- %dt= f.label :first_name_or_last_name_or_company_cont, "Customer"
15
- %dd= f.text_field :first_name_or_last_name_or_company_cont
16
- %dt= f.label :address1_or_address2_or_address3_or_address4_or_postcode_cont, "Billing Address"
17
- %dd= f.text_field :billing_address1_or_billing_address2_or_billing_address3_or_billing_address4_or_billing_postcode_cont
18
- %dt= f.label :consignment_number_cont, "Consignment Number"
19
- %dd= f.text_field :consignment_number_cont
20
- %dt= f.label :received_at_eq, "Received between"
21
- %dd
22
- = f.text_field :received_at_gteq, :class => 'small'
23
- &rarr;
24
- = f.text_field :received_at_lteq, :class => 'small'
25
- %dl.right
26
- %dt= f.label :products_name_cont, "Contains product"
27
- %dd= f.text_field :products_name_cont
28
- %dt= f.label :email_address_cont, "E-Mail Address"
29
- %dd= f.text_field :email_address_cont
30
- %dt= f.label :phone_number_cont, "Phone Number"
31
- %dd= f.text_field :phone_number_cont
32
- %dt= f.label :status_eq, "Status"
33
- %dd= f.select :status_eq, [nil] + Shoppe::Order::STATUSES.map { |s| [s.humanize, s]}
34
- %dd= f.submit "Search", :class => 'button green button'
8
+
9
+ = render 'search_form'
35
10
 
36
11
  .table
37
12
  %table.data
@@ -8,175 +8,12 @@
8
8
  %h2.orders Order <b>##{@order.number}</b>
9
9
 
10
10
  #order
11
- .details
12
- .left
13
- %dl
14
- %dt Name
15
- %dd= @order.first_name + ' ' + @order.last_name
16
- %dt Company
17
- %dd= @order.company.blank? ? '-' : @order.company
18
- %dt Billing#{@order.separate_delivery_address? ? '' : '/Delivery'} Address
19
- %dd= @order.billing_address1
20
- %dd= @order.billing_address2
21
- %dd= @order.billing_address3
22
- %dd= @order.billing_address4
23
- %dd= @order.billing_postcode
24
- %dd= @order.billing_country.try(:name)
25
- - if @order.separate_delivery_address?
26
- %dt Delivery Address
27
- %dd= @order.delivery_name
28
- %dd= @order.delivery_address1
29
- %dd= @order.delivery_address2
30
- %dd= @order.delivery_address3
31
- %dd= @order.delivery_address4
32
- %dd= @order.delivery_postcode
33
- %dd= @order.delivery_country.try(:name)
34
- .right
35
- %dl
36
- %dt E-Mail Address
37
- %dd= mail_to @order.email_address
38
- %dt Telephone
39
- %dd= @order.phone_number
40
- %dt Weight
41
- %dd= number_to_weight @order.total_weight
42
- %dt Build Time
43
- %dd= distance_of_time_in_words(@order.created_at, @order.received_at)
44
- - if @order.invoiced?
45
- %dt Invoice Number
46
- %dd= @order.invoice_number
47
- %dt Order Balance
48
- %dd= boolean_tag @order.paid_in_full?, nil, :true_text => number_to_currency(@order.balance), :false_text => number_to_currency(@order.balance)
49
- - if @order.accepted? && !@order.shipped?
50
- = form_tag [:ship, @order] do
51
- %dl.form
52
- %dt.padding= label_tag 'consignment_number', 'Consignment Number'
53
- %dd= text_field_tag 'consignment_number', '', :class => 'text'
54
- %dl.form
55
- %dd= submit_tag "Mark as shipped", :class => 'button green button-mini'
56
-
57
- - unless @order.accepted? || @order.rejected?
58
- %dl.form
59
- %dd
60
- = link_to "Accept", [:accept, @order], :method => :post, :class => 'button green'
61
- = link_to "Reject", [:reject, @order], :method => :post, :class => 'button purple'
62
-
63
- .status-bar
64
- %ul
65
- - if @order.received?
66
- %li.received
67
- %h4 Order Received
68
- %p on #{@order.received_at.to_s(:short)} from #{@order.ip_address}
11
+ = render 'order_details'
12
+ = render 'status_bar'
69
13
 
70
- - if @order.accepted?
71
- %li.accepted
72
- %h4 Order Accepted
73
- %p on #{@order.accepted_at.to_s(:short)} by #{@order.accepter.try(:short_name) || 'Unknown'}
74
-
75
- - elsif @order.rejected?
76
- %li.rejected
77
- %h4 Order rejected
78
- %p on #{@order.rejected_at.to_s(:short)} by #{@order.rejecter.try(:short_name) || 'Unknown'}
79
-
80
- - if @order.shipped?
81
- %li.shipped
82
- %h4 Order Shipped
83
- %p on #{@order.shipped_at.to_s(:short)} by #{@order.shipper.try(:short_name) || 'Unknown'}
84
- - if @order.courier_tracking_url
85
- %p= link_to "Tracking URL", @order.courier_tracking_url
86
- - else
87
- %p Consignment # <b>#{@order.consignment_number}</b>
88
-
89
14
  = field_set_tag "Order Items", :class => 'padded' do
90
- .order_items
91
- .table
92
- %table.data
93
- %thead
94
- %tr
95
- %th.qty Qty
96
- %th Item
97
- %th SKU
98
- %th.money Cost
99
- %th.money Price
100
- %th.money= Shoppe.settings.tax_name
101
- %th.money Sub-Total
102
- %tbody
103
- - for item in @order.order_items
104
- %tr
105
- %td.qty= item.quantity
106
- %td.product= item.ordered_item.full_name
107
- %td.sku= item.ordered_item.sku
108
- %td.money= number_to_currency item.total_cost
109
- %td.money= number_to_currency item.sub_total
110
- %td.money= number_to_currency item.tax_amount
111
- %td.money= number_to_currency item.total
112
- - if @order.delivery_service
113
- %td.qty
114
- %td.product= link_to @order.delivery_service.name, [:edit, @order.delivery_service]
115
- %td.sku
116
- %td.money= number_to_currency @order.delivery_cost_price
117
- %td.money= number_to_currency @order.delivery_price
118
- %td.money= number_to_currency @order.delivery_tax_amount
119
- %td.money= number_to_currency @order.delivery_price + @order.delivery_tax_amount
120
- %tfoot
121
- %tr
122
- %td.qty= @order.total_items
123
- %td{:colspan => 2}
124
- %td.money= number_to_currency @order.total_cost
125
- %td.money= number_to_currency @order.total_before_tax
126
- %td.money= number_to_currency @order.tax
127
- %td.money= number_to_currency @order.total
15
+ = render 'order_items'
128
16
 
129
17
  = field_set_tag "Payments", :class => 'padded orderPayments' do
130
- - unless @payments.empty?
131
- .table
132
- %table.data
133
- %thead
134
- %tr
135
- %th ID
136
- %th Type
137
- %th Method
138
- %th Reference
139
- %th Amount
140
- %th Refunded?
141
- %th
142
- %tbody
143
- - for payment in @payments
144
- %tr
145
- %td= payment.id
146
- %td
147
- = payment.refund? ? 'Refund' : 'Payment'
148
- %span.float-right= boolean_tag payment.confirmed?
149
- %td= payment.method
150
- %td= link_to_if payment.transaction_url, payment.reference, payment.transaction_url
151
-
152
- - if payment.refund?
153
- %td{:colspan => 2}
154
- %b= number_to_currency payment.amount
155
- from payment ##{payment.parent_payment_id}
156
- - else
157
- %td= number_to_currency payment.amount
158
- %td= boolean_tag payment.refunded?, nil, :true_text => number_to_currency(payment.amount_refunded)
159
- %td.refund
160
- - if payment.refundable?
161
- = link_to "Refund", [:refund, @order, payment], :class => 'button purple button-mini', :rel => 'dialog'
162
- - else
163
- = link_to "Delete", [@order, payment], :class => 'button purple button-mini', :data => {:confirm => "Are you sure you wish to remove this payment?"}, :method => :delete
164
- - else
165
- %p.notice There are no payments recorded for this order...
166
-
167
- = form_for [@order, Shoppe::Payment.new(:amount => @order.balance)] do |f|
168
- %dl.text
169
- %dt= f.label :method
170
- %dd= f.text_field :method, :class => 'text'
171
- %dl.text
172
- %dt= f.label :reference
173
- %dd= f.text_field :reference, :class => 'text'
174
- %dl.amount
175
- %dt= f.label :amount
176
- %dd
177
- .moneyInput
178
- .currency= Shoppe.settings.currency_unit.html_safe
179
- = f.text_field :amount, :class => 'text'
180
- %dl.submit
181
- %dd= f.submit "Add Payment", :class => 'button green'
182
-
18
+ = render 'payments_table'
19
+ = render 'payments_form'
@@ -1,4 +1,6 @@
1
+ - @page_title = "Error"
1
2
  = display_flash
2
3
  .error
3
- %p= @exception.message
4
+ %h2 An error has occurred
5
+ %p.message= @exception.message
4
6
  %p.back= link_to "&larr; Back to Shoppe".html_safe, root_path, :class => 'button'
@@ -21,6 +21,7 @@ Shoppe::Engine.routes.draw do
21
21
  end
22
22
  resources :tax_rates
23
23
  resources :users
24
+ resources :countries
24
25
  resources :attachments, :only => :destroy
25
26
 
26
27
  get 'settings'=> 'settings#edit'
@@ -1,36 +1,20 @@
1
1
  # encoding: UTF-8
2
2
 
3
3
  # tax rates
4
- tax_rate = Shoppe::TaxRate.create(:name => "Standard UK VAT", :rate => 20.0, :country_ids => Shoppe::Country.where(:eu_member => true).pluck(:id))
5
- exempt_tax = Shoppe::TaxRate.create(:name => "Exempt VAT", :rate => 0.0, :country_ids => Shoppe::Country.where(:eu_member => true).pluck(:id))
4
+ tax_rate = Shoppe::TaxRate.create!(:name => "Standard VAT", :rate => 20.0)
5
+ exempt_tax = Shoppe::TaxRate.create!(:name => "Exempt VAT", :rate => 0.0)
6
6
 
7
7
  # delivery services
8
8
 
9
- ds = Shoppe::DeliveryService.create!(:name => "Royal Mail (1st class)", :code => 'RMFC', :courier => 'Royal Mail', :tracking_url => 'http://royalmail.com/track/{{consignment_number}}')
10
- ds.delivery_service_prices.create!(:code => 'Parcel', :min_weight => 0, :max_weight => 0.050, :price => 0.60, :cost_price => 0.55, :tax_rate => exempt_tax, :country_ids => Shoppe::Country.where(:name => 'United Kingdom').pluck(:id))
9
+ ds = Shoppe::DeliveryService.create!(:name => "Next Day Delivery", :code => 'ND16', :courier => 'AnyCourier', :tracking_url => 'http://trackingurl.com/track/{{consignment_number}}')
10
+ ds.delivery_service_prices.create!(:code => 'Parcel', :min_weight => 0, :max_weight => 1, :price => 5.0, :cost_price => 4.50, :tax_rate => tax_rate)
11
+ ds.delivery_service_prices.create!(:code => 'Parcel', :min_weight => 1, :max_weight => 5, :price => 8.0, :cost_price => 7.5, :tax_rate => tax_rate)
12
+ ds.delivery_service_prices.create!(:code => 'Parcel', :min_weight => 5, :max_weight => 20, :price => 10.0, :cost_price => 9.50, :tax_rate => tax_rate)
11
13
 
12
-
13
- ds = Shoppe::DeliveryService.create!(:name => "Royal Mail (signed for)", :code => 'RMSF', :courier => 'Royal Mail', :tracking_url => 'http://royalmail.com/track/{{consignment_number}}')
14
- ds.delivery_service_prices.create!(:code => 'Parcel', :min_weight => 0, :max_weight => 1, :price => 5.0, :cost_price => 4.5, :tax_rate => tax_rate, :country_ids => Shoppe::Country.where(:name => 'United Kingdom').pluck(:id))
15
- ds.delivery_service_prices.create!(:code => 'Parcel', :min_weight => 1, :max_weight => 5, :price => 8.0, :cost_price => 7.5, :tax_rate => tax_rate, :country_ids => Shoppe::Country.where(:name => 'United Kingdom').pluck(:id))
16
- ds.delivery_service_prices.create!(:code => 'Parcel', :min_weight => 5, :max_weight => 10, :price => 10.0, :cost_price => 9.5, :tax_rate => tax_rate, :country_ids => Shoppe::Country.where(:name => 'United Kingdom').pluck(:id))
17
- ds.delivery_service_prices.create!(:code => 'Parcel', :min_weight => 10, :max_weight => 25, :price => 12.0, :cost_price => 11.5, :tax_rate => tax_rate, :country_ids => Shoppe::Country.where(:name => 'United Kingdom').pluck(:id))
18
- ds.delivery_service_prices.create!(:code => 'Parcel', :min_weight => 25, :max_weight => 50, :price => 16.25, :cost_price => 13.5, :tax_rate => tax_rate, :country_ids => Shoppe::Country.where(:name => 'United Kingdom').pluck(:id))
19
-
20
- ds = Shoppe::DeliveryService.create!(:name => "Next Day Delivery (before 4pm)", :default => true, :code => 'ND16', :courier => 'UPS', :tracking_url => 'http://trackingurl.com/track/{{consignment_number}}')
21
- ds.delivery_service_prices.create!(:code => 'Parcel', :min_weight => 0, :max_weight => 1, :price => 7.0, :cost_price => 5.5, :tax_rate => tax_rate, :country_ids => Shoppe::Country.where(:name => 'United Kingdom').pluck(:id))
22
- ds.delivery_service_prices.create!(:code => 'Parcel', :min_weight => 1, :max_weight => 5, :price => 9.0, :cost_price => 7.6, :tax_rate => tax_rate, :country_ids => Shoppe::Country.where(:name => 'United Kingdom').pluck(:id))
23
- ds.delivery_service_prices.create!(:code => 'Parcel', :min_weight => 5, :max_weight => 20, :price => 11.50, :cost_price => 8.9, :tax_rate => tax_rate, :country_ids => Shoppe::Country.where(:name => 'United Kingdom').pluck(:id))
24
-
25
- ds = Shoppe::DeliveryService.create!(:name => "Next Day Delivery (before 10am)", :code => 'NS10', :courier => 'UPS', :tracking_url => 'http://trackingurl.com/track/{{consignment_number}}')
26
- ds.delivery_service_prices.create!(:code => 'Parcel', :min_weight => 0, :max_weight => 1, :price => 17.0, :cost_price => 14.00, :tax_rate => tax_rate, :country_ids => Shoppe::Country.where(:name => 'United Kingdom').pluck(:id))
27
- ds.delivery_service_prices.create!(:code => 'Parcel', :min_weight => 1, :max_weight => 5, :price => 19.0, :cost_price => 16.00, :tax_rate => tax_rate, :country_ids => Shoppe::Country.where(:name => 'United Kingdom').pluck(:id))
28
- ds.delivery_service_prices.create!(:code => 'Parcel', :min_weight => 5, :max_weight => 20, :price => 27.0, :cost_price => 22.00, :tax_rate => tax_rate, :country_ids => Shoppe::Country.where(:name => 'United Kingdom').pluck(:id))
29
-
30
- ds = Shoppe::DeliveryService.create!(:name => "Saturday Delivery", :code => 'NDSA16', :courier => 'UPS', :tracking_url => 'http://trackingurl.com/track/{{consignment_number}}')
31
- ds.delivery_service_prices.create!(:code => 'Parcel', :min_weight => 0, :max_weight => 1, :price => 27.0, :cost_price => 24.00, :tax_rate => tax_rate, :country_ids => Shoppe::Country.where(:name => 'United Kingdom').pluck(:id))
32
- ds.delivery_service_prices.create!(:code => 'Parcel', :min_weight => 1, :max_weight => 5, :price => 29.0, :cost_price => 20.00, :tax_rate => tax_rate, :country_ids => Shoppe::Country.where(:name => 'United Kingdom').pluck(:id))
33
- ds.delivery_service_prices.create!(:code => 'Parcel', :min_weight => 5, :max_weight => 20, :price => 37.0, :cost_price => 32.00,:tax_rate => tax_rate, :country_ids => Shoppe::Country.where(:name => 'United Kingdom').pluck(:id))
14
+ ds = Shoppe::DeliveryService.create!(:name => "Saturday Delivery", :code => 'NDSA16', :courier => 'AnyCourier', :tracking_url => 'http://trackingurl.com/track/{{consignment_number}}')
15
+ ds.delivery_service_prices.create!(:code => 'Parcel', :min_weight => 0, :max_weight => 1, :price => 27.0, :cost_price => 24.00, :tax_rate => tax_rate)
16
+ ds.delivery_service_prices.create!(:code => 'Parcel', :min_weight => 1, :max_weight => 5, :price => 29.0, :cost_price => 20.00, :tax_rate => tax_rate)
17
+ ds.delivery_service_prices.create!(:code => 'Parcel', :min_weight => 5, :max_weight => 20, :price => 37.0, :cost_price => 32.00,:tax_rate => tax_rate)
34
18
 
35
19
  # categories
36
20
  cat1 = Shoppe::ProductCategory.create!(:name => 'VoIP Phones')
@@ -13,11 +13,6 @@ require 'nifty/attachments'
13
13
  require 'nifty/dialog'
14
14
 
15
15
  module Shoppe
16
-
17
- class Error < StandardError
18
- # The Shoppe::Error is the base class for all errors raised by Shoppe.
19
- end
20
-
21
16
  class << self
22
17
 
23
18
  # The path to the root of the Shoppe applicatinio
@@ -0,0 +1,21 @@
1
+ module Shoppe
2
+ class Error < StandardError
3
+
4
+ def initialize(options = {})
5
+ if options.is_a?(String)
6
+ @options = {:message => options}
7
+ else
8
+ @options = options
9
+ end
10
+ end
11
+
12
+ def message
13
+ @options[:message]
14
+ end
15
+
16
+ def options
17
+ @options
18
+ end
19
+
20
+ end
21
+ end
@@ -1,11 +1,6 @@
1
1
  module Shoppe
2
2
  module Errors
3
3
  class InappropriateDeliveryService < Error
4
-
5
- def initialize(options)
6
- @options = options
7
- end
8
-
9
4
  end
10
5
  end
11
6
  end
@@ -2,10 +2,6 @@ module Shoppe
2
2
  module Errors
3
3
  class InsufficientStockToFulfil < Error
4
4
 
5
- def initialize(options)
6
- @options = options
7
- end
8
-
9
5
  def order
10
6
  @options[:order]
11
7
  end
@@ -2,10 +2,6 @@ module Shoppe
2
2
  module Errors
3
3
  class NotEnoughStock < Error
4
4
 
5
- def initialize(options)
6
- @options = options
7
- end
8
-
9
5
  def available_stock
10
6
  @options[:ordered_item].stock
11
7
  end
@@ -1,15 +1,6 @@
1
1
  module Shoppe
2
2
  module Errors
3
- class PaymentDeclined < Error
4
-
5
- def initialize(options)
6
- @options = options
7
- end
8
-
9
- def message
10
- @options[:message]
11
- end
12
-
3
+ class PaymentDeclined < Shoppe::Error
13
4
  end
14
5
  end
15
6
  end
@@ -1,15 +1,6 @@
1
1
  module Shoppe
2
2
  module Errors
3
3
  class RefundFailed < Error
4
-
5
- def initialize(options)
6
- @options = options
7
- end
8
-
9
- def message
10
- @options[:message]
11
- end
12
-
13
4
  end
14
5
  end
15
6
  end
@@ -1,11 +1,6 @@
1
1
  module Shoppe
2
2
  module Errors
3
3
  class UnorderableItem < Error
4
-
5
- def initialize(options)
6
- @options = options
7
- end
8
-
9
4
  end
10
5
  end
11
6
  end