From 86efeb74227b410813db1cb7751a2a447ae57967 Mon Sep 17 00:00:00 2001 From: BitcoinMitchell Date: Thu, 4 Jul 2024 19:35:27 +0200 Subject: [PATCH] [Configuration] Ensure ConfigureController works on PS 8.0 --- docker-compose.yml | 2 +- modules/btcpay/btcpay.php | 2 +- .../Admin/Improve/Payment/ConfigureController.php | 11 +++++++++++ 3 files changed, 13 insertions(+), 2 deletions(-) diff --git a/docker-compose.yml b/docker-compose.yml index cb6bf60..aac72d6 100644 --- a/docker-compose.yml +++ b/docker-compose.yml @@ -123,7 +123,7 @@ services: expose: - '8080' - '8443' - image: 'bitnami/prestashop:8.1.3' + image: 'bitnami/prestashop:8.0.4' links: - mariadb - btcpayserver diff --git a/modules/btcpay/btcpay.php b/modules/btcpay/btcpay.php index 18cef71..c08eaa8 100644 --- a/modules/btcpay/btcpay.php +++ b/modules/btcpay/btcpay.php @@ -52,7 +52,7 @@ public function __construct() { $this->name = 'btcpay'; $this->tab = 'payments_gateways'; - $this->version = '6.1.4'; + $this->version = '6.1.5'; $this->author = 'BTCPay Server'; $this->ps_versions_compliancy = ['min' => Constants::MINIMUM_PS_VERSION, 'max' => _PS_VERSION_]; $this->controllers = ['payment', 'validation', 'webhook']; diff --git a/modules/btcpay/src/Controller/Admin/Improve/Payment/ConfigureController.php b/modules/btcpay/src/Controller/Admin/Improve/Payment/ConfigureController.php index bd11443..35cb908 100644 --- a/modules/btcpay/src/Controller/Admin/Improve/Payment/ConfigureController.php +++ b/modules/btcpay/src/Controller/Admin/Improve/Payment/ConfigureController.php @@ -11,6 +11,7 @@ use BTCPay\Server\Data\ValidateApiKey; use BTCPayServer\Client\ApiKey; use Exception; +use PrestaShop\PrestaShop\Core\Domain\Configuration\ShopConfigurationInterface; use PrestaShop\PrestaShop\Core\Form\FormHandlerInterface; use PrestaShopBundle\Controller\Admin\FrameworkBundleAdminController; use PrestaShopBundle\Security\Annotation\AdminSecurity; @@ -293,6 +294,16 @@ public function validateAPIKeyAction(Request $request): Response return $this->redirectToRoute('admin_btcpay_configure'); } + protected function getConfiguration(): ShopConfigurationInterface + { + // Fallback in case 8.0 is used // TODO: Remove once we make 8.1.0 the minimum + if (\version_compare(\_PS_VERSION_, '8.1.0', '<')) { + return $this->configuration; + } + + return parent::getConfiguration(); + } + /** * @throws Exception */