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.6.2 app/models/spree/adjustable/adjuster/tax.rb
spree_core-4.6.1 app/models/spree/adjustable/adjuster/tax.rb
spree_core-4.6.0 app/models/spree/adjustable/adjuster/tax.rb
spree_core-4.5.3 app/models/spree/adjustable/adjuster/tax.rb
spree_core-4.5.2 app/models/spree/adjustable/adjuster/tax.rb
spree_core-4.5.1 app/models/spree/adjustable/adjuster/tax.rb
spree_core-4.5.0 app/models/spree/adjustable/adjuster/tax.rb
spree_core-4.2.6 app/models/spree/adjustable/adjuster/tax.rb
spree_core-4.3.2 app/models/spree/adjustable/adjuster/tax.rb
spree_core-4.4.0 app/models/spree/adjustable/adjuster/tax.rb
spree_core-4.4.0.rc2 app/models/spree/adjustable/adjuster/tax.rb
spree_core-4.3.1 app/models/spree/adjustable/adjuster/tax.rb
spree_core-4.4.0.rc1 app/models/spree/adjustable/adjuster/tax.rb
spree_core-4.3.0 app/models/spree/adjustable/adjuster/tax.rb
spree_core-4.3.0.rc3 app/models/spree/adjustable/adjuster/tax.rb
spree_core-4.3.0.rc2 app/models/spree/adjustable/adjuster/tax.rb
spree_core-4.3.0.rc1 app/models/spree/adjustable/adjuster/tax.rb
spree_core-4.2.5 app/models/spree/adjustable/adjuster/tax.rb
spree_core-4.1.14 app/models/spree/adjustable/adjuster/tax.rb
spree_core-4.0.8 app/models/spree/adjustable/adjuster/tax.rb