snowplow-archive / codeigniter-paypal-ipn

A CodeIgniter library for working with the PayPal IPN (Instant Payment Notification) service

Geek Repo:Geek Repo

Github PK Tool:Github PK Tool

Fix discount behaviour

alexanderdean opened this issue · comments

From @clarkgriswold:

You're setting $this->order['discount'] by taking the sum of orderItems
mc_gross
and subtracting order mc_gross 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?

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.

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