Class: Liquid::OrderDrop
- Inherits:
-
Drop
- Object
- Drop
- Liquid::OrderDrop
- Includes:
- Memery
- Defined in:
- app/models/liquid/order_drop.rb
Instance Attribute Summary collapse
-
#order ⇒ Object
readonly
Returns the value of attribute order.
Delegated Instance Attributes collapse
-
#any_rooms_not_orderable? ⇒ Object
Alias for Order#any_rooms_not_orderable?.
-
#company_review_url ⇒ Object
Alias for Order#company_review_url.
-
#completely_shipped? ⇒ Object
Alias for Order#completely_shipped?.
-
#created_at ⇒ Object
Alias for Order#created_at.
-
#customer ⇒ Object
Alias for Order#customer.
-
#funded_by_advance_replacement? ⇒ Object
Alias for Order#funded_by_advance_replacement?.
-
#id ⇒ Object
Alias for Order#id.
-
#line_total ⇒ Object
Alias for Order#line_total.
-
#opportunity ⇒ Object
Alias for Order#opportunity.
-
#po_number ⇒ Object
Alias for Order#po_number.
-
#product_review_url ⇒ Object
Alias for Order#product_review_url.
-
#public_payment_link ⇒ Object
Alias for Order#public_payment_link.
-
#reference_number ⇒ Object
Alias for Order#reference_number.
-
#shipped_date ⇒ Object
Alias for Order#shipped_date.
-
#spiff_reward ⇒ Object
Alias for Order#spiff_reward.
-
#tax_total ⇒ Object
Alias for Order#tax_total.
-
#total_money ⇒ Object
Alias for Order#total_money.
Class Method Summary collapse
-
.address_attributes_to_string(address_attrs) ⇒ Object
CLASS METHODS #.
- .deliveries_to_formatted_hash(deliveries) ⇒ Object
- .delivery_to_string(d, total_count) ⇒ Object
- .formatted_line_items_grouped(line_items) ⇒ Object
- .line_item_to_string(li, count) ⇒ Object
Instance Method Summary collapse
- #abandoned_cart_url ⇒ Object
- #all_line_items ⇒ Object
- #coupon_total ⇒ Object
- #coupons ⇒ Object
- #customer_email ⇒ Object
- #customer_full_name ⇒ Object
- #disclaimer ⇒ Object
- #discounted_shipping_cost ⇒ Object
- #formatted_coupon_total ⇒ Object
- #formatted_tax_total ⇒ Object
- #friendly_shipping_method ⇒ Object
- #has_dropship_items? ⇒ Boolean
- #has_out_of_stock_items? ⇒ Boolean
- #has_po_number ⇒ Object
- #has_rooms_needing_layouts? ⇒ Boolean
- #has_service_items? ⇒ Boolean
-
#initialize(order) ⇒ OrderDrop
constructor
A new instance of OrderDrop.
- #installation_plan_request_link ⇒ Object
- #is_canada_order? ⇒ Boolean
- #is_pickup? ⇒ Boolean
- #is_usa_order? ⇒ Boolean
- #job_name ⇒ Object
- #line_items_grouped_by_delivery_category ⇒ Object
- #line_items_grouped_by_room ⇒ Object
-
#lines_on_backorder ⇒ Object
Returns an array of formatted strings describing items on backorder Used by the ORDER_BO_NOTIFY email template.
- #msrp_shipping_cost ⇒ Object
- #quote_number ⇒ Object
- #rep_email ⇒ Object
- #rma_number ⇒ Object
- #rooms_needing_layouts ⇒ Object
- #rooms_needing_layouts_formatted ⇒ Object
- #rooms_needing_layouts_links ⇒ Object
- #service_only_order? ⇒ Boolean
- #ship_from_attributes ⇒ Object
- #ship_from_full_address ⇒ Object
- #ship_to_attributes ⇒ Object
- #ship_to_full_address ⇒ Object
- #shipments_tracking_lines ⇒ Object
- #taxes ⇒ Object
- #total ⇒ Object
Constructor Details
#initialize(order) ⇒ OrderDrop
Returns a new instance of OrderDrop.
29 30 31 |
# File 'app/models/liquid/order_drop.rb', line 29 def initialize(order) @order = order end |
Instance Attribute Details
#order ⇒ Object (readonly)
Returns the value of attribute order.
6 7 8 |
# File 'app/models/liquid/order_drop.rb', line 6 def order @order end |
Class Method Details
.address_attributes_to_string(address_attrs) ⇒ Object
CLASS METHODS #
298 299 300 301 302 |
# File 'app/models/liquid/order_drop.rb', line 298 def self.address_attributes_to_string(address_attrs) addr_arr = [address_attrs['name'], address_attrs['attention_name']] addr_arr += address_attrs['address'].to_array(include_recipient: false) if address_attrs['address'] addr_arr.uniq.join('<br>') end |
.deliveries_to_formatted_hash(deliveries) ⇒ Object
304 305 306 |
# File 'app/models/liquid/order_drop.rb', line 304 def self.deliveries_to_formatted_hash(deliveries) deliveries.each_with_object({}) { |d, hsh| hsh[delivery_to_string(d, deliveries.size)] = formatted_line_items_grouped(d.line_items.parents_only.goods) } end |
.delivery_to_string(d, total_count) ⇒ Object
314 315 316 |
# File 'app/models/liquid/order_drop.rb', line 314 def self.delivery_to_string(d, total_count) "#{d.name(short = true)} of #{total_count}" end |
.formatted_line_items_grouped(line_items) ⇒ Object
318 319 320 321 322 323 324 325 326 327 328 329 330 |
# File 'app/models/liquid/order_drop.rb', line 318 def self.formatted_line_items_grouped(line_items) lines_by_category = {} line_items.group_by(&:category_name).each do |category, line_items_grouped_by_category| lines_by_category[category] = [] line_items_grouped_by_category.group_by(&:serial_number_id).each do |_serial_number_id, line_items_grouped_by_serial_number| line_items_grouped_by_serial_number.group_by(&:item_id).each do |_item_id, line_items_grouped_by_item| count = line_items_grouped_by_item.sum(&:quantity) lines_by_category[category] << line_item_to_string(line_items_grouped_by_item.first, count) end end end lines_by_category end |
.line_item_to_string(li, count) ⇒ Object
308 309 310 311 312 |
# File 'app/models/liquid/order_drop.rb', line 308 def self.line_item_to_string(li, count) line_items_text = "#{count} of #{li.name} [#{li.sku}]" line_items_text << ", serial number: #{li.serial_number}" if li.serial_number.present? line_items_text end |
Instance Method Details
#abandoned_cart_url ⇒ Object
286 287 288 289 290 291 292 |
# File 'app/models/liquid/order_drop.rb', line 286 def abandoned_cart_url return UrlHelper.instance.my_cart_url(host: 'https://' + WEB_HOSTNAME) if customer.account.nil? customer.account.signed_login_url( UrlHelper.instance.retrieve_my_cart_url(host: 'https://' + WEB_HOSTNAME) ) end |
#all_line_items ⇒ Object
51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 |
# File 'app/models/liquid/order_drop.rb', line 51 def all_line_items parent_lis = order.line_items.parents_only.non_shipping.includes(item: :primary_product_line).to_a pls = parent_lis.filter_map { |li| li.item&.primary_product_line }.uniq(&:id) if pls.any? paths = ProductLine.canonical_paths_for(pls) pls.each { |pl| pl.instance_variable_set(:@canonical_path, paths[pl.id]) } end line_items = [] parent_lis.each do |li| line_items << { 'sku' => li.sku, 'qty' => li.quantity, 'name' => li.name, 'unit_msrp_cost' => ActionController::Base.helpers.number_to_currency(li.price), 'msrp_total' => ActionController::Base.helpers.number_to_currency(li.price_total), 'unit_discounted_cost' => ActionController::Base.helpers.number_to_currency(li.discounted_price), 'discounted_total' => ActionController::Base.helpers.number_to_currency(li.total), 'discount' => ActionController::Base.helpers.number_to_currency(li.discounted_total - li.price_total), 'serial_number' => li.serial_number, 'redemption_code' => li.redemption_code, 'url' => (i = li.item) && i.canonical_path ? "https://#{WEB_HOSTNAME}#{i.canonical_url(locale: order.store_id == 2 ? 'en-CA' : 'en-US')}" : nil } end line_items end |
#any_rooms_not_orderable? ⇒ Object
Alias for Order#any_rooms_not_orderable?
8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 |
# File 'app/models/liquid/order_drop.rb', line 8 delegate :company_review_url, :product_review_url, :reference_number, :created_at, :public_payment_link, :any_rooms_not_orderable?, :reference_number, :customer, :opportunity, :shipped_date, :line_total, :tax_total, :spiff_reward, :total_money, :po_number, :completely_shipped?, :funded_by_advance_replacement?, :id, :public_payment_link, to: :order |
#company_review_url ⇒ Object
Alias for Order#company_review_url
8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 |
# File 'app/models/liquid/order_drop.rb', line 8 delegate :company_review_url, :product_review_url, :reference_number, :created_at, :public_payment_link, :any_rooms_not_orderable?, :reference_number, :customer, :opportunity, :shipped_date, :line_total, :tax_total, :spiff_reward, :total_money, :po_number, :completely_shipped?, :funded_by_advance_replacement?, :id, :public_payment_link, to: :order |
#completely_shipped? ⇒ Object
Alias for Order#completely_shipped?
8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 |
# File 'app/models/liquid/order_drop.rb', line 8 delegate :company_review_url, :product_review_url, :reference_number, :created_at, :public_payment_link, :any_rooms_not_orderable?, :reference_number, :customer, :opportunity, :shipped_date, :line_total, :tax_total, :spiff_reward, :total_money, :po_number, :completely_shipped?, :funded_by_advance_replacement?, :id, :public_payment_link, to: :order |
#coupon_total ⇒ Object
266 267 268 |
# File 'app/models/liquid/order_drop.rb', line 266 def coupon_total order.line_discounts.sum(:amount) end |
#coupons ⇒ Object
254 255 256 257 258 259 260 |
# File 'app/models/liquid/order_drop.rb', line 254 def coupons coupons = [] order.discounts_grouped_by_coupon.each do |code, vals| coupons << { 'code' => code, 'title' => vals[:title], 'amount' => ActionController::Base.helpers.number_to_currency(vals[:amount]) } end coupons end |
#created_at ⇒ Object
Alias for Order#created_at
8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 |
# File 'app/models/liquid/order_drop.rb', line 8 delegate :company_review_url, :product_review_url, :reference_number, :created_at, :public_payment_link, :any_rooms_not_orderable?, :reference_number, :customer, :opportunity, :shipped_date, :line_total, :tax_total, :spiff_reward, :total_money, :po_number, :completely_shipped?, :funded_by_advance_replacement?, :id, :public_payment_link, to: :order |
#customer ⇒ Object
Alias for Order#customer
8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 |
# File 'app/models/liquid/order_drop.rb', line 8 delegate :company_review_url, :product_review_url, :reference_number, :created_at, :public_payment_link, :any_rooms_not_orderable?, :reference_number, :customer, :opportunity, :shipped_date, :line_total, :tax_total, :spiff_reward, :total_money, :po_number, :completely_shipped?, :funded_by_advance_replacement?, :id, :public_payment_link, to: :order |
#customer_email ⇒ Object
223 224 225 226 227 228 229 230 231 232 233 234 235 236 237 238 239 240 241 242 243 244 |
# File 'app/models/liquid/order_drop.rb', line 223 def customer_email primary_party = order.primary_party # Try primary party (contact) email first email = primary_party&.email # Fall back to tracking_email if present email ||= order.tracking_email&.first # Fall back to customer email email ||= customer&.email # Fall back to primary party account email email ||= begin primary_party.account.email if primary_party&.respond_to?(:account) && primary_party.account rescue StandardError nil end # Fall back to customer account email email ||= begin customer.account.email if customer&.respond_to?(:account) && customer.account rescue StandardError nil end email end |
#customer_full_name ⇒ Object
217 218 219 220 |
# File 'app/models/liquid/order_drop.rb', line 217 def customer_full_name primary_party = order.primary_party primary_party&.full_name || customer&.full_name end |
#disclaimer ⇒ Object
151 152 153 |
# File 'app/models/liquid/order_drop.rb', line 151 def disclaimer GENERAL_DISCLAIMER_ON_PRODUCT_INSTALLATION_AND_LOCAL_CODES end |
#discounted_shipping_cost ⇒ Object
127 128 129 |
# File 'app/models/liquid/order_drop.rb', line 127 def discounted_shipping_cost ActionController::Base.helpers.number_to_currency(order.shipping_cost) end |
#formatted_coupon_total ⇒ Object
262 263 264 |
# File 'app/models/liquid/order_drop.rb', line 262 def formatted_coupon_total ActionController::Base.helpers.number_to_currency(order.line_discounts.sum(:amount)) end |
#formatted_tax_total ⇒ Object
105 106 107 |
# File 'app/models/liquid/order_drop.rb', line 105 def formatted_tax_total ActionController::Base.helpers.number_to_currency(order.tax_total) end |
#friendly_shipping_method ⇒ Object
117 118 119 120 121 122 123 124 125 |
# File 'app/models/liquid/order_drop.rb', line 117 def friendly_shipping_method if order.is_warehouse_pickup? 'Warehouse Pickup' elsif order.friendly_shipping_method == 'Override' 'Shipping' else order.friendly_shipping_method end end |
#funded_by_advance_replacement? ⇒ Object
Alias for Order#funded_by_advance_replacement?
8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 |
# File 'app/models/liquid/order_drop.rb', line 8 delegate :company_review_url, :product_review_url, :reference_number, :created_at, :public_payment_link, :any_rooms_not_orderable?, :reference_number, :customer, :opportunity, :shipped_date, :line_total, :tax_total, :spiff_reward, :total_money, :po_number, :completely_shipped?, :funded_by_advance_replacement?, :id, :public_payment_link, to: :order |
#has_dropship_items? ⇒ Boolean
155 156 157 |
# File 'app/models/liquid/order_drop.rb', line 155 def has_dropship_items? order.line_items.any?(&:dropship?) end |
#has_out_of_stock_items? ⇒ Boolean
180 181 182 183 |
# File 'app/models/liquid/order_drop.rb', line 180 def has_out_of_stock_items? item_availability = LineItem.availability_hash(order.line_items) order.line_items.any? { |li| li.show_out_of_stock?(item_availability) } end |
#has_po_number ⇒ Object
135 136 137 |
# File 'app/models/liquid/order_drop.rb', line 135 def has_po_number po_number.present? end |
#has_rooms_needing_layouts? ⇒ Boolean
193 194 195 |
# File 'app/models/liquid/order_drop.rb', line 193 def has_rooms_needing_layouts? rooms_needing_layouts.any? end |
#has_service_items? ⇒ Boolean
185 186 187 |
# File 'app/models/liquid/order_drop.rb', line 185 def has_service_items? order.line_items.any?(&:is_service?) end |
#id ⇒ Object
Alias for Order#id
8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 |
# File 'app/models/liquid/order_drop.rb', line 8 delegate :company_review_url, :product_review_url, :reference_number, :created_at, :public_payment_link, :any_rooms_not_orderable?, :reference_number, :customer, :opportunity, :shipped_date, :line_total, :tax_total, :spiff_reward, :total_money, :po_number, :completely_shipped?, :funded_by_advance_replacement?, :id, :public_payment_link, to: :order |
#installation_plan_request_link ⇒ Object
247 248 249 250 251 252 |
# File 'app/models/liquid/order_drop.rb', line 247 def installation_plan_request_link room_name_ref_pairs = rooms_needing_layouts.collect { |r| "#{r.name}: #{r.reference_number}" } subject = CGI.escape("INSTALLATION PLAN REQUEST FOR ORDER # #{order.reference_number}") body = CGI.escape("Attached please find room floor plan attachments for each of the following rooms:\r\n\r\n" + room_name_ref_pairs.join("\r\n") + "\r\n\r\nPlease send me free installation plans for these rooms.") "mailto:#{rep_email}?subject=#{subject}&body=#{body}" end |
#is_canada_order? ⇒ Boolean
270 271 272 |
# File 'app/models/liquid/order_drop.rb', line 270 def is_canada_order? order.store_id == 2 end |
#is_pickup? ⇒ Boolean
278 279 280 |
# File 'app/models/liquid/order_drop.rb', line 278 def is_pickup? order.is_warehouse_pickup? end |
#is_usa_order? ⇒ Boolean
274 275 276 |
# File 'app/models/liquid/order_drop.rb', line 274 def is_usa_order? order.store_id == 1 end |
#job_name ⇒ Object
139 140 141 |
# File 'app/models/liquid/order_drop.rb', line 139 def job_name order.opportunity&.name&.presence end |
#line_items_grouped_by_delivery_category ⇒ Object
76 77 78 |
# File 'app/models/liquid/order_drop.rb', line 76 def line_items_grouped_by_delivery_category self.class.deliveries_to_formatted_hash(order.completed_regular_deliveries) end |
#line_items_grouped_by_room ⇒ Object
81 82 83 84 85 86 87 88 89 90 91 92 93 94 95 96 97 98 99 |
# File 'app/models/liquid/order_drop.rb', line 81 def line_items_grouped_by_room line_items = {} order.line_items.parents_only.non_shipping.group_by { |li| li.room_configuration.try(:name_with_config) || 'Other Items' }.each do |rc, lines| line_items[rc] = [] lines.each do |li| line_items[rc] << { 'sku' => li.sku, 'qty' => li.quantity, 'name' => li.name, 'unit_msrp_cost' => ActionController::Base.helpers.number_to_currency(li.price), 'msrp_total' => ActionController::Base.helpers.number_to_currency(li.price_total), 'unit_discounted_cost' => ActionController::Base.helpers.number_to_currency(li.discounted_price), 'discounted_total' => ActionController::Base.helpers.number_to_currency(li.total), 'discount' => ActionController::Base.helpers.number_to_currency(li.discounted_total - li.price_total), 'serial_number' => li.serial_number, 'redemption_code' => li.redemption_code } end end line_items end |
#line_total ⇒ Object
Alias for Order#line_total
8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 |
# File 'app/models/liquid/order_drop.rb', line 8 delegate :company_review_url, :product_review_url, :reference_number, :created_at, :public_payment_link, :any_rooms_not_orderable?, :reference_number, :customer, :opportunity, :shipped_date, :line_total, :tax_total, :spiff_reward, :total_money, :po_number, :completely_shipped?, :funded_by_advance_replacement?, :id, :public_payment_link, to: :order |
#lines_on_backorder ⇒ Object
Returns an array of formatted strings describing items on backorder
Used by the ORDER_BO_NOTIFY email template
161 162 163 164 165 166 167 168 169 170 171 172 173 174 175 176 177 |
# File 'app/models/liquid/order_drop.rb', line 161 def lines_on_backorder lines = [] item_groups = Inventory::OrderedRemainingItems.new.process(order, nest_kit_components: true).item_groups item_groups.each do |_line_item_id, line_info| next unless line_info[:shortage]&.negative? # Skip those with stock = "#{line_info[:name]} (#{line_info[:sku]})" << ", #{line_info[:shortage].abs} on backorder" promised_delivery_date = line_info.dig(:on_order, 0, :promised_delivery_date) if promised_delivery_date && (promised_delivery_date > Date.current) promised_delivery_date_formatted = promised_delivery_date.strftime('%B %d, %Y') << ", we expect to have this item back in stock on #{promised_delivery_date_formatted}" end lines << end lines end |
#msrp_shipping_cost ⇒ Object
131 132 133 |
# File 'app/models/liquid/order_drop.rb', line 131 def msrp_shipping_cost ActionController::Base.helpers.number_to_currency(order.line_items.shipping_only.to_a.sum(&:price_total)) end |
#opportunity ⇒ Object
Alias for Order#opportunity
8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 |
# File 'app/models/liquid/order_drop.rb', line 8 delegate :company_review_url, :product_review_url, :reference_number, :created_at, :public_payment_link, :any_rooms_not_orderable?, :reference_number, :customer, :opportunity, :shipped_date, :line_total, :tax_total, :spiff_reward, :total_money, :po_number, :completely_shipped?, :funded_by_advance_replacement?, :id, :public_payment_link, to: :order |
#po_number ⇒ Object
Alias for Order#po_number
8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 |
# File 'app/models/liquid/order_drop.rb', line 8 delegate :company_review_url, :product_review_url, :reference_number, :created_at, :public_payment_link, :any_rooms_not_orderable?, :reference_number, :customer, :opportunity, :shipped_date, :line_total, :tax_total, :spiff_reward, :total_money, :po_number, :completely_shipped?, :funded_by_advance_replacement?, :id, :public_payment_link, to: :order |
#product_review_url ⇒ Object
Alias for Order#product_review_url
8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 |
# File 'app/models/liquid/order_drop.rb', line 8 delegate :company_review_url, :product_review_url, :reference_number, :created_at, :public_payment_link, :any_rooms_not_orderable?, :reference_number, :customer, :opportunity, :shipped_date, :line_total, :tax_total, :spiff_reward, :total_money, :po_number, :completely_shipped?, :funded_by_advance_replacement?, :id, :public_payment_link, to: :order |
#public_payment_link ⇒ Object
Alias for Order#public_payment_link
8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 |
# File 'app/models/liquid/order_drop.rb', line 8 delegate :company_review_url, :product_review_url, :reference_number, :created_at, :public_payment_link, :any_rooms_not_orderable?, :reference_number, :customer, :opportunity, :shipped_date, :line_total, :tax_total, :spiff_reward, :total_money, :po_number, :completely_shipped?, :funded_by_advance_replacement?, :id, :public_payment_link, to: :order |
#quote_number ⇒ Object
143 144 145 |
# File 'app/models/liquid/order_drop.rb', line 143 def quote_number order.quote&.reference_number end |
#reference_number ⇒ Object
Alias for Order#reference_number
8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 |
# File 'app/models/liquid/order_drop.rb', line 8 delegate :company_review_url, :product_review_url, :reference_number, :created_at, :public_payment_link, :any_rooms_not_orderable?, :reference_number, :customer, :opportunity, :shipped_date, :line_total, :tax_total, :spiff_reward, :total_money, :po_number, :completely_shipped?, :funded_by_advance_replacement?, :id, :public_payment_link, to: :order |
#rep_email ⇒ Object
213 214 215 |
# File 'app/models/liquid/order_drop.rb', line 213 def rep_email customer.primary_sales_rep.try(:email) || INFO_EMAIL end |
#rma_number ⇒ Object
282 283 284 |
# File 'app/models/liquid/order_drop.rb', line 282 def rma_number order.rma.try(:rma_number) end |
#rooms_needing_layouts ⇒ Object
197 198 199 |
# File 'app/models/liquid/order_drop.rb', line 197 def rooms_needing_layouts order.room_configurations.find_all { |r| r.room_layout_image.nil? } end |
#rooms_needing_layouts_formatted ⇒ Object
201 202 203 |
# File 'app/models/liquid/order_drop.rb', line 201 def rooms_needing_layouts_formatted rooms_needing_layouts.collect { |r| "#{r.name}: #{r.reference_number}" }.join("\r\n") end |
#rooms_needing_layouts_links ⇒ Object
205 206 207 208 209 210 211 |
# File 'app/models/liquid/order_drop.rb', line 205 def rooms_needing_layouts_links links = {} rooms_needing_layouts.each do |r| links[r.name_with_room_and_opp] = "https://#{WEB_HOSTNAME}#{r.public_path}" end links end |
#service_only_order? ⇒ Boolean
189 190 191 |
# File 'app/models/liquid/order_drop.rb', line 189 def service_only_order? order.line_items.non_shipping.any? && order.line_items.non_shipping.all?(&:is_service?) end |
#ship_from_attributes ⇒ Object
38 39 40 |
# File 'app/models/liquid/order_drop.rb', line 38 def ship_from_attributes order.ship_from_attributes.stringify_keys end |
#ship_from_full_address ⇒ Object
47 48 49 |
# File 'app/models/liquid/order_drop.rb', line 47 def ship_from_full_address self.class.address_attributes_to_string ship_from_attributes end |
#ship_to_attributes ⇒ Object
33 34 35 |
# File 'app/models/liquid/order_drop.rb', line 33 def ship_to_attributes order.ship_to_attributes.stringify_keys end |
#ship_to_full_address ⇒ Object
43 44 45 |
# File 'app/models/liquid/order_drop.rb', line 43 def ship_to_full_address self.class.address_attributes_to_string ship_to_attributes end |
#shipments_tracking_lines ⇒ Object
147 148 149 |
# File 'app/models/liquid/order_drop.rb', line 147 def shipments_tracking_lines order.shipments.completed.map { |s| "#{s.carrier}: <a href='#{s.tracking_link}'>#{s.tracking_number}</a>" } end |
#shipped_date ⇒ Object
Alias for Order#shipped_date
8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 |
# File 'app/models/liquid/order_drop.rb', line 8 delegate :company_review_url, :product_review_url, :reference_number, :created_at, :public_payment_link, :any_rooms_not_orderable?, :reference_number, :customer, :opportunity, :shipped_date, :line_total, :tax_total, :spiff_reward, :total_money, :po_number, :completely_shipped?, :funded_by_advance_replacement?, :id, :public_payment_link, to: :order |
#spiff_reward ⇒ Object
Alias for Order#spiff_reward
8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 |
# File 'app/models/liquid/order_drop.rb', line 8 delegate :company_review_url, :product_review_url, :reference_number, :created_at, :public_payment_link, :any_rooms_not_orderable?, :reference_number, :customer, :opportunity, :shipped_date, :line_total, :tax_total, :spiff_reward, :total_money, :po_number, :completely_shipped?, :funded_by_advance_replacement?, :id, :public_payment_link, to: :order |
#tax_total ⇒ Object
Alias for Order#tax_total
8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 |
# File 'app/models/liquid/order_drop.rb', line 8 delegate :company_review_url, :product_review_url, :reference_number, :created_at, :public_payment_link, :any_rooms_not_orderable?, :reference_number, :customer, :opportunity, :shipped_date, :line_total, :tax_total, :spiff_reward, :total_money, :po_number, :completely_shipped?, :funded_by_advance_replacement?, :id, :public_payment_link, to: :order |
#taxes ⇒ Object
109 110 111 112 113 114 115 |
# File 'app/models/liquid/order_drop.rb', line 109 def taxes taxes = {} order.taxes_grouped_by_type.each do |_code, tax_info| taxes[tax_info[:name]] = ActionController::Base.helpers.number_to_currency(tax_info[:tax_amount]) end taxes end |
#total ⇒ Object
101 102 103 |
# File 'app/models/liquid/order_drop.rb', line 101 def total ActionController::Base.helpers.number_to_currency(order.total) end |
#total_money ⇒ Object
Alias for Order#total_money
8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 |
# File 'app/models/liquid/order_drop.rb', line 8 delegate :company_review_url, :product_review_url, :reference_number, :created_at, :public_payment_link, :any_rooms_not_orderable?, :reference_number, :customer, :opportunity, :shipped_date, :line_total, :tax_total, :spiff_reward, :total_money, :po_number, :completely_shipped?, :funded_by_advance_replacement?, :id, :public_payment_link, to: :order |