diff --git a/src/Config/Config.php b/src/Config/Config.php index f7030c46f..fdf4e44af 100644 --- a/src/Config/Config.php +++ b/src/Config/Config.php @@ -18,6 +18,7 @@ use Mollie\Api\Types\PaymentStatus; use Mollie\Api\Types\RefundStatus; use Mollie\Utility\EnvironmentUtility; +use Mollie\Utility\PsVersionUtility; class Config { @@ -315,6 +316,15 @@ class Config public const PRESTASHOP_ACCOUNTS_INSTALLER_VERSION = '5.0.0'; public const PRESTASHOP_CLOUDSYNC_CDN = 'https://assets.prestashop3.com/ext/cloudsync-merchant-sync-consent/latest/cloudsync-cdc.js'; + public static function getPsAccountsVersion(): string + { + if (PsVersionUtility::isPsVersionGreaterOrEqualTo(_PS_VERSION_, '8.0.0')) { + return '6.0.0'; + } + + return '5.0.0'; + } + // TODO migrate functions below to separate service public static function getStatuses() { diff --git a/src/ServiceProvider/BaseServiceProvider.php b/src/ServiceProvider/BaseServiceProvider.php index e39be3fbc..83ce9edf6 100644 --- a/src/ServiceProvider/BaseServiceProvider.php +++ b/src/ServiceProvider/BaseServiceProvider.php @@ -241,7 +241,7 @@ public function register(Container $container) ->withArgument(ApiKeyService::class); $this->addService($container, PsAccountsInstaller::class, PsAccountsInstaller::class) - ->withArgument(Config::PRESTASHOP_ACCOUNTS_INSTALLER_VERSION); + ->withArgument(Config::getPsAccountsVersion()); $this->addService($container, PsAccounts::class, PsAccounts::class) ->withArgument(PsAccountsInstaller::class);