snowplow-archive / codeigniter-paypal-ipn

A CodeIgniter library for working with the PayPal IPN (Instant Payment Notification) service
111 stars 34 forks source link

Fix discount behaviour #5

Open alexanderdean opened 12 years ago

alexanderdean commented 12 years ago

From @clarkgriswold:

You're setting $this->order['discount'] by taking the sum of _orderItems mcgross and subtracting _order mcgross which ends up being the tax but as a negative value. Just wondering what the idea is here.

The basic idea was that, if you take away the sum of the line item mc_gross's from the order's mc_gross, you are left with the discount which was applied to that order as a line item. But: PayPal IPN already returns a discount field, so I think it would be better to remove this custom discount calculation behaviour (or at least rename it to calculated_discount so it doesn't overwrite PayPal IPN's discount).

Thoughts?

markkasaboski commented 12 years ago

I would probably remove it all together, but I think renaming it to calculated_discount is probably the right way to go, especially if anyone else is expecting it to be there. I'm going to be adding in PayPal's discount fields so I'll pull request that as well once I get it done.

alexanderdean commented 12 years ago

Thanks Clark! I'll leave this one open and then close it with the relevant pull request.