fbas Posted December 14, 2011 Share Posted December 14, 2011 I've had to write a payment module to support our organization's payment API. the one piece I have left is refunds. Does anyone have code or documentation or tips on hooking into the refund functionality? thanks fbas Link to comment Share on other sites More sharing options...
bellini13 Posted December 21, 2011 Share Posted December 21, 2011 not sure there is a "hookRefund", but you can review the paypal module on how to accomplish performing a refund. Link to comment Share on other sites More sharing options...
fbas Posted January 4, 2012 Author Share Posted January 4, 2012 I believe I have found it. hook "cancelProduct" in the back office AdminOrders.php seems to be it. http://doc.prestashop.com/display/PS14/Creating+a+PrestaShop+module#CreatingaPrestaShopmodule-Hookingamodule Link to comment Share on other sites More sharing options...
fbas Posted January 11, 2012 Author Share Posted January 11, 2012 The problem now is that returning FALSE in cancelProduct does not halt the refund process. Prestashop still marks the product refunded. This is obviously NOT acceptable!! Can anyone give me a pointer or resource to resolve this? Server information Prestashop Version: 1.4.3 (upgraded to 1.4.4 - don't know why the upgrade doesn't patch the version number) Server information: Windows NT build 7601 ((null) Service Pack 1) i586 Server software Version: Apache/2.2.14 (Win32) DAV/2 mod_ssl/2.2.14 OpenSSL/0.9.8l mod_autoindex_color PHP/5.3.1 mod_apreq2-20090110/2.7.1 mod_perl/2.0.4 Perl/v5.10.1 PHP Version: 5.3.1 MySQL Version: 5.1.41 Link to comment Share on other sites More sharing options...
fbas Posted January 11, 2012 Author Share Posted January 11, 2012 The docs correctly state that this hook is for after the item is deleted from an order. Any ideas about another hook I could use? "Called when an item is deleted from an order, right after the deletion." Link to comment Share on other sites More sharing options...
bellini13 Posted January 11, 2012 Share Posted January 11, 2012 have you looked at the paypal module? Link to comment Share on other sites More sharing options...
fbas Posted January 17, 2012 Author Share Posted January 17, 2012 I have been reading the Paypal module (that's how I found the cancelProduct hook) and they don't respond to any error in the refund process at all - they just echo out the response values from the PayPal api calls. The paypal module also severely lacks documentation. Not being familiar with the paypal process, it can be hard to understand why the code does what it does. Also, because the cancelProduct hook is called for every line item that has an item being cancelled/refunded, a refund call is made separately for each one. This seems like it could be pretty confusing for the customer to get several refunds rather than one amount. Link to comment Share on other sites More sharing options...
fbas Posted February 3, 2012 Author Share Posted February 3, 2012 update: I avoided this approach (using cancelProduct hook) and wrote a new admin tab (based on AdminOrder) in a module with a custom refund hook to let store staff specify a refund price. they have to calculate this themselves. kind of disappointing that prestashop has such poor and neglected support for refunds. as I finish up their shipping scheme, I would like to make a more automatic process that uses the cancelProduct hook to as well as my custom refund hook. my approach will be to use cancelProduct to add line items to a table (indicating they are intended to be refunded, all indexed by the current timestamp), then the refund hook will tally up the refund rows with that index (timestamp), calculate shipping refund and add to that table, issue a refund with my payment processor, then mark those rows as refunded. Link to comment Share on other sites More sharing options...
Recommended Posts
Create an account or sign in to comment
You need to be a member in order to leave a comment
Create an account
Sign up for a new account in our community. It's easy!
Register a new accountSign in
Already have an account? Sign in here.
Sign In Now