Mollie Payments for WooCommerce - Version 7.2.0

Version Description

  • 21-06-2022 =

  • Feature - New payment method: In3

  • Feature - Add order line information to debug logs

  • Feature - Valuta symbol before amount

  • Feature - Add new translations

  • Fix - Check Payment API setting before showing Voucher, Klarna, In3 (Order API mandatory)

  • Fix - Remove title if empty setting on block checkout

  • Fix - Typo in Mollie settings

  • Fix - SEPA notice shows incorrectly when no settings saved

  • Fix - Order API not selected when no settings saved

Download this release

Release Info

Developer carmen222
Plugin Icon wp plugin Mollie Payments for WooCommerce
Version 7.2.0
Comparing to
See all releases

Code changes from version 7.1.0 to 7.2.0

inc/settings/mollie_advanced_settings.php CHANGED
@@ -18,13 +18,13 @@ $api_payment_description_labels = [
18
 
19
  return [
20
  [
21
- 'id' => $pluginName . '_' . 'title',
22
  'title' => __('Mollie advanced settings', 'mollie-payments-for-woocommerce'),
23
  'type' => 'title',
24
  'desc' => '<p>' . __('The following options are required to use the plugin and are used by all Mollie payment methods', 'mollie-payments-for-woocommerce') . '</p>',
25
  ],
26
  [
27
- 'id' => $pluginName . '_' . 'order_status_cancelled_payments',
28
  'title' => __('Order status after cancelled payment', 'mollie-payments-for-woocommerce'),
29
  'type' => 'select',
30
  'options' => [
@@ -77,7 +77,7 @@ return [
77
  'default' => Settings::SETTING_LOCALE_WP_LANGUAGE,
78
  ],
79
  [
80
- 'id' => $pluginName . '_' . 'customer_details',
81
  'title' => __('Store customer details at Mollie', 'mollie-payments-for-woocommerce'),
82
  /* translators: Placeholder 1: enabled or disabled */
83
  'desc' => sprintf(
@@ -93,7 +93,7 @@ return [
93
 
94
  ],
95
  [
96
- 'id' => $pluginName . '_' . 'api_switch',
97
  'title' => __(
98
  'Select API Method',
99
  'mollie-payments-for-woocommerce'
@@ -120,7 +120,7 @@ return [
120
  ),
121
  ],
122
  [
123
- 'id' => $pluginName . '_' . 'api_payment_description',
124
  'title' => __(
125
  'API Payment Description',
126
  'mollie-payments-for-woocommerce'
@@ -173,7 +173,7 @@ return [
173
  ),
174
  ],
175
  [
176
- 'id' => $pluginName . '_' . 'gatewayFeeLabel',
177
  'title' => __(
178
  'Surcharge gateway fee label',
179
  'mollie-payments-for-woocommerce'
@@ -189,7 +189,7 @@ return [
189
  ),
190
  ],
191
  [
192
- 'id' => $pluginName . '_' . 'removeOptionsAndTransients',
193
  'title' => __(
194
  'Remove Mollie data from Database on uninstall',
195
  'mollie-payments-for-woocommerce'
@@ -201,7 +201,7 @@ return [
201
  ) . '</a>)',
202
  ],
203
  [
204
- 'id' => $pluginName . '_' . 'sectionend',
205
  'type' => 'sectionend',
206
  ],
207
  ];
18
 
19
  return [
20
  [
21
+ 'id' => $pluginName . '_title',
22
  'title' => __('Mollie advanced settings', 'mollie-payments-for-woocommerce'),
23
  'type' => 'title',
24
  'desc' => '<p>' . __('The following options are required to use the plugin and are used by all Mollie payment methods', 'mollie-payments-for-woocommerce') . '</p>',
25
  ],
26
  [
27
+ 'id' => $pluginName . '_order_status_cancelled_payments',
28
  'title' => __('Order status after cancelled payment', 'mollie-payments-for-woocommerce'),
29
  'type' => 'select',
30
  'options' => [
77
  'default' => Settings::SETTING_LOCALE_WP_LANGUAGE,
78
  ],
79
  [
80
+ 'id' => $pluginName . '_customer_details',
81
  'title' => __('Store customer details at Mollie', 'mollie-payments-for-woocommerce'),
82
  /* translators: Placeholder 1: enabled or disabled */
83
  'desc' => sprintf(
93
 
94
  ],
95
  [
96
+ 'id' => $pluginName . '_api_switch',
97
  'title' => __(
98
  'Select API Method',
99
  'mollie-payments-for-woocommerce'
120
  ),
121
  ],
122
  [
123
+ 'id' => $pluginName . '_api_payment_description',
124
  'title' => __(
125
  'API Payment Description',
126
  'mollie-payments-for-woocommerce'
173
  ),
174
  ],
175
  [
176
+ 'id' => $pluginName . '_gatewayFeeLabel',
177
  'title' => __(
178
  'Surcharge gateway fee label',
179
  'mollie-payments-for-woocommerce'
189
  ),
190
  ],
191
  [
192
+ 'id' => $pluginName . '_removeOptionsAndTransients',
193
  'title' => __(
194
  'Remove Mollie data from Database on uninstall',
195
  'mollie-payments-for-woocommerce'
201
  ) . '</a>)',
202
  ],
203
  [
204
+ 'id' => $pluginName . '_sectionend',
205
  'type' => 'sectionend',
206
  ],
207
  ];
languages/mollie-payments-for-woocommerce-de_DE.mo CHANGED
Binary file
languages/mollie-payments-for-woocommerce-de_DE_formal.mo CHANGED
Binary file
languages/mollie-payments-for-woocommerce-es_ES.mo CHANGED
Binary file
languages/mollie-payments-for-woocommerce-fr_FR.mo CHANGED
Binary file
languages/mollie-payments-for-woocommerce-it_IT.mo CHANGED
Binary file
languages/mollie-payments-for-woocommerce-nl_BE.mo CHANGED
Binary file
languages/mollie-payments-for-woocommerce-nl_BE_formal.mo CHANGED
Binary file
languages/mollie-payments-for-woocommerce-nl_NL.mo CHANGED
Binary file
languages/mollie-payments-for-woocommerce-nl_NL_formal.mo CHANGED
Binary file
mollie-payments-for-woocommerce.php CHANGED
@@ -3,16 +3,16 @@
3
  * Plugin Name: Mollie Payments for WooCommerce
4
  * Plugin URI: https://www.mollie.com
5
  * Description: Accept payments in WooCommerce with the official Mollie plugin
6
- * Version: 7.1.0
7
  * Author: Mollie
8
  * Author URI: https://www.mollie.com
9
  * Requires at least: 5.0
10
- * Tested up to: 5.9
11
  * Text Domain: mollie-payments-for-woocommerce
12
  * Domain Path: /languages
13
  * License: GPLv2 or later
14
  * WC requires at least: 3.0
15
- * WC tested up to: 6.3
16
  * Requires PHP: 7.2
17
  */
18
  declare(strict_types=1);
3
  * Plugin Name: Mollie Payments for WooCommerce
4
  * Plugin URI: https://www.mollie.com
5
  * Description: Accept payments in WooCommerce with the official Mollie plugin
6
+ * Version: 7.2.0
7
  * Author: Mollie
8
  * Author URI: https://www.mollie.com
9
  * Requires at least: 5.0
10
+ * Tested up to: 6.0
11
  * Text Domain: mollie-payments-for-woocommerce
12
  * Domain Path: /languages
13
  * License: GPLv2 or later
14
  * WC requires at least: 3.0
15
+ * WC tested up to: 6.5
16
  * Requires PHP: 7.2
17
  */
18
  declare(strict_types=1);
public/images/in3.svg ADDED
@@ -0,0 +1,14 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ <svg xmlns="http://www.w3.org/2000/svg" width="32" height="24" viewBox="0 0 32 24" fill="none">
2
+ <rect width="32" height="24" rx="4" fill="#001C5D"/>
3
+ <g clip-path="url(#clip0_2767_2)">
4
+ <path d="M6.2 9.16364C5.53455 9.16364 5 9.70909 5 10.3636V16.7236C5 17.3891 5.53455 17.9236 6.2 17.9236C6.86545 17.9236 7.4 17.3891 7.4 16.7236V10.3636C7.4 9.70909 6.86545 9.16364 6.2 9.16364Z" fill="#33EBC7"/>
5
+ <path d="M6.2 8.41091C6.86545 8.41091 7.4 7.87636 7.4 7.21091C7.4 6.54546 6.86545 6.01091 6.2 6.01091C5.53455 6.01091 5 6.54546 5 7.21091C5 7.87636 5.53455 8.41091 6.2 8.41091Z" fill="#33EBC7"/>
6
+ <path d="M13.3127 9.15273C12.1564 9.15273 11.4145 9.58909 10.9564 10.0145C10.8145 9.88363 10.6509 9.76363 10.4873 9.66545C10.4 9.6 10.3018 9.54545 10.1927 9.50182C10.0618 9.44727 9.91999 9.42545 9.76726 9.42545C9.10181 9.42545 8.56726 9.96 8.56726 10.6255C8.56726 11.0836 8.81817 11.4764 9.18908 11.6836C9.19999 11.6836 9.19999 11.6945 9.2109 11.6945C9.28726 11.7382 9.35272 11.7927 9.39635 11.8364C9.70181 12.1527 9.8109 12.7091 9.83272 13.0473C9.83272 13.1345 9.83272 13.2218 9.84362 13.2873V16.7127C9.84362 17.3782 10.3782 17.9236 11.0436 17.9236C11.7091 17.9236 12.2436 17.3891 12.2436 16.7236V13.2545V12.7309V12.72C12.2436 12.0764 12.7673 11.5527 13.4109 11.5527C14.0545 11.5527 14.5782 12.0764 14.5782 12.72V12.7309V13.2327C14.5782 13.2436 14.5782 13.2545 14.5782 13.2764V16.7236C14.5782 17.3891 15.1127 17.9236 15.7782 17.9236C16.4436 17.9236 16.9782 17.3891 16.9782 16.7236V13.3418C16.9782 13.32 16.9782 13.2873 16.9782 13.2436C16.9782 12.7745 16.8909 11.2473 15.8654 10.1782C15.2436 9.51273 14.3491 9.15273 13.3127 9.15273Z" fill="#33EBC7"/>
7
+ <path d="M26 11.8255C26.0327 11.7818 26.0763 11.7382 26.1091 11.6945C26.1309 11.6727 26.1418 11.64 26.1636 11.6182C26.2072 11.5527 26.2509 11.4982 26.2945 11.4327C26.2945 11.4218 26.3054 11.4218 26.3054 11.4109C26.3709 11.3236 26.4254 11.2255 26.4691 11.1164V11.1055C26.6982 10.6255 26.8182 10.0691 26.8182 9.46909C26.8182 8.31273 26.3818 7.57091 25.9563 7.11273C25.4109 6.56727 24.7454 6 22.8145 6H19.2582C18.5927 6 18.0472 6.53455 18.0472 7.2C18.0472 7.86545 18.5818 8.4 19.2472 8.4H22.7163H23.24H23.2509C23.8945 8.4 24.4182 8.92364 24.4182 9.56727C24.4182 10.1673 23.9709 10.6582 23.4036 10.7236C23.2618 10.7345 23.12 10.7345 22.9563 10.7345H22.7491C22.7382 10.7345 22.7272 10.7345 22.7054 10.7345H19.2582C18.5927 10.7345 18.0582 11.2691 18.0582 11.9345C18.0582 12.6 18.5927 13.1345 19.2582 13.1345H22.7272H23.2509H23.2618C23.9054 13.1345 24.4291 13.6582 24.4291 14.3018C24.4291 14.9455 23.9054 15.4691 23.2618 15.4691H23.2509H22.7491C22.7382 15.4691 22.7272 15.4691 22.7054 15.4691H19.2582C18.5927 15.4691 18.0582 16.0036 18.0582 16.6691C18.0582 17.3345 18.5927 17.8691 19.2582 17.8691H22.64C22.6618 17.8691 22.6945 17.8691 22.7382 17.8691C23.2072 17.8691 24.7345 17.7818 25.8036 16.7564C26.48 16.1127 26.84 15.2182 26.84 14.1818C26.84 13.0255 26.4036 12.2836 25.9782 11.8255C25.9672 11.8582 25.9891 11.8473 26 11.8255Z" fill="#33EBC7"/>
8
+ </g>
9
+ <defs>
10
+ <clipPath id="clip0_2767_2">
11
+ <rect width="21.8182" height="12" fill="white" transform="translate(5 6)"/>
12
+ </clipPath>
13
+ </defs>
14
+ </svg>
readme.txt CHANGED
@@ -2,8 +2,8 @@
2
  Contributors: daanvm, danielhuesken, davdebcom, dinamiko, inpsyde, l.vangunst, ndijkstra, robin-mollie, wido, carmen222
3
  Tags: mollie, payments, payment gateway, woocommerce, credit card, ideal, bancontact, klarna, sofort, giropay, woocommerce subscriptions
4
  Requires at least: 3.8
5
- Tested up to: 5.9
6
- Stable tag: 7.1.0
7
  Requires PHP: 7.2
8
  License: GPLv2 or later
9
  License URI: http://www.gnu.org/licenses/gpl-2.0.html
@@ -185,6 +185,18 @@ Automatic updates should work like a charm; as always though, ensure you backup
185
 
186
  == Changelog ==
187
 
 
 
 
 
 
 
 
 
 
 
 
 
188
  = 7.1.0 - 26-04-2022 =
189
 
190
  * Feature - Implement uninstall method
2
  Contributors: daanvm, danielhuesken, davdebcom, dinamiko, inpsyde, l.vangunst, ndijkstra, robin-mollie, wido, carmen222
3
  Tags: mollie, payments, payment gateway, woocommerce, credit card, ideal, bancontact, klarna, sofort, giropay, woocommerce subscriptions
4
  Requires at least: 3.8
5
+ Tested up to: 6.0
6
+ Stable tag: 7.2.0
7
  Requires PHP: 7.2
8
  License: GPLv2 or later
9
  License URI: http://www.gnu.org/licenses/gpl-2.0.html
185
 
186
  == Changelog ==
187
 
188
+ = 7.2.0 - 21-06-2022 =
189
+
190
+ * Feature - New payment method: In3
191
+ * Feature - Add order line information to debug logs
192
+ * Feature - Valuta symbol before amount
193
+ * Feature - Add new translations
194
+ * Fix - Check Payment API setting before showing Voucher, Klarna, In3 (Order API mandatory)
195
+ * Fix - Remove title if empty setting on block checkout
196
+ * Fix - Typo in Mollie settings
197
+ * Fix - SEPA notice shows incorrectly when no settings saved
198
+ * Fix - Order API not selected when no settings saved
199
+
200
  = 7.1.0 - 26-04-2022 =
201
 
202
  * Feature - Implement uninstall method
src/Assets/AssetsModule.php CHANGED
@@ -12,6 +12,8 @@ use Mollie\Api\Exceptions\ApiException;
12
  use Mollie\WooCommerce\Buttons\ApplePayButton\DataToAppleButtonScripts;
13
  use Mollie\WooCommerce\Buttons\PayPalButton\DataToPayPal;
14
  use Mollie\WooCommerce\Components\AcceptedLocaleValuesDictionary;
 
 
15
  use Psr\Container\ContainerInterface;
16
 
17
  class AssetsModule implements ExecutableModule
@@ -35,8 +37,10 @@ class AssetsModule implements ExecutableModule
35
  $this->pluginUrl = $container->get('shared.plugin_url');
36
  $this->pluginPath = $container->get('shared.plugin_path');
37
  $this->settingsHelper = $container->get('settings.settings_helper');
 
38
  $this->pluginVersion = $container->get('shared.plugin_version');
39
  $this->dataService = $container->get('settings.data_helper');
 
40
 
41
  add_action(
42
  'init',
@@ -503,8 +507,8 @@ class AssetsModule implements ExecutableModule
503
  $content .= $issuers;
504
  $issuers = false;
505
  }
506
- $title = $gateway->paymentMethod->getProperty('title')?:
507
- $gateway->paymentMethod->getProperty('defaultTitle');
508
  $labelMarkup = "<span style='margin-right: 1em'>{$title}</span>{$gateway->icon}";
509
  $hasSurcharge = $gateway->paymentMethod->hasSurcharge();
510
  $gatewayData[] = [
12
  use Mollie\WooCommerce\Buttons\ApplePayButton\DataToAppleButtonScripts;
13
  use Mollie\WooCommerce\Buttons\PayPalButton\DataToPayPal;
14
  use Mollie\WooCommerce\Components\AcceptedLocaleValuesDictionary;
15
+ use Mollie\WooCommerce\Settings\Settings;
16
+ use Mollie\WooCommerce\Shared\Data;
17
  use Psr\Container\ContainerInterface;
18
 
19
  class AssetsModule implements ExecutableModule
37
  $this->pluginUrl = $container->get('shared.plugin_url');
38
  $this->pluginPath = $container->get('shared.plugin_path');
39
  $this->settingsHelper = $container->get('settings.settings_helper');
40
+ assert($this->settingsHelper instanceof Settings);
41
  $this->pluginVersion = $container->get('shared.plugin_version');
42
  $this->dataService = $container->get('settings.data_helper');
43
+ assert($this->dataService instanceof Data);
44
 
45
  add_action(
46
  'init',
507
  $content .= $issuers;
508
  $issuers = false;
509
  }
510
+ $title = $gateway->paymentMethod->getProperty('title') === false?
511
+ $gateway->paymentMethod->getProperty('defaultTitle') : $gateway->paymentMethod->getProperty('title');
512
  $labelMarkup = "<span style='margin-right: 1em'>{$title}</span>{$gateway->icon}";
513
  $hasSurcharge = $gateway->paymentMethod->hasSurcharge();
514
  $gatewayData[] = [
src/Gateway/GatewayModule.php CHANGED
@@ -28,6 +28,7 @@ use Mollie\WooCommerce\Payment\PaymentFieldsService;
28
  use Mollie\WooCommerce\Payment\PaymentService;
29
  use Mollie\WooCommerce\PaymentMethods\IconFactory;
30
  use Mollie\WooCommerce\SDK\Api;
 
31
  use Mollie\WooCommerce\Settings\Settings;
32
  use Mollie\WooCommerce\Shared\Data;
33
  use Mollie\WooCommerce\Shared\GatewaySurchargeHandler;
@@ -65,13 +66,13 @@ class GatewayModule implements ServiceModule, ExecutableModule
65
  return (new self)->instantiatePaymentMethods($container);
66
  },
67
  'gateway.paymentMethodsEnabledAtMollie' => static function (ContainerInterface $container): array {
68
- /* @var Data $dataHelper */
69
  $dataHelper = $container->get('settings.data_helper');
70
- /* @var Settings $settings */
71
  $settings = $container->get('settings.settings_helper');
 
72
  $apiKey = $settings->getApiKey();
73
- $methods = $apiKey? $dataHelper->getAllPaymentMethods($apiKey):[];
74
- foreach ($methods as $key => $method){
75
  $methods[$method['id']] = $method;
76
  unset($methods[$key]);
77
  }
@@ -84,13 +85,20 @@ class GatewayModule implements ServiceModule, ExecutableModule
84
  },
85
  PaymentService::class => static function (ContainerInterface $container): PaymentService {
86
  $logger = $container->get(Logger::class);
 
87
  $notice = $container->get(AdminNotice::class);
 
88
  $paymentFactory = $container->get(PaymentFactory::class);
 
89
  $data = $container->get('settings.data_helper');
 
90
  $api = $container->get('SDK.api_helper');
 
91
  $settings = $container->get('settings.settings_helper');
 
92
  $pluginId = $container->get('shared.plugin_id');
93
  $paymentCheckoutRedirectService = $container->get(PaymentCheckoutRedirectService::class);
 
94
  return new PaymentService($notice, $logger, $paymentFactory, $data, $api, $settings, $pluginId, $paymentCheckoutRedirectService);
95
  },
96
  OrderInstructionsService::class => static function (): OrderInstructionsService {
@@ -98,12 +106,14 @@ class GatewayModule implements ServiceModule, ExecutableModule
98
  },
99
  PaymentFieldsService::class => static function (ContainerInterface $container): PaymentFieldsService {
100
  $data = $container->get('settings.data_helper');
 
101
  return new PaymentFieldsService($data);
102
  },
103
  PaymentCheckoutRedirectService::class => static function (
104
  ContainerInterface $container
105
  ): PaymentCheckoutRedirectService {
106
  $data = $container->get('settings.data_helper');
 
107
  return new PaymentCheckoutRedirectService($data);
108
  },
109
  Surcharge::class => static function (ContainerInterface $container): Surcharge {
@@ -111,12 +121,22 @@ class GatewayModule implements ServiceModule, ExecutableModule
111
  },
112
  MollieOrderService::class => static function (ContainerInterface $container): MollieOrderService {
113
  $HttpResponseService = $container->get('SDK.HttpResponse');
 
114
  $logger = $container->get(Logger::class);
 
115
  $paymentFactory = $container->get(PaymentFactory::class);
 
116
  $data = $container->get('settings.data_helper');
 
117
  $pluginId = $container->get('shared.plugin_id');
118
  return new MollieOrderService($HttpResponseService, $logger, $paymentFactory, $data, $pluginId);
119
  },
 
 
 
 
 
 
120
  ];
121
  }
122
 
@@ -133,6 +153,11 @@ class GatewayModule implements ServiceModule, ExecutableModule
133
  return array_merge($gateways, $mollieGateways);
134
  });
135
  add_filter('woocommerce_payment_gateways', [$this, 'maybeDisableApplePayGateway'], 20);
 
 
 
 
 
136
  add_filter('woocommerce_payment_gateways', static function ($gateways) {
137
  $maybeEnablegatewayHelper = new MaybeDisableGateway();
138
 
@@ -170,38 +195,52 @@ class GatewayModule implements ServiceModule, ExecutableModule
170
 
171
  // Set order to paid and processed when eventually completed without Mollie
172
  add_action('woocommerce_payment_complete', [$this, 'setOrderPaidByOtherGateway'], 10, 1);
173
- $appleGateway = isset($container->get('gateway.instances')['mollie_wc_gateway_applepay'])? $container->get('gateway.instances')['mollie_wc_gateway_applepay']:false;
174
-
 
175
  $notice = $container->get(AdminNotice::class);
 
176
  $logger = $container->get(Logger::class);
 
177
  $pluginUrl = $container->get('shared.plugin_url');
178
  $apiHelper = $container->get('SDK.api_helper');
 
179
  $settingsHelper = $container->get('settings.settings_helper');
180
- $this->gatewaySurchargeHandling($container->get(Surcharge::class));
181
- if($appleGateway){
 
 
 
182
  $this->mollieApplePayDirectHandling($notice, $logger, $apiHelper, $settingsHelper, $appleGateway);
183
  }
184
 
185
- $paypalGateway = isset($container->get('gateway.instances')['mollie_wc_gateway_paypal'])? $container->get('gateway.instances')['mollie_wc_gateway_paypal']:false;
186
- if ($paypalGateway){
 
 
187
  $this->molliePayPalButtonHandling($paypalGateway, $notice, $logger, $pluginUrl);
188
  }
189
 
190
  $maybeDisableVoucher = new MaybeDisableGateway();
191
- $checkoutBlockHandler = new CheckoutBlockService($container->get('settings.data_helper'), $maybeDisableVoucher);
 
 
192
  $checkoutBlockHandler->bootstrapAjaxRequest();
193
- add_action( 'woocommerce_rest_checkout_process_payment_with_context', function($paymentContext){
194
- if(strpos($paymentContext->payment_method, 'mollie_wc_gateway_') === false){
195
- return;
196
- }
197
- $title = isset($paymentContext->payment_data['payment_method_title'])?$paymentContext->payment_data['payment_method_title']:false;
198
- if(!$title){
199
- return ;
 
 
 
 
 
 
200
  }
201
- $order = $paymentContext->order;
202
- $order->set_payment_method_title( $title );
203
- $order->save();
204
- } );
205
 
206
  return true;
207
  }
@@ -399,17 +438,27 @@ class GatewayModule implements ServiceModule, ExecutableModule
399
  public function instantiatePaymentMethodGateways(ContainerInterface $container): array
400
  {
401
  $logger = $container->get(Logger::class);
 
402
  $notice = $container->get(AdminNotice::class);
 
403
  $paymentService = $container->get(PaymentService::class);
 
404
  $mollieOrderService = $container->get(MollieOrderService::class);
 
405
  $HttpResponseService = $container->get('SDK.HttpResponse');
 
406
  $settingsHelper = $container->get('settings.settings_helper');
 
407
  $apiHelper = $container->get('SDK.api_helper');
 
408
  $paymentMethods = $container->get('gateway.paymentMethods');
409
  $data = $container->get('settings.data_helper');
 
410
  $orderInstructionsService = new OrderInstructionsService();
411
  $mollieObject = $container->get(MollieObject::class);
 
412
  $paymentFactory = $container->get(PaymentFactory::class);
 
413
  $pluginId = $container->get('shared.plugin_id');
414
  $methodsEnabledAtMollie = $container->get('gateway.paymentMethodsEnabledAtMollie');
415
  $gateways = [];
@@ -511,11 +560,16 @@ class GatewayModule implements ServiceModule, ExecutableModule
511
  'Applepay',
512
  'Mybank',
513
  'Voucher',
 
514
  ];
515
  $iconFactory = $container->get(IconFactory::class);
 
516
  $settingsHelper = $container->get('settings.settings_helper');
 
517
  $surchargeService = $container->get(Surcharge::class);
 
518
  $paymentFieldsService = $container->get(PaymentFieldsService::class);
 
519
  foreach ($paymentMethodsNames as $paymentMethodName) {
520
  $paymentMethodClassName = 'Mollie\\WooCommerce\\PaymentMethods\\' . $paymentMethodName;
521
  $paymentMethod = new $paymentMethodClassName(
28
  use Mollie\WooCommerce\Payment\PaymentService;
29
  use Mollie\WooCommerce\PaymentMethods\IconFactory;
30
  use Mollie\WooCommerce\SDK\Api;
31
+ use Mollie\WooCommerce\SDK\HttpResponse;
32
  use Mollie\WooCommerce\Settings\Settings;
33
  use Mollie\WooCommerce\Shared\Data;
34
  use Mollie\WooCommerce\Shared\GatewaySurchargeHandler;
66
  return (new self)->instantiatePaymentMethods($container);
67
  },
68
  'gateway.paymentMethodsEnabledAtMollie' => static function (ContainerInterface $container): array {
 
69
  $dataHelper = $container->get('settings.data_helper');
70
+ assert($dataHelper instanceof Data);
71
  $settings = $container->get('settings.settings_helper');
72
+ assert($settings instanceof Settings);
73
  $apiKey = $settings->getApiKey();
74
+ $methods = $apiKey ? $dataHelper->getAllPaymentMethods($apiKey) : [];
75
+ foreach ($methods as $key => $method) {
76
  $methods[$method['id']] = $method;
77
  unset($methods[$key]);
78
  }
85
  },
86
  PaymentService::class => static function (ContainerInterface $container): PaymentService {
87
  $logger = $container->get(Logger::class);
88
+ assert($logger instanceof Logger);
89
  $notice = $container->get(AdminNotice::class);
90
+ assert($notice instanceof AdminNotice);
91
  $paymentFactory = $container->get(PaymentFactory::class);
92
+ assert($paymentFactory instanceof PaymentFactory);
93
  $data = $container->get('settings.data_helper');
94
+ assert($data instanceof Data);
95
  $api = $container->get('SDK.api_helper');
96
+ assert($api instanceof Api);
97
  $settings = $container->get('settings.settings_helper');
98
+ assert($settings instanceof Settings);
99
  $pluginId = $container->get('shared.plugin_id');
100
  $paymentCheckoutRedirectService = $container->get(PaymentCheckoutRedirectService::class);
101
+ assert($paymentCheckoutRedirectService instanceof PaymentCheckoutRedirectService);
102
  return new PaymentService($notice, $logger, $paymentFactory, $data, $api, $settings, $pluginId, $paymentCheckoutRedirectService);
103
  },
104
  OrderInstructionsService::class => static function (): OrderInstructionsService {
106
  },
107
  PaymentFieldsService::class => static function (ContainerInterface $container): PaymentFieldsService {
108
  $data = $container->get('settings.data_helper');
109
+ assert($data instanceof Data);
110
  return new PaymentFieldsService($data);
111
  },
112
  PaymentCheckoutRedirectService::class => static function (
113
  ContainerInterface $container
114
  ): PaymentCheckoutRedirectService {
115
  $data = $container->get('settings.data_helper');
116
+ assert($data instanceof Data);
117
  return new PaymentCheckoutRedirectService($data);
118
  },
119
  Surcharge::class => static function (ContainerInterface $container): Surcharge {
121
  },
122
  MollieOrderService::class => static function (ContainerInterface $container): MollieOrderService {
123
  $HttpResponseService = $container->get('SDK.HttpResponse');
124
+ assert($HttpResponseService instanceof HttpResponse);
125
  $logger = $container->get(Logger::class);
126
+ assert($logger instanceof Logger);
127
  $paymentFactory = $container->get(PaymentFactory::class);
128
+ assert($paymentFactory instanceof PaymentFactory);
129
  $data = $container->get('settings.data_helper');
130
+ assert($data instanceof Data);
131
  $pluginId = $container->get('shared.plugin_id');
132
  return new MollieOrderService($HttpResponseService, $logger, $paymentFactory, $data, $pluginId);
133
  },
134
+ OrderMandatoryGatewayDisabler::class => static function (ContainerInterface $container): OrderMandatoryGatewayDisabler {
135
+ $settings = $container->get('settings.settings_helper');
136
+ assert($settings instanceof Settings);
137
+ $isSettingsOrderApi = $settings->isOrderApiSetting();
138
+ return new OrderMandatoryGatewayDisabler($isSettingsOrderApi);
139
+ },
140
  ];
141
  }
142
 
153
  return array_merge($gateways, $mollieGateways);
154
  });
155
  add_filter('woocommerce_payment_gateways', [$this, 'maybeDisableApplePayGateway'], 20);
156
+ add_filter('woocommerce_payment_gateways', static function ($gateways) use ($container) {
157
+ $orderMandatoryGatewayDisabler = $container->get(OrderMandatoryGatewayDisabler::class);
158
+
159
+ return $orderMandatoryGatewayDisabler->processGateways($gateways);
160
+ });
161
  add_filter('woocommerce_payment_gateways', static function ($gateways) {
162
  $maybeEnablegatewayHelper = new MaybeDisableGateway();
163
 
195
 
196
  // Set order to paid and processed when eventually completed without Mollie
197
  add_action('woocommerce_payment_complete', [$this, 'setOrderPaidByOtherGateway'], 10, 1);
198
+ $appleGateway = isset($container->get('gateway.instances')['mollie_wc_gateway_applepay']) ? $container->get(
199
+ 'gateway.instances'
200
+ )['mollie_wc_gateway_applepay'] : false;
201
  $notice = $container->get(AdminNotice::class);
202
+ assert($notice instanceof AdminNotice);
203
  $logger = $container->get(Logger::class);
204
+ assert($logger instanceof Logger);
205
  $pluginUrl = $container->get('shared.plugin_url');
206
  $apiHelper = $container->get('SDK.api_helper');
207
+ assert($apiHelper instanceof Api);
208
  $settingsHelper = $container->get('settings.settings_helper');
209
+ assert($settingsHelper instanceof Settings);
210
+ $surchargeService = $container->get(Surcharge::class);
211
+ assert($surchargeService instanceof Surcharge);
212
+ $this->gatewaySurchargeHandling($surchargeService);
213
+ if ($appleGateway) {
214
  $this->mollieApplePayDirectHandling($notice, $logger, $apiHelper, $settingsHelper, $appleGateway);
215
  }
216
 
217
+ $paypalGateway = isset($container->get('gateway.instances')['mollie_wc_gateway_paypal']) ? $container->get(
218
+ 'gateway.instances'
219
+ )['mollie_wc_gateway_paypal'] : false;
220
+ if ($paypalGateway) {
221
  $this->molliePayPalButtonHandling($paypalGateway, $notice, $logger, $pluginUrl);
222
  }
223
 
224
  $maybeDisableVoucher = new MaybeDisableGateway();
225
+ $dataService = $container->get('settings.data_helper');
226
+ assert($dataService instanceof Data);
227
+ $checkoutBlockHandler = new CheckoutBlockService($dataService, $maybeDisableVoucher);
228
  $checkoutBlockHandler->bootstrapAjaxRequest();
229
+ add_action(
230
+ 'woocommerce_rest_checkout_process_payment_with_context',
231
+ function ($paymentContext) {
232
+ if (strpos($paymentContext->payment_method, 'mollie_wc_gateway_') === false) {
233
+ return;
234
+ }
235
+ $title = isset($paymentContext->payment_data['payment_method_title']) ? $paymentContext->payment_data['payment_method_title'] : false;
236
+ if (!$title) {
237
+ return;
238
+ }
239
+ $order = $paymentContext->order;
240
+ $order->set_payment_method_title($title);
241
+ $order->save();
242
  }
243
+ );
 
 
 
244
 
245
  return true;
246
  }
438
  public function instantiatePaymentMethodGateways(ContainerInterface $container): array
439
  {
440
  $logger = $container->get(Logger::class);
441
+ assert($logger instanceof Logger);
442
  $notice = $container->get(AdminNotice::class);
443
+ assert($notice instanceof AdminNotice);
444
  $paymentService = $container->get(PaymentService::class);
445
+ assert($paymentService instanceof PaymentService);
446
  $mollieOrderService = $container->get(MollieOrderService::class);
447
+ assert($mollieOrderService instanceof MollieOrderService);
448
  $HttpResponseService = $container->get('SDK.HttpResponse');
449
+ assert($HttpResponseService instanceof HttpResponse);
450
  $settingsHelper = $container->get('settings.settings_helper');
451
+ assert($settingsHelper instanceof Settings);
452
  $apiHelper = $container->get('SDK.api_helper');
453
+ assert($apiHelper instanceof Api);
454
  $paymentMethods = $container->get('gateway.paymentMethods');
455
  $data = $container->get('settings.data_helper');
456
+ assert($data instanceof Data);
457
  $orderInstructionsService = new OrderInstructionsService();
458
  $mollieObject = $container->get(MollieObject::class);
459
+ assert($mollieObject instanceof MollieObject);
460
  $paymentFactory = $container->get(PaymentFactory::class);
461
+ assert($paymentFactory instanceof PaymentFactory);
462
  $pluginId = $container->get('shared.plugin_id');
463
  $methodsEnabledAtMollie = $container->get('gateway.paymentMethodsEnabledAtMollie');
464
  $gateways = [];
560
  'Applepay',
561
  'Mybank',
562
  'Voucher',
563
+ 'In3'
564
  ];
565
  $iconFactory = $container->get(IconFactory::class);
566
+ assert($iconFactory instanceof IconFactory);
567
  $settingsHelper = $container->get('settings.settings_helper');
568
+ assert($settingsHelper instanceof Settings);
569
  $surchargeService = $container->get(Surcharge::class);
570
+ assert($surchargeService instanceof Surcharge);
571
  $paymentFieldsService = $container->get(PaymentFieldsService::class);
572
+ assert($paymentFieldsService instanceof PaymentFieldsService);
573
  foreach ($paymentMethodsNames as $paymentMethodName) {
574
  $paymentMethodClassName = 'Mollie\\WooCommerce\\PaymentMethods\\' . $paymentMethodName;
575
  $paymentMethod = new $paymentMethodClassName(
src/Gateway/OrderMandatoryGatewayDisabler.php ADDED
@@ -0,0 +1,55 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ <?php
2
+
3
+ declare(strict_types=1);
4
+
5
+ namespace Mollie\WooCommerce\Gateway;
6
+
7
+ class OrderMandatoryGatewayDisabler
8
+ {
9
+ /**
10
+ * @var bool
11
+ */
12
+ protected $isSettingsOrderApi;
13
+
14
+ /**
15
+ * OrderMandatoryGatewayDisabler constructor.
16
+ */
17
+ public function __construct(bool $isSettingsOrderApi)
18
+ {
19
+ $this->isSettingsOrderApi = $isSettingsOrderApi;
20
+ }
21
+
22
+ /**
23
+ * @param array $gateways
24
+ * @return array
25
+ */
26
+ public function processGateways(array $gateways): array
27
+ {
28
+ $isWcApiRequest = isset($_GET['wc-api']) ? (bool)sanitize_text_field(wp_unslash($_GET['wc-api'])) : false;
29
+ /*
30
+ * There are 2 cases where we want to filter the gateway and it's when the checkout
31
+ * page render the available payments methods.(classic and block)
32
+ *
33
+ * For any other case we want to be sure voucher gateway is included.
34
+ */
35
+ if (
36
+ ($isWcApiRequest
37
+ || !doing_action('woocommerce_payment_gateways')
38
+ || !wp_doing_ajax()
39
+ || is_admin())
40
+ && !has_block('woocommerce/checkout')
41
+ ) {
42
+ return $gateways;
43
+ }
44
+ if ($this->isSettingsOrderApi) {
45
+ return $gateways;
46
+ }
47
+ return array_filter(
48
+ $gateways,
49
+ function ($gateway) {
50
+ return !($gateway instanceof MolliePaymentGateway)
51
+ || !$gateway->paymentMethod->getProperty('orderMandatory');
52
+ }
53
+ );
54
+ }
55
+ }
src/Gateway/Surcharge.php CHANGED
@@ -190,7 +190,7 @@ class Surcharge
190
  $amountFee = $paymentMethod->getProperty(self::FIXED_FEE);
191
  $currency = get_woocommerce_currency_symbol();
192
  /* translators: Placeholder 1: Fee amount tag. Placeholder 2: Currency.*/
193
- return sprintf(__(' +%1s%2s fee might apply', 'mollie-payments-for-woocommerce'), $amountFee, $currency);
194
  }
195
 
196
  protected function name_percentage($paymentMethod)
@@ -203,7 +203,7 @@ class Surcharge
203
  }
204
  $amountFee = $paymentMethod->getProperty(self::PERCENTAGE);
205
  /* translators: Placeholder 1: Fee amount tag.*/
206
- return sprintf(__(' +%1s%% fee might apply', 'mollie-payments-for-woocommerce'), $amountFee);
207
  }
208
 
209
  protected function name_fixed_fee_percentage($paymentMethod)
@@ -222,7 +222,7 @@ class Surcharge
222
  $currency = get_woocommerce_currency_symbol();
223
  $amountPercent = $paymentMethod->getProperty(self::PERCENTAGE);
224
  /* translators: Placeholder 1: Fee amount tag. Placeholder 2: Currency. Placeholder 3: Percentage amount. */
225
- return sprintf(__(' +%1s%2s + %3s%% fee might apply', 'mollie-payments-for-woocommerce'), $amountFix, $currency, $amountPercent);
226
  }
227
 
228
  /**
190
  $amountFee = $paymentMethod->getProperty(self::FIXED_FEE);
191
  $currency = get_woocommerce_currency_symbol();
192
  /* translators: Placeholder 1: Fee amount tag. Placeholder 2: Currency.*/
193
+ return sprintf(__(' + %1s %2s fee might apply', 'mollie-payments-for-woocommerce'), $currency, $amountFee);
194
  }
195
 
196
  protected function name_percentage($paymentMethod)
203
  }
204
  $amountFee = $paymentMethod->getProperty(self::PERCENTAGE);
205
  /* translators: Placeholder 1: Fee amount tag.*/
206
+ return sprintf(__(' + %1s%% fee might apply', 'mollie-payments-for-woocommerce'), $amountFee);
207
  }
208
 
209
  protected function name_fixed_fee_percentage($paymentMethod)
222
  $currency = get_woocommerce_currency_symbol();
223
  $amountPercent = $paymentMethod->getProperty(self::PERCENTAGE);
224
  /* translators: Placeholder 1: Fee amount tag. Placeholder 2: Currency. Placeholder 3: Percentage amount. */
225
+ return sprintf(__(' + %1s %2s + %3s%% fee might apply', 'mollie-payments-for-woocommerce'), $currency, $amountFix, $amountPercent);
226
  }
227
 
228
  /**
src/Gateway/Voucher/MaybeDisableGateway.php CHANGED
@@ -5,13 +5,15 @@ declare(strict_types=1);
5
  namespace Mollie\WooCommerce\Gateway\Voucher;
6
 
7
  use Mollie\WooCommerce\Gateway\MolliePaymentGateway;
 
8
  use Mollie\WooCommerce\PaymentMethods\Voucher;
9
 
10
  class MaybeDisableGateway
11
  {
12
  /**
13
- * Disable Meal Mollie_WC_Gateway_Voucher Gateway if no categories associated with any product
14
  * in the cart
 
15
  *
16
  * @param array $gateways
17
  *
@@ -28,7 +30,7 @@ class MaybeDisableGateway
28
  * There are 2 cases where we want to filter the gateway and it's when the checkout
29
  * page render the available payments methods.(classic and block)
30
  *
31
- * For any other case we want to be sure mealvoucher gateway is included.
32
  */
33
  if (
34
  ($isWcApiRequest
@@ -51,8 +53,9 @@ class MaybeDisableGateway
51
  }
52
 
53
  $productsWithCategory = $this->numberProductsWithCategory();
 
54
 
55
- if ($mealVoucherGatewayIndex !== false && $productsWithCategory === 0) {
56
  unset($gateways[$mealVoucherGatewayIndex]);
57
  }
58
 
5
  namespace Mollie\WooCommerce\Gateway\Voucher;
6
 
7
  use Mollie\WooCommerce\Gateway\MolliePaymentGateway;
8
+ use Mollie\WooCommerce\Payment\PaymentService;
9
  use Mollie\WooCommerce\PaymentMethods\Voucher;
10
 
11
  class MaybeDisableGateway
12
  {
13
  /**
14
+ * Disable Voucher Gateway if no categories associated with any product
15
  * in the cart
16
+ * Disable if Payments API is selected in advanced settings
17
  *
18
  * @param array $gateways
19
  *
30
  * There are 2 cases where we want to filter the gateway and it's when the checkout
31
  * page render the available payments methods.(classic and block)
32
  *
33
+ * For any other case we want to be sure voucher gateway is included.
34
  */
35
  if (
36
  ($isWcApiRequest
53
  }
54
 
55
  $productsWithCategory = $this->numberProductsWithCategory();
56
+ $paymentAPISetting = get_option('mollie-payments-for-woocommerce_api_switch') === PaymentService::PAYMENT_METHOD_TYPE_PAYMENT;
57
 
58
+ if ($mealVoucherGatewayIndex !== false && ($productsWithCategory === 0 || $paymentAPISetting)) {
59
  unset($gateways[$mealVoucherGatewayIndex]);
60
  }
61
 
src/Payment/PaymentModule.php CHANGED
@@ -12,6 +12,10 @@ use Inpsyde\Modularity\Module\ServiceModule;
12
  use Mollie\Api\Exceptions\ApiException;
13
  use Mollie\Api\Resources\Refund;
14
  use Mollie\WooCommerce\Gateway\MolliePaymentGateway;
 
 
 
 
15
  use Psr\Container\ContainerInterface;
16
  use Psr\Log\LoggerInterface as Logger;
17
  use Psr\Log\LogLevel;
@@ -46,19 +50,28 @@ class PaymentModule implements ServiceModule, ExecutableModule
46
  return [
47
  PaymentFactory::class => static function (ContainerInterface $container): PaymentFactory {
48
  $settingsHelper = $container->get('settings.settings_helper');
 
49
  $apiHelper = $container->get('SDK.api_helper');
 
50
  $data = $container->get('settings.data_helper');
 
51
  $pluginId = $container->get('shared.plugin_id');
52
  $logger = $container->get(Logger::class);
 
53
  return new PaymentFactory($data, $apiHelper, $settingsHelper, $pluginId, $logger);
54
  },
55
  MollieObject::class => static function (ContainerInterface $container): MollieObject {
56
  $logger = $container->get(Logger::class);
 
57
  $data = $container->get('settings.data_helper');
 
58
  $apiHelper = $container->get('SDK.api_helper');
 
59
  $pluginId = $container->get('shared.plugin_id');
60
  $paymentFactory = $container->get(PaymentFactory::class);
 
61
  $settingsHelper = $container->get('settings.settings_helper');
 
62
  return new MollieObject($data, $logger, $paymentFactory, $apiHelper, $settingsHelper, $pluginId);
63
  },
64
  ];
@@ -67,9 +80,13 @@ class PaymentModule implements ServiceModule, ExecutableModule
67
  public function run(ContainerInterface $container): bool
68
  {
69
  $this->httpResponse = $container->get('SDK.HttpResponse');
 
70
  $this->logger = $container->get(Logger::class);
 
71
  $this->apiHelper = $container->get('SDK.api_helper');
 
72
  $this->settingsHelper = $container->get('settings.settings_helper');
 
73
  $this->pluginId = $container->get('shared.plugin_id');
74
  $this->gatewayClassnames = $container->get('gateway.classnames');
75
 
12
  use Mollie\Api\Exceptions\ApiException;
13
  use Mollie\Api\Resources\Refund;
14
  use Mollie\WooCommerce\Gateway\MolliePaymentGateway;
15
+ use Mollie\WooCommerce\SDK\Api;
16
+ use Mollie\WooCommerce\SDK\HttpResponse;
17
+ use Mollie\WooCommerce\Settings\Settings;
18
+ use Mollie\WooCommerce\Shared\Data;
19
  use Psr\Container\ContainerInterface;
20
  use Psr\Log\LoggerInterface as Logger;
21
  use Psr\Log\LogLevel;
50
  return [
51
  PaymentFactory::class => static function (ContainerInterface $container): PaymentFactory {
52
  $settingsHelper = $container->get('settings.settings_helper');
53
+ assert($settingsHelper instanceof Settings);
54
  $apiHelper = $container->get('SDK.api_helper');
55
+ assert($apiHelper instanceof Api);
56
  $data = $container->get('settings.data_helper');
57
+ assert($data instanceof Data);
58
  $pluginId = $container->get('shared.plugin_id');
59
  $logger = $container->get(Logger::class);
60
+ assert($logger instanceof Logger);
61
  return new PaymentFactory($data, $apiHelper, $settingsHelper, $pluginId, $logger);
62
  },
63
  MollieObject::class => static function (ContainerInterface $container): MollieObject {
64
  $logger = $container->get(Logger::class);
65
+ assert($logger instanceof Logger);
66
  $data = $container->get('settings.data_helper');
67
+ assert($data instanceof Data);
68
  $apiHelper = $container->get('SDK.api_helper');
69
+ assert($apiHelper instanceof Api);
70
  $pluginId = $container->get('shared.plugin_id');
71
  $paymentFactory = $container->get(PaymentFactory::class);
72
+ assert($paymentFactory instanceof PaymentFactory);
73
  $settingsHelper = $container->get('settings.settings_helper');
74
+ assert($settingsHelper instanceof Settings);
75
  return new MollieObject($data, $logger, $paymentFactory, $apiHelper, $settingsHelper, $pluginId);
76
  },
77
  ];
80
  public function run(ContainerInterface $container): bool
81
  {
82
  $this->httpResponse = $container->get('SDK.HttpResponse');
83
+ assert($this->httpResponse instanceof HttpResponse);
84
  $this->logger = $container->get(Logger::class);
85
+ assert($this->logger instanceof Logger);
86
  $this->apiHelper = $container->get('SDK.api_helper');
87
+ assert($this->apiHelper instanceof Api);
88
  $this->settingsHelper = $container->get('settings.settings_helper');
89
+ assert($this->settingsHelper instanceof Settings);
90
  $this->pluginId = $container->get('shared.plugin_id');
91
  $this->gatewayClassnames = $container->get('gateway.classnames');
92
 
src/Payment/PaymentService.php CHANGED
@@ -362,7 +362,8 @@ class PaymentService
362
  'metadata' => isset($data['metadata']) ? $data['metadata']
363
  : '',
364
  'orderNumber' => isset($data['orderNumber'])
365
- ? $data['orderNumber'] : ''
 
366
  ];
367
 
368
  $this->logger->log( LogLevel::DEBUG, json_encode($apiCallLog));
362
  'metadata' => isset($data['metadata']) ? $data['metadata']
363
  : '',
364
  'orderNumber' => isset($data['orderNumber'])
365
+ ? $data['orderNumber'] : '',
366
+ 'lines' => isset($data['lines']) ? $data['lines'] : ''
367
  ];
368
 
369
  $this->logger->log( LogLevel::DEBUG, json_encode($apiCallLog));
src/PaymentMethods/In3.php ADDED
@@ -0,0 +1,32 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ <?php
2
+
3
+ declare(strict_types=1);
4
+
5
+ namespace Mollie\WooCommerce\PaymentMethods;
6
+
7
+ class In3 extends AbstractPaymentMethod implements PaymentMethodI
8
+ {
9
+ public function getConfig(): array
10
+ {
11
+ return [
12
+ 'id' => 'in3',
13
+ 'defaultTitle' => __('in3', 'mollie-payments-for-woocommerce'),
14
+ 'settingsDescription' => '',
15
+ 'defaultDescription' => '',
16
+ 'paymentFields' => false,
17
+ 'instructions' => false,
18
+ 'supports' => [
19
+ 'products',
20
+ 'refunds',
21
+ ],
22
+ 'filtersOnBuild' => false,
23
+ 'confirmationDelayed' => false,
24
+ 'orderMandatory' => true,
25
+ ];
26
+ }
27
+
28
+ public function getFormFields($generalFormFields): array
29
+ {
30
+ return $generalFormFields;
31
+ }
32
+ }
src/PaymentMethods/Klarnapaylater.php CHANGED
@@ -26,6 +26,7 @@ class Klarnapaylater extends AbstractPaymentMethod implements PaymentMethodI
26
  'filtersOnBuild' => false,
27
  'confirmationDelayed' => false,
28
  'SEPA' => false,
 
29
  ];
30
  }
31
 
26
  'filtersOnBuild' => false,
27
  'confirmationDelayed' => false,
28
  'SEPA' => false,
29
+ 'orderMandatory' => true,
30
  ];
31
  }
