Remove voucher processing from checkout edit action

This commit is contained in:
Matt-Yorkley
2023-06-13 18:59:57 +01:00
parent 1a744de37a
commit 202b0041d1

View File

@@ -24,7 +24,6 @@ class SplitCheckoutController < ::BaseController
def edit
redirect_to_step_based_on_order unless params[:step]
check_step if params[:step]
apply_voucher if @order.voucher_adjustments.present?
flash_error_when_no_shipping_method_available if available_shipping_methods.none?
end
@@ -204,6 +203,7 @@ class SplitCheckoutController < ::BaseController
def process_voucher
if add_voucher
VoucherAdjustmentsService.calculate(@order)
render_voucher_section_or_redirect
elsif @order.errors.present?
render_error
@@ -308,12 +308,4 @@ class SplitCheckoutController < ::BaseController
redirect_to checkout_step_path(:payment) if params[:step] == "summary"
end
end
def apply_voucher
VoucherAdjustmentsService.calculate(@order)
# update order to take into account the voucher we applied
@order.update_order!
end
end