首页
学习
活动
专区
圈层
工具
发布
首页
学习
活动
专区
圈层
工具
MCP广场
社区首页 >问答首页 >Magento - Paypal争议自动创建贷项通知单

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

Stack Overflow用户
提问于 2012-08-28 15:19:12
回答 1查看 3.3K关注 0票数 2

首先,我使用Magento 1.7。

问题是,如果有人提出PayPal纠纷,Magento内部也会创建一封贷方备忘录电子邮件,并向客户发送一封电子邮件,告知他们已经退款,而此时他们还没有退款。相反,Magento只是暂停资金,直到纠纷得到解决。

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

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

谢谢。

马雷克

EN

回答 1

Stack Overflow用户

回答已采纳

发布于 2012-08-31 20:18:50

在从v1.4.0.1升级到v1.7.0.2之后,我发现这是Magento新版本中的一个恼人的bug。我认为它是在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中,这将是下面的部分。

代码语言:javascript
运行
复制
$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);
票数 1
EN
页面原文内容由Stack Overflow提供。腾讯云小微IT领域专用引擎提供翻译支持
原文链接:

https://stackoverflow.com/questions/12154535

复制
相关文章

相似问题

领券
问题归档专栏文章快讯文章归档关键词归档开发者手册归档开发者手册 Section 归档