Magento Forum

Paypal offline refund return to all items back to in stock when you partially refund. 
 
gettop01
Jr. Member
 
Total Posts:  8
Joined:  2011-06-24
 

I am using Magento ver. 1.7.0.2, when we want to partially refund orders in paypal, All item in the order is coming back to stock and messed up the inventory. You originally want to refund one item for example out of 5 and you can only manually refund 1 items amount but thanks to paypal ipn, all of a sudden all items sends refunded and back to in stock.

So solution is simple, I have used magento core files to change the ipn, this actually should solved by magento long time ago.

Step 1- go to /public_html/app/code/core/Mage/Paypal/Model/

step 2- on line 437 find the below code
/**
* Process a refund or a chargeback
*/
protected function _registerPaymentRefund()
{
$this->_importPaymentInformation();
$reason = $this->getRequestData(’reason_code’);
$isRefundFinal = !$this->_info->isReversalDisputable($reason);
$payment = $this->_order->getPayment()
->setPreparedMessage($this->_createIpnComment($this->_info->explainReasonCode($reason)))
->setTransactionId($this->getRequestData(’txn_id’))
->setParentTransactionId($this->getRequestData(’parent_txn_id’))
->setIsTransactionClosed($isRefundFinal)
->registerRefundNotification(-1 * $this->getRequestData(’mc_gross’));
$this->_order->save();

step 3- take out the last bit to stop paypal saving it back to magento#
$this->_order->save();

Job done !!!!

 
Magento Community Magento Community
Magento Community
Magento Community
 
uhvui
Jr. Member
 
Total Posts:  2
Joined:  2013-03-21
 

thanks you good rasberry

 
Magento Community Magento Community
Magento Community
Magento Community
 
ninjured
Jr. Member
 
Total Posts:  24
Joined:  2010-06-21
 

wow just stumbled across this issue too!!! hope it fixes it. thanks for your help.

 
Magento Community Magento Community
Magento Community
Magento Community
 
ninjured
Jr. Member
 
Total Posts:  24
Joined:  2010-06-21
 

damn didnt work for me still refunded the entire order from paypal :/

 
Magento Community Magento Community
Magento Community
Magento Community
 
gettop01
Jr. Member
 
Total Posts:  8
Joined:  2011-06-24
 
ninjured - 14 April 2013 06:09 PM

damn didnt work for me still refunded the entire order from paypal :/

Hi,

Please go to /public_html/app/code/core/Mage/Paypal/Model/IPN.php
and find the * Process a refund or a chargeback
Take out the below code
$this->_order->save();

This will stop paypal returning all items to back inj stock

Thanks
Alp

 
Magento Community Magento Community
Magento Community
Magento Community
Magento Community
Magento Community
Back to top