Class: Workarea::Pricing::OrderTotals
- Inherits:
-
Object
- Object
- Workarea::Pricing::OrderTotals
- Defined in:
- app/models/workarea/pricing/order_totals.rb
Instance Method Summary collapse
-
#initialize(order, shippings = []) ⇒ OrderTotals
constructor
A new instance of OrderTotals.
- #price_adjustments ⇒ Object
- #total ⇒ Object
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_adjustments ⇒ Object
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 |
#total ⇒ Object
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 |