diff --git a/ViewModel/Cart/Donmo.php b/ViewModel/Cart/Donmo.php index 82b5db9..3cd870b 100644 --- a/ViewModel/Cart/Donmo.php +++ b/ViewModel/Cart/Donmo.php @@ -3,34 +3,24 @@ namespace Donmo\Roundup\ViewModel\Cart; use Donmo\Roundup\Model\Config as DonmoConfig; -use Magento\Framework\App\State; use Magento\Framework\Serialize\Serializer\Json; use Magento\Framework\View\Element\Block\ArgumentInterface; class Donmo implements ArgumentInterface { - private State $appState; private mixed $mode; private DonmoConfig $donmoConfig; private Json $json; - public function __construct(State $appState, DonmoConfig $donmoConfig, Json $json) + public function __construct(DonmoConfig $donmoConfig, Json $json) { - $this->appState = $appState; $this->donmoConfig = $donmoConfig; $this->mode = $this->donmoConfig->getCurrentMode(); $this->json = $json; } - public function getIsAvailable() + public function getIsActive(): bool { - $isActive = $this->donmoConfig->getIsActive(); - - $modesCompatible = - $this->appState->getMode() == State::MODE_PRODUCTION && $this->mode == 'live' - || - $this->appState->getMode() == State::MODE_DEVELOPER && $this->mode == 'test'; - - return ($isActive && $modesCompatible); + return $this->donmoConfig->getIsActive(); } public function getDonmoConfig(): string diff --git a/lib/ApiService.php b/lib/ApiService.php index 5383743..7b9a496 100644 --- a/lib/ApiService.php +++ b/lib/ApiService.php @@ -20,7 +20,7 @@ class ApiService public function __construct( ZendClientFactory $httpClientFactory, Logger $logger, - DonmoConfig $donmoConfig, + DonmoConfig $donmoConfig ) { $this->client = $httpClientFactory->create(); $this->logger = $logger; diff --git a/view/frontend/templates/donmo-cart.phtml b/view/frontend/templates/donmo-cart.phtml index c1bf329..2766572 100644 --- a/view/frontend/templates/donmo-cart.phtml +++ b/view/frontend/templates/donmo-cart.phtml @@ -7,14 +7,14 @@ use Magento\Framework\View\Element\Template; use Donmo\Roundup\Model\Config; $viewModel = $block->getViewModel(); -$isAvailable = $viewModel->getIsAvailable(); +$isActive = $viewModel->getIsActive(); $donmoConfig = $viewModel->getDonmoConfig(); $style = " width: 70%; margin: 15px 5px; " ?> - +