Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

fix: Impossible configure Alma if PS Account version is lower 5.0 #589

Merged
Show file tree
Hide file tree
Changes from 1 commit
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
22 changes: 22 additions & 0 deletions alma/alma.php
Original file line number Diff line number Diff line change
Expand Up @@ -31,6 +31,7 @@
class Alma extends PaymentModule
{
const VERSION = '4.4.0';
const PS_ACCOUNT_VERSION_REQUIRED = '5.0';

public $_path;
public $local_path;
Expand Down Expand Up @@ -149,6 +150,25 @@ public function checkCompatibilityPSModule()
}
}

/**
* Check if PS Account is installed and up to date, minimal version required 5.0.
*
* @return void
*
* @throws \PrestaShop\PsAccountsInstaller\Installer\Exception\ModuleNotInstalledException
*/
public function checkPsAccountCompatibility()
{
$psAccountModule = \Module::getInstanceByName('ps_accounts');
if (!$psAccountModule) {
throw new \PrestaShop\PsAccountsInstaller\Installer\Exception\ModuleNotInstalledException('[Alma] PS Account is not installed');
}

if ($psAccountModule->version < self::PS_ACCOUNT_VERSION_REQUIRED) {
throw new \PrestaShop\PsAccountsInstaller\Installer\Exception\ModuleNotInstalledException('[Alma] PS Account is not up to date, minimal version required ' . self::PS_ACCOUNT_VERSION_REQUIRED);
}
}

