Files
esun3d/app/code/Esun/OrderCleanup/Model/Config.php
T
2026-09-15 10:35:56 +08:00

33 lines
754 B
PHP

<?php
declare(strict_types=1);
namespace Esun\OrderCleanup\Model;
use Magento\Framework\App\Config\ScopeConfigInterface;
class Config
{
public const XML_PATH_CANCEL_PENDING_AFTER = 'sales/orders/cancel_pending_after';
/**
* @param ScopeConfigInterface $scopeConfig
*/
public function __construct(private readonly ScopeConfigInterface $scopeConfig)
{
}
/**
* Return the global pending-order cancellation lifetime.
*/
public function getCancellationLifetimeMinutes(): int
{
return max(
0,
(int)$this->scopeConfig->getValue(
self::XML_PATH_CANCEL_PENDING_AFTER,
ScopeConfigInterface::SCOPE_TYPE_DEFAULT
)
);
}
}