Mollie Payments for WooCommerce - Version 5.1.7

Version Description

  • 28-04-2019 =

  • Fix - Remove Bitcoin as payment gateway, no longer supported by Mollie, contact info@mollie.com for details

  • Fix - Add extra check for URL's with parameters and correct them is structure is incorrect

  • Fix - getMethodIssuers: improve caching of issuers (iDEAL, KBC/CBC)

  • Fix - During payment always check if a product exists, if it doesn't create a Mollie Payment instead of Mollie Order

Download this release

Release Info

Developer davdebcom
Plugin Icon wp plugin Mollie Payments for WooCommerce
Version 5.1.7
Comparing to
See all releases

Code changes from version 5.1.6 to 5.1.7

includes/mollie-api-php/examples/database/.gitignore ADDED
@@ -0,0 +1 @@
 
1
+ *.txt
includes/mollie/wc/gateway/abstract.php CHANGED
@@ -429,13 +429,6 @@ abstract class Mollie_WC_Gateway_Abstract extends WC_Payment_Gateway
429
  $test_mode = $settings_helper->isTestModeEnabled();
430
  $customer_id = $this->getUserMollieCustomerId( $order, $test_mode );
431
 
432
- $payment_object = Mollie_WC_Plugin::getPaymentFactoryHelper()->getPaymentObject( 'order' );
433
- $paymentRequestData = $payment_object->getPaymentRequestData( $order, $customer_id );
434
-
435
- $data = array_filter( $paymentRequestData );
436
-
437
- $data = apply_filters( 'woocommerce_' . $this->id . '_args', $data, $order );
438
-
439
  //
440
  // PROCESS SUBSCRIPTION SWITCH - If this is a subscription switch and customer has a valid mandate, process the order internally
441
  //
@@ -443,6 +436,13 @@ abstract class Mollie_WC_Gateway_Abstract extends WC_Payment_Gateway
443
  0 != $order->get_user_id() && ( wcs_order_contains_switch( $order ) )
