spree/spree — pull request #4603 by shioyama (2014-04-23 07:55:38+00:00)
Title: Remove transaction around Spree::Payment state transitions.

Similar to #4542 and #4409.

Payment state transitions are wrapped in transactions. In the case we are working with, we have a payment observer that runs an `after_transition` callback which triggers an electronic shipment, which can occasionally fail. When it fails it rolls back the entire transaction, including the payment.

This means that although the payment has been successfully processed, we see it as pending.

Stripping the transaction does not seem to cause any problems, and allows for this type of case (i.e. where a payment has succeeded, but an `after_callback` has failed) to persist the payment to the db.

I'm submitting this to `1-3-stable` since that's what we're working with, but it should apply to master as well. I think in general that no state transitions on spree models really need to be wrapped in transactions, they are just set that way by default by `state_machine`.