Mollie Payments for WooCommerce - Version 5.5.1

Version Description

  • 12-03-2020 =

  • Fix - Fatal error caused by debug() function

  • Fix - Critical uncaught error when idn_to_ascii() function is disabled

Download this release

Release Info

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

Code changes from version 5.5.0 to 5.5.1

inc/utils.php CHANGED
@@ -8,7 +8,7 @@ use Mollie\Api\Resources\CurrentProfile;
8
  *
9
  * @return bool
10
  */
11
- function isCheckoutContext()
12
  {
13
  return is_checkout() || is_checkout_pay_page();
14
  }
@@ -18,7 +18,7 @@ function isCheckoutContext()
18
  *
19
  * @return array
20
  */
21
- function mollieComponentsStylesForAvailableGateways()
22
  {
23
  $mollieComponentsStyles = new Mollie_WC_Components_Styles(
24
  new Mollie_WC_Settings_Components(),
@@ -33,7 +33,7 @@ function mollieComponentsStylesForAvailableGateways()
33
  *
34
  * @return bool
35
  */
36
- function isTestModeEnabled()
37
  {
38
  $settingsHelper = Mollie_WC_Plugin::getSettingsHelper();
39
  $isTestModeEnabled = $settingsHelper->isTestModeEnabled();
@@ -45,12 +45,12 @@ function isTestModeEnabled()
45
  * @return CurrentProfile
46
  * @throws ApiException
47
  */
48
- function merchantProfile()
49
  {
50
  static $profile = null;
51
 
52
  if ($profile === null) {
53
- $isTestMode = isTestModeEnabled();
54
 
55
  $apiHelper = Mollie_WC_Plugin::getApiHelper();
56
  $profile = $apiHelper->getApiClient($isTestMode)->profiles->getCurrent();
@@ -65,7 +65,7 @@ function merchantProfile()
65
  * @return int|string
66
  * @throws ApiException
67
  */
68
- function merchantProfileId()
69
  {
70
  static $merchantProfileId = null;
71
  $merchantProfileIdOptionKey = Mollie_WC_Plugin::PLUGIN_ID . '_profile_merchant_id';
@@ -79,7 +79,7 @@ function merchantProfileId()
79
  */
80
  if (!$merchantProfileId) {
81
  try {
82
- $merchantProfile = merchantProfile();
83
  $merchantProfileId = isset($merchantProfile->id) ? $merchantProfile->id : '';
84
  } catch (ApiException $exception) {
85
  $merchantProfileId = '';
@@ -99,7 +99,7 @@ function merchantProfileId()
99
  *
100
  * @return string
101
  */
102
- function cardToken()
103
  {
104
  return $cardToken = filter_input(INPUT_POST, 'cardToken', FILTER_SANITIZE_STRING) ?: '';
105
  }
@@ -109,9 +109,9 @@ function cardToken()
109
  *
110
  * @return array|bool|mixed|\Mollie\Api\Resources\BaseCollection|\Mollie\Api\Resources\MethodCollection
111
  */
112
- function availablePaymentMethods()
113
  {
114
- $testMode = isTestModeEnabled();
115
  $dataHelper = Mollie_WC_Plugin::getDataHelper();
116
  $methods = $dataHelper->getApiPaymentMethods($testMode, $use_cache = true);
117
 
@@ -124,7 +124,7 @@ function availablePaymentMethods()
124
  * @param string $message
125
  * @param bool $set_debug_header Set X-Mollie-Debug header (default false)
126
  */
127
- function debug($message, $set_debug_header = false)
128
  {
129
  Mollie_WC_Plugin::debug($message, $set_debug_header);
130
  }
@@ -135,7 +135,7 @@ function debug($message, $set_debug_header = false)
135
  * @param string $message
136
  * @param string $type One of notice, error or success (default notice)
137
  */
138
- function notice($message, $type = 'notice')
139
  {
140
  Mollie_WC_Plugin::addNotice($message, $type);
141
  }
@@ -144,7 +144,7 @@ function notice($message, $type = 'notice')
144
  *
145
  * @return Mollie_WC_Helper_Data
146
  */
147
- function getDataHelper()
148
  {
149
  return Mollie_WC_Plugin::getDataHelper();
150
  }
8
  *
9
  * @return bool
10
  */
11
+ function mollieWooCommerceIsCheckoutContext()
12
  {
13
  return is_checkout() || is_checkout_pay_page();
14
  }
18
  *
19
  * @return array
20
  */
21
+ function mollieWooCommerceComponentsStylesForAvailableGateways()
22
  {
23
  $mollieComponentsStyles = new Mollie_WC_Components_Styles(
24
  new Mollie_WC_Settings_Components(),
33
  *
34
  * @return bool
35
  */
36
+ function mollieWooCommerceIsTestModeEnabled()
37
  {
38
  $settingsHelper = Mollie_WC_Plugin::getSettingsHelper();
39
  $isTestModeEnabled = $settingsHelper->isTestModeEnabled();
45
  * @return CurrentProfile
46
  * @throws ApiException
47
  */
48
+ function mollieWooCommerceMerchantProfile()
49
  {
50
  static $profile = null;
51
 
52
  if ($profile === null) {
53
+ $isTestMode = mollieWooCommerceIsTestModeEnabled();
54
 
55
  $apiHelper = Mollie_WC_Plugin::getApiHelper();
56
  $profile = $apiHelper->getApiClient($isTestMode)->profiles->getCurrent();
65
  * @return int|string
66
  * @throws ApiException
67
  */
68
+ function mollieWooCommerceMerchantProfileId()
69
  {
70
  static $merchantProfileId = null;
71
  $merchantProfileIdOptionKey = Mollie_WC_Plugin::PLUGIN_ID . '_profile_merchant_id';
79
  */
80
  if (!$merchantProfileId) {
81
  try {
82
+ $merchantProfile = mollieWooCommerceMerchantProfile();
83
  $merchantProfileId = isset($merchantProfile->id) ? $merchantProfile->id : '';
84
  } catch (ApiException $exception) {
85
  $merchantProfileId = '';
99
  *
100
  * @return string
101
  */
102
+ function mollieWooCommerceCardToken()
103
  {
104
  return $cardToken = filter_input(INPUT_POST, 'cardToken', FILTER_SANITIZE_STRING) ?: '';
105
  }
109
  *
110
  * @return array|bool|mixed|\Mollie\Api\Resources\BaseCollection|\Mollie\Api\Resources\MethodCollection
111
  */
112
+ function mollieWooCommerceAvailablePaymentMethods()
113
  {
114
+ $testMode = mollieWooCommerceIsTestModeEnabled();
115
  $dataHelper = Mollie_WC_Plugin::getDataHelper();
116
  $methods = $dataHelper->getApiPaymentMethods($testMode, $use_cache = true);
117
 
124
  * @param string $message
125
  * @param bool $set_debug_header Set X-Mollie-Debug header (default false)
126
  */
127
+ function mollieWooCommerceDebug($message, $set_debug_header = false)
128
  {
129
  Mollie_WC_Plugin::debug($message, $set_debug_header);
130
  }
135
  * @param string $message
136
  * @param string $type One of notice, error or success (default notice)
137
  */
138
+ function mollieWooCommerceNotice($message, $type = 'notice')
139
  {
140
  Mollie_WC_Plugin::addNotice($message, $type);
141
  }
144
  *
145
  * @return Mollie_WC_Helper_Data
146
  */
147
+ function mollieWooCommerceGetDataHelper()
148
  {
149
  return Mollie_WC_Plugin::getDataHelper();
150
  }
inc/woocommerce.php CHANGED
@@ -40,7 +40,7 @@ function mollieWooCommerceSession()
40
  * @param WC_Order $order
41
  * @return int
42
  */
43
- function wooCommerceOrderId(WC_Order $order)
44
  {
45
  return version_compare(WC_VERSION, '3.0', '<')
46
  ? $order->id
@@ -52,7 +52,7 @@ function wooCommerceOrderId(WC_Order $order)
52
  * @param WC_Order $order
53
  * @return string
54
  */
55
- function wooCommerceOrderKey(WC_Order $order)
56
  {
57
  return version_compare(WC_VERSION, '3.0', '<')
58
  ? $order->order_key
40
  * @param WC_Order $order
41
  * @return int
42
  */
43
+ function mollieWooCommerceOrderId(WC_Order $order)
44
  {
45
  return version_compare(WC_VERSION, '3.0', '<')
46
  ? $order->id
52
  * @param WC_Order $order
53
  * @return string
54
  */
55
+ function mollieWooCommerceOrderKey(WC_Order $order)
56
  {
57
  return version_compare(WC_VERSION, '3.0', '<')
58
  ? $order->order_key
mollie-payments-for-woocommerce.php CHANGED
@@ -3,7 +3,7 @@
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: 5.5.0
7
  * Author: Mollie
8
  * Author URI: https://www.mollie.com
9
  * Requires at least: 3.8
@@ -12,7 +12,7 @@
12
  * Domain Path: /i18n/languages/
13
  * License: GPLv2 or later
14
  * WC requires at least: 2.2.0
15
- * WC tested up to: 3.9
16
  */
17
 
18
  use Mollie\Api\CompatibilityChecker;
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: 5.5.1
7
  * Author: Mollie
8
  * Author URI: https://www.mollie.com
9
  * Requires at least: 3.8
12
  * Domain Path: /i18n/languages/
13
  * License: GPLv2 or later
14
  * WC requires at least: 2.2.0
15
+ * WC tested up to: 4.0
16
  */
17
 
18
  use Mollie\Api\CompatibilityChecker;
readme.txt CHANGED
@@ -3,7 +3,7 @@ Contributors: daanvm, danielhuesken, davdebcom, dinamiko, inpsyde, l.vangunst, n
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.3
6
- Stable tag: 5.5.0
7
  Requires PHP: 5.6
8
  License: GPLv2 or later
9
  License URI: http://www.gnu.org/licenses/gpl-2.0.html
@@ -181,6 +181,11 @@ Automatic updates should work like a charm; as always though, ensure you backup
181
 
182
  == Changelog ==
183
 
 
 
 
 
 
184
  = 5.5.0 - 11-03-2020 =
185
 
186
  * Add - Use key instead of id to retrieve order onMollieReturn event webhooks
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.3
6
+ Stable tag: 5.5.1
7
  Requires PHP: 5.6
8
  License: GPLv2 or later
9
  License URI: http://www.gnu.org/licenses/gpl-2.0.html
181
 
182
  == Changelog ==
183
 
184
+ = 5.5.1 - 12-03-2020 =
185
+
186
+ * Fix - Fatal error caused by debug() function
187
+ * Fix - Critical uncaught error when idn_to_ascii() function is disabled
188
+
189
  = 5.5.0 - 11-03-2020 =
190
 
191
  * Add - Use key instead of id to retrieve order onMollieReturn event webhooks
src/Mollie/WC/Gateway/Abstract.php CHANGED
@@ -1,7 +1,6 @@
1
  <?php
2
 
3
  use Mollie\Api\Exceptions\ApiException;
4
- use Mollie\Api\Types\PaymentMethod;
5
 
6
  abstract class Mollie_WC_Gateway_Abstract extends WC_Payment_Gateway
7
  {
@@ -1247,9 +1246,9 @@ abstract class Mollie_WC_Gateway_Abstract extends WC_Payment_Gateway
1247
  */
1248
  public function getReturnRedirectUrlForOrder( WC_Order $order )
1249
  {
1250
- $order_id = wooCommerceOrderId($order);
1251
  $debugLine = __METHOD__ . " {$order_id}: Determine what the redirect URL in WooCommerce should be.";
1252
- debug($debugLine);
1253
 
1254
  if ( $this->orderNeedsPayment( $order ) ) {
1255
 
@@ -1287,7 +1286,7 @@ abstract class Mollie_WC_Gateway_Abstract extends WC_Payment_Gateway
1287
  try {
1288
  $payment = $this->activePaymentObject($order_id, false);
1289
  if ( ! $payment->isOpen() && ! $payment->isPending() && ! $payment->isPaid() && ! $payment->isAuthorized() ) {
1290
- notice(__('Your payment was not successful. Please complete your order with a different payment method.', 'mollie-payments-for-woocommerce'));
1291
  // Return to order payment page
1292
  if ( method_exists( $order, 'get_checkout_payment_url' ) ) {
1293
  return $order->get_checkout_payment_url( false );
@@ -1295,10 +1294,10 @@ abstract class Mollie_WC_Gateway_Abstract extends WC_Payment_Gateway
1295
  }
1296
  do_action( Mollie_WC_Plugin::PLUGIN_ID . '_customer_return_payment_success', $order );
1297
  } catch (UnexpectedValueException $exc) {
1298
- notice( __('Your payment was not successful. Please complete your order with a different payment method.', 'mollie-payments-for-woocommerce' ));
1299
  $exceptionMessage = $exc->getMessage();
1300
  $debugLine = __METHOD__ . " Problem processing the payment. {$exceptionMessage}";
1301
- debug($debugLine);
1302
  do_action( Mollie_WC_Plugin::PLUGIN_ID . '_customer_return_payment_failed', $order );
1303
  }
1304
  }
@@ -1724,9 +1723,11 @@ abstract class Mollie_WC_Gateway_Abstract extends WC_Payment_Gateway
1724
  {
1725
  $returnUrl = WC()->api_request_url( 'mollie_return' );
1726
  $returnUrl = untrailingslashit($returnUrl);
1727
- $returnUrl = idn_to_ascii($returnUrl);
1728
- $orderId = wooCommerceOrderId($order);
1729
- $orderKey = wooCommerceOrderKey($order);
 
 
1730
  $returnUrl = $this->appendOrderArgumentsToUrl(
1731
  $orderId,
1732
  $orderKey,
@@ -1740,7 +1741,7 @@ abstract class Mollie_WC_Gateway_Abstract extends WC_Payment_Gateway
1740
  $langUrlParams = substr( $langUrl, strpos( $langUrl, "/?" ) + 2 );
1741
  $returnUrl = $returnUrl . '&' . $langUrlParams;
1742
  }
1743
- debug("{$this->id} : Order {$orderId} returnUrl: {$returnUrl}", true);
1744
  return apply_filters(Mollie_WC_Plugin::PLUGIN_ID . '_return_url', $returnUrl, $order);
1745
  }
1746
 
@@ -1758,9 +1759,11 @@ abstract class Mollie_WC_Gateway_Abstract extends WC_Payment_Gateway
1758
 
1759
  $webhookUrl = WC()->api_request_url(strtolower(get_class($this)));
1760
  $webhookUrl = untrailingslashit($webhookUrl);
1761
- $webhookUrl = idn_to_ascii($webhookUrl);
1762
- $orderId = wooCommerceOrderId($order);
1763
- $orderKey = wooCommerceOrderKey($order);
 
 
1764
  $webhookUrl = $this->appendOrderArgumentsToUrl(
1765
  $orderId,
1766
  $orderKey,
@@ -1781,7 +1784,7 @@ abstract class Mollie_WC_Gateway_Abstract extends WC_Payment_Gateway
1781
  // Some (multilanguage) plugins will add a extra slash to the url (/nl//) causing the URL to redirect and lose it's data.
1782
  // Status updates via webhook will therefor not be processed. The below regex will find and remove those double slashes.
1783
  $webhookUrl = preg_replace('/([^:])(\/{2,})/', '$1/', $webhookUrl);
1784
- debug("{$this->id} : Order {$orderId} webhookUrl: {$webhookUrl}", true);
1785
 
1786
  return apply_filters(Mollie_WC_Plugin::PLUGIN_ID . '_webhook_url', $webhookUrl, $order);
1787
  }
@@ -2091,7 +2094,7 @@ abstract class Mollie_WC_Gateway_Abstract extends WC_Payment_Gateway
2091
  {
2092
  static $factory = null;
2093
  if ($factory === null){
2094
- $paymentMethods = array_filter((array)availablePaymentMethods());
2095
  $paymentMethodsImages = $this->associativePaymentMethodsImages($paymentMethods);
2096
  $factory = new Mollie_WC_Helper_PaymentMethodsIconUrl($paymentMethodsImages);
2097
  }
1
  <?php
2
 
3
  use Mollie\Api\Exceptions\ApiException;
 
4
 
5
  abstract class Mollie_WC_Gateway_Abstract extends WC_Payment_Gateway
6
  {
1246
  */
1247
  public function getReturnRedirectUrlForOrder( WC_Order $order )
1248
  {
1249
+ $order_id = mollieWooCommerceOrderId($order);
1250
  $debugLine = __METHOD__ . " {$order_id}: Determine what the redirect URL in WooCommerce should be.";
1251
+ mollieWooCommerceDebug($debugLine);
1252
 
1253
  if ( $this->orderNeedsPayment( $order ) ) {
1254
 
1286
  try {
1287
  $payment = $this->activePaymentObject($order_id, false);
1288
  if ( ! $payment->isOpen() && ! $payment->isPending() && ! $payment->isPaid() && ! $payment->isAuthorized() ) {
1289
+ mollieWooCommerceNotice(__('Your payment was not successful. Please complete your order with a different payment method.', 'mollie-payments-for-woocommerce'));
1290
  // Return to order payment page
1291
  if ( method_exists( $order, 'get_checkout_payment_url' ) ) {
1292
  return $order->get_checkout_payment_url( false );
1294
  }
1295
  do_action( Mollie_WC_Plugin::PLUGIN_ID . '_customer_return_payment_success', $order );
1296
  } catch (UnexpectedValueException $exc) {
1297
+ mollieWooCommerceNotice(__('Your payment was not successful. Please complete your order with a different payment method.', 'mollie-payments-for-woocommerce' ));
1298
  $exceptionMessage = $exc->getMessage();
1299
  $debugLine = __METHOD__ . " Problem processing the payment. {$exceptionMessage}";
1300
+ mollieWooCommerceDebug($debugLine);
1301
  do_action( Mollie_WC_Plugin::PLUGIN_ID . '_customer_return_payment_failed', $order );
1302
  }
1303
  }
1723
  {
1724
  $returnUrl = WC()->api_request_url( 'mollie_return' );
1725
  $returnUrl = untrailingslashit($returnUrl);
1726
+ if (function_exists('idn_to_ascii')) {
1727
+ $returnUrl = idn_to_ascii($returnUrl);
1728
+ }
1729
+ $orderId = mollieWooCommerceOrderId($order);
1730
+ $orderKey = mollieWooCommerceOrderKey($order);
1731
  $returnUrl = $this->appendOrderArgumentsToUrl(
1732
  $orderId,
1733
  $orderKey,
1741
  $langUrlParams = substr( $langUrl, strpos( $langUrl, "/?" ) + 2 );
1742
  $returnUrl = $returnUrl . '&' . $langUrlParams;
1743
  }
1744
+ mollieWooCommerceDebug("{$this->id} : Order {$orderId} returnUrl: {$returnUrl}", true);
1745
  return apply_filters(Mollie_WC_Plugin::PLUGIN_ID . '_return_url', $returnUrl, $order);
1746
  }
1747
 
1759
 
1760
  $webhookUrl = WC()->api_request_url(strtolower(get_class($this)));
1761
  $webhookUrl = untrailingslashit($webhookUrl);
1762
+ if (function_exists('idn_to_ascii')) {
1763
+ $webhookUrl = idn_to_ascii($webhookUrl);
1764
+ }
1765
+ $orderId = mollieWooCommerceOrderId($order);
1766
+ $orderKey = mollieWooCommerceOrderKey($order);
1767
  $webhookUrl = $this->appendOrderArgumentsToUrl(
1768
  $orderId,
1769
  $orderKey,
1784
  // Some (multilanguage) plugins will add a extra slash to the url (/nl//) causing the URL to redirect and lose it's data.
1785
  // Status updates via webhook will therefor not be processed. The below regex will find and remove those double slashes.
1786
  $webhookUrl = preg_replace('/([^:])(\/{2,})/', '$1/', $webhookUrl);
1787
+ mollieWooCommerceDebug("{$this->id} : Order {$orderId} webhookUrl: {$webhookUrl}", true);
1788
 
1789
  return apply_filters(Mollie_WC_Plugin::PLUGIN_ID . '_webhook_url', $webhookUrl, $order);
1790
  }
2094
  {
2095
  static $factory = null;
2096
  if ($factory === null){
2097
+ $paymentMethods = array_filter((array)mollieWooCommerceAvailablePaymentMethods());
2098
  $paymentMethodsImages = $this->associativePaymentMethodsImages($paymentMethods);
2099
  $factory = new Mollie_WC_Helper_PaymentMethodsIconUrl($paymentMethodsImages);
2100
  }
src/Mollie/WC/Helper/Settings.php CHANGED
@@ -163,7 +163,7 @@ class Mollie_WC_Helper_Settings
163
  $merchantProfileIdOptionKey = Mollie_WC_Plugin::PLUGIN_ID . '_profile_merchant_id';
164
 
165
  try {
166
- $merchantProfile = merchantProfile();
167
  $merchantProfileId = isset($merchantProfile->id) ? $merchantProfile->id : '';
168
  } catch (ApiException $exception) {
169
  $merchantProfileId = '';
163
  $merchantProfileIdOptionKey = Mollie_WC_Plugin::PLUGIN_ID . '_profile_merchant_id';
164
 
165
  try {
166
+ $merchantProfile = mollieWooCommerceMerchantProfile();
167
  $merchantProfileId = isset($merchantProfile->id) ? $merchantProfile->id : '';
168
  } catch (ApiException $exception) {
169
  $merchantProfileId = '';
src/Mollie/WC/Payment/Object.php CHANGED
@@ -652,7 +652,7 @@ class Mollie_WC_Payment_Object {
652
  */
653
  protected function isFinalOrderStatus(WC_Order $order)
654
  {
655
- $dataHelper = getDataHelper();
656
  $orderStatus = $dataHelper->getOrderStatus($order);
657
  $isFinalOrderStatus = in_array(
658
  $orderStatus,
652
  */
653
  protected function isFinalOrderStatus(WC_Order $order)
654
  {
655
+ $dataHelper = mollieWooCommerceGetDataHelper();
656
  $orderStatus = $dataHelper->getOrderStatus($order);
657
  $isFinalOrderStatus = in_array(
658
  $orderStatus,
src/Mollie/WC/Payment/Order.php CHANGED
@@ -184,7 +184,7 @@ class Mollie_WC_Payment_Order extends Mollie_WC_Payment_Object {
184
  $paymentRequestData['payment']['customerId'] = $customer_id;
185
  }
186
 
187
- $cardToken = cardToken();
188
  if ($cardToken && isset($paymentRequestData['payment'])) {
189
  $paymentRequestData['payment']['cardToken'] = $cardToken;
190
  }
@@ -483,14 +483,14 @@ class Mollie_WC_Payment_Order extends Mollie_WC_Payment_Object {
483
  public function onWebhookCanceled( WC_Order $order, $payment, $payment_method_title ) {
484
 
485
  // Get order ID in the correct way depending on WooCommerce version
486
- $order_id = wooCommerceOrderId($order);
487
 
488
  // Add messages to log
489
- debug( __METHOD__ . " called for order {$order_id}" );
490
 
491
  // if the status is Completed|Refunded|Cancelled DONT change the status to cancelled
492
  if ($this->isFinalOrderStatus($order)) {
493
- debug(
494
  __METHOD__
495
  . " called for payment {$order_id} has final status. Nothing to be done"
496
  );
184
  $paymentRequestData['payment']['customerId'] = $customer_id;
185
  }
186
 
187
+ $cardToken = mollieWooCommerceCardToken();
188
  if ($cardToken && isset($paymentRequestData['payment'])) {
189
  $paymentRequestData['payment']['cardToken'] = $cardToken;
190
  }
483
  public function onWebhookCanceled( WC_Order $order, $payment, $payment_method_title ) {
484
 
485
  // Get order ID in the correct way depending on WooCommerce version
486
+ $order_id = mollieWooCommerceOrderId($order);
487
 
488
  // Add messages to log
489
+ mollieWooCommerceDebug(__METHOD__ . " called for order {$order_id}" );
490
 
491
  // if the status is Completed|Refunded|Cancelled DONT change the status to cancelled
492
  if ($this->isFinalOrderStatus($order)) {
493
+ mollieWooCommerceDebug(
494
  __METHOD__
495
  . " called for payment {$order_id} has final status. Nothing to be done"
496
  );
src/Mollie/WC/Payment/Payment.php CHANGED
@@ -120,7 +120,7 @@ class Mollie_WC_Payment_Payment extends Mollie_WC_Payment_Object {
120
  $paymentRequestData['customerId'] = $customer_id;
121
  }
122
 
123
- $cardToken = cardToken();
124
  if ($cardToken) {
125
  $paymentRequestData['cardToken'] = $cardToken;
126
  }
@@ -285,14 +285,14 @@ class Mollie_WC_Payment_Payment extends Mollie_WC_Payment_Object {
285
  public function onWebhookCanceled( WC_Order $order, $payment, $payment_method_title ) {
286
 
287
  // Get order ID in the correct way depending on WooCommerce version
288
- $order_id = wooCommerceOrderId($order);
289
 
290
  // Add messages to log
291
- debug( __METHOD__ . " called for payment {$order_id}" );
292
 
293
  // if the status is Completed|Refunded|Cancelled DONT change the status to cancelled
294
  if ($this->isFinalOrderStatus($order)) {
295
- debug(
296
  __METHOD__
297
  . " called for payment {$order_id} has final status. Nothing to be done"
298
  );
120
  $paymentRequestData['customerId'] = $customer_id;
121
  }
122
 
123
+ $cardToken = mollieWooCommerceCardToken();
124
  if ($cardToken) {
125
  $paymentRequestData['cardToken'] = $cardToken;
126
  }
285
  public function onWebhookCanceled( WC_Order $order, $payment, $payment_method_title ) {
286
 
287
  // Get order ID in the correct way depending on WooCommerce version
288
+ $order_id = mollieWooCommerceOrderId($order);
289
 
290
  // Add messages to log
291
+ mollieWooCommerceDebug(__METHOD__ . " called for payment {$order_id}" );
292
 
293
  // if the status is Completed|Refunded|Cancelled DONT change the status to cancelled
294
  if ($this->isFinalOrderStatus($order)) {
295
+ mollieWooCommerceDebug(
296
  __METHOD__
297
  . " called for payment {$order_id} has final status. Nothing to be done"
298
  );
src/Mollie/WC/Plugin.php CHANGED
@@ -8,7 +8,7 @@ class Mollie_WC_Plugin
8
  {
9
  const PLUGIN_ID = 'mollie-payments-for-woocommerce';
10
  const PLUGIN_TITLE = 'Mollie Payments for WooCommerce';
11
- const PLUGIN_VERSION = '5.5.0';
12
 
13
  const DB_VERSION = '1.0';
14
  const DB_VERSION_PARAM_NAME = 'mollie-db-version';
@@ -361,7 +361,7 @@ class Mollie_WC_Plugin
361
  */
362
  public static function enqueueFrontendScripts()
363
  {
364
- if (is_admin() || !isCheckoutContext()) {
365
  return;
366
  }
367
 
@@ -373,17 +373,17 @@ class Mollie_WC_Plugin
373
  */
374
  public static function enqueueComponentsAssets()
375
  {
376
- if (is_admin() || !isCheckoutContext()) {
377
  return;
378
  }
379
 
380
  try {
381
- $merchantProfileId = merchantProfileId();
382
  } catch (ApiException $exception) {
383
  return;
384
  }
385
 
386
- $mollieComponentsStylesGateways = mollieComponentsStylesForAvailableGateways();
387
  $gatewayNames = array_keys($mollieComponentsStylesGateways);
388
 
389
  if (!$merchantProfileId || !$mollieComponentsStylesGateways) {
@@ -402,7 +402,7 @@ class Mollie_WC_Plugin
402
  'merchantProfileId' => $merchantProfileId,
403
  'options' => [
404
  'locale' => $locale,
405
- 'testmode' => isTestModeEnabled(),
406
  ],
407
  'enabledGateways' => $gatewayNames,
408
  'componentsSettings' => $mollieComponentsStylesGateways,
@@ -446,7 +446,7 @@ class Mollie_WC_Plugin
446
  */
447
  public static function orderByRequest()
448
  {
449
- $dataHelper = getDataHelper();
450
 
451
  $orderId = filter_input(INPUT_GET, 'order_id', FILTER_SANITIZE_NUMBER_INT) ?: null;
452
  $key = filter_input(INPUT_GET, 'key', FILTER_SANITIZE_STRING) ?: null;
@@ -477,24 +477,24 @@ class Mollie_WC_Plugin
477
  */
478
  public static function onMollieReturn ()
479
  {
480
- $dataHelper = getDataHelper();
481
 
482
  try {
483
  $order = self::orderByRequest();
484
  } catch (RuntimeException $exc) {
485
  self::setHttpResponseCode($exc->getCode());
486
- debug(__METHOD__ . ": {$exc->getMessage()}");
487
  return;
488
  }
489
 
490
  $gateway = $dataHelper->getWcPaymentGatewayByOrder($order);
491
- $orderId = wooCommerceOrderId($order);
492
 
493
  if (!$gateway) {
494
  $gatewayName = $order->get_payment_method();
495
 
496
  self::setHttpResponseCode(404);
497
- debug(
498
  __METHOD__ . ": Could not find gateway {$gatewayName} for order {$orderId}."
499
  );
500
  return;
@@ -502,7 +502,7 @@ class Mollie_WC_Plugin
502
 
503
  if (!($gateway instanceof Mollie_WC_Gateway_Abstract)) {
504
  self::setHttpResponseCode(400);
505
- debug(__METHOD__ . ": Invalid gateway {get_class($gateway)} for this plugin. Order {$orderId}.");
506
  return;
507
  }
508
 
@@ -511,7 +511,7 @@ class Mollie_WC_Plugin
511
  // Add utm_nooverride query string
512
  $redirect_url = add_query_arg(['utm_nooverride' => 1], $redirect_url);
513
 
514
- debug(__METHOD__ . ": Redirect url on return order {$gateway->id}, order {$orderId}: {$redirect_url}");
515
 
516
  wp_safe_redirect($redirect_url);
517
  }
@@ -928,7 +928,7 @@ class Mollie_WC_Plugin
928
  }
929
 
930
  // Is test mode enabled?
931
- $test_mode = isTestModeEnabled();
932
 
933
  try {
934
  // Get the order from the Mollie API
@@ -1013,7 +1013,7 @@ class Mollie_WC_Plugin
1013
  }
1014
 
1015
  // Is test mode enabled?
1016
- $test_mode = isTestModeEnabled();
1017
 
1018
  try {
1019
  // Get the order from the Mollie API
8
  {
9
  const PLUGIN_ID = 'mollie-payments-for-woocommerce';
10
  const PLUGIN_TITLE = 'Mollie Payments for WooCommerce';
11
+ const PLUGIN_VERSION = '5.5.1';
12
 
13
  const DB_VERSION = '1.0';
14
  const DB_VERSION_PARAM_NAME = 'mollie-db-version';
361
  */
362
  public static function enqueueFrontendScripts()
363
  {
364
+ if (is_admin() || !mollieWooCommerceIsCheckoutContext()) {
365
  return;
366
  }
367
 
373
  */
374
  public static function enqueueComponentsAssets()
375
  {
376
+ if (is_admin() || !mollieWooCommerceIsCheckoutContext()) {
377
  return;
378
  }
379
 
380
  try {
381
+ $merchantProfileId = mollieWooCommerceMerchantProfileId();
382
  } catch (ApiException $exception) {
383
  return;
384
  }
385
 
386
+ $mollieComponentsStylesGateways = mollieWooCommerceComponentsStylesForAvailableGateways();
387
  $gatewayNames = array_keys($mollieComponentsStylesGateways);
388
 
389
  if (!$merchantProfileId || !$mollieComponentsStylesGateways) {
402
  'merchantProfileId' => $merchantProfileId,
403
  'options' => [
404
  'locale' => $locale,
405
+ 'testmode' => mollieWooCommerceIsTestModeEnabled(),
406
  ],
407
  'enabledGateways' => $gatewayNames,
408
  'componentsSettings' => $mollieComponentsStylesGateways,
446
  */
447
  public static function orderByRequest()
448
  {
449
+ $dataHelper = mollieWooCommerceGetDataHelper();
450
 
451
  $orderId = filter_input(INPUT_GET, 'order_id', FILTER_SANITIZE_NUMBER_INT) ?: null;
452
  $key = filter_input(INPUT_GET, 'key', FILTER_SANITIZE_STRING) ?: null;
477
  */
478
  public static function onMollieReturn ()
479
  {
480
+ $dataHelper = mollieWooCommerceGetDataHelper();
481
 
482
  try {
483
  $order = self::orderByRequest();
484
  } catch (RuntimeException $exc) {
485
  self::setHttpResponseCode($exc->getCode());
486
+ mollieWooCommerceDebug(__METHOD__ . ": {$exc->getMessage()}");
487
  return;
488
  }
489
 
490
  $gateway = $dataHelper->getWcPaymentGatewayByOrder($order);
491
+ $orderId = mollieWooCommerceOrderId($order);
492
 
493
  if (!$gateway) {
494
  $gatewayName = $order->get_payment_method();
495
 
496
  self::setHttpResponseCode(404);
497
+ mollieWooCommerceDebug(
498
  __METHOD__ . ": Could not find gateway {$gatewayName} for order {$orderId}."
499
  );
500
  return;
502
 
503
  if (!($gateway instanceof Mollie_WC_Gateway_Abstract)) {
504
  self::setHttpResponseCode(400);
505
+ mollieWooCommerceDebug(__METHOD__ . ": Invalid gateway {get_class($gateway)} for this plugin. Order {$orderId}.");
506
  return;
507
  }
508
 
511
  // Add utm_nooverride query string
512
  $redirect_url = add_query_arg(['utm_nooverride' => 1], $redirect_url);
513
 
514
+ mollieWooCommerceDebug(__METHOD__ . ": Redirect url on return order {$gateway->id}, order {$orderId}: {$redirect_url}");
515
 
516
  wp_safe_redirect($redirect_url);
517
  }
928
  }
929
 
930
  // Is test mode enabled?
931
+ $test_mode = mollieWooCommerceIsTestModeEnabled();
932
 
933
  try {
934
  // Get the order from the Mollie API
1013
  }
1014
 
1015
  // Is test mode enabled?
1016
+ $test_mode = mollieWooCommerceIsTestModeEnabled();
1017
 
1018
  try {
1019
  // Get the order from the Mollie API
vendor/autoload.php CHANGED
@@ -4,4 +4,4 @@
4
 
5
  require_once __DIR__ . '/composer/autoload_real.php';
6
 
7
- return ComposerAutoloaderInit3a6433875eadc19b9fbc0964b61769a4::getLoader();
4
 
5
  require_once __DIR__ . '/composer/autoload_real.php';
6
 
7
+ return ComposerAutoloaderInit0e0f84c502efc5e060d5602a9841af8f::getLoader();
vendor/composer/autoload_real.php CHANGED
@@ -2,7 +2,7 @@
2
 
3
  // autoload_real.php @generated by Composer
4
 
5
- class ComposerAutoloaderInit3a6433875eadc19b9fbc0964b61769a4
6
  {
7
  private static $loader;
8
 
@@ -19,15 +19,15 @@ class ComposerAutoloaderInit3a6433875eadc19b9fbc0964b61769a4
19
  return self::$loader;
20
  }
21
 
22
- spl_autoload_register(array('ComposerAutoloaderInit3a6433875eadc19b9fbc0964b61769a4', 'loadClassLoader'), true, true);
23
  self::$loader = $loader = new \Composer\Autoload\ClassLoader();
24
- spl_autoload_unregister(array('ComposerAutoloaderInit3a6433875eadc19b9fbc0964b61769a4', 'loadClassLoader'));
25
 
26
  $useStaticLoader = PHP_VERSION_ID >= 50600 && !defined('HHVM_VERSION') && (!function_exists('zend_loader_file_encoded') || !zend_loader_file_encoded());
27
  if ($useStaticLoader) {
28
  require_once __DIR__ . '/autoload_static.php';
29
 
30
- call_user_func(\Composer\Autoload\ComposerStaticInit3a6433875eadc19b9fbc0964b61769a4::getInitializer($loader));
31
  } else {
32
  $map = require __DIR__ . '/autoload_namespaces.php';
33
  foreach ($map as $namespace => $path) {
@@ -48,19 +48,19 @@ class ComposerAutoloaderInit3a6433875eadc19b9fbc0964b61769a4
48
  $loader->register(true);
49
 
50
  if ($useStaticLoader) {
51
- $includeFiles = Composer\Autoload\ComposerStaticInit3a6433875eadc19b9fbc0964b61769a4::$files;
52
  } else {
53
  $includeFiles = require __DIR__ . '/autoload_files.php';
54
  }
55
  foreach ($includeFiles as $fileIdentifier => $file) {
56
- composerRequire3a6433875eadc19b9fbc0964b61769a4($fileIdentifier, $file);
57
  }
58
 
59
  return $loader;
60
  }
61
  }
62
 
63
- function composerRequire3a6433875eadc19b9fbc0964b61769a4($fileIdentifier, $file)
64
  {
65
  if (empty($GLOBALS['__composer_autoload_files'][$fileIdentifier])) {
66
  require $file;
2
 
3
  // autoload_real.php @generated by Composer
4
 
5
+ class ComposerAutoloaderInit0e0f84c502efc5e060d5602a9841af8f
6
  {
7
  private static $loader;
8
 
19
  return self::$loader;
20
  }
21
 
22
+ spl_autoload_register(array('ComposerAutoloaderInit0e0f84c502efc5e060d5602a9841af8f', 'loadClassLoader'), true, true);
23
  self::$loader = $loader = new \Composer\Autoload\ClassLoader();
24
+ spl_autoload_unregister(array('ComposerAutoloaderInit0e0f84c502efc5e060d5602a9841af8f', 'loadClassLoader'));
25
 
26
  $useStaticLoader = PHP_VERSION_ID >= 50600 && !defined('HHVM_VERSION') && (!function_exists('zend_loader_file_encoded') || !zend_loader_file_encoded());
27
  if ($useStaticLoader) {
28
  require_once __DIR__ . '/autoload_static.php';
29
 
30
+ call_user_func(\Composer\Autoload\ComposerStaticInit0e0f84c502efc5e060d5602a9841af8f::getInitializer($loader));
31
  } else {
32
  $map = require __DIR__ . '/autoload_namespaces.php';
33
  foreach ($map as $namespace => $path) {
48
  $loader->register(true);
49
 
50
  if ($useStaticLoader) {
51
+ $includeFiles = Composer\Autoload\ComposerStaticInit0e0f84c502efc5e060d5602a9841af8f::$files;
52
  } else {
53
  $includeFiles = require __DIR__ . '/autoload_files.php';
54
  }
55
  foreach ($includeFiles as $fileIdentifier => $file) {
56
+ composerRequire0e0f84c502efc5e060d5602a9841af8f($fileIdentifier, $file);
57
  }
58
 
59
  return $loader;
60
  }
61
  }
62
 
63
+ function composerRequire0e0f84c502efc5e060d5602a9841af8f($fileIdentifier, $file)
64
  {
65
  if (empty($GLOBALS['__composer_autoload_files'][$fileIdentifier])) {
66
  require $file;
vendor/composer/autoload_static.php CHANGED
@@ -4,7 +4,7 @@
4
 
5
  namespace Composer\Autoload;
6
 
7
- class ComposerStaticInit3a6433875eadc19b9fbc0964b61769a4
8
  {
9
  public static $files = array (
10
  '7b11c4dc42b3b3023073cb14e519683c' => __DIR__ . '/..' . '/ralouphie/getallheaders/src/getallheaders.php',
@@ -287,10 +287,10 @@ class ComposerStaticInit3a6433875eadc19b9fbc0964b61769a4
287
  public static function getInitializer(ClassLoader $loader)
288
  {
289
  return \Closure::bind(function () use ($loader) {
290
- $loader->prefixLengthsPsr4 = ComposerStaticInit3a6433875eadc19b9fbc0964b61769a4::$prefixLengthsPsr4;
291
- $loader->prefixDirsPsr4 = ComposerStaticInit3a6433875eadc19b9fbc0964b61769a4::$prefixDirsPsr4;
292
- $loader->prefixesPsr0 = ComposerStaticInit3a6433875eadc19b9fbc0964b61769a4::$prefixesPsr0;
293
- $loader->classMap = ComposerStaticInit3a6433875eadc19b9fbc0964b61769a4::$classMap;
294
 
295
  }, null, ClassLoader::class);
296
  }
4
 
5
  namespace Composer\Autoload;
6
 
7
+ class ComposerStaticInit0e0f84c502efc5e060d5602a9841af8f
8
  {
9
  public static $files = array (
10
  '7b11c4dc42b3b3023073cb14e519683c' => __DIR__ . '/..' . '/ralouphie/getallheaders/src/getallheaders.php',
287
  public static function getInitializer(ClassLoader $loader)
288
  {
289
  return \Closure::bind(function () use ($loader) {
290
+ $loader->prefixLengthsPsr4 = ComposerStaticInit0e0f84c502efc5e060d5602a9841af8f::$prefixLengthsPsr4;
291
+ $loader->prefixDirsPsr4 = ComposerStaticInit0e0f84c502efc5e060d5602a9841af8f::$prefixDirsPsr4;
292
+ $loader->prefixesPsr0 = ComposerStaticInit0e0f84c502efc5e060d5602a9841af8f::$prefixesPsr0;
293
+ $loader->classMap = ComposerStaticInit0e0f84c502efc5e060d5602a9841af8f::$classMap;
294
 
295
  }, null, ClassLoader::class);
296
  }