444
  ) {
445
 
 
 
 
 
 
 
 
446
  try {
447
  Mollie_WC_Plugin::debug( $this->id . ': Subscription switch started, fetching mandate(s) for order #' . $order_id );
448
  $mandates = Mollie_WC_Plugin::getApiHelper()->getApiClient( $test_mode )->customers->get( $customer_id )->mandates();
@@ -485,78 +485,130 @@ abstract class Mollie_WC_Gateway_Abstract extends WC_Payment_Gateway
485
  }
486
 
487
  //
488
- // PROCESS REGULAR PAYMENT
 
 
 
489
  //
490
 
491
- try {
492
- if ( version_compare( WC_VERSION, '3.0', '<' ) ) {
493
- Mollie_WC_Plugin::debug( $this->id . ': Create Mollie payment object for order ' . $order->id, true );
494
- } else {
495
- Mollie_WC_Plugin::debug( $this->id . ': Create Mollie payment object for order ' . $order->get_id(), true );
496
- }
497
 
498
- do_action( Mollie_WC_Plugin::PLUGIN_ID . '_create_payment', $data, $order );
499
 
500
- // Create Mollie payment with customer id.
501
- try {
502
- Mollie_WC_Plugin::debug( 'Creating payment object: type Order, first try creating a Mollie Order.' );
503
 
504
- // Only enable this for hardcore debugging!
505
- // Mollie_WC_Plugin::debug( $data );
506
 
507
- $payment_object = Mollie_WC_Plugin::getApiHelper()->getApiClient( $test_mode )->orders->create( $data );
 
 
 
 
 
 
 
 
 
508
  }
509
- catch ( Mollie\Api\Exceptions\ApiException $e ) {
 
 
 
 
510
 
511
- // Don't try to create a Mollie Payment for Klarna payment methods
512
- $order_payment_method = ( version_compare( WC_VERSION, '3.0', '<' ) ) ? $order->payment_method : $order->get_payment_method();
513
 
514
- if ( $order_payment_method == 'mollie_wc_gateway_klarnapaylater' || $order_payment_method == 'mollie_wc_gateway_sliceit' ) {
515
- Mollie_WC_Plugin::debug( 'Creating payment object: type Order, failed for Klarna payment, stopping process.' );
516
- throw $e;
 
 
 
 
 
 
 
517
  }
518
 
519
- Mollie_WC_Plugin::debug( 'Creating payment object: type Order, first try failed: ' . $e->getMessage() );
 
 
 
 
 
520
 
521
- // Unset missing customer ID
522
- unset( $data['payment']['customerId'] );
523
 
 
524
  try {
 
525
 
526
- if ( $e->getField() !== 'payment.customerId' ) {
527
- Mollie_WC_Plugin::debug( 'Creating payment object: type Order, did not fail because of incorrect customerId, so trying Payment now.' );
528
- throw $e;
529
- }
530
 
531
- // Retry without customer id.
532
- Mollie_WC_Plugin::debug( 'Creating payment object: type Order, second try, creating a Mollie Order without a customerId.' );
533
  $payment_object = Mollie_WC_Plugin::getApiHelper()->getApiClient( $test_mode )->orders->create( $data );
534
  }
535
  catch ( Mollie\Api\Exceptions\ApiException $e ) {
536
 
537
- Mollie_WC_Plugin::debug( 'Creating payment object: type Payment, final try, creating a Payment.' );
 
538
 
539
- $payment_object = Mollie_WC_Plugin::getPaymentFactoryHelper()->getPaymentObject( 'payment' );
540
- $paymentRequestData = $payment_object->getPaymentRequestData( $order, $customer_id );
 
 
541
 
542
- $data = array_filter( $paymentRequestData );
543
 
544
- $data = apply_filters( 'woocommerce_' . $this->id . '_args', $data, $order );
 
545
 
546
  try {
547
 
548
- // Only enable this for hardcore debugging!
549
- // Mollie_WC_Plugin::debug( $data );
 
 
550
 
551
- // Retry as simple payment
552
- $payment_object = Mollie_WC_Plugin::getApiHelper()->getApiClient( $test_mode )->payments->create( $data );
 
553
  }
554
  catch ( Mollie\Api\Exceptions\ApiException $e ) {
555
- throw $e;
 
 
556
  }
557
  }
558
  }
559
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
560
  $this->saveMollieInfo( $order, $payment_object );
561
 
562
  do_action( Mollie_WC_Plugin::PLUGIN_ID . '_payment_created', $payment_object, $order );
@@ -620,7 +672,7 @@ abstract class Mollie_WC_Gateway_Abstract extends WC_Payment_Gateway
620
  $message = sprintf( __( 'Could not create %s payment.', 'mollie-payments-for-woocommerce' ), $this->title );
621
 
622
  if ( defined( 'WP_DEBUG' ) && WP_DEBUG ) {
623
- $message .= ' ' . $e->getMessage();
624
  }
625
 
626
  Mollie_WC_Plugin::addNotice( $message, 'error' );
@@ -1634,11 +1686,13 @@ abstract class Mollie_WC_Gateway_Abstract extends WC_Payment_Gateway
1634
 
1635
  $lang_url = $this->getSiteUrlWithLanguage();
1636
 
1637
- if ( strpos( $lang_url, '/?') !== FALSE ) {
1638
- $return_url = str_replace( '/?', '&', $return_url);
1639
- }
1640
-
1641
- $return_url = str_replace($site_url, $lang_url, $return_url);
 
 
1642
 
1643
  if ( version_compare( WC_VERSION, '3.0', '<' ) ) {
1644
  Mollie_WC_Plugin::debug( $this->id . ': Order ' . $order->id . ' returnUrl: ' . $return_url, true );
@@ -1675,12 +1729,14 @@ abstract class Mollie_WC_Gateway_Abstract extends WC_Payment_Gateway
1675
 
1676
  $lang_url = $this->getSiteUrlWithLanguage();
1677
 
1678
- if ( strpos( $lang_url, '/?') !== FALSE ) {
1679
- $webhook_url = str_replace( '/?', '&', $webhook_url);
 
 
 
 
1680
  }
1681
 
1682
- $webhook_url = str_replace($site_url, $lang_url, $webhook_url);
1683
-
1684
  // Some (multilanguage) plugins will add a extra slash to the url (/nl//) causing the URL to redirect and lose it's data.
1685
  // Status updates via webhook will therefor not be processed. The below regex will find and remove those double slashes.
1686
  $webhook_url = preg_replace('/([^:])(\/{2,})/', '$1/', $webhook_url);
429
  $test_mode = $settings_helper->isTestModeEnabled();
430
  $customer_id = $this->getUserMollieCustomerId( $order, $test_mode );
431
 
 
 
 
 
 
 
 
432
  //
433
  // PROCESS SUBSCRIPTION SWITCH - If this is a subscription switch and customer has a valid mandate, process the order internally
434
  //
436
  0 != $order->get_user_id() && ( wcs_order_contains_switch( $order ) )
437
  ) {
438
 
439
+ $payment_object = Mollie_WC_Plugin::getPaymentFactoryHelper()->getPaymentObject( 'payment' );
440
+ $paymentRequestData = $payment_object->getPaymentRequestData( $order, $customer_id );
441
+
442
+ $data = array_filter( $paymentRequestData );
443
+
444
+ $data = apply_filters( 'woocommerce_' . $this->id . '_args', $data, $order );
445
+
446
  try {
447
  Mollie_WC_Plugin::debug( $this->id . ': Subscription switch started, fetching mandate(s) for order #' . $order_id );
448
  $mandates = Mollie_WC_Plugin::getApiHelper()->getApiClient( $test_mode )->customers->get( $customer_id )->mandates();
485
  }
486
 
487
  //
488
+ // CHECK WOOCOMMERCE PRODUCTS
489
+ // Make sure all cart items are real WooCommerce products,
490
+ // not removed products or virtual ones (by WooCommerce Events Manager etc).
491
+ // If products are virtual, use Payments API instead of Orders API
492
  //
493
 
494
+ $mollie_payment_type = 'order';
 
 
 
 
 
495
 
496
+ foreach ( $order->get_items() as $cart_item ) {
497
 
498
+ if ( $cart_item['quantity'] ) {
 
 
499
 
500
+ do_action( Mollie_WC_Plugin::PLUGIN_ID . '_orderlines_process_items_before_getting_product_id', $cart_item );
 
501
 
502
+ if ( $cart_item['variation_id'] ) {
503
+ $product = wc_get_product( $cart_item['variation_id'] );
504
+ } else {
505
+ $product = wc_get_product( $cart_item['product_id'] );
506
+ }
507
+
508
+ if ( $product == false ) {
509
+ $mollie_payment_type = 'payment';
510
+ break;
511
+ }
512
  }
513
+ }
514
+
515
+ //
516
+ // TRY PROCESSING THE PAYMENT AS MOLLIE ORDER OR MOLLIE PAYMENT
517
+ //
518
 
519
+ try {
 
520
 
521
+ //
522
+ // PROCESS REGULAR PAYMENT AS MOLLIE ORDER
523
+ //
524
+
525
+ if ( $mollie_payment_type == 'order' ) {
526
+
527
+ if ( version_compare( WC_VERSION, '3.0', '<' ) ) {
528
+ Mollie_WC_Plugin::debug( $this->id . ': Create Mollie payment object for order ' . $order->id, true );
529
+ } else {
530
+ Mollie_WC_Plugin::debug( $this->id . ': Create Mollie payment object for order ' . $order->get_id(), true );
531
  }
532
 
533
+ $payment_object = Mollie_WC_Plugin::getPaymentFactoryHelper()->getPaymentObject( 'order' );
534
+ $paymentRequestData = $payment_object->getPaymentRequestData( $order, $customer_id );
535
+
536
+ $data = array_filter( $paymentRequestData );
537
+
538
+ $data = apply_filters( 'woocommerce_' . $this->id . '_args', $data, $order );
539
 
540
+ do_action( Mollie_WC_Plugin::PLUGIN_ID . '_create_payment', $data, $order );
 
541
 
542
+ // Create Mollie payment with customer id.
543
  try {
544
+ Mollie_WC_Plugin::debug( 'Creating payment object: type Order, first try creating a Mollie Order.' );
545
 
546
+ // Only enable this for hardcore debugging!
547
+ // Mollie_WC_Plugin::debug( $data );
 
 
548
 
 
 
549
  $payment_object = Mollie_WC_Plugin::getApiHelper()->getApiClient( $test_mode )->orders->create( $data );
550
  }
551
  catch ( Mollie\Api\Exceptions\ApiException $e ) {
552
 
553
+ // Don't try to create a Mollie Payment for Klarna payment methods
554
+ $order_payment_method = ( version_compare( WC_VERSION, '3.0', '<' ) ) ? $order->payment_method : $order->get_payment_method();
555
 
556
+ if ( $order_payment_method == 'mollie_wc_gateway_klarnapaylater' || $order_payment_method == 'mollie_wc_gateway_sliceit' ) {
557
+ Mollie_WC_Plugin::debug( 'Creating payment object: type Order, failed for Klarna payment, stopping process.' );
558
+ throw $e;
559
+ }
560
 
561
+ Mollie_WC_Plugin::debug( 'Creating payment object: type Order, first try failed: ' . $e->getMessage() );
562
 
563
+ // Unset missing customer ID
564
+ unset( $data['payment']['customerId'] );
565
 
566
  try {
567
 
568
+ if ( $e->getField() !== 'payment.customerId' ) {
569
+ Mollie_WC_Plugin::debug( 'Creating payment object: type Order, did not fail because of incorrect customerId, so trying Payment now.' );
570
+ throw $e;
571
+ }
572
 
573
+ // Retry without customer id.
574
+ Mollie_WC_Plugin::debug( 'Creating payment object: type Order, second try, creating a Mollie Order without a customerId.' );
575
+ $payment_object = Mollie_WC_Plugin::getApiHelper()->getApiClient( $test_mode )->orders->create( $data );
576
  }
577
  catch ( Mollie\Api\Exceptions\ApiException $e ) {
578
+
579
+ // Set Mollie payment type to payment, when creating a Mollie Order has failed
580
+ $mollie_payment_type = 'payment';
581
  }
582
  }
583
  }
584
 
585
+ //
586
+ // PROCESS REGULAR PAYMENT AS MOLLIE PAYMENT
587
+ //
588
+
589
+ if ( $mollie_payment_type == 'payment' ) {
590
+ Mollie_WC_Plugin::debug( 'Creating payment object: type Payment, creating a Payment.' );
591
+
592
+ $payment_object = Mollie_WC_Plugin::getPaymentFactoryHelper()->getPaymentObject( 'payment' );
593
+ $paymentRequestData = $payment_object->getPaymentRequestData( $order, $customer_id );
594
+
595
+ $data = array_filter( $paymentRequestData );
596
+
597
+ $data = apply_filters( 'woocommerce_' . $this->id . '_args', $data, $order );
598
+
599
+ try {
600
+
601
+ // Only enable this for hardcore debugging!
602
+ // Mollie_WC_Plugin::debug( $data );
603
+
604
+ // Try as simple payment
605
+ $payment_object = Mollie_WC_Plugin::getApiHelper()->getApiClient( $test_mode )->payments->create( $data );
606
+ }
607
+ catch ( Mollie\Api\Exceptions\ApiException $e ) {
608
+ throw $e;
609
+ }
610
+ }
611
+
612
  $this->saveMollieInfo( $order, $payment_object );
613
 
614
  do_action( Mollie_WC_Plugin::PLUGIN_ID . '_payment_created', $payment_object, $order );
672
  $message = sprintf( __( 'Could not create %s payment.', 'mollie-payments-for-woocommerce' ), $this->title );
673
 
674
  if ( defined( 'WP_DEBUG' ) && WP_DEBUG ) {
675
+ $message .= 'hii ' . $e->getMessage();
676
  }
677
 
678
  Mollie_WC_Plugin::addNotice( $message, 'error' );
1686
 
1687
  $lang_url = $this->getSiteUrlWithLanguage();
1688
 
1689
+ // Make sure there aren't any double /? in the URL (some (multilanguage) plugins will add this)
1690
+ if ( strpos( $lang_url, '/?' ) !== false ) {
1691
+ $lang_url_params = substr( $lang_url, strpos( $lang_url, "/?" ) + 2 );
1692
+ $return_url = $return_url . '&' . $lang_url_params;
1693
+ } else {
1694
+ $return_url = str_replace( $site_url, $lang_url, $return_url );
1695
+ }
1696
 
1697
  if ( version_compare( WC_VERSION, '3.0', '<' ) ) {
1698
  Mollie_WC_Plugin::debug( $this->id . ': Order ' . $order->id . ' returnUrl: ' . $return_url, true );
1729
 
1730
  $lang_url = $this->getSiteUrlWithLanguage();
1731
 
1732
+ // Make sure there aren't any double /? in the URL (some (multilanguage) plugins will add this)
1733
+ if ( strpos( $lang_url, '/?' ) !== false ) {
1734
+ $lang_url_params = substr( $lang_url, strpos( $lang_url, "/?" ) + 2 );
1735
+ $webhook_url = $webhook_url . '&' . $lang_url_params;
1736
+ } else {
1737
+ $webhook_url = str_replace( $site_url, $lang_url, $webhook_url );
1738
  }
1739
 
 
 
1740
  // Some (multilanguage) plugins will add a extra slash to the url (/nl//) causing the URL to redirect and lose it's data.
1741
  // Status updates via webhook will therefor not be processed. The below regex will find and remove those double slashes.
1742
  $webhook_url = preg_replace('/([^:])(\/{2,})/', '$1/', $webhook_url);
includes/mollie/wc/gateway/bitcoin.php DELETED
@@ -1,37 +0,0 @@
1
- <?php
2
-
3
- use Mollie\Api\Types\PaymentMethod;
4
-
5
- class Mollie_WC_Gateway_Bitcoin extends Mollie_WC_Gateway_Abstract
6
- {
7
- /**
8
- * @return string
9
- */
10
- public function getMollieMethodId ()
11
- {
12
- return PaymentMethod::BITCOIN;
13
- }
14
-
15
- /**
16
- * @return string
17
- */
18
- public function getDefaultTitle ()
19
- {
20
- return __('Bitcoin', 'mollie-payments-for-woocommerce');
21
- }
22
-
23
- /**
24
- * @return string
25
- */
26
- protected function getSettingsDescription() {
27
- return '';
28
- }
29
-
30
- /**
31
- * @return string
32
- */
33
- protected function getDefaultDescription ()
34
- {
35
- return '';
36
- }
37
- }
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
includes/mollie/wc/gateway/giftcard.php CHANGED
@@ -96,8 +96,8 @@ class Mollie_WC_Gateway_Giftcard extends Mollie_WC_Gateway_Abstract
96
  $html = '';
97
 
98
  // If only one gift card issuers is available, show it without a dropdown
99
- if ( count( $issuers->issuers ) === 1 ) {
100
- $html .= '<img src="' . $this->getIssuerIconUrl( $issuers->issuers[0]->id ) . '" style="vertical-align:middle" />';
101
  $html .= $issuers->description;
102
  echo wpautop( wptexturize( $html ) );
103
 
@@ -107,7 +107,7 @@ class Mollie_WC_Gateway_Giftcard extends Mollie_WC_Gateway_Abstract
107
  // If multiple gift card issuers are available, show them in a dropdown
108
  $html .= '<select name="' . Mollie_WC_Plugin::PLUGIN_ID . '_issuer_' . $this->id . '">';
109
  $html .= '<option value="">' . esc_html( __( $this->get_option( 'issuers_empty_option', '' ), 'mollie-payments-for-woocommerce' ) ) . '</option>';
110
- foreach ( $issuers->issuers as $issuer ) {
111
  $html .= '<option value="' . esc_attr( $issuer->id ) . '"' . ( $selected_issuer == $issuer->id ? ' selected=""' : '' ) . '>' . esc_html( $issuer->name ) . '</option>';
112
  }
113
  $html .= '</select>';
96
  $html = '';
97
 
98
  // If only one gift card issuers is available, show it without a dropdown
99
+ if ( count( $issuers ) === 1 ) {
100
+ $html .= '<img src="' . $this->getIssuerIconUrl( $issuers[0]->id ) . '" style="vertical-align:middle" />';
101
  $html .= $issuers->description;
102
  echo wpautop( wptexturize( $html ) );
103
 
107
  // If multiple gift card issuers are available, show them in a dropdown
108
  $html .= '<select name="' . Mollie_WC_Plugin::PLUGIN_ID . '_issuer_' . $this->id . '">';
109
  $html .= '<option value="">' . esc_html( __( $this->get_option( 'issuers_empty_option', '' ), 'mollie-payments-for-woocommerce' ) ) . '</option>';
110
+ foreach ( $issuers as $issuer ) {
111
  $html .= '<option value="' . esc_attr( $issuer->id ) . '"' . ( $selected_issuer == $issuer->id ? ' selected=""' : '' ) . '>' . esc_html( $issuer->name ) . '</option>';
112
  }
113
  $html .= '</select>';
includes/mollie/wc/gateway/ideal.php CHANGED
@@ -96,7 +96,7 @@ class Mollie_WC_Gateway_Ideal extends Mollie_WC_Gateway_AbstractSepaRecurring
96
 
97
  $html = '<select name="' . Mollie_WC_Plugin::PLUGIN_ID . '_issuer_' . $this->id . '">';
98
  $html .= '<option value="">' . esc_html(__($this->get_option('issuers_empty_option', $this->getDefaultDescription()), 'mollie-payments-for-woocommerce')) . '</option>';
99
- foreach ($issuers->issuers as $issuer)
100
  {
101
  $html .= '<option value="' . esc_attr($issuer->id) . '"' . ($selected_issuer == $issuer->id ? ' selected=""' : '') . '>' . esc_html($issuer->name) . '</option>';
102
  }
96
 
97
  $html = '<select name="' . Mollie_WC_Plugin::PLUGIN_ID . '_issuer_' . $this->id . '">';
98
  $html .= '<option value="">' . esc_html(__($this->get_option('issuers_empty_option', $this->getDefaultDescription()), 'mollie-payments-for-woocommerce')) . '</option>';
99
+ foreach ($issuers as $issuer)
100
  {
101
  $html .= '<option value="' . esc_attr($issuer->id) . '"' . ($selected_issuer == $issuer->id ? ' selected=""' : '') . '>' . esc_html($issuer->name) . '</option>';
102
  }
includes/mollie/wc/gateway/kbc.php CHANGED
@@ -96,7 +96,7 @@ class Mollie_WC_Gateway_Kbc extends Mollie_WC_Gateway_AbstractSepaRecurring
96
 
97
  $html = '<select name="' . Mollie_WC_Plugin::PLUGIN_ID . '_issuer_' . $this->id . '">';
98
  $html .= '<option value="">' . esc_html(__($this->get_option('issuers_empty_option', $this->getDefaultDescription()), 'mollie-payments-for-woocommerce')) . '</option>';
99
- foreach ($issuers->issuers as $issuer)
100
  {
101
  $html .= '<option value="' . esc_attr($issuer->id) . '"' . ($selected_issuer == $issuer->id ? ' selected=""' : '') . '>' . esc_html($issuer->name) . '</option>';
102
  }
96
 
97
  $html = '<select name="' . Mollie_WC_Plugin::PLUGIN_ID . '_issuer_' . $this->id . '">';
98
  $html .= '<option value="">' . esc_html(__($this->get_option('issuers_empty_option', $this->getDefaultDescription()), 'mollie-payments-for-woocommerce')) . '</option>';
99
+ foreach ($issuers as $issuer)
100
  {
101
  $html .= '<option value="' . esc_attr($issuer->id) . '"' . ($selected_issuer == $issuer->id ? ' selected=""' : '') . '>' . esc_html($issuer->name) . '</option>';
102
  }
includes/mollie/wc/helper/data.php CHANGED
@@ -396,14 +396,18 @@ class Mollie_WC_Helper_Data
396
 
397
  try {
398
 
399
- $transient_id = Mollie_WC_Plugin::getDataHelper()->getTransientId( 'issuers_' . ( $test_mode ? 'test' : 'live' ) );
400
 
401
- $cached_issuers = unserialize( get_transient( $transient_id ) );
 
402
 
403
- if ( $cached_issuers && $cached_issuers instanceof \Mollie\Api\Resources\MethodCollection ) {
404
- return $cached_issuers;
405
- } else {
406
- $issuers = $this->api_helper->getApiClient( $test_mode )->methods->get( "$method", array ( "include" => "issuers" ) );
 
 
 
407
 
408
  // Set new transients (as cache)
409
  try {
396
 
397
  try {
398
 
399
+ $transient_id = Mollie_WC_Plugin::getDataHelper()->getTransientId( $method . '_issuers_' . ( $test_mode ? 'test' : 'live' ) );
400
 
401
+ // When no cache exists $cached_issuers will be `false`
402
+ $issuers = unserialize( get_transient( $transient_id ) );
403
 
404
+ if ( $issuers === false ) {
405
+
406
+ // Remove existing expired transients
407
+ delete_transient( $transient_id );
408
+
409
+ $method = $this->api_helper->getApiClient( $test_mode )->methods->get( "$method", array ( "include" => "issuers" ) );
410
+ $issuers = $method->issuers;
411
 
412
  // Set new transients (as cache)
413
  try {
includes/mollie/wc/helper/orderlines.php CHANGED
@@ -333,8 +333,10 @@ class Mollie_WC_Helper_OrderLines {
333
  private function get_item_reference( $product ) {
334
  if ( $product && $product->get_sku() ) {
335
  $item_reference = $product->get_sku();
336
- } else {
337
  $item_reference = $product->get_id();
 
 
338
  }
339
 
340
  return substr( strval( $item_reference ), 0, 64 );
@@ -476,4 +478,4 @@ class Mollie_WC_Helper_OrderLines {
476
  return $shipping_tax_amount;
477
  }
478
 
479
- }
333
  private function get_item_reference( $product ) {
334
  if ( $product && $product->get_sku() ) {
335
  $item_reference = $product->get_sku();
336
+ } elseif ( $product ) {
337
  $item_reference = $product->get_id();
338
+ } else {
339
+ $item_reference = '';
340
  }
341
 
342
  return substr( strval( $item_reference ), 0, 64 );
478
  return $shipping_tax_amount;
479
  }
480
 
481
+ }
includes/mollie/wc/plugin.php CHANGED
@@ -7,7 +7,7 @@ class Mollie_WC_Plugin
7
  {
8
  const PLUGIN_ID = 'mollie-payments-for-woocommerce';
9
  const PLUGIN_TITLE = 'Mollie Payments for WooCommerce';
10
- const PLUGIN_VERSION = '5.1.6';
11
 
12
  const DB_VERSION = '1.0';
13
  const DB_VERSION_PARAM_NAME = 'mollie-db-version';
@@ -24,7 +24,6 @@ class Mollie_WC_Plugin
24
  public static $GATEWAYS = array(
25
  'Mollie_WC_Gateway_BankTransfer',
26
  'Mollie_WC_Gateway_Belfius',
27
- 'Mollie_WC_Gateway_Bitcoin',
28
  'Mollie_WC_Gateway_Creditcard',
29
  'Mollie_WC_Gateway_DirectDebit',
30
  'Mollie_WC_Gateway_EPS',
7
  {
8
  const PLUGIN_ID = 'mollie-payments-for-woocommerce';
9
  const PLUGIN_TITLE = 'Mollie Payments for WooCommerce';
10
+ const PLUGIN_VERSION = '5.1.7';
11
 
12
  const DB_VERSION = '1.0';
13
  const DB_VERSION_PARAM_NAME = 'mollie-db-version';
24
  public static $GATEWAYS = array(
25
  'Mollie_WC_Gateway_BankTransfer',
26
  'Mollie_WC_Gateway_Belfius',
 
27
  'Mollie_WC_Gateway_Creditcard',
28
  'Mollie_WC_Gateway_DirectDebit',
29
  'Mollie_WC_Gateway_EPS',
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.1.6
7
  * Author: Mollie
8
  * Author URI: https://www.mollie.com
9
  * Requires at least: 3.8
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.1.7
7
  * Author: Mollie
8
  * Author URI: https://www.mollie.com
9
  * Requires at least: 3.8
readme.txt CHANGED
@@ -2,13 +2,13 @@
2
  Contributors: daanvm, davdebcom, l.vangunst, ndijkstra, robin-mollie
3
  Tags: mollie, payments, payment gateway, woocommerce, credit card
4
  Requires at least: 3.8
5
- Tested up to: 5.1
6
- Stable tag: 5.1.6
7
  Requires PHP: 5.6
8
  License: GPLv2 or later
9
  License URI: http://www.gnu.org/licenses/gpl-2.0.html
10
 
11
- Accept all major payment methods in WooCommerce today. Credit cards, iDEAL, bitcoin and more! Fast, safe and intuitive.
12
 
13
  == Description ==
14
 
@@ -50,7 +50,6 @@ European and local payment methods:
50
  International payment methods:
51
 
52
  * PayPal (International)
53
- * Bitcoin (International)
54
  * Paysafecard (International)
55
 
56
  Pay after delivery payment methods:
@@ -181,6 +180,13 @@ Automatic updates should work like a charm; as always though, ensure you backup
181
 
182
  == Changelog ==
183
 
 
 
 
 
 
 
 
184
  = 5.1.6 - 10-04-2019 =
185
 
186
  * New - Add support for Przelewy24 (Poland)
@@ -541,7 +547,7 @@ WooCommerce -> Settings -> Payments -> Mollie - Bank Transfer.
541
 
542
  = 2.0.1 - 02/10/2015 =
543
  * Add support for SEPA Direct Debit.
544
- * Add message for Belfius, Bitcoin, Bancontact and paysafecard when the payment is paid successfully.
545
 
546
  = 2.0.0 - 17/08/2015 =
547
  * Complete rewrite of our WooCommerce plugin to better follow WordPress and WooCommerce standards and add better support for other plugins.
2
  Contributors: daanvm, davdebcom, l.vangunst, ndijkstra, robin-mollie
3
  Tags: mollie, payments, payment gateway, woocommerce, credit card
4
  Requires at least: 3.8
5
+ Tested up to: 5.2
6
+ Stable tag: 5.1.7
7
  Requires PHP: 5.6
8
  License: GPLv2 or later
9
  License URI: http://www.gnu.org/licenses/gpl-2.0.html
10
 
11
+ Accept all major payment methods in WooCommerce today. Credit cards, iDEAL and more! Fast, safe and intuitive.
12
 
13
  == Description ==
14
 
50
  International payment methods:
51
 
52
  * PayPal (International)
 
53
  * Paysafecard (International)
54
 
55
  Pay after delivery payment methods:
180
 
181
  == Changelog ==
182
 
183
+ = 5.1.7 - 28-04-2019 =
184
+
185
+ * Fix - Remove Bitcoin as payment gateway, no longer supported by Mollie, contact info@mollie.com for details
186
+ * Fix - Add extra check for URL's with parameters and correct them is structure is incorrect
187
+ * Fix - getMethodIssuers: improve caching of issuers (iDEAL, KBC/CBC)
188
+ * Fix - During payment always check if a product exists, if it doesn't create a Mollie Payment instead of Mollie Order
189
+
190
  = 5.1.6 - 10-04-2019 =
191
 
192
  * New - Add support for Przelewy24 (Poland)
547
 
548
  = 2.0.1 - 02/10/2015 =
549
  * Add support for SEPA Direct Debit.
550
+ * Add message for Belfius, Bancontact and paysafecard when the payment is paid successfully.
551
 
552
  = 2.0.0 - 17/08/2015 =
553
  * Complete rewrite of our WooCommerce plugin to better follow WordPress and WooCommerce standards and add better support for other plugins.