From 7dd2c096410e6123d9e22fa92e811c754b741c8a Mon Sep 17 00:00:00 2001 From: Andy Brett Date: Tue, 24 Aug 2021 12:29:23 -0700 Subject: [PATCH] ensure terms are accepted before order is placed --- app/controllers/split_checkout_controller.rb | 7 +++++-- 1 file changed, 5 insertions(+), 2 deletions(-) diff --git a/app/controllers/split_checkout_controller.rb b/app/controllers/split_checkout_controller.rb index 846dd66c4e..59f74dfb14 100644 --- a/app/controllers/split_checkout_controller.rb +++ b/app/controllers/split_checkout_controller.rb @@ -44,7 +44,7 @@ class SplitCheckoutController < ::BaseController if params[:shipping_method_id].blank? @order.errors.add(:base, "no_shipping_method_selected") end - flash.now[:error] = "Saving failed, please update the highlighted fields" + flash.now[:error] = "Saving failed, please update the highlighted fields: #{@order.errors.full_messages}" render :edit end end @@ -98,7 +98,10 @@ class SplitCheckoutController < ::BaseController def confirm_order return unless @order.confirmation? && params[:confirm_order] - + if params["accept_terms"] != "1" + @order.errors.add(:base, "please accept terms") + return false + end @order.confirm! end