spree/spree — pull request #3772 by dkubb (2013-09-25 22:29:54+00:00)
Title: Add manual adjustments to discount

This branch changes the payment processor to factor in manual adjustments to the discount amount passed to the gateway.

--

The previous code would work with promo codes adjustments, but not with "manual" adjustments where the originator is nil. This adds a Spree::Order#discount_total which is used by the payment processor to set the discount option.

--

Also this branch refactors some of the sum operations to use aggregate functions instead of pulling back the full result-set and performing the sum on in-memory objects.