33 lines
754 B
PHP
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
|
|
)
|
|
);
|
|
}
|
|
}
|