gpt4 book ai didi

magento - "Suspected Fraud"完成magento付款后的状态?

转载 作者:太空宇宙 更新时间:2023-11-03 16:13:48 24 4
gpt4 key购买 nike

我在 magento 中制作了我的自定义模块,我在其中动态设置了折扣。我为此使用以下代码。但是当我完成付款程序时,订单状态应该是“processing”,但订单状态不是“Susspected 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);

最佳答案

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

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

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

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

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

当您 try catch 的金额不完全等于剩余订单余额时,_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;
}

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

关于magento - "Suspected Fraud"完成magento付款后的状态?,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/9804883/

24 4 0
Copyright 2021 - 2024 cfsdn All Rights Reserved 蜀ICP备2022000587号
广告合作:1813099741@qq.com 6ren.com