Sha256: 5c11f90588e1dd96d50a5e95474b0cadf92cebffdcd5a828839f1cd840d34e07

Contents?: true

Size: 948 Bytes

Versions: 2

Compression:

Stored size: 948 Bytes

Contents

module Workarea
  decorate Storefront::OrderViewModel, with: :global_e do
    def subtotal_price
      return super unless model.global_e?

      model.international_subtotal_price
    end

    def total_price
      return super unless model.global_e?

      model.international_total_price
    end

    def shipping_total
      return super unless model.global_e?

      model.international_shipping_total
    end

    def total_adjustments
      return super unless model.global_e?

      @total_adjustments ||= international_price_adjustments.reduce_by_description('order')
    end

    def store_credit_amount
      if store_credit.present?
        store_credit.amount
      else
        0.to_m(order.currency)
      end
    end

    if Plugin.installed?(:gift_cards)
      def gift_card_tender_amount
        if gift_card?
          gift_card_tender.amount
        else
          0.to_m(order.currency)
        end
      end
    end
  end
end

Version data entries

2 entries across 2 versions & 1 rubygems

Version Path
workarea-global_e-1.3.0 app/view_models/workarea/storefront/order_view_model.decorator
workarea-global_e-1.2.1 app/view_models/workarea/storefront/order_view_model.decorator