完成magento支付后的“疑似诈骗”状态?

时间:2012-03-21 12:45:18

标签: magento paypal payment

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

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

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

2 个答案:

答案 0 :(得分:4)

从你的问题中判断并不容易。这可能取决于您使用的Magento支付网关/方法(Paypal,Authorize.net,Saved Card等),因为每个可以实现不同的交易授权,捕获等方法。

查看默认的Mage_Sales_Model_Order_Payment课程。当尝试为交易捕获资金时,这会调用一个名为$this->getIsFraudDetected()的方法,如果true如此,则将订单状态设置为可疑欺诈:

if ($this->getIsFraudDetected()) {
    $status = Mage_Sales_Model_Order::STATUS_FRAUD;
}

在默认的Payment类中,当registerCaptureNotification()方法返回_isCaptureFinal()时,欺诈标记会在false方法中设置:

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

/**
 * 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;
}

如果使用默认付款方式或查看付款方式实施并使用上述信息调试代码,请检查总计(请求的捕获与未结余额)...

答案 1 :(得分:0)

我需要很长时间来解决这个0.10错误,

所以我将与您分享我的案例中的问题:

在:

  

/app/code/core/Mage/Paypal/Model/Cart.php

有一个_validate函数,PayPal会检查$sum$referenceAmount之间的区别。

我将其替换为:

if (sprintf('%.4F', $sum) == sprintf('%.4F', $referenceAmount)) {
    $this->_areItemsValid = true;
}

我在升级之前在Magento备份中找到了它。