Sha256: b2aaf732d6e49b95bd2852d0f62cb0b3f62880f9f0b5a0ca5902d7c17555450e

Contents?: true

Size: 798 Bytes

Versions: 2

Compression:

Stored size: 798 Bytes

Contents

module Workarea
  module Pricing
    class Discount
      class InternationalOrder < Discount::Order
        # Only return items that are discountable.
        #
        # TODO this needs update in 3.4
        #
        # @return [Array<Workarea::Order::Item>]
        #
        def items
          @order.items.select(&:discountable?).select do |item|
            allow_sale_items? || !item.on_sale?
          end.map { |item| InternationalItemProxy.new(item) }
        end

        # The subtotal, not including items that cannot be discounted.
        #
        # @return [Money]
        #
        def subtotal_price
          items.reduce(0.to_m(@order.currency)) do |memo, item|
            memo + item.international_price_adjustments.sum
          end
        end
      end
    end
  end
end

Version data entries

2 entries across 2 versions & 1 rubygems

Version Path
workarea-global_e-1.3.0 app/models/workarea/pricing/discount/international_order.rb
workarea-global_e-1.2.1 app/models/workarea/pricing/discount/international_order.rb