32
 
src/PaymentMethods/Klarnapaynow.php CHANGED
@@ -25,6 +25,7 @@ class Klarnapaynow extends AbstractPaymentMethod implements PaymentMethodI
25
  'filtersOnBuild' => false,
26
  'confirmationDelayed' => false,
27
  'SEPA' => false,
 
28
  ];
29
  }
30
 
25
  'filtersOnBuild' => false,
26
  'confirmationDelayed' => false,
27
  'SEPA' => false,
28
+ 'orderMandatory' => true,
29
  ];
30
  }
31
 
src/PaymentMethods/Klarnasliceit.php CHANGED
@@ -26,6 +26,7 @@ class Klarnasliceit extends AbstractPaymentMethod implements PaymentMethodI
26
  'filtersOnBuild' => false,
27
  'confirmationDelayed' => false,
28
  'SEPA' => false,
 
29
  ];
30
  }
31
 
26
  'filtersOnBuild' => false,
27
  'confirmationDelayed' => false,
28
  'SEPA' => false,
29
+ 'orderMandatory' => true,
30
  ];
31
  }
32
 
src/PaymentMethods/Voucher.php CHANGED
@@ -43,6 +43,7 @@ class Voucher extends AbstractPaymentMethod implements PaymentMethodI
43
  'filtersOnBuild' => false,
