From d12cac5027b8c9d48b06c13fdbccfe4bdc602408 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Daniel=20H=C3=BCsken?= Date: Mon, 20 Jan 2025 15:40:46 +0100 Subject: [PATCH 1/3] Add Multibanco gateway --- public/images/multibanco.svg | 6 ++++ src/PaymentMethods/Multibanco.php | 43 +++++++++++++++++++++++++++++ src/Shared/SharedDataDictionary.php | 1 + 3 files changed, 50 insertions(+) create mode 100644 public/images/multibanco.svg create mode 100644 src/PaymentMethods/Multibanco.php diff --git a/public/images/multibanco.svg b/public/images/multibanco.svg new file mode 100644 index 00000000..7938967c --- /dev/null +++ b/public/images/multibanco.svg @@ -0,0 +1,6 @@ + + + + + + diff --git a/src/PaymentMethods/Multibanco.php b/src/PaymentMethods/Multibanco.php new file mode 100644 index 00000000..a69cb4c5 --- /dev/null +++ b/src/PaymentMethods/Multibanco.php @@ -0,0 +1,43 @@ + 'multibanco', + 'defaultTitle' => 'Multibanco', + 'settingsDescription' => 'To accept payments via Multibanco', + 'defaultDescription' => '', + 'paymentFields' => false, + 'instructions' => false, + 'supports' => [ + 'products', + 'refunds', + ], + 'filtersOnBuild' => false, + 'confirmationDelayed' => true, + 'SEPA' => false, + 'docs' => '', + ]; + } + + public function initializeTranslations(): void + { + if ($this->translationsInitialized) { + return; + } + $this->config['defaultTitle'] = __('Multibanco', 'mollie-payments-for-woocommerce'); + $this->config['settingsDescription'] = __('To accept payments via Multibanco', 'mollie-payments-for-woocommerce'); + $this->translationsInitialized = true; + } + + public function getFormFields($generalFormFields): array + { + return $generalFormFields; + } +} diff --git a/src/Shared/SharedDataDictionary.php b/src/Shared/SharedDataDictionary.php index 7ea56432..c45ff07d 100644 --- a/src/Shared/SharedDataDictionary.php +++ b/src/Shared/SharedDataDictionary.php @@ -40,6 +40,7 @@ class SharedDataDictionary 'Mollie_WC_Gateway_Riverty', 'Mollie_WC_Gateway_Satispay', 'Mollie_WC_Gateway_Swish', + 'Mollie_WC_Gateway_Multibanco', ]; public const MOLLIE_OPTIONS_NAMES = [ From e5762dee40acc5605608fdc2820ee7c5ec66e2f0 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Daniel=20H=C3=BCsken?= Date: Tue, 28 Jan 2025 10:29:54 +0100 Subject: [PATCH 2/3] add feature flag for multibanco --- src/Gateway/GatewayModule.php | 6 ++++++ 1 file changed, 6 insertions(+) diff --git a/src/Gateway/GatewayModule.php b/src/Gateway/GatewayModule.php index a7a06172..18e88d24 100644 --- a/src/Gateway/GatewayModule.php +++ b/src/Gateway/GatewayModule.php @@ -130,6 +130,12 @@ public function services(): array return $method['id'] !== Constants::SWISH; }); } + $swishFlag = (bool) apply_filters('inpsyde.feature-flags.mollie-woocommerce.multibanco_enabled', false); + if (!$swishFlag) { + $availablePaymentMethods = array_filter($availablePaymentMethods, static function ($method) { + return $method['id'] !== 'multibanco'; + }); + } return $availablePaymentMethods; }, 'gateway.isSDDGatewayEnabled' => static function (ContainerInterface $container): bool { From cfa5c991034bdf806c2152a3093b9db1578de45a Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Daniel=20H=C3=BCsken?= Date: Thu, 30 Jan 2025 15:38:18 +0100 Subject: [PATCH 3/3] feature flag not needed --- src/Gateway/GatewayModule.php | 6 ------ 1 file changed, 6 deletions(-) diff --git a/src/Gateway/GatewayModule.php b/src/Gateway/GatewayModule.php index 18e88d24..a7a06172 100644 --- a/src/Gateway/GatewayModule.php +++ b/src/Gateway/GatewayModule.php @@ -130,12 +130,6 @@ public function services(): array return $method['id'] !== Constants::SWISH; }); } - $swishFlag = (bool) apply_filters('inpsyde.feature-flags.mollie-woocommerce.multibanco_enabled', false); - if (!$swishFlag) { - $availablePaymentMethods = array_filter($availablePaymentMethods, static function ($method) { - return $method['id'] !== 'multibanco'; - }); - } return $availablePaymentMethods; }, 'gateway.isSDDGatewayEnabled' => static function (ContainerInterface $container): bool {