Add a flash error where no available shipping methods to the customer

+ update specs as well
This commit is contained in:
Jean-Baptiste Bellet
2022-08-08 16:59:37 +02:00
parent 9dd3a8bc5a
commit 86cb86e8b5
3 changed files with 24 additions and 0 deletions

View File

@@ -23,6 +23,8 @@ class SplitCheckoutController < ::BaseController
redirect_to_step_based_on_order unless params[:step]
check_step if params[:step]
recalculate_tax if params[:step] == "summary"
flash_error_when_no_shipping_method_available if available_shipping_methods.none?
end
def update
@@ -47,6 +49,10 @@ class SplitCheckoutController < ::BaseController
private
def flash_error_when_no_shipping_method_available
flash[:error] = I18n.t('split_checkout.errors.no_shipping_methods_available')
end
def clear_invalid_payments
@order.payments.with_state(:invalid).delete_all
end