Tax enterprise fee adjustments when calling #recreate_all_fees!

This commit is contained in:
Matt-Yorkley
2021-04-13 12:11:41 +01:00
parent 355837547e
commit c84f9e56fb
2 changed files with 7 additions and 2 deletions

View File

@@ -67,7 +67,7 @@ module Spree
delegate :admin_and_handling_total, :payment_fee, :ship_total, to: :adjustments_fetcher
delegate :update_totals, to: :updater
delegate :create_line_item_fees!, :create_order_fees!, :update_order_fees!,
:update_line_item_fees!, :recreate_all_fees!, to: :fee_handler
:update_line_item_fees!, :recreate_all_fees!, :tax_enterprise_fees!, to: :fee_handler
# Needs to happen before save_permalink is called
before_validation :set_currency
@@ -297,7 +297,7 @@ module Spree
Spree::TaxRate.adjust(self, line_items)
Spree::TaxRate.adjust(self, shipments) if shipments.any?
Spree::TaxRate.adjust(self, all_adjustments.enterprise_fee)
tax_enterprise_fees!
end
def name

View File

@@ -19,6 +19,7 @@ class OrderFeesHandler
create_line_item_fees!
create_order_fees!
tax_enterprise_fees!
end
order.update_order!
@@ -38,6 +39,10 @@ class OrderFeesHandler
calculator.create_order_adjustments_for order
end
def tax_enterprise_fees!
Spree::TaxRate.adjust(order, order.all_adjustments.enterprise_fee)
end
def update_line_item_fees!(line_item)
line_item.adjustments.enterprise_fee.each do |fee|
fee.update_adjustment!(line_item, force: true)