Clear invalid payments

When going back and changing the payment option, the previous payment gets invalidated.
This commit is contained in:
Matt-Yorkley
2021-08-12 12:23:55 +01:00
parent 98ae82147c
commit 026e51081c

View File

@@ -51,6 +51,7 @@ class SplitCheckoutController < ::BaseController
def update
if confirm_order || update_order
clear_invalid_payments
advance_order_state
redirect_to_step
else
@@ -69,6 +70,10 @@ class SplitCheckoutController < ::BaseController
private
def clear_invalid_payments
@order.payments.with_state(:invalid).delete_all
end
def confirm_order
return unless @order.confirmation? && params[:confirm_order]