Class: Workarea::Pricing::Discount::InternationalOrder

Inherits:
Discount::Order
  • Object
show all
Defined in:
app/models/workarea/pricing/discount/international_order.rb

Instance Method Summary collapse

Instance Method Details

#itemsArray<Workarea::Order::Item>

Only return items that are discountable.

TODO this needs update in 3.4

Returns:

  • (Array<Workarea::Order::Item>)


11
12
13
14
15
# File 'app/models/workarea/pricing/discount/international_order.rb', line 11

def items
  @order.items.select(&:discountable?).select do |item|
    allow_sale_items? || !item.on_sale?
  end.map { |item| InternationalItemProxy.new(item) }
end

#subtotal_priceMoney

The subtotal, not including items that cannot be discounted.

Returns:

  • (Money)


21
22
23
24
25
# File 'app/models/workarea/pricing/discount/international_order.rb', line 21

def subtotal_price
  items.reduce(0.to_m(@order.currency)) do |memo, item|
    memo + item.international_price_adjustments.sum
  end
end