paypal now calculates discounts for us

Create issue
Issue #1047 resolved
Tay Ray Chuan created an issue


Earlier, in [[ | 9838081afd30]], we started using {{{{% load satchmo_itemlist %}}}} and the {{{flatten_discounts}}} filter; item prices ({{{item.price}}} instead of {{{item.orderitem.unit_price}}}) that were passed to PayPal have taken into account discounts.

In [[ | 0a9af30cf8e0]], we passed an order-wide discount to PayPal.

In effect, the discount is double-counted.

I'm not sure if this was always the case, or only after this [[ | "announcement" from PayPal]].

I think the fix would be to not filter with {{{flatten_discounts}}} and modifying the template accordingly, but I wish to know about the intention behind [[ | 9838081afd30]] and {{{flatten_discounts}}} before proceeding further; Chris, any idea?

PS. I traced 9838081afd30 to the merge [[ | ec0fb306211d]].

Comments (4)

  1. Tay Ray Chuan reporter

    I think there are two solutions to this:

    1. Continue using it, but don't pass discount_amount_cart to PayPal.
    2. Revert this and use item.unit_price again for amount_x (where item is an instance of OrderItem), and pass per-item discount info to PayPal as discount_amount_x with . Again, don't pass discount_amount_cart to PayPal.

    Note: In both cases, we don't pass discount_amount_cart to PayPal, because shipping discount has already been factored into order.shipping_with_tax.

    I prefer that latter option, because PayPal shows the discount information to the user; the PayPal bill in the former won't show any discount for the products, as this has already been factored into the individual item prices.

  2. Chris Moffitt repo owner

    I haven't done extensive research but I think your preferred approach makes the most sense. In general, using the payment processors api should be preferable to trying to get satchmo to do lots of payment processing.

  3. Tay Ray Chuan reporter

    Yeah, we don't want the user to think that his/her discount wasn't processed correctly.

    I've published this as 1409:3d4981e2a9cc.

    (After this changeset, he satchmo code base doesn't use the flatten_discounts filter or require {% load satchmo_itemlist %} anymore; I'll leave it to you whether to remove this file.)

  4. Log in to comment