Magento - Paypal争议自动创建贷项通知单

时间:2012-08-28 07:19:12

标签: magento paypal

首先,我使用的是Magento 1.7。

问题在于,如果有人打开PayPal争议,还会在Magento内创建一个贷项通知单电子邮件,并向客户发送一封电子邮件,告诉他们在没有收到退款时已退款。相反,PayPal只是暂停资金,直到争议得到解决。

当我们解决争议时,贷项通知单仍然存在,我们无法将其删除或取消。

有谁知道如何防止这种情况发生?

感谢。

马立克

1 个答案:

答案 0 :(得分:1)

我发现这是在从v1.4.0.1升级到v1.7.0.2之后我遇到的新版Magento中的一个烦人的错误。我认为它在v1.4.2.0左右出现。有很多方法可以出错我不知道为什么他们认为添加它是个好主意。

为此操作提供动力的代码位于/app/code/core/Mage/Sales/Model/Order/Payment.php中Mage_Sales_Model_Order_Payment类的registerRefundNotification()方法中。

每个timpea修复http://www.magentocommerce.com/boards/viewthread/261158/你只需要重载registerRefundNotification()并注释掉有问题的部分,在v1.7.0.2中将是下面的部分。

$serviceModel = Mage::getModel('sales/service_order', $order);
if ($invoice) {
    if ($invoice->getBaseTotalRefunded() > 0) {
        $adjustment = array('adjustment_positive' => $amount);
    } else {
        $adjustment = array('adjustment_negative' => $baseGrandTotal - $amount);
    }
    $creditmemo = $serviceModel->prepareInvoiceCreditmemo($invoice, $adjustment);
    if ($creditmemo) {
        $totalRefunded = $invoice->getBaseTotalRefunded() + $creditmemo->getBaseGrandTotal();
        $this->setShouldCloseParentTransaction($invoice->getBaseGrandTotal() <= $totalRefunded);
    }
} else {
    if ($order->getBaseTotalRefunded() > 0) {
        $adjustment = array('adjustment_positive' => $amount);
    } else {
        $adjustment = array('adjustment_negative' => $baseGrandTotal - $amount);
    }
    $creditmemo = $serviceModel->prepareCreditmemo($adjustment);
    if ($creditmemo) {
        $totalRefunded = $order->getBaseTotalRefunded() + $creditmemo->getBaseGrandTotal();
        $this->setShouldCloseParentTransaction($order->getBaseGrandTotal() <= $totalRefunded);
    }
}

$creditmemo->setPaymentRefundDisallowed(true)
    ->setAutomaticallyCreated(true)
    ->register()
    ->addComment(Mage::helper('sales')->__('Credit memo has been created automatically'))
    ->save();

$this->_updateTotals(array(
    'amount_refunded' => $creditmemo->getGrandTotal(),
    'base_amount_refunded_online' => $amount
));

$this->setCreatedCreditmemo($creditmemo);