Extract method on_update that will be used elsewhere

This commit is contained in:
Jean-Baptiste Bellet
2023-04-18 11:21:46 +02:00
parent 05a040b4c3
commit 6172d1f2e5
2 changed files with 11 additions and 6 deletions

View File

@@ -34,12 +34,7 @@ module Spree
end
def update
@order.recreate_all_fees!
unless @order.cart?
@order.create_tax_charge!
@order.update_order!
end
on_update
if params[:set_distribution_step] && @order.update(order_params)
return redirect_to spree.admin_order_customer_path(@order)
@@ -106,6 +101,15 @@ module Spree
private
def on_update
@order.recreate_all_fees!
unless @order.cart?
@order.create_tax_charge!
@order.update_order!
end
end
def order_params
return params[:order] if params[:order].blank?

View File

@@ -90,6 +90,7 @@ Spree::Core::Engine.routes.draw do
get :invoice
get :print
get :distribution, to: 'orders#set_distribution'
put :distribution, to: 'orders#set_distribution'
end
collection do