diff --git a/app/helpers/tax_helper.rb b/app/helpers/tax_helper.rb index 164e875f8f..a60481b389 100644 --- a/app/helpers/tax_helper.rb +++ b/app/helpers/tax_helper.rb @@ -14,10 +14,10 @@ module TaxHelper def display_line_items_taxes(line_item, display_zero: true) if line_item.included_tax.positive? - tax = line_item.included_tax + enterprise_fee_tax(line_item) + tax = line_item.included_tax + enterprise_fee_adjustments(line_item).total_included_tax Spree::Money.new(tax, currency: line_item.currency) elsif line_item.added_tax.positive? - tax = line_item.added_tax + enterprise_fee_tax(line_item) + tax = line_item.added_tax + enterprise_fee_adjustments(line_item).total_additional_tax Spree::Money.new(tax, currency: line_item.currency) elsif display_zero Spree::Money.new(0.00, currency: line_item.currency) @@ -31,7 +31,7 @@ module TaxHelper private - def enterprise_fee_tax(line_item) - EnterpriseFeeAdjustments.new(line_item.enterprise_fee_adjustments).total_tax + def enterprise_fee_adjustments(line_item) + EnterpriseFeeAdjustments.new(line_item.enterprise_fee_adjustments) end end diff --git a/spec/helpers/tax_helper_spec.rb b/spec/helpers/tax_helper_spec.rb index 1c70257ab6..ed87864390 100644 --- a/spec/helpers/tax_helper_spec.rb +++ b/spec/helpers/tax_helper_spec.rb @@ -73,10 +73,11 @@ describe TaxHelper, type: :helper do ) } - it "doesn't add enterprise fee tax, it is already included in the line item tax" do + it "includes enterprise fee tax" do + expected_tax = line_item.included_tax + fee_tax_adjustment.amount expect( helper.display_line_items_taxes(line_item) - ).to eq Spree::Money.new(line_item.included_tax, currency: line_item.currency) + ).to eq Spree::Money.new(expected_tax, currency: line_item.currency) end end end