spree/spree — pull request #4768 by jordan-brough (2014-06-02 21:21:30+00:00)
Title: fix for payments made via /admin

orders placed via /admin were being charged twice.

See these two lines from Spree::Admin::PaymentsController:

while @order.next; end
@payment.process! if @order.completed?

For incomplete orders the first line will trigger callbacks that cause
the payment to be charged if the order reaches the "completed" state.
Then the second line will process the payment *again*, resulting in a
double charge.

We can't just remove the second line because orders that are already
complete won't trigger any callbacks from the first line, so these
orders need to have their payments charged manually.

The effect of the bug in our case was that Braintree rejected the second
(duplicate) billing on the payment, and this resulted in the Payment
object being marked as failed when actually it succeeded on the first
attempt. So it appeared from within Spree that a successful payment
was a failed payment.

It would be great to get this into the 2-2-stable branch as well.

This replaces https://github.com/spree/spree/pull/4765