diff --git a/Helper/Webhook/ExpireWebhookHandler.php b/Helper/Webhook/ExpireWebhookHandler.php index 588a29672..b31f86940 100644 --- a/Helper/Webhook/ExpireWebhookHandler.php +++ b/Helper/Webhook/ExpireWebhookHandler.php @@ -17,7 +17,6 @@ use Adyen\Payment\Helper\Data; use Adyen\Payment\Helper\Order as OrderHelper; use Adyen\Payment\Logger\AdyenLogger; -use Adyen\Payment\Model\Config\Source\CaptureMode; use Adyen\Payment\Model\Notification; use Magento\Framework\Exception\LocalizedException; use Magento\Sales\Model\Order; @@ -50,19 +49,8 @@ public function handleWebhook(Order $order, Notification $notification, string $ { $storeId = $order->getStoreId(); $isExpireWebhookIgnored = $this->configHelper->isExpireWebhookIgnored($storeId); - $captureMode = $this->configHelper->getCaptureMode($storeId); - if (strcmp($captureMode, CaptureMode::CAPTURE_MODE_AUTO) === 0) { - /* - * Expire webhook should not be obtained if auto capture is enabled. - * If so, it might be an indicator of an incorrect plugin configuration. - */ - $orderComment = __( - 'An unexpected %1 webhook has arrived even though auto capture is enabled, please check the plugin configuration! This webhook was skipped.', - $notification->getEventCode() - ); - $logMessage = $orderComment; - } elseif ($isExpireWebhookIgnored) { + if ($isExpireWebhookIgnored) { $orderComment = __( 'The remaining uncaptured authorisation with amount %1 has expired but no action has been taken as the %2 webhook was skipped.', $notification->getFormattedAmountCurrency(), diff --git a/Test/Unit/Helper/Webhook/ExpireWebhookHandlerTest.php b/Test/Unit/Helper/Webhook/ExpireWebhookHandlerTest.php index 66a01b17d..f7beba8cf 100644 --- a/Test/Unit/Helper/Webhook/ExpireWebhookHandlerTest.php +++ b/Test/Unit/Helper/Webhook/ExpireWebhookHandlerTest.php @@ -17,7 +17,6 @@ use Adyen\Payment\Helper\Webhook\ExpireWebhookHandler; use Adyen\Payment\Logger\AdyenLogger; use Adyen\Payment\Model\AdyenAmountCurrency; -use Adyen\Payment\Model\Config\Source\CaptureMode; use Adyen\Payment\Model\Notification; use Adyen\Payment\Test\Unit\AbstractAdyenTestCase; use Magento\Sales\Api\Data\OrderInterface; @@ -65,31 +64,8 @@ protected function tearDown(): void $this->webhookHandler = null; } - public function testAutoCaptureEnabled(): void - { - $this->configMock->expects($this->once()) - ->method('getCaptureMode') - ->willReturn(CaptureMode::CAPTURE_MODE_AUTO); - - $this->adyenLoggerMock->expects($this->once())->method('addAdyenNotification'); - $this->orderMock->expects($this->once())->method('addCommentToStatusHistory'); - $this->orderHelperMock->expects($this->never())->method('holdCancelOrder'); - - $result = $this->webhookHandler->handleWebhook( - $this->orderMock, - $this->notificationMock, - 'pending' - ); - - $this->assertInstanceOf(OrderInterface::class, $result); - } - public function testExpireWebhookIgnored() { - $this->configMock->expects($this->once()) - ->method('getCaptureMode') - ->willReturn(CaptureMode::CAPTURE_MODE_MANUAL); - $this->configMock->expects($this->once()) ->method('isExpireWebhookIgnored') ->willReturn(true); @@ -109,10 +85,6 @@ public function testExpireWebhookIgnored() public function testHandleWebhookWithPartialExpiration() { - $this->configMock->expects($this->once()) - ->method('getCaptureMode') - ->willReturn(CaptureMode::CAPTURE_MODE_MANUAL); - $this->configMock->expects($this->once()) ->method('isExpireWebhookIgnored') ->willReturn(false); @@ -142,10 +114,6 @@ public function testHandleWebhookWithPartialExpiration() public function testHandleWebhookWithShipments() { - $this->configMock->expects($this->once()) - ->method('getCaptureMode') - ->willReturn(CaptureMode::CAPTURE_MODE_MANUAL); - $this->configMock->expects($this->once()) ->method('isExpireWebhookIgnored') ->willReturn(false); @@ -176,10 +144,6 @@ public function testHandleWebhookWithShipments() public function testHandleWebhookSuccessfully() { - $this->configMock->expects($this->once()) - ->method('getCaptureMode') - ->willReturn(CaptureMode::CAPTURE_MODE_MANUAL); - $this->configMock->expects($this->once()) ->method('isExpireWebhookIgnored') ->willReturn(false);