Well I discovered that I had two motivations for revisiting PayPal payments in Prestashop this week. One is a new site that I’m working on for a client (more news on that later) and the other is that I discovered I had some free time in between the festivities. Well, not really free time but I managed to squeeze in a few hours at the keyboard anyway.
Today I rewrote a lot of the actual payment module class to move some of the functionality that used to reside in the validation.php script into it. This is in preparation to handle some of the outstanding issues that people still have with the module. I also incorporated the debug logging functions that Didier Hermes (www.dietibox.com) suggested in his updated version albeit with a few modifications.
On to the changes.
One of the main issues people have had is that the module creates an order immediately — even before the customer has actually paid any money. Sadly this is a necessary evil, however, now that there is a new PayPal order status as standard in Prestashop we can use this instead of having to create a new order status as in the previous version. As a bonus this already has the email generation disabled — which immediately eliminates an issue with upgrades (don’t get me started on the Prestashop upgrade process!) as well as preventing emails being sent to the customer unnecessarily.
The IPN validation has also been rewritten to make cURL the default transport method — only falling back on the fsockopen method if completely necessary.
Payment return should now work reliably, so your customer should get an appropriate “success” page when returning to your store rather than being dumped to the order history screen. In addition, if the customer clicks the “cancel and return” link on the PayPal screens the order will be cancelled in the store too. This area still needs some work, as it would be more desireable to convert the order back to a cart and remove the order completely, but I felt that this would be a step too far for the next release, so will likely have to wait until the next version (although I promise it will be released sooner than this update was).
I should have finished testing in the next few days and will release the code as usual from the product page.