Extract #valid_order_line_items?

This commit is contained in:
Matt-Yorkley
2021-12-05 10:03:27 +00:00
parent c5c5738382
commit 06eb98bdf4
2 changed files with 6 additions and 6 deletions

View File

@@ -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

View File

@@ -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?