From 507ec1fc76449e37ef4a020b48733bd6d6c7feb2 Mon Sep 17 00:00:00 2001 From: carmenmaymo Date: Mon, 16 Sep 2024 10:10:46 +0200 Subject: [PATCH 1/2] Add Swish method --- src/PaymentMethods/Swish.php | 32 +++++++++++++++++++++++++++++ src/Shared/SharedDataDictionary.php | 1 + 2 files changed, 33 insertions(+) create mode 100644 src/PaymentMethods/Swish.php diff --git a/src/PaymentMethods/Swish.php b/src/PaymentMethods/Swish.php new file mode 100644 index 00000000..704fbc04 --- /dev/null +++ b/src/PaymentMethods/Swish.php @@ -0,0 +1,32 @@ + 'swish', + 'defaultTitle' => __('Swish', 'mollie-payments-for-woocommerce'), + 'settingsDescription' => '', + 'defaultDescription' => '', + 'paymentFields' => false, + 'instructions' => false, + 'supports' => [ + 'products', + 'refunds', + ], + 'filtersOnBuild' => false, + 'confirmationDelayed' => false, + 'SEPA' => false, + ]; + } + + public function getFormFields($generalFormFields): array + { + return $generalFormFields; + } +} diff --git a/src/Shared/SharedDataDictionary.php b/src/Shared/SharedDataDictionary.php index 7bd19e9d..e33282c2 100644 --- a/src/Shared/SharedDataDictionary.php +++ b/src/Shared/SharedDataDictionary.php @@ -39,6 +39,7 @@ class SharedDataDictionary 'Mollie_WC_Gateway_Payconiq', 'Mollie_WC_Gateway_Riverty', 'Mollie_WC_Gateway_Satispay', + 'Mollie_WC_Gateway_Swish', ]; public const MOLLIE_OPTIONS_NAMES = [ From 63ff8bcc003daf6b9a7d9bccb13f29e8a65a7ada Mon Sep 17 00:00:00 2001 From: carmenmaymo Date: Tue, 24 Sep 2024 12:16:59 +0200 Subject: [PATCH 2/2] Add swish after flag default false --- public/images/swish.svg | 1 + src/Gateway/GatewayModule.php | 6 ++++++ src/PaymentMethods/Constants.php | 3 +-- 3 files changed, 8 insertions(+), 2 deletions(-) create mode 100644 public/images/swish.svg diff --git a/public/images/swish.svg b/public/images/swish.svg new file mode 100644 index 00000000..23a795e0 --- /dev/null +++ b/public/images/swish.svg @@ -0,0 +1 @@ + diff --git a/src/Gateway/GatewayModule.php b/src/Gateway/GatewayModule.php index 0004ef09..6e16668c 100644 --- a/src/Gateway/GatewayModule.php +++ b/src/Gateway/GatewayModule.php @@ -124,6 +124,12 @@ public function services(): array return $method['id'] !== Constants::ALMA; }); } + $swishFlag = apply_filters('inpsyde.feature-flags.mollie-woocommerce.swish_enabled', false); + if (!$swishFlag) { + $availablePaymentMethods = array_filter($availablePaymentMethods, static function ($method) { + return $method['id'] !== Constants::SWISH; + }); + } return $availablePaymentMethods; }, 'gateway.isSDDGatewayEnabled' => static function (ContainerInterface $container): bool { diff --git a/src/PaymentMethods/Constants.php b/src/PaymentMethods/Constants.php index d8597c60..c74ce5f0 100644 --- a/src/PaymentMethods/Constants.php +++ b/src/PaymentMethods/Constants.php @@ -10,8 +10,7 @@ class Constants public const KLARNA = 'klarna'; public const DIRECTDEBIT = 'directdebit'; public const BANKTRANSFER = 'banktransfer'; - public const BANCOMATPAY = 'bancomatpay'; - public const ALMA = 'alma'; + public const SWISH = 'swish'; }