-
Notifications
You must be signed in to change notification settings - Fork 212
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
[EPC-9177] Refactor class names and implement comment modal
- Loading branch information
Can Demiralp
committed
Feb 3, 2025
1 parent
4fc60c5
commit f61619c
Showing
17 changed files
with
136 additions
and
88 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -3,7 +3,7 @@ | |
* | ||
* Adyen Payment module (https://www.adyen.com/) | ||
* | ||
* Copyright (c) 2024 Adyen N.V. (https://www.adyen.com/) | ||
* Copyright (c) 2025 Adyen N.V. (https://www.adyen.com/) | ||
* See LICENSE.txt for license details. | ||
* | ||
* Author: Adyen <[email protected]> | ||
|
@@ -17,7 +17,7 @@ | |
use Magento\Framework\Api\SearchCriteriaBuilder; | ||
use Magento\Framework\Exception\LocalizedException; | ||
|
||
class ProcessedOldNotificationsProvider implements NotificationsProviderInterface | ||
class ProcessedWebhooksProvider implements WebhooksProviderInterface | ||
{ | ||
public function __construct( | ||
private readonly AdyenNotificationRepositoryInterface $adyenNotificationRepository, | ||
|
@@ -28,7 +28,7 @@ public function __construct( | |
|
||
public function provide(): array | ||
{ | ||
$numberOfDays = $this->configHelper->getRequiredDaysForOldWebhooks(); | ||
$numberOfDays = $this->configHelper->getProcessedWebhookRemovalTime(); | ||
|
||
$dateFrom = date('Y-m-d H:i:s', time() - $numberOfDays * 24 * 60 * 60); | ||
|
||
|
@@ -43,7 +43,7 @@ public function provide(): array | |
return $items->getItems(); | ||
} catch (LocalizedException $e) { | ||
$errorMessage = sprintf( | ||
__('An error occurred while providing notifications older than %s days!'), | ||
__('An error occurred while providing webhooks older than %s days!'), | ||
$numberOfDays | ||
); | ||
|
||
|
@@ -55,6 +55,6 @@ public function provide(): array | |
|
||
public function getProviderName(): string | ||
{ | ||
return "Adyen processed old webhook notifications"; | ||
return "Adyen processed webhooks provider"; | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -3,15 +3,15 @@ | |
* | ||
* Adyen Payment module (https://www.adyen.com/) | ||
* | ||
* Copyright (c) 2024 Adyen N.V. (https://www.adyen.com/) | ||
* Copyright (c) 2025 Adyen N.V. (https://www.adyen.com/) | ||
* See LICENSE.txt for license details. | ||
* | ||
* Author: Adyen <[email protected]> | ||
*/ | ||
|
||
namespace Adyen\Payment\Cron\Providers; | ||
|
||
interface NotificationsProviderInterface | ||
interface WebhooksProviderInterface | ||
{ | ||
/** | ||
* @return array | ||
|
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,35 @@ | ||
<?php | ||
/** | ||
* | ||
* Adyen Payment Module | ||
* | ||
* Copyright (c) 2025 Adyen N.V. | ||
* This file is open source and available under the MIT license. | ||
* See the LICENSE file for more info. | ||
* | ||
* Author: Adyen <[email protected]> | ||
*/ | ||
|
||
namespace Adyen\Payment\Model\Comment; | ||
|
||
use Adyen\Payment\Cron\Providers\ProcessedWebhooksProvider; | ||
use Magento\Config\Model\Config\CommentInterface; | ||
|
||
class WebhookRemovalNotice implements CommentInterface | ||
{ | ||
public function __construct( | ||
private readonly ProcessedWebhooksProvider $processedNotificationProvider | ||
) { } | ||
|
||
public function getCommentText($elementValue) | ||
{ | ||
if ($elementValue === '0') { | ||
$numberOfNotificationsToBeRemoved = count($this->processedNotificationProvider->provide()); | ||
|
||
return __( | ||
'Enabling this feature will remove %1 processed webhooks from the database!', | ||
$numberOfNotificationsToBeRemoved | ||
); | ||
} | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Oops, something went wrong.