Skip to content

Commit b7e9487

Browse files
authored
Merge pull request #19 from donmo-roundup/remove-modes-compatibility-check
remove modes compatibility check from cart integration, minor fixes
2 parents f181006 + 12b2274 commit b7e9487

File tree

3 files changed

+6
-16
lines changed

3 files changed

+6
-16
lines changed

ViewModel/Cart/Donmo.php

Lines changed: 3 additions & 13 deletions
Original file line numberDiff line numberDiff line change
@@ -3,34 +3,24 @@
33
namespace Donmo\Roundup\ViewModel\Cart;
44

55
use Donmo\Roundup\Model\Config as DonmoConfig;
6-
use Magento\Framework\App\State;
76
use Magento\Framework\Serialize\Serializer\Json;
87
use Magento\Framework\View\Element\Block\ArgumentInterface;
98

109
class Donmo implements ArgumentInterface
1110
{
12-
private State $appState;
1311
private mixed $mode;
1412
private DonmoConfig $donmoConfig;
1513
private Json $json;
16-
public function __construct(State $appState, DonmoConfig $donmoConfig, Json $json)
14+
public function __construct(DonmoConfig $donmoConfig, Json $json)
1715
{
18-
$this->appState = $appState;
1916
$this->donmoConfig = $donmoConfig;
2017
$this->mode = $this->donmoConfig->getCurrentMode();
2118
$this->json = $json;
2219
}
2320

24-
public function getIsAvailable()
21+
public function getIsActive(): bool
2522
{
26-
$isActive = $this->donmoConfig->getIsActive();
27-
28-
$modesCompatible =
29-
$this->appState->getMode() == State::MODE_PRODUCTION && $this->mode == 'live'
30-
||
31-
$this->appState->getMode() == State::MODE_DEVELOPER && $this->mode == 'test';
32-
33-
return ($isActive && $modesCompatible);
23+
return $this->donmoConfig->getIsActive();
3424
}
3525

3626
public function getDonmoConfig(): string

lib/ApiService.php

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -20,7 +20,7 @@ class ApiService
2020
public function __construct(
2121
ZendClientFactory $httpClientFactory,
2222
Logger $logger,
23-
DonmoConfig $donmoConfig,
23+
DonmoConfig $donmoConfig
2424
) {
2525
$this->client = $httpClientFactory->create();
2626
$this->logger = $logger;

view/frontend/templates/donmo-cart.phtml

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -7,14 +7,14 @@ use Magento\Framework\View\Element\Template;
77
use Donmo\Roundup\Model\Config;
88

99
$viewModel = $block->getViewModel();
10-
$isAvailable = $viewModel->getIsAvailable();
10+
$isActive = $viewModel->getIsActive();
1111
$donmoConfig = $viewModel->getDonmoConfig();
1212
$style = "
1313
width: 70%;
1414
margin: 15px 5px;
1515
"
1616
?>
17-
<?php if ($isAvailable):?>
17+
<?php if ($isActive):?>
1818
<div id="donmo-component" style="<?= $style ?>" data-bind="scope:'donmo-component'">
1919
<!-- ko template: getTemplate() --><!-- /ko -->
2020
<script type="text/x-magento-init">

0 commit comments

Comments
 (0)