From 9458e37eb0cf50b00535bfa0f16ef12c256329d3 Mon Sep 17 00:00:00 2001 From: carmenmaymo Date: Mon, 3 Jun 2024 08:48:07 +0200 Subject: [PATCH 1/4] Cast surcharge values to float --- src/Gateway/Surcharge.php | 6 ++++-- 1 file changed, 4 insertions(+), 2 deletions(-) diff --git a/src/Gateway/Surcharge.php b/src/Gateway/Surcharge.php index 8bb077a0..55ba4ac7 100644 --- a/src/Gateway/Surcharge.php +++ b/src/Gateway/Surcharge.php @@ -171,7 +171,7 @@ protected function calculate_percentage(WC_Cart $cart, array $gatewaySettings) if (empty($gatewaySettings[Surcharge::PERCENTAGE])) { return 0.0; } - $percentageFee = $gatewaySettings[Surcharge::PERCENTAGE]; + $percentageFee = (float) $gatewaySettings[Surcharge::PERCENTAGE]; $subtotal = $cart->get_subtotal() + $cart->get_shipping_total() - $cart->get_discount_total(); $taxes = $cart->get_subtotal_tax() + $cart->get_shipping_tax() - $cart->get_discount_tax(); $total = $subtotal + $taxes; @@ -190,7 +190,7 @@ protected function calculate_percentage_order(WC_Order $order, array $gatewaySet if (empty($gatewaySettings[Surcharge::PERCENTAGE])) { return 0.0; } - $percentageFee = $gatewaySettings[Surcharge::PERCENTAGE]; + $percentageFee = (float) $gatewaySettings[Surcharge::PERCENTAGE]; $total = $order->get_total(); $fee = $total * ($percentageFee / 100); @@ -340,4 +340,6 @@ protected function maybeAddTaxString(string $feeText): string } return $feeText; } + + } From 233e41b9690354571a419ead1c89f4c664777369 Mon Sep 17 00:00:00 2001 From: carmenmaymo Date: Mon, 3 Jun 2024 08:50:31 +0200 Subject: [PATCH 2/4] Update version and tested wc version --- mollie-payments-for-woocommerce.php | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/mollie-payments-for-woocommerce.php b/mollie-payments-for-woocommerce.php index 526a9f49..98207929 100644 --- a/mollie-payments-for-woocommerce.php +++ b/mollie-payments-for-woocommerce.php @@ -3,7 +3,7 @@ * Plugin Name: Mollie Payments for WooCommerce * Plugin URI: https://www.mollie.com * Description: Accept payments in WooCommerce with the official Mollie plugin - * Version: 7.5.4-beta + * Version: 7.5.4 * Author: Mollie * Author URI: https://www.mollie.com * Requires at least: 5.0 @@ -12,7 +12,7 @@ * Domain Path: /languages * License: GPLv2 or later * WC requires at least: 3.9 - * WC tested up to: 8.7 + * WC tested up to: 8.9 * Requires PHP: 7.2 * Requires Plugins: woocommerce */ From cbf8d82f99eac4c714322e295fba50e47354082e Mon Sep 17 00:00:00 2001 From: carmenmaymo Date: Mon, 3 Jun 2024 09:02:57 +0200 Subject: [PATCH 3/4] Fix cs --- src/Gateway/Surcharge.php | 2 -- 1 file changed, 2 deletions(-) diff --git a/src/Gateway/Surcharge.php b/src/Gateway/Surcharge.php index 55ba4ac7..9d6d82d1 100644 --- a/src/Gateway/Surcharge.php +++ b/src/Gateway/Surcharge.php @@ -340,6 +340,4 @@ protected function maybeAddTaxString(string $feeText): string } return $feeText; } - - } From 7e2bcb0e2e2e746808f111efc9aa68b478526dc3 Mon Sep 17 00:00:00 2001 From: carmenmaymo Date: Mon, 3 Jun 2024 11:26:56 +0200 Subject: [PATCH 4/4] Put alma method under flag default hidden --- src/Gateway/GatewayModule.php | 6 ++++++ src/PaymentMethods/Constants.php | 2 ++ 2 files changed, 8 insertions(+) diff --git a/src/Gateway/GatewayModule.php b/src/Gateway/GatewayModule.php index 889769de..1e9602df 100644 --- a/src/Gateway/GatewayModule.php +++ b/src/Gateway/GatewayModule.php @@ -118,6 +118,12 @@ public function services(): array return $method['id'] !== Constants::BANCOMATPAY; }); } + $almaFlag = apply_filters('inpsyde.feature-flags.mollie-woocommerce.alma_enabled', false); + if (!$almaFlag) { + return array_filter($availablePaymentMethods, static function ($method) { + return $method['id'] !== Constants::ALMA; + }); + } return $availablePaymentMethods; }, 'gateway.isSDDGatewayEnabled' => static function (ContainerInterface $container): bool { diff --git a/src/PaymentMethods/Constants.php b/src/PaymentMethods/Constants.php index 6f62e6b2..d8597c60 100644 --- a/src/PaymentMethods/Constants.php +++ b/src/PaymentMethods/Constants.php @@ -12,4 +12,6 @@ class Constants public const BANKTRANSFER = 'banktransfer'; public const BANCOMATPAY = 'bancomatpay'; + + public const ALMA = 'alma'; }