Class: Liquid::OrderDrop
- Inherits:
-
Drop
- Object
- Drop
- Liquid::OrderDrop
- Includes:
- Memery
- Defined in:
- app/models/liquid/order_drop.rb
Overview
Helper class scoped to Liquid.
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.
28 29 30 |
# File 'app/models/liquid/order_drop.rb', line 28 def initialize(order) @order = order end |
Instance Attribute Details
#order ⇒ Object (readonly)
Returns the value of attribute order.
7 8 9 |
# File 'app/models/liquid/order_drop.rb', line 7 def order @order end |
Class Method Details
.address_attributes_to_string(address_attrs) ⇒ Object
CLASS METHODS #
295 296 297 298 299 |
# File 'app/models/liquid/order_drop.rb', line 295 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
301 302 303 |
# File 'app/models/liquid/order_drop.rb', line 301 def self.deliveries_to_formatted_hash(deliveries) deliveries.to_h { |d| [delivery_to_string(d, deliveries.size), formatted_line_items_grouped(d.line_items.parents_only.goods)] } end |
.delivery_to_string(d, total_count) ⇒ Object
311 312 313 |
# File 'app/models/liquid/order_drop.rb', line 311 def self.delivery_to_string(d, total_count) "#{d.name(true)} of #{total_count}" end |
.formatted_line_items_grouped(line_items) ⇒ Object
315 316 317 318 319 320 321 322 323 324 325 326 327 |
# File 'app/models/liquid/order_drop.rb', line 315 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
305 306 307 308 309 |
# File 'app/models/liquid/order_drop.rb', line 305 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
283 284 285 286 287 288 289 |
# File 'app/models/liquid/order_drop.rb', line 283 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
50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 |
# File 'app/models/liquid/order_drop.rb', line 50 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 parent_lis.map do |li| { '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' => if (i = li.item) && i.canonical_path "https://#{WEB_HOSTNAME}#{i.canonical_url(locale: order.store_id == 2 ? 'en-CA' : 'en-US')}" end } end end |
#any_rooms_not_orderable? ⇒ Object
Alias for Order#any_rooms_not_orderable?
9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 |
# File 'app/models/liquid/order_drop.rb', line 9 delegate :company_review_url, :product_review_url, :reference_number, :created_at, :public_payment_link, :any_rooms_not_orderable?, :customer, :opportunity, :shipped_date, :line_total, :tax_total, :spiff_reward, :total_money, :po_number, :completely_shipped?, :funded_by_advance_replacement?, :id, to: :order |
#company_review_url ⇒ Object
Alias for Order#company_review_url
9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 |
# File 'app/models/liquid/order_drop.rb', line 9 delegate :company_review_url, :product_review_url, :reference_number, :created_at, :public_payment_link, :any_rooms_not_orderable?, :customer, :opportunity, :shipped_date, :line_total, :tax_total, :spiff_reward, :total_money, :po_number, :completely_shipped?, :funded_by_advance_replacement?, :id, to: :order |
#completely_shipped? ⇒ Object
Alias for Order#completely_shipped?
9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 |
# File 'app/models/liquid/order_drop.rb', line 9 delegate :company_review_url, :product_review_url, :reference_number, :created_at, :public_payment_link, :any_rooms_not_orderable?, :customer, :opportunity, :shipped_date, :line_total, :tax_total, :spiff_reward, :total_money, :po_number, :completely_shipped?, :funded_by_advance_replacement?, :id, to: :order |
#coupon_total ⇒ Object
263 264 265 |
# File 'app/models/liquid/order_drop.rb', line 263 def coupon_total order.line_discounts.sum(:amount) end |
#coupons ⇒ Object
253 254 255 256 257 |
# File 'app/models/liquid/order_drop.rb', line 253 def coupons order.discounts_grouped_by_coupon.map do |code, vals| { 'code' => code, 'title' => vals[:title], 'amount' => ActionController::Base.helpers.number_to_currency(vals[:amount]) } end end |
#created_at ⇒ Object
Alias for Order#created_at
9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 |
# File 'app/models/liquid/order_drop.rb', line 9 delegate :company_review_url, :product_review_url, :reference_number, :created_at, :public_payment_link, :any_rooms_not_orderable?, :customer, :opportunity, :shipped_date, :line_total, :tax_total, :spiff_reward, :total_money, :po_number, :completely_shipped?, :funded_by_advance_replacement?, :id, to: :order |
#customer ⇒ Object
Alias for Order#customer
9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 |
# File 'app/models/liquid/order_drop.rb', line 9 delegate :company_review_url, :product_review_url, :reference_number, :created_at, :public_payment_link, :any_rooms_not_orderable?, :customer, :opportunity, :shipped_date, :line_total, :tax_total, :spiff_reward, :total_money, :po_number, :completely_shipped?, :funded_by_advance_replacement?, :id, to: :order |
#customer_email ⇒ Object
222 223 224 225 226 227 228 229 230 231 232 233 234 235 236 237 238 239 240 241 242 243 |
# File 'app/models/liquid/order_drop.rb', line 222 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
216 217 218 219 |
# File 'app/models/liquid/order_drop.rb', line 216 def customer_full_name primary_party = order.primary_party primary_party&.full_name || customer&.full_name end |
#disclaimer ⇒ Object
150 151 152 |
# File 'app/models/liquid/order_drop.rb', line 150 def disclaimer GENERAL_DISCLAIMER_ON_PRODUCT_INSTALLATION_AND_LOCAL_CODES end |
#discounted_shipping_cost ⇒ Object
126 127 128 |
# File 'app/models/liquid/order_drop.rb', line 126 def discounted_shipping_cost ActionController::Base.helpers.number_to_currency(order.shipping_cost) end |
#formatted_coupon_total ⇒ Object
259 260 261 |
# File 'app/models/liquid/order_drop.rb', line 259 def formatted_coupon_total ActionController::Base.helpers.number_to_currency(order.line_discounts.sum(:amount)) end |
#formatted_tax_total ⇒ Object
104 105 106 |
# File 'app/models/liquid/order_drop.rb', line 104 def formatted_tax_total ActionController::Base.helpers.number_to_currency(order.tax_total) end |
#friendly_shipping_method ⇒ Object
116 117 118 119 120 121 122 123 124 |
# File 'app/models/liquid/order_drop.rb', line 116 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?
9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 |
# File 'app/models/liquid/order_drop.rb', line 9 delegate :company_review_url, :product_review_url, :reference_number, :created_at, :public_payment_link, :any_rooms_not_orderable?, :customer, :opportunity, :shipped_date, :line_total, :tax_total, :spiff_reward, :total_money, :po_number, :completely_shipped?, :funded_by_advance_replacement?, :id, to: :order |
#has_dropship_items? ⇒ Boolean
154 155 156 |
# File 'app/models/liquid/order_drop.rb', line 154 def has_dropship_items? order.line_items.any?(&:dropship?) end |
#has_out_of_stock_items? ⇒ Boolean
179 180 181 182 |
# File 'app/models/liquid/order_drop.rb', line 179 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
134 135 136 |
# File 'app/models/liquid/order_drop.rb', line 134 def has_po_number po_number.present? end |
#has_rooms_needing_layouts? ⇒ Boolean
192 193 194 |
# File 'app/models/liquid/order_drop.rb', line 192 def has_rooms_needing_layouts? rooms_needing_layouts.any? end |
#has_service_items? ⇒ Boolean
184 185 186 |
# File 'app/models/liquid/order_drop.rb', line 184 def has_service_items? order.line_items.any?(&:is_service?) end |
#id ⇒ Object
Alias for Order#id
9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 |
# File 'app/models/liquid/order_drop.rb', line 9 delegate :company_review_url, :product_review_url, :reference_number, :created_at, :public_payment_link, :any_rooms_not_orderable?, :customer, :opportunity, :shipped_date, :line_total, :tax_total, :spiff_reward, :total_money, :po_number, :completely_shipped?, :funded_by_advance_replacement?, :id, to: :order |
#installation_plan_request_link ⇒ Object
246 247 248 249 250 251 |
# File 'app/models/liquid/order_drop.rb', line 246 def installation_plan_request_link room_name_ref_pairs = rooms_needing_layouts.map { |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
267 268 269 |
# File 'app/models/liquid/order_drop.rb', line 267 def is_canada_order? order.store_id == 2 end |
#is_pickup? ⇒ Boolean
275 276 277 |
# File 'app/models/liquid/order_drop.rb', line 275 def is_pickup? order.is_warehouse_pickup? end |
#is_usa_order? ⇒ Boolean
271 272 273 |
# File 'app/models/liquid/order_drop.rb', line 271 def is_usa_order? order.store_id == 1 end |
#job_name ⇒ Object
138 139 140 |
# File 'app/models/liquid/order_drop.rb', line 138 def job_name order.opportunity&.name&.presence end |
#line_items_grouped_by_delivery_category ⇒ Object
75 76 77 |
# File 'app/models/liquid/order_drop.rb', line 75 def line_items_grouped_by_delivery_category self.class.deliveries_to_formatted_hash(order.completed_regular_deliveries) end |
#line_items_grouped_by_room ⇒ Object
80 81 82 83 84 85 86 87 88 89 90 91 92 93 94 95 96 97 98 |
# File 'app/models/liquid/order_drop.rb', line 80 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
9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 |
# File 'app/models/liquid/order_drop.rb', line 9 delegate :company_review_url, :product_review_url, :reference_number, :created_at, :public_payment_link, :any_rooms_not_orderable?, :customer, :opportunity, :shipped_date, :line_total, :tax_total, :spiff_reward, :total_money, :po_number, :completely_shipped?, :funded_by_advance_replacement?, :id, to: :order |
#lines_on_backorder ⇒ Object
Returns an array of formatted strings describing items on backorder
Used by the ORDER_BO_NOTIFY email template
160 161 162 163 164 165 166 167 168 169 170 171 172 173 174 175 176 |
# File 'app/models/liquid/order_drop.rb', line 160 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
130 131 132 |
# File 'app/models/liquid/order_drop.rb', line 130 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
9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 |
# File 'app/models/liquid/order_drop.rb', line 9 delegate :company_review_url, :product_review_url, :reference_number, :created_at, :public_payment_link, :any_rooms_not_orderable?, :customer, :opportunity, :shipped_date, :line_total, :tax_total, :spiff_reward, :total_money, :po_number, :completely_shipped?, :funded_by_advance_replacement?, :id, to: :order |
#po_number ⇒ Object
Alias for Order#po_number
9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 |
# File 'app/models/liquid/order_drop.rb', line 9 delegate :company_review_url, :product_review_url, :reference_number, :created_at, :public_payment_link, :any_rooms_not_orderable?, :customer, :opportunity, :shipped_date, :line_total, :tax_total, :spiff_reward, :total_money, :po_number, :completely_shipped?, :funded_by_advance_replacement?, :id, to: :order |
#product_review_url ⇒ Object
Alias for Order#product_review_url
9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 |
# File 'app/models/liquid/order_drop.rb', line 9 delegate :company_review_url, :product_review_url, :reference_number, :created_at, :public_payment_link, :any_rooms_not_orderable?, :customer, :opportunity, :shipped_date, :line_total, :tax_total, :spiff_reward, :total_money, :po_number, :completely_shipped?, :funded_by_advance_replacement?, :id, to: :order |
#public_payment_link ⇒ Object
Alias for Order#public_payment_link
9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 |
# File 'app/models/liquid/order_drop.rb', line 9 delegate :company_review_url, :product_review_url, :reference_number, :created_at, :public_payment_link, :any_rooms_not_orderable?, :customer, :opportunity, :shipped_date, :line_total, :tax_total, :spiff_reward, :total_money, :po_number, :completely_shipped?, :funded_by_advance_replacement?, :id, to: :order |
#quote_number ⇒ Object
142 143 144 |
# File 'app/models/liquid/order_drop.rb', line 142 def quote_number order.quote&.reference_number end |
#reference_number ⇒ Object
Alias for Order#reference_number
9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 |
# File 'app/models/liquid/order_drop.rb', line 9 delegate :company_review_url, :product_review_url, :reference_number, :created_at, :public_payment_link, :any_rooms_not_orderable?, :customer, :opportunity, :shipped_date, :line_total, :tax_total, :spiff_reward, :total_money, :po_number, :completely_shipped?, :funded_by_advance_replacement?, :id, to: :order |
#rep_email ⇒ Object
212 213 214 |
# File 'app/models/liquid/order_drop.rb', line 212 def rep_email customer.primary_sales_rep.try(:email) || INFO_EMAIL end |
#rma_number ⇒ Object
279 280 281 |
# File 'app/models/liquid/order_drop.rb', line 279 def rma_number order.rma.try(:rma_number) end |
#rooms_needing_layouts ⇒ Object
196 197 198 |
# File 'app/models/liquid/order_drop.rb', line 196 def rooms_needing_layouts order.room_configurations.select { |r| r.room_layout_image.nil? } end |
#rooms_needing_layouts_formatted ⇒ Object
200 201 202 |
# File 'app/models/liquid/order_drop.rb', line 200 def rooms_needing_layouts_formatted rooms_needing_layouts.map { |r| "#{r.name}: #{r.reference_number}" }.join("\r\n") end |
#rooms_needing_layouts_links ⇒ Object
204 205 206 207 208 209 210 |
# File 'app/models/liquid/order_drop.rb', line 204 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
188 189 190 |
# File 'app/models/liquid/order_drop.rb', line 188 def service_only_order? order.line_items.non_shipping.any? && order.line_items.non_shipping.all?(&:is_service?) end |
#ship_from_attributes ⇒ Object
37 38 39 |
# File 'app/models/liquid/order_drop.rb', line 37 def ship_from_attributes order.ship_from_attributes.stringify_keys end |
#ship_from_full_address ⇒ Object
46 47 48 |
# File 'app/models/liquid/order_drop.rb', line 46 def ship_from_full_address self.class.address_attributes_to_string ship_from_attributes end |
#ship_to_attributes ⇒ Object
32 33 34 |
# File 'app/models/liquid/order_drop.rb', line 32 def ship_to_attributes order.ship_to_attributes.stringify_keys end |
#ship_to_full_address ⇒ Object
42 43 44 |
# File 'app/models/liquid/order_drop.rb', line 42 def ship_to_full_address self.class.address_attributes_to_string ship_to_attributes end |
#shipments_tracking_lines ⇒ Object
146 147 148 |
# File 'app/models/liquid/order_drop.rb', line 146 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
9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 |
# File 'app/models/liquid/order_drop.rb', line 9 delegate :company_review_url, :product_review_url, :reference_number, :created_at, :public_payment_link, :any_rooms_not_orderable?, :customer, :opportunity, :shipped_date, :line_total, :tax_total, :spiff_reward, :total_money, :po_number, :completely_shipped?, :funded_by_advance_replacement?, :id, to: :order |
#spiff_reward ⇒ Object
Alias for Order#spiff_reward
9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 |
# File 'app/models/liquid/order_drop.rb', line 9 delegate :company_review_url, :product_review_url, :reference_number, :created_at, :public_payment_link, :any_rooms_not_orderable?, :customer, :opportunity, :shipped_date, :line_total, :tax_total, :spiff_reward, :total_money, :po_number, :completely_shipped?, :funded_by_advance_replacement?, :id, to: :order |
#tax_total ⇒ Object
Alias for Order#tax_total
9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 |
# File 'app/models/liquid/order_drop.rb', line 9 delegate :company_review_url, :product_review_url, :reference_number, :created_at, :public_payment_link, :any_rooms_not_orderable?, :customer, :opportunity, :shipped_date, :line_total, :tax_total, :spiff_reward, :total_money, :po_number, :completely_shipped?, :funded_by_advance_replacement?, :id, to: :order |
#taxes ⇒ Object
108 109 110 111 112 113 114 |
# File 'app/models/liquid/order_drop.rb', line 108 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
100 101 102 |
# File 'app/models/liquid/order_drop.rb', line 100 def total ActionController::Base.helpers.number_to_currency(order.total) end |
#total_money ⇒ Object
Alias for Order#total_money
9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 |
# File 'app/models/liquid/order_drop.rb', line 9 delegate :company_review_url, :product_review_url, :reference_number, :created_at, :public_payment_link, :any_rooms_not_orderable?, :customer, :opportunity, :shipped_date, :line_total, :tax_total, :spiff_reward, :total_money, :po_number, :completely_shipped?, :funded_by_advance_replacement?, :id, to: :order |