mirror of
https://github.com/openfoodfoundation/openfoodnetwork
synced 2026-01-24 20:36:49 +00:00
Extract #valid_order_line_items?
This commit is contained in:
@@ -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
|
||||
|
||||
@@ -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?
|
||||
|
||||
|
||||
Reference in New Issue
Block a user