spree/spree — pull request #3663 by jumph4x (2013-08-30 19:11:07+00:00)
Title: Stop Patment#identifier overwriting on each save

After the fix for 1998 went into the codebase, the gateway and the app invoice #'s have gotten out of sync. This happens because each time after sending the purchase/authorization to the gateway, the app calls ```#save``` on the payment, thereby overwriting its identifier. So the invoice # sent tothe gateway is impossible to recreate.

Makes looking up transactions really hard for the sales staff :)

This commit refactor the method to only run once with a while loop, thereby letting us simply check for identifier presence as an early return guard condition.

Awkward case for a regression spec, but LMK if that's desired.