Skip to content

Commit b29d0de

Browse files
PLGMAG2V2-494: Fixed an issue with the timing of request timeouts for incoming notifications (#522)
* PLGMAG2V2-494: Fix issue with request timeouts * Remove double status history comment
1 parent fd33fdb commit b29d0de

File tree

2 files changed

+12
-2
lines changed

2 files changed

+12
-2
lines changed

CHANGELOG.md

+2
Original file line numberDiff line numberDiff line change
@@ -5,6 +5,8 @@ The format is based on [Keep a Changelog](https://keepachangelog.com/en/1.0.0/),
55
and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0.html).
66

77
## [Unreleased]
8+
### Fixed
9+
- Fixed an issue with the timing of request timeouts for incoming notifications
810

911
## [2.15.1] - 2022-05-10
1012
### Fixed

Service/Order/ProcessOrderByTransactionStatus.php

+10-2
Original file line numberDiff line numberDiff line change
@@ -17,6 +17,8 @@
1717

1818
namespace MultiSafepay\ConnectCore\Service\Order;
1919

20+
use Exception;
21+
use Magento\Framework\Exception\LocalizedException;
2022
use Magento\Sales\Api\Data\OrderInterface;
2123
use Magento\Sales\Api\Data\OrderPaymentInterface;
2224
use Magento\Sales\Model\Order;
@@ -148,7 +150,6 @@ public function execute(
148150
case TransactionStatus::DECLINED:
149151
case TransactionStatus::CANCELLED:
150152
case TransactionStatus::VOID:
151-
usleep(5000000);
152153
$updateOrderStatus = true;
153154
$this->cancelOrder($order, $transactionStatusMessage);
154155
break;
@@ -228,13 +229,20 @@ private function completeOrderTransaction(
228229
}
229230

230231
/**
232+
* Cancel the order if it is not already canceled
233+
*
231234
* @param OrderInterface $order
232235
* @param string $transactionStatusMessage
236+
* @throws LocalizedException
237+
* @throws Exception
233238
*/
234239
private function cancelOrder(OrderInterface $order, string $transactionStatusMessage): void
235240
{
241+
if ($order->getState() === Order::STATE_CANCELED) {
242+
return;
243+
}
244+
236245
$order->cancel();
237-
$order->addCommentToStatusHistory($transactionStatusMessage);
238246
$this->logger->logInfoForOrder(
239247
$order->getIncrementId(),
240248
'Order has been canceled. ' . $transactionStatusMessage

0 commit comments

Comments
 (0)