【问题标题】:Magento - Paypal dispute create credit memo automaticallyMagento - Paypal 争议自动创建贷记凭证
【发布时间】:2012-08-22 16:22:16
【问题描述】:

首先,我使用的是 Magento 1.7。

问题在于,如果有人提出 PayPal 争议,还会在 Magento 中创建贷项通知单电子邮件,并向客户发送一封电子邮件,告知他们已经退款,但实际上他们还没有退款。相反,PayPal 只是暂停资金,直到争议解决。

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

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

谢谢。

马雷克

【问题讨论】:

    标签: magento paypal


    【解决方案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() 方法中。

    根据 http://www.magentocommerce.com/boards/viewthread/261158/ 的 timpea 修复,您只需重载 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);
    

    【讨论】:

    • 谢谢!会试试看!
    猜你喜欢
    • 1970-01-01
    • 1970-01-01
    • 2014-09-27
    • 2013-09-22
    • 1970-01-01
    • 2015-10-09
    • 1970-01-01
    • 2015-03-22
    • 2012-12-19
    相关资源
    最近更新 更多