Sha256: 916ed0438ba2fb72218c7a1a1a2bd967e1611145007944345d604cd62a6cf054

Contents?: true

Size: 713 Bytes

Versions: 2

Compression:

Stored size: 713 Bytes

Contents

module Workarea
  module Pricing
    class Discount
      class InternationalItemProxy
        attr_reader :order_item
        delegate_missing_to :order_item

        def initialize(order_item)
          @order_item = order_item
        end

        def current_unit_price
          return 0.to_m(order.currency) if international_price_adjustments.blank?
          international_price_adjustments.adjusting('item').map(&:unit).sum.to_m
        end

        # Adds an international price adjustment to the item. Does not persist.
        #
        # @return [self]
        #
        def adjust_pricing(options = {})
          international_price_adjustments.build(options)
        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_item_proxy.rb
workarea-global_e-1.2.1 app/models/workarea/pricing/discount/international_item_proxy.rb