From c0bf09131f83e78ec1674de4b06017addd4c4e4e Mon Sep 17 00:00:00 2001 From: luisramos0 Date: Fri, 7 Feb 2020 15:47:25 +0000 Subject: [PATCH] Make order.pending_payments include payments in pending state so that these payments (pending is the state after authorization for credit cards) are also processed as part of the normal order workflow --- app/models/spree/order_decorator.rb | 6 ++++++ 1 file changed, 6 insertions(+) diff --git a/app/models/spree/order_decorator.rb b/app/models/spree/order_decorator.rb index 28d487d6fd..1cde659f65 100644 --- a/app/models/spree/order_decorator.rb +++ b/app/models/spree/order_decorator.rb @@ -115,6 +115,12 @@ Spree::Order.class_eval do end end + # "Checkout" is the initial state and, for card payments, "pending" is the state after authorization + # These are both valid states to process the payment + def pending_payments + (payments.select(&:pending?) + payments.select(&:checkout?)).uniq + end + def remove_variant(variant) line_items(:reload) current_item = find_line_item_by_variant(variant)