diff --git a/inc/utils.php b/inc/utils.php index 4fb667d9..bdd68c75 100644 --- a/inc/utils.php +++ b/inc/utils.php @@ -186,11 +186,7 @@ function mollieWooCommerceFormatCurrencyValue($value, $currency) if (in_array($currency, $currenciesWithNoDecimals)) { return number_format($value, 0, '.', ''); } - // trying to avoid floating point issues - $value = $value * 1000; - $value = (int) $value / 1000; //drop the last decimal after the third - $value = round($value, 3); - $value = round($value, 2, PHP_ROUND_HALF_DOWN); //round down, as seems woo like it :) + return number_format($value, 2, '.', ''); } diff --git a/mollie-payments-for-woocommerce.php b/mollie-payments-for-woocommerce.php index 808999e0..7e9d56bd 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.5 + * Version: 7.6.0 * 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.9 + * WC tested up to: 9.0 * Requires PHP: 7.2 * Requires Plugins: woocommerce */ diff --git a/public/images/trustly.svg b/public/images/trustly.svg new file mode 100644 index 00000000..fefc5da1 --- /dev/null +++ b/public/images/trustly.svg @@ -0,0 +1 @@ + diff --git a/readme.txt b/readme.txt index 72dbcc5d..e7247028 100644 --- a/readme.txt +++ b/readme.txt @@ -3,7 +3,7 @@ Contributors: daanvm, danielhuesken, davdebcom, dinamiko, syde, l.vangunst, ndij Tags: mollie, payments, payment gateway, woocommerce, credit card, apple pay, ideal, bancontact, klarna, sofort, giropay, woocommerce subscriptions Requires at least: 3.8 Tested up to: 6.5 -Stable tag: 7.5.2 +Stable tag: 7.5.5 Requires PHP: 7.2 License: GPLv2 or later License URI: http://www.gnu.org/licenses/gpl-2.0.html @@ -12,26 +12,23 @@ Accept all major payment methods in WooCommerce today. Credit cards, iDEAL and m == Description == -https://www.youtube.com/watch?v=yslqbm2FPFg +https://www.youtube.com/watch?v=33sQNKelKW4 -Quickly integrate all major payment methods in WooCommerce, wherever you need them. Simply drop them ready-made into your WooCommerce webshop with this powerful plugin by Mollie. Mollie is dedicated to making payments better for WooCommerce. +Quickly integrate all major payment methods in WooCommerce, wherever you need them. Mollie Payments for WooCommerce adds the critical success factor: an easy-to-install, easy-to-use, customizable payments gateway that is as flexible as WooCommerce itself. -> Next level payments, for WooCommerce +> **Effortless payments for your customers, designed for growth** -No need to spend weeks on paperwork or security compliance procedures. No more lost conversions because you don’t support a shopper’s favorite payment method or because they don’t feel safe. We made payments intuitive and safe for merchants and their customers. +No need to spend weeks on paperwork or security compliance procedures. Enjoy enhanced conversions as we support shopper's favorite payment methods and ensure their utmost safety. We made payments intuitive and safe for merchants and their customers. -= PAYMENT METHODS = += Payment methods = -Credit cards: +Credit & Debit Cards: * VISA (International) * MasterCard (International) * American Express (International) * Cartes Bancaires (France) * CartaSi (Italy) - -Debit cards: - * V Pay (International) * Maestro (International) @@ -39,46 +36,84 @@ European and local payment methods: * iDEAL (Netherlands) * Bancontact (Belgium) -* ING Home'Pay (Belgium) +* Bancomat Pay (Italy) +* Blik (Poland) +* Przelewy24 (Poland) * Giropay (Germany) * EPS (Austria) -* Przelewy24 (Poland) -* SOFORT banking (EU) +* SOFORT Banking (EU) * Belfius (Belgium) * KBC/CBC payment button (Belgium) * SEPA - Credit Transfer (EU) * SEPA - Direct Debit (EU) * Gift cards (Netherlands) -* Eco-, gift- and meal vouchers (Belgium) +* Klarna Pay now (Netherlands, Belgium, Germany, Austria, Finland) +* Klarna One (UK) +* Vouchers (Netherlands, Belgium) +* TWINT (Switzerland) International payment methods: +* Apple Pay (International) * PayPal (International) * Paysafecard (International) Pay after delivery payment methods: -* Klarna Pay later (Netherlands, Germany, Austria, Finland) +* Klarna Pay later (Netherlands, Belgium, Germany, Austria, Finland) * Klarna Slice it (Germany, Austria, Finland) +* Billie - Pay by Invoice for Businesses +* iDEAL in3 - Pay in 3 installments, 0% interest + + += Get started with Mollie = + +1. [Create a Mollie account](https://my.mollie.com/dashboard/signup) +2. Install **Mollie Payments for WooCommerce** on your WordPress website +3. Activate Mollie in your WooCommerce webshop and enter your Mollie API key +4. In your Mollie Dashboard, go to Settings > Website profiles and select the payment methods you want to offer +5. Go to your WordPress Admin Panel. Open WooCommerce > Settings > Payments to check if your preferred methods are enabled -Please go to the [signup page](https://www.mollie.com/signup) to create a new Mollie account and start receiving payments in a couple of minutes. Contact info@mollie.com if you have any questions or comments about this plugin. +Once your Mollie account has been approved, you can start accepting payments. -> Our pricing is always per transaction. No startup fees, no monthly fees, and no gateway fees. No hidden fees, period. +> **Our pricing is always per transaction. No startup fees, no monthly fees, and no gateway fees. No hidden fees, period.** -= FEATURES = += Features = * Support for all available Mollie payment methods * Compatible with WooCommerce Subscriptions for recurring payments (Apple Pay, credit card, iDEAL, and more via SEPA Direct Debit) * Transparent pricing. No startup fees, no monthly fees, and no gateway fees. No hidden fees, period. * Edit the order, title and description of every payment method in WooCommerce checkout -* Support for full and partial payment refunds (WooCommerce 2.2+) +* Support for full and partial payment refunds * Configurable pay outs: daily, weekly, monthly - whatever you prefer -* [Powerful dashboard](https://www.mollie.com/en/features/dashboard) on mollie.com to easily keep track of your payments. -* Fast in-house support. You will always be helped by someone who knows our products intimately. -* Multiple translations: English, Dutch, German and French +* [Powerful dashboard](https://www.mollie.com/en/features/dashboard) on mollie.com to easily keep track of your payments +* Fast in-house support. You will always be helped by someone who knows our products intimately +* Multiple translations: English, Dutch, German, French, Italian, Spanish * Event log for debugging purposes * WordPress Multisite support -* WPML support +* Works well with multilingual plugins like WPML/Polylang + +Contact info@mollie.com if you have any questions or comments about this plugin. + += Join the Mollie Community = + +Become part of Mollie's growing community and gain access to our comprehensive support network, including a [Discord Developer Community](https://discord.gg/y2rbjqszbs) to stay connected and informed. + +> **Your success is our mission. With Mollie, simplify your payments and focus on growing your business.** + +[Sign up today](https://my.mollie.com/dashboard/signup) and start enhancing your WooCommerce store with Mollie's advanced payment solutions. + += More about Mollie = + +Since 2004, Mollie has been on a mission to help businesses drive growth through simplified payments and financial services. + +Initially observing banks offering businesses outdated technology and complex processes, Mollie decided to innovate. Striving to improve conditions by acting fairly and being a true partner to customers on their journey to success has always been a priority. + +Over the years, Mollie has expanded significantly, yet the core mission remains unchanged: to address and solve customer problems to facilitate their growth. + +Mollie champions the belief that simplicity leads to the best solutions and designs products to serve everyone: from solopreneurs and startups to global enterprises. This approach ensures every customer has access to the necessary tools for success. + +Today, Mollie powers growth for over 130,000 businesses with effortless online payments, money management tools, and flexible funding, continuously enhancing payment and financial services for a broad spectrum of clients including global brands, SMEs, marketplaces, SaaS platforms, and more. == Frequently Asked Questions == @@ -114,8 +149,8 @@ You can either download and use the incomplete translations or help us get the t To download translations manually: 1. Go to [translate.wordpress.org](https://translate.wordpress.org/projects/wp-plugins/mollie-payments-for-woocommerce/) 2. Click on the percentage in the "Stable" column for your language. -3. Scroll down to "Export".  -4. Choose "All current" and "MO - Machine Object"  +3. Scroll down to "Export". +4. Choose "All current" and "MO - Machine Object" 5. Upload this file to plugins/languages/mollie-payments-for-woocommerce/. 6. Repeat this for all your translations. @@ -183,8 +218,34 @@ Please contact info@mollie.com if you need help installing the Mollie WooCommerc Automatic updates should work like a charm; as always though, ensure you backup your site just in case. + == Changelog == += 7.5.5 - 18-06-2024 = + +* Feature Flag - Enable Bancomat Pay & Alma feature flag by default (official launch 2024-07-01) +* Task - update wordpress.org plugin page +* Fix - Change from iDeal 1.0 to iDeal 2.0 +* Fix - update apple-developer-merchantid-domain-association certificate +* Fix - Description not shown on block checkout +* Fix - All Gift Card issuers displayed despite only some being active +* Fix - Several Undefined array key warnings malform JSON requests on Block Checkout +* Fix - Surcharge string to ‘excl. VAT’ + += 7.5.4 - 03-06-2024 = + +* Feature Flag - Initiative - Alma for WooCommerce Integration - under flag add_filter('inpsyde.feature-flags.mollie-woocommerce.alma_enabled', false); +* Feature - Add WooCommerce as required plugin in header +* Fix - Display error for Apple Pay Validation Error in Woocommerce +* Fix - TypeError when WooCommerce Analytics is disabled +* Fix - In3 - payment successful with date in the future +* Fix - Ensure Smooth Order Processing Despite Rounding Differences +* FIx - Rebrand from Inpsyde to Syde + += 7.5.3 - 22-05-2024 = + +* Fix - Updated in3 checkout process: Phone and birthdate are now optional, but if provided, validated values will be sent to expedite checkout. + = 7.5.2 - 22-04-2024 = * Feature - Support for new payment method Bancomat Pay (beta) diff --git a/src/MerchantCapture/Capture/Action/CapturePayment.php b/src/MerchantCapture/Capture/Action/CapturePayment.php index 41fd5ab7..8d50f699 100644 --- a/src/MerchantCapture/Capture/Action/CapturePayment.php +++ b/src/MerchantCapture/Capture/Action/CapturePayment.php @@ -13,6 +13,11 @@ class CapturePayment extends AbstractPaymentCaptureAction public function __invoke() { try { + $payment = $this->order->get_payment_method(); + if (strpos($payment, 'mollie') === false) { + return; + } + $paymentId = $this->order->get_meta('_mollie_payment_id'); if (!$paymentId) { diff --git a/src/Payment/MollieObject.php b/src/Payment/MollieObject.php index 84f70d42..7eac75ed 100644 --- a/src/Payment/MollieObject.php +++ b/src/Payment/MollieObject.php @@ -543,7 +543,7 @@ protected function setOrderPaidAndProcessed(WC_Order $order) protected function isOrderPaymentStartedByOtherGateway(WC_Order $order) { // Get the current payment method id for the order - $payment_method_id = $order->get_meta('_payment_method', true); + $payment_method_id = $order->get_payment_method(); // If the current payment method id for the order is not Mollie, return true return strpos($payment_method_id, 'mollie') === false; } @@ -1079,7 +1079,7 @@ protected function getFormatedPhoneNumber(string $phone) $phone = transformPhoneToNLFormat($phone); //check that $phone is in E164 format or can be changed by api - if (preg_match('/^\+[1-9]\d{10,13}$|^[1-9]\d{9,13}$/', $phone)) { + if (is_string($phone) && preg_match('/^\+[1-9]\d{10,13}$|^[1-9]\d{9,13}$/', $phone)) { return $phone; } return null; diff --git a/src/Payment/OrderLines.php b/src/Payment/OrderLines.php index de67b7c5..1c76bbf3 100644 --- a/src/Payment/OrderLines.php +++ b/src/Payment/OrderLines.php @@ -64,12 +64,48 @@ public function order_lines($order, $voucherDefaultCategory) $this->process_shipping(); $this->process_fees(); $this->process_gift_cards(); + $this->process_missmatch(); return [ 'lines' => $this->get_order_lines(), ]; } + private function process_missmatch() + { + $orderTotal = (float) $this->order->get_total(); + $orderTotalRounded = round($orderTotal, 2); + $linesTotal = array_sum(array_map(function ($line) { + return $line['totalAmount']['value']; + }, $this->order_lines)); + $orderTotalDiff = $orderTotalRounded - $linesTotal; + if (abs($orderTotalDiff) > 0) { + $missmatch = [ + 'type' => 'surcharge', + 'name' => __('Rounding difference', 'mollie-payments-for-woocommerce'), + 'quantity' => 1, + 'vatRate' => 0, + 'unitPrice' => [ + 'currency' => $this->currency, + 'value' => $this->dataHelper->formatCurrencyValue($orderTotalDiff, $this->currency), + ], + 'totalAmount' => [ + 'currency' => $this->currency, + 'value' => $this->dataHelper->formatCurrencyValue($orderTotalDiff, $this->currency), + ], + 'vatAmount' => [ + 'currency' => $this->currency, + 'value' => $this->dataHelper->formatCurrencyValue(0, $this->currency), + ], + 'metadata' => [ + 'order_item_id' => 'rounding_diff', + ], + ]; + + $this->order_lines[] = $missmatch; + } + } + /** * Get order lines formatted for Mollie Orders API. * diff --git a/src/PaymentMethods/Giropay.php b/src/PaymentMethods/Giropay.php index 31e2ec00..f7e700fe 100644 --- a/src/PaymentMethods/Giropay.php +++ b/src/PaymentMethods/Giropay.php @@ -27,6 +27,24 @@ protected function getConfig(): array public function getFormFields($generalFormFields): array { - return $generalFormFields; + $notice = [ + 'notice' => [ + 'title' => + sprintf( + __( + '%1$s Paydirekt, the owner of Giropay, has decided to deprecate Giropay. On Monday, 24 June 2024, Mollie was informed that Giropay would cease onboarding new merchants and processing new payments after 30 June 2024. No action is needed from your side. Mollie will automatically remove Giropay as a payment option from your Checkout by 30 June. +Subscription renewals and refunds will continue to be processed as usual beyond June 30. More details can be found in the %2$s Giropay Deprecation FAQ. %3$s', + 'mollie-payments-for-woocommerce' + ), + '

