From 0fc66b8cbdb471f19fc07bf54bc14cc55ab2ca64 Mon Sep 17 00:00:00 2001 From: Gytautas Date: Tue, 11 Jun 2024 09:19:24 +0300 Subject: [PATCH 1/5] PIPRES-427: ideal v2 improvements --- changelog.md | 3 + .../PaymentOption/IdealDropdownInfoBlock.php | 61 ----------------- src/Builder/FormBuilder.php | 25 ------- src/Config/Config.php | 7 +- .../PaymentOption/PaymentOptionHandler.php | 4 -- src/Install/Installer.php | 1 - src/Install/Uninstall.php | 1 - .../IdealPaymentOptionProvider.php | 27 +------- src/Service/ConfigFieldService.php | 1 - src/Service/IssuerService.php | 67 ------------------- src/Service/SettingsSaveService.php | 2 - upgrade/Upgrade-2.0.0.php | 1 - upgrade/Upgrade-6.0.1.php | 3 - upgrade/Upgrade-6.2.1.php | 24 +++++++ views/css/mollie.css | 27 -------- views/css/mollie_15.css | 27 -------- views/templates/hook/ideal_dropdown.tpl | 60 ----------------- views/templates/hook/payment.tpl | 38 ----------- 18 files changed, 29 insertions(+), 350 deletions(-) delete mode 100644 src/Builder/Content/PaymentOption/IdealDropdownInfoBlock.php delete mode 100644 src/Service/IssuerService.php create mode 100644 upgrade/Upgrade-6.2.1.php delete mode 100644 views/templates/hook/ideal_dropdown.tpl diff --git a/changelog.md b/changelog.md index 2d0a3e828..09a8211bc 100644 --- a/changelog.md +++ b/changelog.md @@ -2,6 +2,9 @@ # Changelog # +## Changes in release 6.2.1 ## ++ Ideal v2 payment method improvement + ## Changes in release 6.2.0 ## + New payment methods: Bancomat and Alma + Apple certificate update diff --git a/src/Builder/Content/PaymentOption/IdealDropdownInfoBlock.php b/src/Builder/Content/PaymentOption/IdealDropdownInfoBlock.php deleted file mode 100644 index 318bbff0d..000000000 --- a/src/Builder/Content/PaymentOption/IdealDropdownInfoBlock.php +++ /dev/null @@ -1,61 +0,0 @@ - - * @copyright Mollie B.V. - * @license https://github.com/mollie/PrestaShop/blob/master/LICENSE.md - * - * @see https://github.com/mollie/PrestaShop - * @codingStandardsIgnoreStart - */ - -namespace Mollie\Builder\Content\PaymentOption; - -use Mollie; -use Mollie\Api\Types\PaymentMethod; -use Mollie\Builder\TemplateBuilderInterface; -use Mollie\Service\IssuerService; - -if (!defined('_PS_VERSION_')) { - exit; -} - -class IdealDropdownInfoBlock implements TemplateBuilderInterface -{ - /** - * @var Mollie - */ - private $module; - - /** - * @var IssuerService - */ - private $issuerService; - - public function __construct(Mollie $module, IssuerService $issuerService) - { - $this->module = $module; - $this->issuerService = $issuerService; - } - - /** - * {@inheritDoc} - */ - public function buildParams() - { - return [ - 'idealIssuers' => $this->getIdealIssuers(), - ]; - } - - /** - * @return array - */ - private function getIdealIssuers() - { - $issuers = $this->issuerService->getIdealIssuers(); - - return isset($issuers[PaymentMethod::IDEAL]) ? $issuers[PaymentMethod::IDEAL] : []; - } -} diff --git a/src/Builder/FormBuilder.php b/src/Builder/FormBuilder.php index 871d53870..2af16f9e8 100644 --- a/src/Builder/FormBuilder.php +++ b/src/Builder/FormBuilder.php @@ -372,31 +372,6 @@ protected function getAccountSettingsSection($isApiKeyProvided) ], ]; - $input = array_merge($input, [ - [ - 'type' => 'select', - 'label' => $this->module->l('Issuer list', self::FILE_NAME), - 'tab' => $generalSettings, - 'desc' => $this->module->l('Some payment methods (e.g. iDEAL) have an issuer list. Select where to display the list.', self::FILE_NAME), - 'name' => Config::MOLLIE_ISSUERS[(int) $this->configuration->get(Config::MOLLIE_ENVIRONMENT) ? 'production' : 'sandbox'], - 'options' => [ - 'query' => [ - [ - 'id' => Config::ISSUERS_ON_CLICK, - 'name' => $this->module->l('In the shop checkout', self::FILE_NAME), - ], - [ - 'id' => Config::ISSUERS_PAYMENT_PAGE, - 'name' => $this->module->l('In the Mollie Checkout', self::FILE_NAME), - ], - ], - 'id' => 'id', - 'name' => 'name', - ], - ], - ] - ); - $input[] = [ 'type' => 'mollie-h2', 'tab' => $generalSettings, diff --git a/src/Config/Config.php b/src/Config/Config.php index a20d2dd87..6ca067414 100644 --- a/src/Config/Config.php +++ b/src/Config/Config.php @@ -82,8 +82,6 @@ class Config const LOGOS_NORMAL = 'normal'; const LOGOS_HIDE = 'hide'; - const ISSUERS_ON_CLICK = 'on-click'; - const ISSUERS_PAYMENT_PAGE = 'payment-page'; const METHODS_CONFIG = 'MOLLIE_METHODS_CONFIG'; const ENVIRONMENT_TEST = 0; @@ -113,10 +111,7 @@ class Config const MOLLIE_IMAGES = 'MOLLIE_IMAGES'; const MOLLIE_SHOW_RESEND_PAYMENT_LINK = 'MOLLIE_SHOW_RESEND_PAYMENT_LINK'; - const MOLLIE_ISSUERS = [ - 'sandbox' => 'MOLLIE_SANDBOX_ISSUERS', - 'production' => 'MOLLIE_PRODUCTION_ISSUERS', - ]; + const MOLLIE_CSS = 'MOLLIE_CSS'; const MOLLIE_DEBUG_LOG = 'MOLLIE_DEBUG_LOG'; const MOLLIE_METHOD_COUNTRIES = 'MOLLIE_METHOD_COUNTRIES'; diff --git a/src/Handler/PaymentOption/PaymentOptionHandler.php b/src/Handler/PaymentOption/PaymentOptionHandler.php index 1fe2ab067..414490995 100644 --- a/src/Handler/PaymentOption/PaymentOptionHandler.php +++ b/src/Handler/PaymentOption/PaymentOptionHandler.php @@ -125,10 +125,6 @@ private function isIdealPaymentMethod(MolPaymentMethod $paymentMethod) return false; } - if ($this->configurationAdapter->get(Config::MOLLIE_ISSUERS) !== Config::ISSUERS_ON_CLICK) { - return false; - } - return true; } diff --git a/src/Install/Installer.php b/src/Install/Installer.php index 15720d22d..60bcc10eb 100644 --- a/src/Install/Installer.php +++ b/src/Install/Installer.php @@ -187,7 +187,6 @@ protected function initConfig() $this->configurationAdapter->updateValue(Config::MOLLIE_PAYMENTSCREEN_LOCALE, Config::PAYMENTSCREEN_LOCALE_BROWSER_LOCALE); $this->configurationAdapter->updateValue(Config::MOLLIE_IFRAME, true); $this->configurationAdapter->updateValue(Config::MOLLIE_IMAGES, Config::LOGOS_NORMAL); - $this->configurationAdapter->updateValue(Config::MOLLIE_ISSUERS, Config::ISSUERS_ON_CLICK); $this->configurationAdapter->updateValue(Config::MOLLIE_CSS, ''); $this->configurationAdapter->updateValue(Config::MOLLIE_TRACKING_URLS, ''); $this->configurationAdapter->updateValue(Config::MOLLIE_DEBUG_LOG, Config::DEBUG_LOG_ERRORS); diff --git a/src/Install/Uninstall.php b/src/Install/Uninstall.php index 8a15ced6c..95b8d84ea 100644 --- a/src/Install/Uninstall.php +++ b/src/Install/Uninstall.php @@ -75,7 +75,6 @@ private function deleteConfig() Config::MOLLIE_SEND_ORDER_CONFIRMATION, Config::MOLLIE_IFRAME, Config::MOLLIE_IMAGES, - Config::MOLLIE_ISSUERS, Config::MOLLIE_CSS, Config::MOLLIE_DEBUG_LOG, Config::MOLLIE_DISPLAY_ERRORS, diff --git a/src/Provider/PaymentOption/IdealPaymentOptionProvider.php b/src/Provider/PaymentOption/IdealPaymentOptionProvider.php index dbf78324c..61d6ce1d9 100644 --- a/src/Provider/PaymentOption/IdealPaymentOptionProvider.php +++ b/src/Provider/PaymentOption/IdealPaymentOptionProvider.php @@ -38,7 +38,6 @@ use Mollie; use Mollie\Adapter\LegacyContext; -use Mollie\Builder\Content\PaymentOption\IdealDropdownInfoBlock; use Mollie\Provider\CreditCardLogoProvider; use Mollie\Provider\OrderTotal\OrderTotalProviderInterface; use Mollie\Provider\PaymentFeeProviderInterface; @@ -81,11 +80,6 @@ class IdealPaymentOptionProvider implements PaymentOptionProviderInterface */ private $templateParser; - /** - * @var IdealDropdownInfoBlock - */ - private $idealDropdownInfoBlock; - /** * @var LanguageService */ @@ -99,7 +93,6 @@ public function __construct( CreditCardLogoProvider $creditCardLogoProvider, PaymentFeeProviderInterface $paymentFeeProvider, TemplateParserInterface $templateParser, - IdealDropdownInfoBlock $idealDropdownInfoBlock, LanguageService $languageService, OrderTotalProviderInterface $orderTotalProvider ) { @@ -108,7 +101,6 @@ public function __construct( $this->creditCardLogoProvider = $creditCardLogoProvider; $this->paymentFeeProvider = $paymentFeeProvider; $this->templateParser = $templateParser; - $this->idealDropdownInfoBlock = $idealDropdownInfoBlock; $this->languageService = $languageService; $this->orderTotalProvider = $orderTotalProvider; } @@ -131,19 +123,7 @@ public function getPaymentOption(MolPaymentMethod $paymentMethod): PaymentOption ['method' => $paymentMethod->getPaymentMethodName(), 'rand' => Mollie\Utility\TimeUtility::getCurrentTimeStamp()], true )); - $paymentOption->setInputs([ - 'token' => [ - 'name' => 'issuer', - 'type' => 'hidden', - 'value' => '', - ], - ]); - - $paymentOption->setAdditionalInformation($this->templateParser->parseTemplate( - $this->context->getSmarty(), - $this->idealDropdownInfoBlock, - $this->module->getLocalPath() . 'views/templates/hook/ideal_dropdown.tpl' - )); + $paymentOption->setLogo($this->creditCardLogoProvider->getMethodOptionLogo($paymentMethod)); $paymentFeeData = $this->paymentFeeProvider->getPaymentFee($paymentMethod, $this->orderTotalProvider->getOrderTotal()); @@ -151,11 +131,6 @@ public function getPaymentOption(MolPaymentMethod $paymentMethod): PaymentOption if ($paymentFeeData->isActive()) { $paymentOption->setInputs( [ - [ - 'name' => 'issuer', - 'type' => 'hidden', - 'value' => '', - ], [ 'type' => 'hidden', 'name' => 'payment-fee-price', diff --git a/src/Service/ConfigFieldService.php b/src/Service/ConfigFieldService.php index 054904753..7c8717696 100644 --- a/src/Service/ConfigFieldService.php +++ b/src/Service/ConfigFieldService.php @@ -68,7 +68,6 @@ public function getConfigFieldsValues() Config::MOLLIE_CSS => $this->configurationAdapter->get(Config::MOLLIE_CSS), Config::MOLLIE_IMAGES => $this->configurationAdapter->get(Config::MOLLIE_IMAGES), Config::MOLLIE_SHOW_RESEND_PAYMENT_LINK => $this->configurationAdapter->get(Config::MOLLIE_SHOW_RESEND_PAYMENT_LINK), - Config::MOLLIE_ISSUERS[(int) $this->configurationAdapter->get(Config::MOLLIE_ENVIRONMENT) ? 'production' : 'sandbox'] => $this->configurationAdapter->get(Config::MOLLIE_ISSUERS), Config::MOLLIE_METHOD_COUNTRIES => $this->configurationAdapter->get(Config::MOLLIE_METHOD_COUNTRIES), Config::MOLLIE_METHOD_COUNTRIES_DISPLAY => $this->configurationAdapter->get(Config::MOLLIE_METHOD_COUNTRIES_DISPLAY), diff --git a/src/Service/IssuerService.php b/src/Service/IssuerService.php deleted file mode 100644 index bfe0c5400..000000000 --- a/src/Service/IssuerService.php +++ /dev/null @@ -1,67 +0,0 @@ - - * @copyright Mollie B.V. - * @license https://github.com/mollie/PrestaShop/blob/master/LICENSE.md - * - * @see https://github.com/mollie/PrestaShop - * @codingStandardsIgnoreStart - */ - -namespace Mollie\Service; - -use Configuration; -use Context; -use Mollie; -use Mollie\Api\Types\PaymentMethod; -use Mollie\Repository\PaymentMethodRepository; - -if (!defined('_PS_VERSION_')) { - exit; -} - -class IssuerService -{ - /** - * @var PaymentMethodRepository - */ - private $paymentMethodRepository; - /** - * @var Mollie - */ - private $module; - - public function __construct(Mollie $module, PaymentMethodRepository $paymentMethodRepository) - { - $this->paymentMethodRepository = $paymentMethodRepository; - $this->module = $module; - } - - public function getIdealIssuers() - { - $environment = (int) Configuration::get(Mollie\Config\Config::MOLLIE_ENVIRONMENT); - - $methodId = $this->paymentMethodRepository->getPaymentMethodIdByMethodId(PaymentMethod::IDEAL, $environment); - $method = new \MolPaymentMethod($methodId); - $issuersJson = $this->paymentMethodRepository->getPaymentMethodIssuersByPaymentMethodId($methodId); - $issuers = json_decode($issuersJson, true); - $issuerList[PaymentMethod::IDEAL] = []; - if (!$issuers) { - return $issuerList; - } - $context = Context::getContext(); - foreach ($issuers as $issuer) { - $issuer['href'] = $context->link->getModuleLink( - $this->module->name, - 'payment', - ['method' => $method->id_method, 'issuer' => $issuer['id'], 'rand' => time()], - true - ); - $issuerList[PaymentMethod::IDEAL][$issuer['id']] = $issuer; - } - - return $issuerList; - } -} diff --git a/src/Service/SettingsSaveService.php b/src/Service/SettingsSaveService.php index 64a305ff3..7eff900e7 100644 --- a/src/Service/SettingsSaveService.php +++ b/src/Service/SettingsSaveService.php @@ -246,7 +246,6 @@ public function saveSettings(&$errors = []) $mollieImages = $this->tools->getValue(Config::MOLLIE_IMAGES); $showResentPayment = $this->tools->getValue(Config::MOLLIE_SHOW_RESEND_PAYMENT_LINK); - $mollieIssuers = $this->tools->getValue(Config::MOLLIE_ISSUERS[$environment ? 'production' : 'sandbox']); $mollieCss = $this->tools->getValue(Config::MOLLIE_CSS); if (!isset($mollieCss)) { @@ -308,7 +307,6 @@ public function saveSettings(&$errors = []) $this->configurationAdapter->updateValue(Config::MOLLIE_SINGLE_CLICK_PAYMENT, $mollieSingleClickPaymentEnabled); $this->configurationAdapter->updateValue(Config::MOLLIE_IMAGES, $mollieImages); $this->configurationAdapter->updateValue(Config::MOLLIE_SHOW_RESEND_PAYMENT_LINK, $showResentPayment); - $this->configurationAdapter->updateValue(Config::MOLLIE_ISSUERS, $mollieIssuers); $this->configurationAdapter->updateValue(Config::MOLLIE_METHOD_COUNTRIES, (int) $mollieMethodCountriesEnabled); $this->configurationAdapter->updateValue(Config::MOLLIE_METHOD_COUNTRIES_DISPLAY, (int) $mollieMethodCountriesDisplayEnabled); $this->configurationAdapter->updateValue(Config::MOLLIE_CSS, $mollieCss); diff --git a/upgrade/Upgrade-2.0.0.php b/upgrade/Upgrade-2.0.0.php index 0e37d81b2..3f71fec5d 100644 --- a/upgrade/Upgrade-2.0.0.php +++ b/upgrade/Upgrade-2.0.0.php @@ -22,7 +22,6 @@ function upgrade_module_2_0_0() { Configuration::deleteByName('MOLLIE_VERSION'); - Configuration::updateValue('MOLLIE_ISSUERS', 'payment-page'); return true; } diff --git a/upgrade/Upgrade-6.0.1.php b/upgrade/Upgrade-6.0.1.php index d3566b40e..ffe19bced 100644 --- a/upgrade/Upgrade-6.0.1.php +++ b/upgrade/Upgrade-6.0.1.php @@ -24,9 +24,6 @@ function upgrade_module_6_0_1(Mollie $module): bool $configuration->updateValue(Config::MOLLIE_IFRAME['production'], Configuration::get('MOLLIE_IFRAME')); $configuration->updateValue(Config::MOLLIE_IFRAME['sandbox'], Configuration::get('MOLLIE_IFRAME')); - $configuration->updateValue(Config::MOLLIE_ISSUERS['production'], Configuration::get('MOLLIE_ISSUERS')); - $configuration->updateValue(Config::MOLLIE_ISSUERS['sandbox'], Configuration::get('MOLLIE_ISSUERS')); - $configuration->updateValue(Config::MOLLIE_SINGLE_CLICK_PAYMENT['production'], Configuration::get('MOLLIE_SINGLE_CLICK_PAYMENT')); $configuration->updateValue(Config::MOLLIE_SINGLE_CLICK_PAYMENT['sandbox'], Configuration::get('MOLLIE_SINGLE_CLICK_PAYMENT')); diff --git a/upgrade/Upgrade-6.2.1.php b/upgrade/Upgrade-6.2.1.php new file mode 100644 index 000000000..fb6c41176 --- /dev/null +++ b/upgrade/Upgrade-6.2.1.php @@ -0,0 +1,24 @@ + + * @copyright Mollie B.V. + * @license https://github.com/mollie/PrestaShop/blob/master/LICENSE.md + * + * @see https://github.com/mollie/PrestaShop + */ + +use Mollie\Adapter\ConfigurationAdapter; +use Mollie\Config\Config; + +if (!defined('_PS_VERSION_')) { + exit; +} + +function upgrade_module_6_2_1(Mollie $module): bool +{ + //todo remove issuers list config + //todo remove table with issuers + return true; +} \ No newline at end of file diff --git a/views/css/mollie.css b/views/css/mollie.css index ab5788b86..4685bb507 100644 --- a/views/css/mollie.css +++ b/views/css/mollie.css @@ -30,33 +30,6 @@ color: #747474; } -/****Mollie issuers****/ -.mollie_issuer { - margin-left: auto; - margin-right: auto; - max-width: 400px; -} - -.mollie_issuer_page { - box-shadow: 2px 2px 8px 0 rgba(0, 0, 0, .2); - margin-top: 2rem; - margin-bottom: 2rem; - background: #fff; - padding: 1.25rem 1.875rem; -} - -.mollie_issuers { - font-size: 16px; - margin-top: 1.25rem; -} - -.mollie_issuers select, .mollie_issuers input { - border: 1px solid #D6D4D4; - border-radius: 4px; - background: #FBFBFB; - height: 20px; -} - .sortable-helper { border-width: 2px!important; -webkit-box-shadow: 2px 2px 16px -2px rgba(0,0,0,0.75); diff --git a/views/css/mollie_15.css b/views/css/mollie_15.css index 9f2f62fa8..cd644bff2 100644 --- a/views/css/mollie_15.css +++ b/views/css/mollie_15.css @@ -27,33 +27,6 @@ color: #747474; } -/****Mollie issuers****/ -.mollie_issuer { - margin-left: auto; - margin-right: auto; - max-width: 400px; -} - -.mollie_issuer_page { - box-shadow: 2px 2px 8px 0 rgba(0, 0, 0, .2); - margin-top: 2rem; - margin-bottom: 2rem; - background: #fff; - padding: 1.25rem 1.875rem; -} - -.mollie_issuers { - font-size: 16px; - margin-top: 1.25rem; -} - -.mollie_issuers select, .mollie_issuers input { - border: 1px solid #D6D4D4; - border-radius: 4px; - background: #FBFBFB; - height: 20px; -} - .sortable-helper { border-width: 2px!important; -webkit-box-shadow: 2px 2px 16px -2px rgba(0,0,0,0.75); diff --git a/views/templates/hook/ideal_dropdown.tpl b/views/templates/hook/ideal_dropdown.tpl deleted file mode 100644 index 911304211..000000000 --- a/views/templates/hook/ideal_dropdown.tpl +++ /dev/null @@ -1,60 +0,0 @@ -{** - * Mollie https://www.mollie.nl - * - * @author Mollie B.V. - * @copyright Mollie B.V. - * @license https://github.com/mollie/PrestaShop/blob/master/LICENSE.md - * - * @see https://github.com/mollie/PrestaShop - * @codingStandardsIgnoreStart - *} - - - diff --git a/views/templates/hook/payment.tpl b/views/templates/hook/payment.tpl index 0a3316e97..e111aaa3d 100644 --- a/views/templates/hook/payment.tpl +++ b/views/templates/hook/payment.tpl @@ -62,41 +62,3 @@ {include file="./init_urls.tpl"} - -{if !empty($issuers['ideal']) && $issuer_setting === $ISSUERS_ON_CLICK} - -{/if} From 853065e044cb5da55fbb90490ea775cc4e6951b3 Mon Sep 17 00:00:00 2001 From: Gytautas Date: Tue, 11 Jun 2024 09:36:54 +0300 Subject: [PATCH 2/5] PIPRES-427: related data with issuers deleted --- controllers/front/payment.php | 2 - src/DTO/Object/Payment.php | 19 --------- src/DTO/PaymentData.php | 22 ----------- src/Entity/MolPaymentMethodIssuer.php | 39 ------------------- src/Install/DatabaseTableInstaller.php | 6 --- src/Install/DatabaseTableUninstaller.php | 1 - src/Repository/PaymentMethodRepository.php | 24 ------------ .../PaymentMethodRepositoryInterface.php | 4 -- src/Service/ApiService.php | 3 +- src/Service/PaymentMethodService.php | 8 ---- src/Service/SettingsSaveService.php | 17 -------- tests/seed/database/prestashop_8.sql | 9 ----- upgrade/Upgrade-4.0.0.php | 5 --- upgrade/Upgrade-6.2.1.php | 8 ++-- 14 files changed, 6 insertions(+), 161 deletions(-) delete mode 100644 src/Entity/MolPaymentMethodIssuer.php diff --git a/controllers/front/payment.php b/controllers/front/payment.php index 62119cd9b..3425c13fe 100644 --- a/controllers/front/payment.php +++ b/controllers/front/payment.php @@ -70,7 +70,6 @@ public function initContent() } $method = Tools::getValue('method'); - $issuer = Tools::getValue('issuer') ?: null; $originalAmount = $cart->getOrderTotal( true, @@ -105,7 +104,6 @@ public function initContent() $amount, Tools::strtoupper($this->context->currency->iso_code), $method, - $issuer, (int) $cart->id, $customer->secure_key, $paymentMethodObj, diff --git a/src/DTO/Object/Payment.php b/src/DTO/Object/Payment.php index a10e81d3f..f8591ef31 100644 --- a/src/DTO/Object/Payment.php +++ b/src/DTO/Object/Payment.php @@ -23,8 +23,6 @@ class Payment implements \JsonSerializable /** @var string */ private $webhookUrl; /** @var ?string */ - private $issuer; - /** @var ?string */ private $customerId; /** @var ?string */ private $applePayPaymentToken; @@ -60,22 +58,6 @@ public function setWebhookUrl(string $webhookUrl): void $this->webhookUrl = $webhookUrl; } - /** - * @return ?string - */ - public function getIssuer(): ?string - { - return $this->issuer; - } - - /** - * @maps issuer - */ - public function setIssuer(string $issuer): void - { - $this->issuer = $issuer; - } - /** * @return ?string */ @@ -131,7 +113,6 @@ public function jsonSerialize() $result = []; $result['cardToken'] = $this->getCardToken(); $result['webhookUrl'] = $this->getWebhookUrl(); - $result['issuer'] = $this->getIssuer(); $result['customerId'] = $this->getCustomerId(); $result['applePayPaymentToken'] = $this->getApplePayPaymentToken(); $result['company'] = $this->getCompany() ? $this->getCompany()->jsonSerialize() : null; diff --git a/src/DTO/PaymentData.php b/src/DTO/PaymentData.php index 78a40dc7d..68d00f2d1 100644 --- a/src/DTO/PaymentData.php +++ b/src/DTO/PaymentData.php @@ -58,11 +58,6 @@ class PaymentData implements JsonSerializable */ private $locale; - /** - * @var string - */ - private $issuer; - /** * @var string */ @@ -230,22 +225,6 @@ public function setLocale($locale) $this->locale = $locale; } - /** - * @return string - */ - public function getIssuer() - { - return $this->issuer; - } - - /** - * @param string $issuer - */ - public function setIssuer($issuer) - { - $this->issuer = $issuer; - } - /** * @return string */ @@ -387,7 +366,6 @@ public function jsonSerialize() 'method' => $this->getMethod(), 'metadata' => $this->getMetadata(), 'locale' => $this->getLocale(), - 'issuer' => $this->getIssuer(), 'cardToken' => $this->getCardToken(), 'customerId' => $this->getCustomerId(), 'applePayPaymentToken' => $this->getApplePayToken(), diff --git a/src/Entity/MolPaymentMethodIssuer.php b/src/Entity/MolPaymentMethodIssuer.php deleted file mode 100644 index 932acc12b..000000000 --- a/src/Entity/MolPaymentMethodIssuer.php +++ /dev/null @@ -1,39 +0,0 @@ - - * @copyright Mollie B.V. - * @license https://github.com/mollie/PrestaShop/blob/master/LICENSE.md - * - * @see https://github.com/mollie/PrestaShop - * @codingStandardsIgnoreStart - */ -if (!defined('_PS_VERSION_')) { - exit; -} - -class MolPaymentMethodIssuer extends ObjectModel -{ - /** - * @var int - */ - public $id_payment_method; - - /** - * @var string - */ - public $issuers_json; - - /** - * @var array - */ - public static $definition = [ - 'table' => 'mol_payment_method_issuer', - 'primary' => 'id_payment_method_issuer', - 'fields' => [ - 'id_payment_method' => ['type' => self::TYPE_INT, 'validate' => 'isInt'], - 'issuers_json' => ['type' => self::TYPE_STRING, 'validate' => 'isString'], - ], - ]; -} diff --git a/src/Install/DatabaseTableInstaller.php b/src/Install/DatabaseTableInstaller.php index b931e2b5c..efeff8aae 100644 --- a/src/Install/DatabaseTableInstaller.php +++ b/src/Install/DatabaseTableInstaller.php @@ -85,12 +85,6 @@ private function getCommands() `id_shop` INT(64) DEFAULT 1 ) ENGINE=' . _MYSQL_ENGINE_ . ' DEFAULT CHARSET=utf8;'; - $sql[] = 'CREATE TABLE IF NOT EXISTS `' . _DB_PREFIX_ . 'mol_payment_method_issuer` ( - `id_payment_method_issuer` INT(64) NOT NULL PRIMARY KEY AUTO_INCREMENT, - `id_payment_method` INT(64) NOT NULL, - `issuers_json` TEXT NOT NULL - ) ENGINE=' . _MYSQL_ENGINE_ . ' DEFAULT CHARSET=utf8;'; - $sql[] = 'CREATE TABLE IF NOT EXISTS `' . _DB_PREFIX_ . 'mol_order_payment_fee` ( `id_mol_order_payment_fee` INT(64) NOT NULL PRIMARY KEY AUTO_INCREMENT, `id_cart` INT(64) NOT NULL, diff --git a/src/Install/DatabaseTableUninstaller.php b/src/Install/DatabaseTableUninstaller.php index 30510c4ee..2a92d160c 100644 --- a/src/Install/DatabaseTableUninstaller.php +++ b/src/Install/DatabaseTableUninstaller.php @@ -37,7 +37,6 @@ private function getCommands(): array $sql[] = 'DROP TABLE IF EXISTS `' . _DB_PREFIX_ . 'mol_country`;'; $sql[] = 'DROP TABLE IF EXISTS `' . _DB_PREFIX_ . 'mol_payment_method`;'; - $sql[] = 'DROP TABLE IF EXISTS `' . _DB_PREFIX_ . 'mol_payment_method_issuer`;'; $sql[] = 'DROP TABLE IF EXISTS `' . _DB_PREFIX_ . 'mol_carrier_information`;'; $sql[] = 'DROP TABLE IF EXISTS `' . _DB_PREFIX_ . 'mol_pending_order_cart`;'; $sql[] = 'DROP TABLE IF EXISTS `' . _DB_PREFIX_ . 'mol_excluded_country`;'; diff --git a/src/Repository/PaymentMethodRepository.php b/src/Repository/PaymentMethodRepository.php index 119b5130e..651979d14 100644 --- a/src/Repository/PaymentMethodRepository.php +++ b/src/Repository/PaymentMethodRepository.php @@ -38,30 +38,6 @@ public function __construct() parent::__construct(MolPaymentMethod::class); } - /** - * @param string $paymentMethodId - * - * @return false|string|null - */ - public function getPaymentMethodIssuersByPaymentMethodId($paymentMethodId) - { - $sql = 'Select issuers_json FROM `' . _DB_PREFIX_ . 'mol_payment_method_issuer` WHERE id_payment_method = "' . pSQL($paymentMethodId) . '"'; - - return Db::getInstance()->getValue($sql); - } - - /** - * @param string $paymentMethodId - * - * @return bool - */ - public function deletePaymentMethodIssuersByPaymentMethodId($paymentMethodId) - { - $sql = 'DELETE FROM `' . _DB_PREFIX_ . 'mol_payment_method_issuer` WHERE id_payment_method = "' . pSQL($paymentMethodId) . '"'; - - return Db::getInstance()->execute($sql); - } - /** * @param int $environment * diff --git a/src/Repository/PaymentMethodRepositoryInterface.php b/src/Repository/PaymentMethodRepositoryInterface.php index 696a1cddb..f0eb0fdb6 100644 --- a/src/Repository/PaymentMethodRepositoryInterface.php +++ b/src/Repository/PaymentMethodRepositoryInterface.php @@ -20,10 +20,6 @@ interface PaymentMethodRepositoryInterface extends ReadOnlyRepositoryInterface { - public function getPaymentMethodIssuersByPaymentMethodId($paymentMethodId); - - public function deletePaymentMethodIssuersByPaymentMethodId($paymentMethodId); - public function deleteOldPaymentMethods(array $savedPaymentMethods, $environment, int $shopId); public function getPaymentMethodIdByMethodId($paymentMethodId, $environment, $shopId = null); diff --git a/src/Service/ApiService.php b/src/Service/ApiService.php index 481c5a29b..4f557430c 100644 --- a/src/Service/ApiService.php +++ b/src/Service/ApiService.php @@ -119,7 +119,7 @@ public function getMethodsForConfig(MollieApiClient $api) try { /** Requires local param or fails */ /** @var BaseCollection|MethodCollection $apiMethods */ - $apiMethods = $api->methods->allAvailable(['locale' => '', 'include' => 'issuers']); + $apiMethods = $api->methods->allAvailable(['locale' => '']); $apiMethods = $apiMethods->getArrayCopy(); /** @var Method $method */ foreach ($apiMethods as $key => $method) { @@ -153,7 +153,6 @@ public function getMethodsForConfig(MollieApiClient $api) 'name' => $apiMethod->description, 'available' => !in_array($apiMethod->id, $notAvailable), 'image' => (array) $apiMethod->image, - 'issuers' => $apiMethod->issuers, 'tipEnableSSL' => $tipEnableSSL, 'minimumAmount' => $apiMethod->minimumAmount ? [ 'value' => NumberUtility::toPrecision( diff --git a/src/Service/PaymentMethodService.php b/src/Service/PaymentMethodService.php index 24fce0c4c..411ea16e6 100644 --- a/src/Service/PaymentMethodService.php +++ b/src/Service/PaymentMethodService.php @@ -258,7 +258,6 @@ public function getMethodsForCheckout() * @param float|string $amount * @param string $currency * @param string $method - * @param string|null $issuer * @param int|Cart $cartId * @param string $secureKey * @param string $orderReference @@ -272,7 +271,6 @@ public function getPaymentData( $amount, $currency, $method, - $issuer, $cartId, $secureKey, MolPaymentMethod $molPaymentMethod, @@ -337,7 +335,6 @@ public function getPaymentData( $paymentData->setMethod($molPaymentMethod->id_method); $paymentData->setDescription($orderReference); - $paymentData->setIssuer($issuer); if (isset($cart->id_address_invoice)) { $billingAddress = new Address((int) $cart->id_address_invoice); @@ -457,10 +454,6 @@ public function getPaymentData( true )); - if (!empty($issuer)) { - $payment->setIssuer($issuer); - } - if ($molPaymentMethod->id_method === PaymentMethod::CREDITCARD) { $molCustomer = $this->handleCustomerInfo($cart->id_customer, $saveCard, $useSavedCard); if ($molCustomer && !empty($molCustomer->customer_id)) { @@ -536,7 +529,6 @@ private function getSupportedMollieMethods(?string $sequenceType = null): array $methods = $this->module->getApiClient()->methods->allActive( [ 'resource' => 'orders', - 'include' => 'issuers', 'includeWallets' => 'applepay', 'locale' => $this->context->getLanguageLocale(), 'billingCountry' => $country->iso_code, diff --git a/src/Service/SettingsSaveService.php b/src/Service/SettingsSaveService.php index 7eff900e7..e55747606 100644 --- a/src/Service/SettingsSaveService.php +++ b/src/Service/SettingsSaveService.php @@ -28,7 +28,6 @@ use Mollie\Repository\CountryRepository; use Mollie\Repository\PaymentMethodRepositoryInterface; use Mollie\Utility\TagsUtility; -use MolPaymentMethodIssuer; use OrderState; use PrestaShopDatabaseException; use PrestaShopException; @@ -185,22 +184,6 @@ public function saveSettings(&$errors = []) continue; } - if (!$this->paymentMethodRepository->deletePaymentMethodIssuersByPaymentMethodId($paymentMethod->id)) { - $errors[] = $this->module->l('Something went wrong. Couldn\'t delete old payment methods issuers', self::FILE_NAME) . ":{$method['id']}"; - continue; - } - - if ($method['issuers']) { - $paymentMethodIssuer = new MolPaymentMethodIssuer(); - $paymentMethodIssuer->issuers_json = json_encode($method['issuers']); - $paymentMethodIssuer->id_payment_method = $paymentMethod->id; - try { - $paymentMethodIssuer->add(); - } catch (Exception $e) { - $errors[] = $this->module->l('Something went wrong. Couldn\'t save your payment methods issuer', self::FILE_NAME); - } - } - $countries = $this->tools->getValue(Config::MOLLIE_METHOD_CERTAIN_COUNTRIES . $method['id']); $excludedCountries = $this->tools->getValue( Config::MOLLIE_METHOD_EXCLUDE_CERTAIN_COUNTRIES . $method['id'] diff --git a/tests/seed/database/prestashop_8.sql b/tests/seed/database/prestashop_8.sql index 22e1c4b0f..59fb043ef 100644 --- a/tests/seed/database/prestashop_8.sql +++ b/tests/seed/database/prestashop_8.sql @@ -11935,15 +11935,6 @@ CREATE TABLE `ps_mol_payment_method` ( ) ENGINE=InnoDB DEFAULT CHARSET=utf8; -DROP TABLE IF EXISTS `ps_mol_payment_method_issuer`; -CREATE TABLE `ps_mol_payment_method_issuer` ( - `id_payment_method_issuer` int(64) NOT NULL AUTO_INCREMENT, - `id_payment_method` int(64) NOT NULL, - `issuers_json` text NOT NULL, - PRIMARY KEY (`id_payment_method_issuer`) -) ENGINE=InnoDB DEFAULT CHARSET=utf8; - - DROP TABLE IF EXISTS `ps_mol_pending_order_cart`; CREATE TABLE `ps_mol_pending_order_cart` ( `id_mol_pending_order_cart` int(64) NOT NULL AUTO_INCREMENT, diff --git a/upgrade/Upgrade-4.0.0.php b/upgrade/Upgrade-4.0.0.php index bbc81a102..f2b228eab 100644 --- a/upgrade/Upgrade-4.0.0.php +++ b/upgrade/Upgrade-4.0.0.php @@ -37,11 +37,6 @@ function upgrade_module_4_0_0(Mollie $module) `images_json` TEXT ) ENGINE=' . _MYSQL_ENGINE_ . ' DEFAULT CHARSET=utf8;'; - $sql[] = 'CREATE TABLE IF NOT EXISTS `' . _DB_PREFIX_ . 'mol_payment_method_issuer` ( - `id_payment_method_issuer` INT(64) NOT NULL PRIMARY KEY AUTO_INCREMENT, - `id_payment_method` INT(64) NOT NULL, - `issuers_json` TEXT NOT NULL - ) ENGINE=' . _MYSQL_ENGINE_ . ' DEFAULT CHARSET=utf8;'; $sql[] = 'CREATE TABLE IF NOT EXISTS `' . _DB_PREFIX_ . 'mol_order_fee` ( `id_mol_order_fee` INT(64) NOT NULL PRIMARY KEY AUTO_INCREMENT, diff --git a/upgrade/Upgrade-6.2.1.php b/upgrade/Upgrade-6.2.1.php index fb6c41176..37c612ae0 100644 --- a/upgrade/Upgrade-6.2.1.php +++ b/upgrade/Upgrade-6.2.1.php @@ -18,7 +18,9 @@ function upgrade_module_6_2_1(Mollie $module): bool { - //todo remove issuers list config - //todo remove table with issuers - return true; + $isTableDeleted = Db::getInstance()->execute('DROP TABLE IF EXISTS `' . _DB_PREFIX_ . 'mol_payment_method_issuer`'); + $isSandboxConfigDeleted = Configuration::deleteByName('MOLLIE_SANDBOX_ISSUERS'); + $isProdConfigDeleted = Configuration::deleteByName('MOLLIE_PRODUCTION_ISSUERS'); + + return $isTableDeleted && $isSandboxConfigDeleted && $isProdConfigDeleted; } \ No newline at end of file From 9200e4069120da6837beb9eb193277c07d7ab25f Mon Sep 17 00:00:00 2001 From: Gytautas Date: Tue, 11 Jun 2024 09:57:43 +0300 Subject: [PATCH 3/5] PIPRES-427: removed issuers from payment data --- controllers/front/bancontactAjax.php | 1 - mollie.php | 1 - src/Application/CommandHandler/CreateApplePayOrderHandler.php | 1 - 3 files changed, 3 deletions(-) diff --git a/controllers/front/bancontactAjax.php b/controllers/front/bancontactAjax.php index 352c761a8..3cfdb68bd 100644 --- a/controllers/front/bancontactAjax.php +++ b/controllers/front/bancontactAjax.php @@ -64,7 +64,6 @@ private function createTransaction() $cart->getOrderTotal(), $currency->iso_code, PaymentMethod::BANCONTACT, - null, $cart->id, $cart->secure_key, $paymentMethod, diff --git a/mollie.php b/mollie.php index 0439674d1..695e1e226 100755 --- a/mollie.php +++ b/mollie.php @@ -931,7 +931,6 @@ public function hookActionValidateOrder($params) $totalPaid, $currency, '', - null, $cartId, $customerKey, $paymentMethodObj, diff --git a/src/Application/CommandHandler/CreateApplePayOrderHandler.php b/src/Application/CommandHandler/CreateApplePayOrderHandler.php index 62aa4770b..93a271b61 100644 --- a/src/Application/CommandHandler/CreateApplePayOrderHandler.php +++ b/src/Application/CommandHandler/CreateApplePayOrderHandler.php @@ -198,7 +198,6 @@ private function createMollieTransaction(Cart $cart, string $cardToken) $cart->getOrderTotal(true, Cart::BOTH, null, $cart->id_carrier), Tools::strtoupper($currency->iso_code), Config::APPLEPAY, - null, (int) $cart->id, $cart->secure_key, $paymentMethodObj, From 162eb30ebdbf0547cb742db62c2d2699bfff14a3 Mon Sep 17 00:00:00 2001 From: Gytautas Zumaras <96050852+GytisZum@users.noreply.github.com> Date: Tue, 25 Jun 2024 13:16:44 +0300 Subject: [PATCH 4/5] Update Upgrade-6.2.1.php --- upgrade/Upgrade-6.2.1.php | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) diff --git a/upgrade/Upgrade-6.2.1.php b/upgrade/Upgrade-6.2.1.php index 37c612ae0..1a486e55a 100644 --- a/upgrade/Upgrade-6.2.1.php +++ b/upgrade/Upgrade-6.2.1.php @@ -19,8 +19,8 @@ function upgrade_module_6_2_1(Mollie $module): bool { $isTableDeleted = Db::getInstance()->execute('DROP TABLE IF EXISTS `' . _DB_PREFIX_ . 'mol_payment_method_issuer`'); - $isSandboxConfigDeleted = Configuration::deleteByName('MOLLIE_SANDBOX_ISSUERS'); - $isProdConfigDeleted = Configuration::deleteByName('MOLLIE_PRODUCTION_ISSUERS'); + Configuration::deleteByName('MOLLIE_SANDBOX_ISSUERS'); + Configuration::deleteByName('MOLLIE_PRODUCTION_ISSUERS'); - return $isTableDeleted && $isSandboxConfigDeleted && $isProdConfigDeleted; -} \ No newline at end of file + return $isTableDeleted; +} From b119af559f22d080206cd6ed0ece39c16986f588 Mon Sep 17 00:00:00 2001 From: Gytautas Zumaras <96050852+GytisZum@users.noreply.github.com> Date: Tue, 25 Jun 2024 16:29:17 +0300 Subject: [PATCH 5/5] Update mollie.php --- mollie.php | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/mollie.php b/mollie.php index 695e1e226..c68e33c91 100755 --- a/mollie.php +++ b/mollie.php @@ -84,7 +84,7 @@ public function __construct() { $this->name = 'mollie'; $this->tab = 'payments_gateways'; - $this->version = '6.2.0'; + $this->version = '6.2.1'; $this->author = 'Mollie B.V.'; $this->need_instance = 1; $this->bootstrap = true;