ingenesis/shopp — pull request #3158 by crunnells (2014-12-10 07:59:04+00:00)
Title: Incorrect Calculation with Multiple Credits

Fixes a bug where multiple credits are compared against the order total instead of the order total minus earlier credits.

The scenario is this: an order of $200 receives a credit of $25. A second credit of $2000 is applied to the order, of which $175 should be applied. However, when ShoppDiscounts->credits() calls ShoppOrderDiscount->calculate(), the calculate method looks to the 'credit' entry in the discounts register, but it doesn't get updated until after credits() is done looping through all of the discounts. So it ends up applying $200 from the $2000 credit for a total of $225 off of a $200 order.