init
This commit is contained in:
@@ -0,0 +1,32 @@
|
||||
<?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
|
||||
)
|
||||
);
|
||||
}
|
||||
}
|
||||
Reference in New Issue
Block a user