Vpago payment except Payway is stay on checkout state when it's selected by user in cart.
When a Spree::Payment is checkout state, Spree::Order considered it as a unprocessed_payments, so when we call order.next, it does not raise gateway error, and lead to moving order state to complete.
Solution
Above problem can be fixed by call payment.process. I also added process for other vpago payment to avoid this error in future.
What can we do better?
When the payment state is checkout or not in valid state, should raise a gateway error when call order.next. This will make sure order is not moving to completed state.
Problem
Error demo: https://github.com/bookmebus/spree_vpago/issues/145
checkout
state when it's selected by user in cart.checkout
state, Spree::Order considered it as a unprocessed_payments, so when we call order.next, it does not raise gateway error, and lead to moving order state to complete.Solution
Above problem can be fixed by call payment.process. I also added process for other vpago payment to avoid this error in future.
What can we do better?
When the payment state is
checkout
or not in valid state, should raise a gateway error when call order.next. This will make sure order is not moving to completed state.