Class: Workarea::Pricing::OrderTotals

Inherits:
Object
  • Object
show all
Defined in:
app/models/workarea/pricing/order_totals.rb

Instance Method Summary collapse

Constructor Details

#initialize(order, shippings = []) ⇒ OrderTotals

Returns a new instance of OrderTotals.



4
5
6
7
# File 'app/models/workarea/pricing/order_totals.rb', line 4

def initialize(order, shippings = [])
  @order = order
  @shippings = shippings
end

Instance Method Details

#price_adjustmentsObject



18
19
20
21
# File 'app/models/workarea/pricing/order_totals.rb', line 18

def price_adjustments
  @price_adjustments ||= @order.price_adjustments +
                          @shippings.map(&:price_adjustments).reduce(:+)
end

#totalObject



9
10
11
12
13
14
15
16
# File 'app/models/workarea/pricing/order_totals.rb', line 9

def total
  set_item_totals
  set_subtotal
  set_shipping_totals
  set_tax_totals
  set_total
  set_total_value
end