首页
学习
活动
专区
圈层
工具
发布
首页
学习
活动
专区
圈层
工具
MCP广场
社区首页 >问答首页 >在magento中强制付款后的“涉嫌欺诈”状态?

在magento中强制付款后的“涉嫌欺诈”状态?
EN

Stack Overflow用户
提问于 2012-03-21 20:45:18
回答 2查看 10.2K关注 0票数 0

我已经在magento中制作了我的自定义模块,其中我已经动态地设置了折扣。为此,我使用了以下代码。但是当我完成付款程序后,订单状态应该是'processing‘,而不是这个订单状态变成了"Suspected Fraud“。

请让我知道我做错了什么。虽然在订单信息中成功添加了折扣。

代码语言:javascript
复制
$order->setData('base_discount_amount', $discountAmt);

$order->setData('base_discount_canceled', $discountAmt);

$order->setData('base_discount_invoiced', $discountAmt);

$order->setData('base_discount_refunded', $discountAmt);

$order->setData('discount_description', 'Affliate Discount');

$order->setData('discount_amount', $discountAmt);

$order->setData('discount_canceled', $discountAmt);

$order->setData('discount_invoiced', $discountAmt);

$order->setData('discount_refunded', $discountAmt);
EN

回答 2

Stack Overflow用户

回答已采纳

发布于 2012-03-22 04:42:59

从你的问题中很难看出。这取决于您正在使用的Magento支付网关/方法(贝宝、Authorize.net、储存卡等),因为每个都可以实现不同的交易授权、捕获等方法。

看一下默认的Mage_Sales_Model_Order_Payment类。在尝试捕获交易的资金并将订单状态设置为可疑欺诈时,这会多次调用名为$this->getIsFraudDetected()的方法,如果true是这样的话:

代码语言:javascript
复制
if ($this->getIsFraudDetected()) {
    $status = Mage_Sales_Model_Order::STATUS_FRAUD;
}

在默认支付类中,当registerCaptureNotification()方法返回false时,将在_isCaptureFinal()方法中设置欺诈标志

代码语言:javascript
复制
if ($this->_isCaptureFinal($amount)) {
    $invoice = $order->prepareInvoice()->register();
    $order->addRelatedObject($invoice);
    $this->setCreatedInvoice($invoice);
} else {
    $this->setIsFraudDetected(true);
    $this->_updateTotals(array('base_amount_paid_online' => $amount));
}

当您尝试捕获的金额与剩余订单余额不完全相等时,_isCaptureFinal()方法将返回false

代码语言:javascript
复制
/**
 * Decide whether authorization transaction may close (if the amount to capture will cover entire order)
 * @param float $amountToCapture
 * @return bool
 */
protected function _isCaptureFinal($amountToCapture)
{
    $amountToCapture = $this->_formatAmount($amountToCapture, true);
    $orderGrandTotal = $this->_formatAmount($this->getOrder()->getBaseGrandTotal(), true);
    if ($orderGrandTotal == $this->_formatAmount($this->getBaseAmountPaid(), true) + $amountToCapture) {
        if (false !== $this->getShouldCloseParentTransaction()) {
            $this->setShouldCloseParentTransaction(true);
        }
        return true;
    }
    return false;
}

如果使用默认付款方式,请检查您的总数(请求捕获与未偿还余额),或者查看您的付款方式实现,并使用上述信息来调试您的代码...

票数 4
EN

Stack Overflow用户

发布于 2017-07-09 14:25:20

我花了很长时间来解决这个0.10错误,

因此,我将与大家分享我的案例中的问题:

在:

/app/code/core/Mage/Paypal/模型/cart.php

有一个_validate函数,PayPal在其中检查$sum$referenceAmount之间的差异。

我将其替换为:

代码语言:javascript
复制
if (sprintf('%.4F', $sum) == sprintf('%.4F', $referenceAmount)) {
    $this->_areItemsValid = true;
}

我在升级前的Magento备份中找到的。

票数 0
EN
页面原文内容由Stack Overflow提供。腾讯云小微IT领域专用引擎提供翻译支持
原文链接:

https://stackoverflow.com/questions/9804883

复制
相关文章

相似问题

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