PayPal IPN模型并自动订购状态更改
-
22-10-2019 - |
题
首先,我将向您解释有关Actuall功能的信息:
- 客户通过PayPal在商店购买
- 商店运营商从外部软件(WAWI;不知道EN)调用订单,该软件设置了订单状态以完成
- 商店运营商根据其卖方帐户从客户那里收取款项
- 之后,贝宝(PayPal
问题是防止PayPal(或IPN模型)设置从状态完成的订单回到待处理。
我们已经对课程进行了一些修改:MAGE/PAYPAL/paypal/model/ipn.php中的mage_paypal_model_ipn。我认为是_registerPaymentCapture()中的负责任代码。这是我们的编辑(标有编辑):
if ($this->getRequestData('transaction_entity') == 'auth') {
return;
}
$this->_importPaymentInformation();
$payment = $this->_order->getPayment();
/* Edit: check if order state is complete */
$orderStateComplete = (Mage_Sales_Model_Order::STATE_COMPLETE == $this->_order->getState());
$orderStatusBefore = $this->_order->getStatus();
$payment->setTransactionId($this->getRequestData('txn_id'))
->setPreparedMessage($this->_createIpnComment(''))
->setParentTransactionId($this->getRequestData('parent_txn_id'))
->setShouldCloseParentTransaction('Completed' === $this->getRequestData('auth_status'))
->setIsTransactionClosed(0)
->registerCaptureNotification($this->getRequestData('mc_gross'));
/* Edit: reset state and status, if order was already complete before */
if ($orderStateComplete) {
$this->_order->setState(Mage_Sales_Model_Order::STATE_COMPLETE)
->setStatus($orderStatusBefore);
}
$this->_order->save();
// notify customer
$invoice = $payment->getCreatedInvoice();
if ($invoice && !$this->_order->getEmailSent()) {
$this->_order->sendNewOrderEmail()->addStatusHistoryComment(
Mage::helper('paypal')->__('Notified customer about invoice #%s.', $invoice->getIncrementId())
)
->setIsCustomerNotified(true)
->save();
}
问题仍然存在,我不知道在哪里编辑文件以防止订单状态更改。
engretz&提前感谢
解决方案
我们管理了它。问题在于,订单状态未设置的ERP软件,只是状态,因此条件没有被挫败。