Class: Workarea::Pricing::Discount::InternationalOrder
- Inherits:
-
Discount::Order
- Object
- Discount::Order
- Workarea::Pricing::Discount::InternationalOrder
- Defined in:
- app/models/workarea/pricing/discount/international_order.rb
Instance Method Summary collapse
-
#items ⇒ Array<Workarea::Order::Item>
Only return items that are discountable.
-
#subtotal_price ⇒ Money
The subtotal, not including items that cannot be discounted.
Instance Method Details
#items ⇒ Array<Workarea::Order::Item>
Only return items that are discountable.
TODO this needs update in 3.4
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_price ⇒ Money
The subtotal, not including items that cannot be discounted.
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 |