spree/spree — pull request #5350 by HoyaBoya (2014-09-11 15:12:28+00:00)
Title: Require at least one valid payment on transition to complete

This commit attempts to address an issue where it is possible to checkout with only invalid / failed payments. I believe the issue is due to process_payments! only considers unprocessed payments in it's loop. If every payment is failed / invalid, it will just loop over nothing but never adding an error to the model, thus allowing the ```after_transition: :payment``` to continue to the next steps.

https://github.com/spree/spree/blob/master/core/app/models/spree/order/payments.rb#L45

The result is that if a payment process fails legitimately for the first try i.e. Gateway rejects or invalid to Active Merchant, someone can simply do ```order.next!``` a second time and just move on. This is regardless of capture true/false on the Spree configuration key ```allow_checkout_on_gateway_error```.

Supersedes:
https://github.com/spree/spree/pull/5206