diff --git a/app/controllers/checkout_controller.rb b/app/controllers/checkout_controller.rb index 31c5f89bbb..edb92f8b8d 100644 --- a/app/controllers/checkout_controller.rb +++ b/app/controllers/checkout_controller.rb @@ -98,12 +98,6 @@ class CheckoutController < ::BaseController !@order || @order.completed? || !@order.checkout_allowed? end - def valid_order_line_items? - @order.insufficient_stock_lines.empty? && - OrderCycleDistributedVariants.new(@order.order_cycle, @order.distributor). - distributes_order_variants?(@order) - end - def handle_invalid_stock cancel_incomplete_payments if valid_payment_intent_provided? reset_order_to_cart diff --git a/app/controllers/concerns/order_stock_check.rb b/app/controllers/concerns/order_stock_check.rb index 2adfaf67be..98cea69387 100644 --- a/app/controllers/concerns/order_stock_check.rb +++ b/app/controllers/concerns/order_stock_check.rb @@ -3,6 +3,12 @@ module OrderStockCheck extend ActiveSupport::Concern + def valid_order_line_items? + @order.insufficient_stock_lines.empty? && + OrderCycleDistributedVariants.new(@order.order_cycle, @order.distributor). + distributes_order_variants?(@order) + end + def handle_insufficient_stock return if sufficient_stock?