44
  'confirmationDelayed' => false,
45
  'SEPA' => false,
 
46
  ];
47
  }
48
 
43
  'filtersOnBuild' => false,
44
  'confirmationDelayed' => false,
45
  'SEPA' => false,
46
+ 'orderMandatory' => true,
47
  ];
48
  }
49
 
src/Settings/Page/MollieSettingsPage.php CHANGED
@@ -128,7 +128,7 @@ class MollieSettingsPage extends WC_Settings_Page
128
  'mollie-payments-for-woocommerce'
129
  ) . '</a> ';
130
  $presentationText .= __(
131
- 'to create a new Mollie account and start receiving payments in a couple of minutes. ',
132
  'mollie-payments-for-woocommerce'
133
  );
134
  $presentationText .= __(
@@ -389,8 +389,12 @@ class MollieSettingsPage extends WC_Settings_Page
389
  */
390
  protected function checkDirectDebitStatus($content): string
391
  {
392
- $idealGateway = !empty($this->registeredGateways["mollie_wc_gateway_ideal"]) && $this->paymentMethods["ideal"]->getProperty('enabled') === 'yes';
393
- $sepaGateway = !empty($this->registeredGateways["mollie_wc_gateway_directdebit"]) && $this->paymentMethods["directdebit"]->getProperty('enabled') === 'yes';
 
 
 
 
394
 
395
  if ((class_exists('WC_Subscription')) && $idealGateway && !$sepaGateway) {
396
  $warning_message = __(
128
  'mollie-payments-for-woocommerce'
129
  ) . '</a> ';
130
  $presentationText .= __(
131
+ ' to create a new Mollie account and start receiving payments in a couple of minutes. ',
132
  'mollie-payments-for-woocommerce'
133
  );
134
  $presentationText .= __(
389
  */
390
  protected function checkDirectDebitStatus($content): string
391
  {
392
+ $hasCustomIdealSettings = $this->paymentMethods["ideal"]->getProperty('enabled') !== false;
393
+ $isIdealEnabled = !$hasCustomIdealSettings || $this->paymentMethods["ideal"]->getProperty('enabled') === 'yes';
394
+ $hasCustomSepaSettings = $this->paymentMethods["directdebit"]->getProperty('enabled') !== false;
395
+ $isSepaEnabled = !$hasCustomSepaSettings || $this->paymentMethods["directdebit"]->getProperty('enabled') === 'yes';
396
+ $idealGateway = !empty($this->registeredGateways["mollie_wc_gateway_ideal"]) && $isIdealEnabled;
397
+ $sepaGateway = !empty($this->registeredGateways["mollie_wc_gateway_directdebit"]) && $isSepaEnabled;
398
 
399
  if ((class_exists('WC_Subscription')) && $idealGateway && !$sepaGateway) {
400
  $warning_message = __(
src/Settings/Settings.php CHANGED
@@ -9,6 +9,7 @@ use DateTime;
9
  use Mollie\Api\Exceptions\ApiException;
10
  use Mollie\WooCommerce\Gateway\Surcharge;
11
  use Mollie\WooCommerce\Notice\AdminNotice;
 
12
  use Mollie\WooCommerce\Settings\General\MollieGeneralSettings;
13
  use WC_Payment_Gateway;
14
 
@@ -288,6 +289,15 @@ class Settings
288
  return is_string($testModeEnabled) ? trim($testModeEnabled) === 'yes' : false;
289
  }
290
 
 
 
 
 
 
 
 
 
 
291
  /**
292
  * @param bool $overrideTestMode
293
  * @return null|string
9
  use Mollie\Api\Exceptions\ApiException;
10
  use Mollie\WooCommerce\Gateway\Surcharge;
11
  use Mollie\WooCommerce\Notice\AdminNotice;
12
+ use Mollie\WooCommerce\Payment\PaymentService;
13
  use Mollie\WooCommerce\Settings\General\MollieGeneralSettings;
14
  use WC_Payment_Gateway;
15
 
289
  return is_string($testModeEnabled) ? trim($testModeEnabled) === 'yes' : false;
290
  }
291
 
292
+ /**
293
+ * Check if the advanced setting to switch API has value 'Order"
294
+ * @return bool
295
+ */
296
+ public function isOrderApiSetting()
297
+ {
298
+ $orderApiSetting = get_option($this->getSettingId('api_switch'));
299
+ return !$orderApiSetting || is_string($orderApiSetting) && trim($orderApiSetting) === PaymentService::PAYMENT_METHOD_TYPE_ORDER;
300
+ }
301
  /**
302
  * @param bool $overrideTestMode
303
  * @return null|string
src/Settings/SettingsModule.php CHANGED
@@ -13,6 +13,7 @@ use Mollie\WooCommerce\Notice\AdminNotice;
13
  use Mollie\WooCommerce\SDK\Api;
14
  use Mollie\WooCommerce\Settings\Page\MollieSettingsPage;
15
  use Mollie\WooCommerce\Shared\Data;
 
16
  use Mollie\WooCommerce\Uninstall\CleanDb;
17
  use Psr\Container\ContainerInterface;
18
  use Psr\Log\LoggerInterface as Logger;
@@ -42,9 +43,12 @@ class SettingsModule implements ServiceModule, ExecutableModule
42
  $pluginId = $container->get('shared.plugin_id');
43
  $pluginUrl = $container->get('shared.plugin_url');
44
  $statusHelper = $container->get('shared.status_helper');
 
45
  $pluginVersion = $container->get('shared.plugin_version');
46
  $apiHelper = $container->get('SDK.api_helper');
 
47
  $cleanDb = $container->get(CleanDb::class);
 
48
  return new Settings(
49
  $pluginId,
50
  $statusHelper,
@@ -55,17 +59,19 @@ class SettingsModule implements ServiceModule, ExecutableModule
55
  );
56
  },
57
  'settings.data_helper' => static function (ContainerInterface $container): Data {
58
- /** @var Api $apiHelper */
59
  $apiHelper = $container->get('SDK.api_helper');
 
60
  $logger = $container->get(Logger::class);
 
61
  $pluginId = $container->get('shared.plugin_id');
62
  $pluginPath = $container->get('shared.plugin_path');
63
  $settings = $container->get('settings.settings_helper');
 
64
  return new Data($apiHelper, $logger, $pluginId, $settings, $pluginPath);
65
  },
66
  'settings.IsTestModeEnabled' => static function (ContainerInterface $container): bool {
67
- /** @var Settings $settingsHelper */
68
  $settingsHelper = $container->get('settings.settings_helper');
 
69
  return $settingsHelper->isTestModeEnabled();
70
  },
71
  ];
@@ -75,8 +81,10 @@ class SettingsModule implements ServiceModule, ExecutableModule
75
  {
76
  $this->plugin_basename = $container->get('shared.plugin_file');
77
  $this->settingsHelper = $container->get('settings.settings_helper');
 
78
  $this->isTestModeEnabled = $container->get('settings.IsTestModeEnabled');
79
  $this->dataHelper = $container->get('settings.data_helper');
 
80
  $pluginPath = $container->get('shared.plugin_path');
81
  $gateways = $container->get('gateway.instances');
82
  $paymentMethods = $container->get('gateway.paymentMethods');
13
  use Mollie\WooCommerce\SDK\Api;
14
  use Mollie\WooCommerce\Settings\Page\MollieSettingsPage;
15
  use Mollie\WooCommerce\Shared\Data;
16
+ use Mollie\WooCommerce\Shared\Status;
17
  use Mollie\WooCommerce\Uninstall\CleanDb;
18
  use Psr\Container\ContainerInterface;
19
  use Psr\Log\LoggerInterface as Logger;
43
  $pluginId = $container->get('shared.plugin_id');
44
  $pluginUrl = $container->get('shared.plugin_url');
45
  $statusHelper = $container->get('shared.status_helper');
46
+ assert($statusHelper instanceof Status);
47
  $pluginVersion = $container->get('shared.plugin_version');
48
  $apiHelper = $container->get('SDK.api_helper');
49
+ assert($apiHelper instanceof Api);
50
  $cleanDb = $container->get(CleanDb::class);
51
+ assert($cleanDb instanceof CleanDb);
52
  return new Settings(
53
  $pluginId,
54
  $statusHelper,
59
  );
60
  },
61
  'settings.data_helper' => static function (ContainerInterface $container): Data {
 
62
  $apiHelper = $container->get('SDK.api_helper');
63
+ assert($apiHelper instanceof Api);
64
  $logger = $container->get(Logger::class);
65
+ assert($logger instanceof Logger);
66
  $pluginId = $container->get('shared.plugin_id');
67
  $pluginPath = $container->get('shared.plugin_path');
68
  $settings = $container->get('settings.settings_helper');
69
+ assert($settings instanceof Settings);
70
  return new Data($apiHelper, $logger, $pluginId, $settings, $pluginPath);
71
  },
72
  'settings.IsTestModeEnabled' => static function (ContainerInterface $container): bool {
 
73
  $settingsHelper = $container->get('settings.settings_helper');
74
+ assert($settingsHelper instanceof Settings);
75
  return $settingsHelper->isTestModeEnabled();
76
  },
77
  ];
81
  {
82
  $this->plugin_basename = $container->get('shared.plugin_file');
83
  $this->settingsHelper = $container->get('settings.settings_helper');
84
+ assert($this->settingsHelper instanceof Settings);
85
  $this->isTestModeEnabled = $container->get('settings.IsTestModeEnabled');
86
  $this->dataHelper = $container->get('settings.data_helper');
87
+ assert($this->dataHelper instanceof Data);
88
  $pluginPath = $container->get('shared.plugin_path');
89
  $gateways = $container->get('gateway.instances');
90
  $paymentMethods = $container->get('gateway.paymentMethods');
src/Shared/SharedDataDictionary.php CHANGED
@@ -28,6 +28,7 @@ class SharedDataDictionary
28
  'Mollie_WC_Gateway_ApplePay',
29
  'Mollie_WC_Gateway_MyBank',
30
  'Mollie_WC_Gateway_Voucher',
 
31
  ];
32
 
33
  public const MOLLIE_OPTIONS_NAMES = [
28
  'Mollie_WC_Gateway_ApplePay',
29
  'Mollie_WC_Gateway_MyBank',
30
  'Mollie_WC_Gateway_Voucher',
31
+ 'Mollie_WC_Gateway_In3',
32
  ];
33
 
34
  public const MOLLIE_OPTIONS_NAMES = [
src/Shared/SharedModule.php CHANGED
@@ -29,7 +29,7 @@ class SharedModule implements ServiceModule
29
  },
30
  'shared.plugin_version' => static function (): string {
31
  //Get plugin version
32
- return '7.1.0';
33
  },
34
  'shared.plugin_title' => static function (): string {
35
  //Get plugin version
29
  },
30
  'shared.plugin_version' => static function (): string {
31
  //Get plugin version
32
+ return '7.2.0';
33
  },
34
  'shared.plugin_title' => static function (): string {
35
  //Get plugin version
src/Subscription/SubscriptionModule.php CHANGED
@@ -10,6 +10,8 @@ use DateTime;
10
  use Inpsyde\Modularity\Module\ExecutableModule;
11
  use Inpsyde\Modularity\Module\ModuleClassNameIdTrait;
12
  use Mollie\WooCommerce\Gateway\MolliePaymentGateway;
 
 
13
  use Psr\Container\ContainerInterface;
14
  use Psr\Log\LoggerInterface as Logger;
15
  use Psr\Log\LogLevel;
@@ -34,8 +36,11 @@ class SubscriptionModule implements ExecutableModule
34
  public function run(ContainerInterface $container): bool
35
  {
36
  $this->logger = $container->get(Logger::class);
 
37
  $this->dataHelper = $container->get('settings.data_helper');
 
38
  $this->settingsHelper = $container->get('settings.settings_helper');
 
39
  $this->maybeFixSubscriptions();
40
  $this->schedulePendingPaymentOrdersExpirationCheck();
41
  return true;
10
  use Inpsyde\Modularity\Module\ExecutableModule;
11
  use Inpsyde\Modularity\Module\ModuleClassNameIdTrait;
12
  use Mollie\WooCommerce\Gateway\MolliePaymentGateway;
13
+ use Mollie\WooCommerce\Settings\Settings;
14
+ use Mollie\WooCommerce\Shared\Data;
15
  use Psr\Container\ContainerInterface;
16
  use Psr\Log\LoggerInterface as Logger;
17
  use Psr\Log\LogLevel;
36
  public function run(ContainerInterface $container): bool
37
  {
38
  $this->logger = $container->get(Logger::class);
39
+ assert($this->logger instanceof Logger);
40
  $this->dataHelper = $container->get('settings.data_helper');
41
+ assert($this->dataHelper instanceof Data);
42
  $this->settingsHelper = $container->get('settings.settings_helper');
43
+ assert($this->settingsHelper instanceof Settings);
44
  $this->maybeFixSubscriptions();
45
  $this->schedulePendingPaymentOrdersExpirationCheck();
46
  return true;