我已经在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);发布于 2012-03-22 04:42:59
从你的问题中很难看出。这取决于您正在使用的Magento支付网关/方法(贝宝、Authorize.net、储存卡等),因为每个都可以实现不同的交易授权、捕获等方法。
看一下默认的Mage_Sales_Model_Order_Payment类。在尝试捕获交易的资金并将订单状态设置为可疑欺诈时,这会多次调用名为$this->getIsFraudDetected()的方法,如果true是这样的话:
if ($this->getIsFraudDetected()) {
$status = Mage_Sales_Model_Order::STATUS_FRAUD;
}在默认支付类中,当registerCaptureNotification()方法返回false时,将在_isCaptureFinal()方法中设置欺诈标志
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;
}如果使用默认付款方式,请检查您的总数(请求捕获与未偿还余额),或者查看您的付款方式实现,并使用上述信息来调试您的代码...
发布于 2017-07-09 14:25:20
我花了很长时间来解决这个0.10错误,
因此,我将与大家分享我的案例中的问题:
在:
/app/code/core/Mage/Paypal/模型/cart.php
有一个_validate函数,PayPal在其中检查$sum和$referenceAmount之间的差异。
我将其替换为:
if (sprintf('%.4F', $sum) == sprintf('%.4F', $referenceAmount)) {
$this->_areItemsValid = true;
}我在升级前的Magento备份中找到的。
https://stackoverflow.com/questions/9804883
复制相似问题