Thanks Bruce ... that helps a lot. On Mon, Jul 6, 2009 at 6:17 PM, Bruce Kroeze <[email protected]> wrote:
> On Mon, Jul 6, 2009 at 2:17 PM, Bob Waycott <[email protected]> wrote: > >> Hey guys, >> Hopefully Chris & Bruce could shed a bit of light here. Our client is >> wanting us to explain the difference between Order Payments & Order Payment >> Authorizations as they show up in the admin. >> >> My guess at this is that an OrderPayment is saved every time checkout is >> completed; an OrderPaymentAuthorization is saved every time a gateway is >> used to process a payment. >> >> Am I anywhere close on this? >> > > Yes, that's pretty close. I wrote this code, and I wanted to keep things > very clear, but I realize it isn't documented explicitly. > > Here's how it works. Some payment gateways understand "AUTH/CAPTURE" as > separate steps. For example, Authorize.net can do this. That gateway has a > config option, allowing an immediate CAPTURE, or to instead split AUTH and > CAPTURE. In the latter > case, when a customer checks out, instead of making an OrderPayment, we make > an OrderAuthorization. Later, when the order is marked "Shipped," the system > automatically attempts to make the CAPTURE for all pending authorizations > on that order. After the CAPTURE is complete, the OrderAuthorization object > is marked complete, and an OrderPayment object is created for the > successfully captured payment. > > If you look at this Order method, you'll see that we are counting AUTHs as > counting toward amount paid, so that we can properly calculate whether we > are partially paid. > > def _balance_paid(self): > payments = [p.amount for p in self.payments.all()] > if payments: > paid = reduce(operator.add, payments) > else: > paid = Decimal("0.0000000000") > > return paid + self.authorized_remaining > > Hopefully that makes things clearer. > > --- > Bruce Kroeze > http://gosatchmo.com > > > > > --~--~---------~--~----~------------~-------~--~----~ You received this message because you are subscribed to the Google Groups "Satchmo users" group. To post to this group, send email to [email protected] To unsubscribe from this group, send email to [email protected] For more options, visit this group at http://groups.google.com/group/satchmo-users?hl=en -~----------~----~----~----~------~----~------~--~---
