Sha256: 87085763dcd0a99882aa424af6c2732b54fe491656b2751fb5eca711f7b8a6e7

Contents?: true

Size: 754 Bytes

Versions: 165

Compression:

Stored size: 754 Bytes

Contents

module Spree
  module Adjustable
    module Adjuster
      class Tax < Spree::Adjustable::Adjuster::Base
        def update
          tax = adjustments.tax
          included_tax_total = tax.is_included.reload.map(&:update!).compact.sum
          additional_tax_total = tax.additional.reload.map(&:update!).compact.sum

          update_totals(included_tax_total, additional_tax_total)
        end

        private

        def adjustments
          adjustable.try(:all_adjustments) || adjustable.adjustments
        end

        def update_totals(included_tax_total, additional_tax_total)
          @totals[:included_tax_total] = included_tax_total
          @totals[:additional_tax_total] = additional_tax_total
        end
      end
    end
  end
end

Version data entries

165 entries across 165 versions & 1 rubygems

Version Path
spree_core-4.10.1 app/models/spree/adjustable/adjuster/tax.rb
spree_core-4.10.0 app/models/spree/adjustable/adjuster/tax.rb
spree_core-4.9.0 app/models/spree/adjustable/adjuster/tax.rb
spree_core-4.8.3 app/models/spree/adjustable/adjuster/tax.rb
spree_core-4.8.2 app/models/spree/adjustable/adjuster/tax.rb
spree_core-4.7.3 app/models/spree/adjustable/adjuster/tax.rb
spree_core-4.6.6 app/models/spree/adjustable/adjuster/tax.rb
spree_core-4.5.5 app/models/spree/adjustable/adjuster/tax.rb
spree_core-4.0.9 app/models/spree/adjustable/adjuster/tax.rb
spree_core-4.1.15 app/models/spree/adjustable/adjuster/tax.rb
spree_core-4.2.7 app/models/spree/adjustable/adjuster/tax.rb
spree_core-4.3.3 app/models/spree/adjustable/adjuster/tax.rb
spree_core-4.4.1 app/models/spree/adjustable/adjuster/tax.rb
spree_core-4.5.4 app/models/spree/adjustable/adjuster/tax.rb
spree_core-4.6.5 app/models/spree/adjustable/adjuster/tax.rb
spree_core-4.7.2 app/models/spree/adjustable/adjuster/tax.rb
spree_core-4.7.1 app/models/spree/adjustable/adjuster/tax.rb
spree_core-4.6.4 app/models/spree/adjustable/adjuster/tax.rb
spree_core-4.7.0 app/models/spree/adjustable/adjuster/tax.rb
spree_core-4.6.3 app/models/spree/adjustable/adjuster/tax.rb