-
Notifications
You must be signed in to change notification settings - Fork 211
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
[EPC-9177] Implement a notice box indication the feature is enabled
Can Demiralp
committed
Jan 31, 2025
1 parent
5b7d8e8
commit 35678e2
Showing
3 changed files
with
72 additions
and
0 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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,47 @@ | ||
<?php | ||
/** | ||
* | ||
* Adyen Payment module (https://www.adyen.com/) | ||
* | ||
* Copyright (c) 2025 Adyen N.V. (https://www.adyen.com/) | ||
* See LICENSE.txt for license details. | ||
* | ||
* Author: Adyen <magento@adyen.com> | ||
*/ | ||
|
||
namespace Adyen\Payment\Block\Adminhtml\Notification; | ||
|
||
use Adyen\Payment\Helper\Config; | ||
use Magento\Framework\View\Element\Template\Context; | ||
use Magento\Theme\Block\Html\Notices; | ||
|
||
class CleanupJobNotice extends Notices | ||
{ | ||
public function __construct( | ||
Context $context, | ||
private readonly Config $configHelper, | ||
array $data = null | ||
) { | ||
parent::__construct($context, $data); | ||
} | ||
|
||
/** | ||
* Determines the visibility of the auto notification notice on Adyen Notifications Overview page. | ||
* | ||
* @return bool | ||
*/ | ||
public function isAutoNotificationCleanupEnabled(): bool | ||
{ | ||
return $this->configHelper->getIsWebhookCleanupEnabled(); | ||
} | ||
|
||
/** | ||
* Returns the number of days after which the notifications will be cleaned-up. | ||
* | ||
* @return int | ||
*/ | ||
public function getNumberOfDays(): int | ||
{ | ||
return $this->configHelper->getRequiredDaysForOldWebhooks(); | ||
} | ||
} |
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
22 changes: 22 additions & 0 deletions
22
view/adminhtml/templates/notification/cleanup_job_notice.phtml
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,22 @@ | ||
<?php | ||
/** | ||
* @var \Adyen\Payment\Block\Adminhtml\Notification\CleanupJobNotice $block | ||
* @var \Magento\Framework\Escaper $escaper | ||
*/ | ||
?> | ||
|
||
<?php if ($block->isAutoNotificationCleanupEnabled()): ?> | ||
<div id="messages"> | ||
<div class="messages"> | ||
<div class="message message-notice notice"> | ||
<div data-ui-id="messages-message-notice"> | ||
<?= $escaper->escapeHtml(__( | ||
'Notification clean-up is enabled from the plugin configuration. | ||
Processed notifications older than %1 days will be cleaned-up by the cronjob!', | ||
$block->getNumberOfDays() | ||
)); ?> | ||
</div> | ||
</div> | ||
</div> | ||
</div> | ||
<?php endif; ?> |