Skip to content

Commit

Permalink
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
Browse files Browse the repository at this point in the history
Can Demiralp committed Jan 31, 2025
1 parent 5b7d8e8 commit 35678e2
Showing 3 changed files with 72 additions and 0 deletions.
47 changes: 47 additions & 0 deletions Block/Adminhtml/Notification/CleanupJobNotice.php
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();
}
}
3 changes: 3 additions & 0 deletions view/adminhtml/layout/adyen_notifications_overview.xml
Original file line number Diff line number Diff line change
@@ -8,6 +8,9 @@
</head>
<body>
<referenceContainer name="content">
<block class="Adyen\Payment\Block\Adminhtml\Notification\CleanupJobNotice"
name="adyen_notification_cleanup_job_notice"
template="Adyen_Payment::notification/cleanup_job_notice.phtml" />
<uiComponent name="adyen_notifications_overview"/>
</referenceContainer>
</body>
22 changes: 22 additions & 0 deletions view/adminhtml/templates/notification/cleanup_job_notice.phtml
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; ?>

0 comments on commit 35678e2

Please sign in to comment.