-
Notifications
You must be signed in to change notification settings - Fork 17
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge branch 'master' into product_prices
- Loading branch information
Showing
10 changed files
with
150 additions
and
3 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
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,49 @@ | ||
<?php | ||
|
||
declare(strict_types = 1); | ||
|
||
namespace Macopedia\Allegro\Cron; | ||
|
||
use Macopedia\Allegro\Logger\Logger; | ||
use Magento\Framework\App\Config\ScopeConfigInterface; | ||
use Macopedia\Allegro\Model\OrderImporter\AllegroReservation; | ||
|
||
/** | ||
* Class responsible for cleaning old reservations | ||
*/ | ||
class CleanReservations | ||
{ | ||
const RESERVATIONS_CONFIG_KEY = 'allegro/order/reservations_enabled'; | ||
|
||
/** @var Logger */ | ||
private $logger; | ||
|
||
/** @var ScopeConfigInterface */ | ||
private $scopeConfig; | ||
|
||
/** @var AllegroReservation */ | ||
private $allegroReservation; | ||
|
||
/** | ||
* @param Logger $logger | ||
* @param ScopeConfigInterface $scopeConfig | ||
* @param AllegroReservation $allegroReservation | ||
*/ | ||
public function __construct( | ||
Logger $logger, | ||
ScopeConfigInterface $scopeConfig, | ||
AllegroReservation $allegroReservation | ||
) { | ||
$this->logger = $logger; | ||
$this->scopeConfig = $scopeConfig; | ||
$this->allegroReservation = $allegroReservation; | ||
} | ||
|
||
public function execute() | ||
{ | ||
if ($this->scopeConfig->getValue(self::RESERVATIONS_CONFIG_KEY)) { | ||
$this->logger->addInfo("Cronjob clean reservations is executed."); | ||
$this->allegroReservation->cleanOldReservations(); | ||
} | ||
} | ||
} |
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
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
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
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
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
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
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
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