spree/spree — pull request #4499 by shioyama (2014-03-27 05:23:41+00:00)
Title: Add failing test showing payment processing is set in a transaction.

We've been experiencing issues where two requests complete an order in rapid succession resulting in two purchase requests being sent to the gateway. This results in a success followed by a failure (double submission) which overwrites the payment state to failed, causing problems down the line.

At first I thought this was something specific to do with the payment gateway or our spree customizations, but this PR confirms that the "processing" state which should prevent this is not working, because it is set within a transaction. AFAICT this would affect any store using Spree. Although here I'm just testing that `ActiveRecord::Base.connection.open_transactions` is zero, I've actually tested parallel requests and confirmed that the "processing" state is not being persisted to the db at any time.

Can someone confirm that this is the case? If so I can try to push up a fix. If I'm misunderstanding something, then some clarification would be great (I'm fairly new to Spree).

Thanks!