Skip to content

Commit

Permalink
dynamic ps_accounts version method
Browse files Browse the repository at this point in the history
  • Loading branch information
mandan2 committed Oct 17, 2023
1 parent 41fdd9b commit 038bea3
Show file tree
Hide file tree
Showing 2 changed files with 11 additions and 1 deletion.
10 changes: 10 additions & 0 deletions src/Config/Config.php
Original file line number Diff line number Diff line change
Expand Up @@ -18,6 +18,7 @@
use Mollie\Api\Types\PaymentStatus;
use Mollie\Api\Types\RefundStatus;
use Mollie\Utility\EnvironmentUtility;
use Mollie\Utility\PsVersionUtility;

class Config
{
Expand Down Expand Up @@ -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()
{
Expand Down
2 changes: 1 addition & 1 deletion src/ServiceProvider/BaseServiceProvider.php
Original file line number Diff line number Diff line change
Expand Up @@ -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);
Expand Down

0 comments on commit 038bea3

Please sign in to comment.