Sha256: 8ac41ff6f0d22c136115cbafab9ea16f061a5f667977c14e1d153f2b7e0a9a32

Contents?: true

Size: 756 Bytes

Versions: 9

Compression:

Stored size: 756 Bytes

Contents

module Spree
  module Tax
    # Add tax adjustments to all line items and shipments in an order
    class OrderAdjuster
      attr_reader :order

      include TaxHelpers

      # @param [Spree::Order] order to be adjusted
      def initialize(order)
        @order = order
      end

      # Creates tax adjustments for all taxable items (shipments and line items)
      # in the given order.
      def adjust!
        (order.line_items + order.shipments).each do |item|
          ItemAdjuster.new(item, order_wide_options).adjust!
        end
      end

      private

      def order_wide_options
        {
          rates_for_order: rates_for_order(order),
          rates_for_default_zone: rates_for_default_zone
        }
      end
    end
  end
end

Version data entries

9 entries across 9 versions & 1 rubygems

Version Path
solidus_core-2.2.2 app/models/spree/tax/order_adjuster.rb
solidus_core-2.1.1 app/models/spree/tax/order_adjuster.rb
solidus_core-2.2.1 app/models/spree/tax/order_adjuster.rb
solidus_core-2.2.0 app/models/spree/tax/order_adjuster.rb
solidus_core-2.2.0.rc1 app/models/spree/tax/order_adjuster.rb
solidus_core-2.2.0.beta1 app/models/spree/tax/order_adjuster.rb
solidus_core-2.1.0 app/models/spree/tax/order_adjuster.rb
solidus_core-2.1.0.rc1 app/models/spree/tax/order_adjuster.rb
solidus_core-2.1.0.beta1 app/models/spree/tax/order_adjuster.rb