snowplow-archive / codeigniter-paypal-ipn

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

Fixed tax column name in orderFields whitelist #4

Closed markkasaboski closed 12 years ago

markkasaboski commented 12 years ago

Changed 'tax decimal' in orderFields' whitelist to just 'tax' as per the column name in the ipn_orders table.

alexanderdean commented 12 years ago

Thanks Clark - good spot! Merging now...

markkasaboski commented 12 years ago

Also, I have a few questions if you don't mind:

Currently you have the options columns in the _ipnorders table. Would it not make more sense to have them in the _ipn_orderitems table?

Also, in regards to the options columns, options are set per item so they include the suffix in the IPN data like this: option_name1_1, option_selection1_1. The option data never gets set in the DB because the key in the array never matches the current column names. On this current project I'm working on I've moved the option data to the _ipn_order_items_table (option_name_1 through 7, and option_selection_1 through 7 as PayPal allows up to 7 options to be set per item) and then I set the options like this:

for ($ii = 1, $count = 7; $ii < $count; $ii++) { $this->orderItems[$i]['optionname'.$ii] = isset($this->ipnData['optionname'.$ii.''.$suffix]) ? $this->ipnData['optionname'.$ii.''.$suffix] : null; $this->orderItems[$i]['optionselection'.$ii] = isset($this->ipnData['optionselection'.$ii.''.$suffix]) ? $this->ipnData['optionselection'.$ii.''.$suffix] : null; }

This is working for me so if you're into it I'll adjust the SQL as well as PayPal_IPN.php and pull request.

Last question:

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.

Thanks for this package Alexander.

On Sat, Nov 5, 2011 at 12:30 PM, Alexander Dean < reply@reply.github.com>wrote:

Thanks Clark - good spot! Merging now...


Reply to this email directly or view it on GitHub:

https://github.com/orderly/codeigniter-paypal-ipn/pull/4#issuecomment-2641157

alexanderdean commented 12 years ago

Hi Clark,

Thanks very much for taking the time to put this together. On your options point: anything which PayPal returns at the order item level should be stored within the order_items table - I missed the options because for my sites there aren't any options. If you can issue a pull request for the SQL and PayPal_IPN.php then I will merge that it in (don't worry about updating the PayPal_IPN.php for the Doctrine version - nobody uses that version apart from me!). Thanks very much.

On the discount point, thanks for raising, see new ticket here: https://github.com/orderly/codeigniter-paypal-ipn/issues/5