/**
* @return array[]
*/
Expand Down Expand Up @@ -604,10 +624,12 @@ public function getContent()
* @return bool
*
* @throws \Alma\PrestaShop\Exceptions\CompatibilityPsAccountException
* @throws \PrestaShop\PsAccountsInstaller\Installer\Exception\ModuleNotInstalledException
*/
public function renderPSAccount()
{
$this->checkCompatibilityPSModule();
$this->checkPsAccountCompatibility();
Benjamin-Freoua-Alma marked this conversation as resolved.
Show resolved Hide resolved
$this->setContainer();

try {
Expand Down
2 changes: 1 addition & 1 deletion alma/translations/de.php
Original file line number Diff line number Diff line change
Expand Up @@ -260,7 +260,7 @@
$_MODULE['<{alma}prestashop>notificationconfiguration_cf5ec9fb9f7214a3db82a5a39fec5b48'] = 'Enter your API key';
$_MODULE['<{alma}prestashop>notificationconfiguration_055f421849c2a1c32b885c95540f827c'] = 'Find your API live key on your %1$s Alma dashboard%2$s';
$_MODULE['<{alma}prestashop>notificationconfiguration_53b458e8453e3694811e61c96527d638'] = 'Um den Testmodus zu verwenden, rufen Sie Ihren Test-API-Schlüssel von Ihrem %1$ssandbox dashboard%2$s ab.';
$_MODULE['<{alma}prestashop>notificationconfiguration_41d0063d3bb7d3067f46734fac8b27c4'] = 'Wir bieten das PrestaShop Account Modul zum Download an';
$_MODULE['<{alma}prestashop>notificationconfiguration_42deb316427c319fae8ef1e9a2ebfacb'] = 'Wir bieten das PrestaShop Account Modul zum Download an';
$_MODULE['<{alma}prestashop>notificationconfiguration_6997dde298b14fbf6a7c95bd39fe8dc4'] = 'Das Modul %1$sfinden Sie hier%2$s';
$_MODULE['<{alma}prestashop>notificationshareofcheckout_a6b0ef107f0d278df612764187bbdece'] = ' Steigern Sie Ihre Leistung und erhalten Sie Einblicke!';
$_MODULE['<{alma}prestashop>notificationshareofcheckout_5b64cb0849dd12ea528c04f2fe66ae4d'] = 'Indem Sie diese Option akzeptieren, ermöglichen Sie es Alma, die Nutzung Ihrer Zahlungsmittel zu analysieren, [1]mehr Informationen zu erhalten, um[/1] durchzuführen und diese Daten mit Ihnen zu teilen. Sie können [2]jederzeit abbestellen und Ihre Daten[/2] löschen.';
Expand Down
3 changes: 2 additions & 1 deletion alma/translations/en.php
Original file line number Diff line number Diff line change
Expand Up @@ -260,7 +260,8 @@
$_MODULE['<{alma}prestashop>notificationconfiguration_cf5ec9fb9f7214a3db82a5a39fec5b48'] = 'Enter your API key';
$_MODULE['<{alma}prestashop>notificationconfiguration_055f421849c2a1c32b885c95540f827c'] = 'Find your API live key on your %1$s Alma dashboard%2$s';
$_MODULE['<{alma}prestashop>notificationconfiguration_53b458e8453e3694811e61c96527d638'] = 'To use Test mode, retrieve your Test API key from your %1$ssandbox dashboard%2$s';
$_MODULE['<{alma}prestashop>notificationconfiguration_41d0063d3bb7d3067f46734fac8b27c4'] = 'We offer to download the PrestaShop Account module';
$_MODULE['<{alma}prestashop>notificationconfiguration_42deb316427c319fae8ef1e9a2ebfacb'] = 'We offer to download the PrestaShop Account module';
$_MODULE['<{alma}prestashop>notificationconfiguration_9700e091d54b8ff1fafcd27518c75b23'] = 'Link your store to your PrestaShop account to take full advantage of the modules offered by the PrestaShop Marketplace and optimize your experience.';
$_MODULE['<{alma}prestashop>notificationconfiguration_6997dde298b14fbf6a7c95bd39fe8dc4'] = 'You can find the module %1$shere%2$s';
$_MODULE['<{alma}prestashop>notificationshareofcheckout_a6b0ef107f0d278df612764187bbdece'] = ' Increase your performance & get insights !';
$_MODULE['<{alma}prestashop>notificationshareofcheckout_5b64cb0849dd12ea528c04f2fe66ae4d'] = 'By accepting this option, you enable Alma to analyse the usage of your payment methods, [1]get more information to perform[/1] and share this data with you. You can [2]unsubscribe and erase your data[/2] at any moment.';
Expand Down
2 changes: 1 addition & 1 deletion alma/translations/es.php
Original file line number Diff line number Diff line change
Expand Up @@ -260,7 +260,7 @@
$_MODULE['<{alma}prestashop>notificationconfiguration_cf5ec9fb9f7214a3db82a5a39fec5b48'] = 'Introduce tu clave API';
$_MODULE['<{alma}prestashop>notificationconfiguration_055f421849c2a1c32b885c95540f827c'] = 'Encuentra tu API live key en tu %1$s Alma dashboard%2$s';
$_MODULE['<{alma}prestashop>notificationconfiguration_53b458e8453e3694811e61c96527d638'] = 'Para utilizar el modo de prueba, obtenga su clave de API de prueba en el panel de control de su sandbox %1$s%2$s';
$_MODULE['<{alma}prestashop>notificationconfiguration_41d0063d3bb7d3067f46734fac8b27c4'] = 'Te proponemos descargar el módulo Cuenta PrestaShop';
$_MODULE['<{alma}prestashop>notificationconfiguration_42deb316427c319fae8ef1e9a2ebfacb'] = 'Te proponemos descargar el módulo Cuenta PrestaShop';
$_MODULE['<{alma}prestashop>notificationconfiguration_6997dde298b14fbf6a7c95bd39fe8dc4'] = 'Encontrará el módulo %1$saquí%2$s';
$_MODULE['<{alma}prestashop>notificationshareofcheckout_a6b0ef107f0d278df612764187bbdece'] = ' Aumenta tu rendimiento y obtén información';
$_MODULE['<{alma}prestashop>notificationshareofcheckout_5b64cb0849dd12ea528c04f2fe66ae4d'] = 'Al aceptar esta opción, permites a Alma analizar el uso de tus métodos de pago, [1]obtener más información para realizar[/1] y compartir estos datos contigo. Puedes [2]darte de baja y borrar tus datos[/2] en cualquier momento.';
Expand Down
6 changes: 4 additions & 2 deletions alma/translations/fr.php
Original file line number Diff line number Diff line change
Expand Up @@ -148,7 +148,8 @@
$_MODULE['<{alma}prestashop>admininsurancehelper_7442e29d7d53e549b78d93c46b8cdcfc'] = 'Commandes';
$_MODULE['<{alma}prestashop>insuranceservice_d87aee5118a62a7ff6c21e4ac31006c5'] = 'Par la présente, je reconnais accepter de souscrire à l\'assurance proposée par Alma. Ce faisant, je confirme avoir préalablement pris connaissance de la [notice d\'information valant conditions générales], du [document d\'information sur le produit d\'assurance], et de la [fiche d\'information et de conseil précontractuelle]. J\'y adhère sans réserve et accepte de signer électroniquement les différents documents formant mon contrat, le cas échéant. Je consens expressément à la collecte et à l\'utilisation de mes données personnelles aux fins de la souscription et de la gestion de mon (mes) contrat(s) d\'assurance.';
$_MODULE['<{alma}prestashop>adminalmainsuranceconfiguration_b824200e9b8aca1fbb762d6566ff0cd7'] = 'Votre configuration a été sauvegardée';
$_MODULE['<{alma}prestashop>adminalmainsuranceconfiguration_4a39c6a33c3441762924914168d2a387'] = 'Erreur lors de la création de la configuration Assurance Alma : %1$s';
$_MODULE['<{alma}prestashop>adminalmainsuranceconfiguration_a6bf06f186e2fccecad054fd831c2144'] = '[Alma] Erreur sur le produit d\'assurance pendant le changement de configuration : %1$s';
$_MODULE['<{alma}prestashop>adminalmainsuranceconfiguration_b42688965893bdb7a37cf1197e506e25'] = '[Alma] Erreur de création de configuration sur l\'assurance Alma : %1$s';
$_MODULE['<{alma}prestashop>adminalmainsuranceorders_a66f446516cd125af12bd25073f88b78'] = 'Commandes avec assurance';
$_MODULE['<{alma}prestashop>adminalmainsuranceorders_49414cda71621b3ee718ae5ff40804c5'] = 'Ordonnance Id';
$_MODULE['<{alma}prestashop>adminalmainsuranceorders_63d5049791d9d79d86e9a108b0a999ca'] = 'Référence';
Expand Down Expand Up @@ -260,7 +261,8 @@
$_MODULE['<{alma}prestashop>notificationconfiguration_cf5ec9fb9f7214a3db82a5a39fec5b48'] = 'Entrez votre clé API';
$_MODULE['<{alma}prestashop>notificationconfiguration_055f421849c2a1c32b885c95540f827c'] = 'Trouvez votre clé API sur votre tableau de bord %1$s Alma%2$s';
$_MODULE['<{alma}prestashop>notificationconfiguration_53b458e8453e3694811e61c96527d638'] = 'Pour utiliser le mode test, récupérez votre clé API de test dans le tableau de bord de votre sandbox %1$s%2$s';
$_MODULE['<{alma}prestashop>notificationconfiguration_41d0063d3bb7d3067f46734fac8b27c4'] = 'Nous vous proposons de télécharger le module PrestaShop Account';
$_MODULE['<{alma}prestashop>notificationconfiguration_42deb316427c319fae8ef1e9a2ebfacb'] = 'Nous vous proposons de télécharger le module PrestaShop Account';
$_MODULE['<{alma}prestashop>notificationconfiguration_9700e091d54b8ff1fafcd27518c75b23'] = 'Liez votre boutique à votre compte PrestaShop pour profiter pleinement des modules proposés par PrestaShop Marketplace et optimiser votre expérience.';
$_MODULE['<{alma}prestashop>notificationconfiguration_6997dde298b14fbf6a7c95bd39fe8dc4'] = 'Vous pouvez trouver le module %1$sici%2$s';
$_MODULE['<{alma}prestashop>notificationshareofcheckout_a6b0ef107f0d278df612764187bbdece'] = ' Augmentez vos performances et obtenez des informations !';
$_MODULE['<{alma}prestashop>notificationshareofcheckout_5b64cb0849dd12ea528c04f2fe66ae4d'] = 'En acceptant cette option, vous permettez à Alma d\'analyser l\'utilisation de vos moyens de paiement, [1]d\'obtenir plus d\'informations pour effectuer[/1] et de partager ces données avec vous. Vous pouvez à tout moment vous désinscrire [2]et effacer vos données[/2] .';
Expand Down
2 changes: 1 addition & 1 deletion alma/translations/it.php
Original file line number Diff line number Diff line change
Expand Up @@ -260,7 +260,7 @@
$_MODULE['<{alma}prestashop>notificationconfiguration_cf5ec9fb9f7214a3db82a5a39fec5b48'] = 'Inserire la chiave API';
$_MODULE['<{alma}prestashop>notificationconfiguration_055f421849c2a1c32b885c95540f827c'] = 'Trovate la vostra chiave API live sul vostro cruscotto %1$s Alma%2$s';
$_MODULE['<{alma}prestashop>notificationconfiguration_53b458e8453e3694811e61c96527d638'] = 'Per utilizzare la modalità Test, recuperare la chiave API Test dalla dashboard di %1$ssandbox%2$s.';
$_MODULE['<{alma}prestashop>notificationconfiguration_41d0063d3bb7d3067f46734fac8b27c4'] = 'Vi proponiamo di scaricare il modulo Account di PrestaShop';
$_MODULE['<{alma}prestashop>notificationconfiguration_42deb316427c319fae8ef1e9a2ebfacb'] = 'Vi proponiamo di scaricare il modulo Account di PrestaShop';
$_MODULE['<{alma}prestashop>notificationconfiguration_6997dde298b14fbf6a7c95bd39fe8dc4'] = 'È possibile trovare il modulo %1$squi%2$s';
$_MODULE['<{alma}prestashop>notificationshareofcheckout_a6b0ef107f0d278df612764187bbdece'] = 'Aumenta le tue prestazioni e ricevi approfondimenti sulle tue vendite!';
$_MODULE['<{alma}prestashop>notificationshareofcheckout_5b64cb0849dd12ea528c04f2fe66ae4d'] = 'Attivando questa opzione, permetti ad Alma di analizzare l\'utilizzo dei tuoi metodi di pagamento [1]al fine[/1] di migliorare il servizio e condividerti un approfondimento sui dati analizzati. Puoi [2]annullare l\'iscrizione e cancellare i tuoi dati[/2] in qualsiasi momento.';
Expand Down
2 changes: 1 addition & 1 deletion alma/translations/nl.php
Original file line number Diff line number Diff line change
Expand Up @@ -260,7 +260,7 @@
$_MODULE['<{alma}prestashop>notificationconfiguration_cf5ec9fb9f7214a3db82a5a39fec5b48'] = 'Voer je API-sleutel in';
$_MODULE['<{alma}prestashop>notificationconfiguration_055f421849c2a1c32b885c95540f827c'] = 'Vind je API live key op je %1$s Alma dashboard%2$s';
$_MODULE['<{alma}prestashop>notificationconfiguration_53b458e8453e3694811e61c96527d638'] = 'Om de Testmodus te gebruiken, haalt je je Test API-sleutel op van jouw %1$ssandbox dashboard%2$s';
$_MODULE['<{alma}prestashop>notificationconfiguration_41d0063d3bb7d3067f46734fac8b27c4'] = 'Wij bieden aan om de PrestaShop Account module te downloaden';
$_MODULE['<{alma}prestashop>notificationconfiguration_42deb316427c319fae8ef1e9a2ebfacb'] = 'Wij bieden aan om de PrestaShop Account module te downloaden';
$_MODULE['<{alma}prestashop>notificationconfiguration_6997dde298b14fbf6a7c95bd39fe8dc4'] = 'Je kunt de module %1$shier vinden%2$s';
$_MODULE['<{alma}prestashop>notificationshareofcheckout_a6b0ef107f0d278df612764187bbdece'] = ' Verhoog je prestaties & krijg inzichten!';
$_MODULE['<{alma}prestashop>notificationshareofcheckout_5b64cb0849dd12ea528c04f2fe66ae4d'] = 'Door deze optie te aanvaarden, stel je Alma in staat het gebruik van je betaalmethoden te analyseren, [1]meer informatie te verkrijgen om beter te presteren[/1] en deze gegevens met jou te delen. Je kunt [2]je op elk moment uitschrijven en je data wissen[/2].';
Expand Down
2 changes: 1 addition & 1 deletion alma/translations/pt.php
Original file line number Diff line number Diff line change
Expand Up @@ -260,7 +260,7 @@
$_MODULE['<{alma}prestashop>notificationconfiguration_cf5ec9fb9f7214a3db82a5a39fec5b48'] = 'Introduza a sua chave API';
$_MODULE['<{alma}prestashop>notificationconfiguration_055f421849c2a1c32b885c95540f827c'] = 'Encontre a sua chave de acesso à API no seu painel de controlo %1$s Alma%2$s';
$_MODULE['<{alma}prestashop>notificationconfiguration_53b458e8453e3694811e61c96527d638'] = 'Para utilizar o modo de teste, recupere a sua chave de API de teste a partir do seu painel de controlo da caixa de areia %1$s%2$s';
$_MODULE['<{alma}prestashop>notificationconfiguration_41d0063d3bb7d3067f46734fac8b27c4'] = 'Oferecemos a possibilidade de descarregar o módulo Conta PrestaShop';
$_MODULE['<{alma}prestashop>notificationconfiguration_42deb316427c319fae8ef1e9a2ebfacb'] = 'Oferecemos a possibilidade de descarregar o módulo Conta PrestaShop';
$_MODULE['<{alma}prestashop>notificationconfiguration_6997dde298b14fbf6a7c95bd39fe8dc4'] = 'Pode encontrar o módulo %1$saqui%2$s';
$_MODULE['<{alma}prestashop>notificationshareofcheckout_a6b0ef107f0d278df612764187bbdece'] = ' Aumente o seu desempenho e obtenha conhecimentos!';
$_MODULE['<{alma}prestashop>notificationshareofcheckout_5b64cb0849dd12ea528c04f2fe66ae4d'] = 'Ao aceitar esta opção, permite à Alma analisar a utilização dos seus métodos de pagamento, [1]obter mais informações para realizar[/1] e partilhar estes dados consigo. Pode [2]cancelar e apagar os seus dados[/2] a qualquer momento.';
Expand Down
4 changes: 2 additions & 2 deletions alma/views/templates/hook/notificationConfiguration.tpl
Original file line number Diff line number Diff line change
Expand Up @@ -95,10 +95,10 @@
{if isset($suggestPSAccount) && $suggestPSAccount}
<div class="alma alert alert-dismissible alert-info">
<h2>
{l s='We offer to download the PrestaShop Account module ' mod='alma'}
{l s='We offer to download the PrestaShop Account module' mod='alma'}
</h2>
<p>
{l s='Link your store to your PrestaShop account to take full advantage of the modules offered by the PrestaShop Marketplace and optimize your experience.'}
{l s='Link your store to your PrestaShop account to take full advantage of the modules offered by the PrestaShop Marketplace and optimize your experience.' mod='alma'}
</p>
{almaDisplayHtml}
{l s='You can find the module %1$shere%2$s' sprintf=['<a href="https://addons.prestashop.com/en/administrative-tools/49648-prestashop-account.html" target=\"_blank\">', '</a>'] mod='alma'}
Expand Down