Skip to content

Commit

Permalink
MAGE-536: Fix TxStatus association with relevant OrderId
Browse files Browse the repository at this point in the history
  • Loading branch information
Vincent Boulanger committed May 30, 2024
1 parent 437f671 commit 5231b7f
Show file tree
Hide file tree
Showing 2 changed files with 24 additions and 0 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -49,6 +49,9 @@ public function _construct()
public function getByOrder(Mage_Sales_Model_Order $order)
{
$this->addFieldToFilter('order_id', $order->getId());
if ($order->getData('increment_id') != 0) {
$this->addFilter('reference', $order->getData('increment_id'), 'or');
}
}

/**
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -79,6 +79,27 @@ public function indexAction()
// Handle Request:
$response = $service->handleByPost();

/**
* MAGE-536 : Fix missing OrderId and StoreId in TxStatus when reference exists
*/
if ($response->getStatus() == 'TSOK') {
/** @var $transactionStatusCollection Payone_Core_Model_Domain_Resource_Protocol_TransactionStatus_Collection */
$transactionStatusCollection = Mage::getModel('payone_core/domain_protocol_transactionStatus')
->getCollection();
$transactionStatusCollection->getItemsByColumnValue('reference', $reference);

/** @var Payone_Core_Model_Domain_Protocol_TransactionStatus $transactionStatus */
foreach ($transactionStatusCollection as $transactionStatus) {
if (empty($transactionStatus->getOrderId())) {
$transactionStatus->setOrderId($order->getId());
}
if (empty($transactionStatus->getStoreId())) {
$transactionStatus->setStoreId($order->getStoreId());
}
$transactionStatus->save();
}
}

// NEW forwarding handling
$this->_forwardStatus($order);

Expand Down

0 comments on commit 5231b7f

Please sign in to comment.