mirror of
https://github.com/openfoodfoundation/openfoodnetwork
synced 2026-01-24 20:36:49 +00:00
Delegate order updater method
This commit is contained in:
@@ -32,7 +32,7 @@ module Api
|
||||
@shipment.fee_adjustment.fire_events(:open)
|
||||
|
||||
if @shipment.update(shipment_params)
|
||||
@order.updater.update_totals_and_states
|
||||
@order.update_totals_and_states
|
||||
end
|
||||
|
||||
@shipment.fee_adjustment.close
|
||||
|
||||
@@ -115,7 +115,7 @@ class CheckoutController < ::BaseController
|
||||
end
|
||||
|
||||
def update_payment_total
|
||||
@order.updater.update_totals
|
||||
@order.update_totals
|
||||
@order.updater.update_pending_payment
|
||||
end
|
||||
|
||||
|
||||
@@ -172,7 +172,7 @@ class SplitCheckoutController < ::BaseController
|
||||
|
||||
@order.select_shipping_method(params[:shipping_method_id])
|
||||
@order.update(order_params)
|
||||
@order.updater.update_totals_and_states
|
||||
@order.update_totals_and_states
|
||||
|
||||
validate_current_step!
|
||||
|
||||
|
||||
@@ -14,7 +14,7 @@ module Spree
|
||||
|
||||
def update_order
|
||||
@order.reload
|
||||
@order.updater.update_totals_and_states
|
||||
@order.update_totals_and_states
|
||||
end
|
||||
|
||||
def collection
|
||||
|
||||
@@ -58,7 +58,7 @@ module Spree
|
||||
@order.create_tax_charge!
|
||||
Spree::TaxRate.adjust(@order, @order.adjustments.admin)
|
||||
|
||||
@order.updater.update_totals_and_states
|
||||
@order.update_totals_and_states
|
||||
end
|
||||
|
||||
def order_params
|
||||
|
||||
@@ -83,7 +83,7 @@ module Spree
|
||||
accepts_nested_attributes_for :shipments
|
||||
|
||||
delegate :admin_and_handling_total, :payment_fee, :ship_total, to: :adjustments_fetcher
|
||||
delegate :update_totals, to: :updater
|
||||
delegate :update_totals, :update_totals_and_states, to: :updater
|
||||
delegate :create_line_item_fees!, :create_order_fees!, :update_order_fees!,
|
||||
:update_line_item_fees!, :recreate_all_fees!, to: :fee_handler
|
||||
|
||||
@@ -712,7 +712,7 @@ module Spree
|
||||
return if adjustment.finalized?
|
||||
|
||||
adjustment.update_adjustment!(force: true)
|
||||
updater.update_totals_and_states
|
||||
update_totals_and_states
|
||||
end
|
||||
end
|
||||
end
|
||||
|
||||
@@ -17,7 +17,7 @@ FactoryBot.define do
|
||||
|
||||
after(:create) do |order|
|
||||
order.line_items << build(:line_item, order: order)
|
||||
order.updater.update_totals_and_states
|
||||
order.update_totals_and_states
|
||||
|
||||
order.order_cycle.exchanges.outgoing.first.variants << order.line_items.first.variant
|
||||
end
|
||||
@@ -49,7 +49,7 @@ FactoryBot.define do
|
||||
after(:create) do |order|
|
||||
create(:line_item, order: order)
|
||||
order.line_items.reload # to ensure order.line_items is accessible after
|
||||
order.updater.update_totals_and_states
|
||||
order.update_totals_and_states
|
||||
end
|
||||
end
|
||||
|
||||
|
||||
Reference in New Issue
Block a user