Magento - Paypal 争议自动创建信用凭证

标签 magento paypal

首先,我使用的是 Magento 1.7。

问题是,如果有人提出 PayPal 争议,还会在 Magento 中创建信用备忘录电子邮件,并向客户发送一封电子邮件,告知他们已获得退款,而实际上他们还没有。相反, Paypal 只是暂停资金,直到争议解决。

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

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

谢谢。

马立克

最佳答案

我发现这是我在从 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() 方法中。

Per 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);

关于Magento - Paypal 争议自动创建信用凭证,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/12154535/

相关文章:

php - 在 Magento 的 sales_order_save_commit_after Hook 中,为什么我的订单中出现重复的商品?

paypal - 获取与 Paypal 中的定期付款配置文件关联的交易

php - 像Web门户那样的ebay之类的API接口(interface)

php - Magento:拦截所有外发电子邮件

database - 通过 SQL 脚本在 Magento 中创建邮件模板?

magento - 如何使用带有 Oauth 的 magento REST api 的 POSTMAN REST 客户端。如何获取 Token 和 Token Secret?

paypal - Shopware 6 SwagPayPal 默认配置不起作用

php - Paypal 自适应支付和 SOAP SDK

magento - 如何在 Magento 1.6.2 中添加新的州/省和城市下拉列表?

php - Magento CE 2.0 安装在大约 90% 时停止