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-3.7.12 app/models/spree/adjustable/adjuster/tax.rb
spree_core-4.2.0.rc1 app/models/spree/adjustable/adjuster/tax.rb
spree_core-4.0.4 app/models/spree/adjustable/adjuster/tax.rb
spree_core-3.7.11 app/models/spree/adjustable/adjuster/tax.rb
spree_core-4.1.11 app/models/spree/adjustable/adjuster/tax.rb
spree_core-4.1.10 app/models/spree/adjustable/adjuster/tax.rb
spree_core-4.2.0.beta app/models/spree/adjustable/adjuster/tax.rb
spree_core-4.1.9 app/models/spree/adjustable/adjuster/tax.rb
spree_core-4.1.8 app/models/spree/adjustable/adjuster/tax.rb
spree_core-4.1.7 app/models/spree/adjustable/adjuster/tax.rb
spree_core-4.1.6 app/models/spree/adjustable/adjuster/tax.rb
spree_core-4.1.5 app/models/spree/adjustable/adjuster/tax.rb
spree_core-4.1.4 app/models/spree/adjustable/adjuster/tax.rb
spree_core-4.1.3 app/models/spree/adjustable/adjuster/tax.rb
spree_core-4.1.2 app/models/spree/adjustable/adjuster/tax.rb
spree_core-4.1.1 app/models/spree/adjustable/adjuster/tax.rb
spree_core-4.1.0 app/models/spree/adjustable/adjuster/tax.rb
spree_core-4.1.0.rc3 app/models/spree/adjustable/adjuster/tax.rb
spree_core-4.1.0.rc2 app/models/spree/adjustable/adjuster/tax.rb
spree_core-4.1.0.rc1 app/models/spree/adjustable/adjuster/tax.rb