', + '', + '

' + ), + 'type' => 'title', + 'class' => 'notice notice-warning', + 'css' => 'padding:20px;', + ], + ]; + return array_merge($notice, $generalFormFields); } } diff --git a/src/PaymentMethods/Trustly.php b/src/PaymentMethods/Trustly.php new file mode 100644 index 00000000..05179fbb --- /dev/null +++ b/src/PaymentMethods/Trustly.php @@ -0,0 +1,32 @@ + 'trustly', + 'defaultTitle' => __('Trustly', 'mollie-payments-for-woocommerce'), + 'settingsDescription' => '', + 'defaultDescription' => '', + 'paymentFields' => false, + 'instructions' => true, + 'supports' => [ + 'products', + 'refunds', + ], + 'filtersOnBuild' => false, + 'confirmationDelayed' => true, + 'SEPA' => false, + ]; + } + + public function getFormFields($generalFormFields): array + { + return $generalFormFields; + } +} diff --git a/src/Shared/SharedDataDictionary.php b/src/Shared/SharedDataDictionary.php index a78fcd26..3519fdde 100644 --- a/src/Shared/SharedDataDictionary.php +++ b/src/Shared/SharedDataDictionary.php @@ -35,6 +35,7 @@ class SharedDataDictionary 'Mollie_WC_Gateway_Twint', 'Mollie_WC_Gateway_Bancomatpay', 'Mollie_WC_Gateway_Alma', + 'Mollie_WC_Gateway_Trustly', ]; public const MOLLIE_OPTIONS_NAMES = [ diff --git a/tests/php/Functional/Payment/PaymentServiceTest.php b/tests/php/Functional/Payment/PaymentServiceTest.php index 52e7e8bc..acf34319 100644 --- a/tests/php/Functional/Payment/PaymentServiceTest.php +++ b/tests/php/Functional/Payment/PaymentServiceTest.php @@ -98,9 +98,7 @@ public function processPayment_Order_success(){ 'wc_clean' => null, ] ); - $gateway->expects($this->once()) - ->method('getSelectedIssuer') - ->willReturn('ideal_INGBNL2A'); + $expectedRequestToMollie = $this->expectedRequestData($wcOrder); $orderEndpoints->method('create')->with($expectedRequestToMollie); @@ -212,7 +210,7 @@ private function wcOrder($id, $orderKey) [ 'get_id' => $id, 'get_order_key' => $orderKey, - 'get_total' => '20', + 'get_total' => 40.00, 'get_items' => [$this->wcOrderItem()], 'get_billing_first_name' => 'billingggivenName', 'get_billing_last_name' => 'billingfamilyName', @@ -307,7 +305,7 @@ private function expectedRequestData($order){ return [ 'amount' => [ 'currency' => 'EUR', - 'value' => '20.00' + 'value' => '40.00' ], 'redirectUrl' => 'https://webshop.example.org/wc-api/mollie_return?order_id=1&key=wc_order_hxZniP1zDcnM8', @@ -317,7 +315,7 @@ private function expectedRequestData($order){ 'ideal', 'payment' => [ - 'issuer' => 'ideal_INGBNL2A' + 'issuer' => null ], 'locale' => 'en_US', 'billingAddress' => $this->billingAddress($order),