Skip to content

Commit

Permalink
phpstan and minor ps_evenbus install tweaks
Browse files Browse the repository at this point in the history
  • Loading branch information
mandan2 committed Oct 9, 2023
1 parent a4e6a80 commit faa9ac4
Show file tree
Hide file tree
Showing 3 changed files with 14 additions and 8 deletions.
6 changes: 5 additions & 1 deletion controllers/admin/AdminMollieSettingsController.php
Original file line number Diff line number Diff line change
Expand Up @@ -227,15 +227,19 @@ private function setEnvironmentForCloudSync(): void
return;
}

/* @phpstan-ignore-next-line */
/** @var \Ps_eventbus $eventbusModule */
$eventbusModule = \Module::getInstanceByName('ps_eventbus');

Check failure on line 232 in controllers/admin/AdminMollieSettingsController.php

View workflow job for this annotation

GitHub Actions / PHPStan (1.7.6.8)

PHPDoc tag @var for variable $eventbusModule contains unknown class Ps_eventbus.

/* @phpstan-ignore-next-line */
if (version_compare($eventbusModule->version, '1.9.0', '>=')) {
/* @phpstan-ignore-next-line */
/** @var PresenterService $eventbusPresenterService */
$eventbusPresenterService = $eventbusModule->getService(PresenterService::class);

Check failure on line 238 in controllers/admin/AdminMollieSettingsController.php

View workflow job for this annotation

GitHub Actions / PHPStan (1.7.6.8)

Call to method getService() on an unknown class Ps_eventbus.

Check failure on line 238 in controllers/admin/AdminMollieSettingsController.php

View workflow job for this annotation

GitHub Actions / PHPStan (1.7.6.8)

Class PrestaShop\Module\PsEventbus\Service\PresenterService not found.

Check failure on line 238 in controllers/admin/AdminMollieSettingsController.php

View workflow job for this annotation

GitHub Actions / PHPStan (1.7.6.8)

PHPDoc tag @var for variable $eventbusPresenterService contains unknown class PrestaShop\Module\PsEventbus\Service\PresenterService.

/* @phpstan-ignore-next-line */
Media::addJsDef([
'contextPsEventbus' => $eventbusPresenterService->expose($this->module, ['orders',]),
'contextPsEventbus' => $eventbusPresenterService->expose($this->module, ['orders']),

Check failure on line 242 in controllers/admin/AdminMollieSettingsController.php

View workflow job for this annotation

GitHub Actions / PHPStan (1.7.6.8)

Call to method expose() on an unknown class PrestaShop\Module\PsEventbus\Service\PresenterService.
]);
}

Expand Down
14 changes: 8 additions & 6 deletions mollie.php
Original file line number Diff line number Diff line change
Expand Up @@ -185,15 +185,17 @@ public function install()
$moduleManager = ModuleManagerBuilder::getInstance()->build();

try {
if (!$moduleManager->isInstalled('ps_eventbus')) {
$moduleManager->install('ps_eventbus');
}

if (!$moduleManager->isEnabled('ps_eventbus')) {
/**
* NOTE: install method upgrades the module if there is a newer version
*/
if (
$moduleManager->isInstalled('ps_eventbus') &&
!$moduleManager->isEnabled('ps_eventbus')
) {
$moduleManager->enable('ps_eventbus');
}

$moduleManager->upgrade('ps_eventbus');
$moduleManager->install('ps_eventbus');
} catch (Exception $exception) {
$this->_errors[] = $this->l('Failed to install/upgrade Prestashop event bus module. Please contact support.');

Expand Down
2 changes: 1 addition & 1 deletion src/Config/Config.php
Original file line number Diff line number Diff line change
Expand Up @@ -313,7 +313,7 @@ class Config
const MOLLIE_BUTTON_ORDER_TOTAL_REFRESH = 'MOLLIE_BUTTON_ORDER_TOTAL_REFRESH';

public const PRESTASHOP_ACCOUNTS_INSTALLER_VERSION = '5.0.0';
public const PRESTASHOP_CLOUDSYNC_CDN = 'https://integration-assets.prestashop3.com/ext/cloudsync-merchant-sync-consent/latest/cloudsync-cdc.js';
public const PRESTASHOP_CLOUDSYNC_CDN = 'https://assets.prestashop3.com/ext/cloudsync-merchant-sync-consent/latest/cloudsync-cdc.js';

// TODO migrate functions below to separate service
public static function getStatuses()
Expand Down

0 comments on commit faa9ac4

Please sign in to comment.