mirror of
https://github.com/openfoodfoundation/openfoodnetwork
synced 2026-03-25 05:45:15 +00:00
Clear invalid payments
When going back and changing the payment option, the previous payment gets invalidated.
This commit is contained in:
@@ -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]
|
||||
|
||||
|
||||
Reference in New Issue
Block a user