Mollie Payments for WooCommerce - Version 5.0.6

Version Description

  • 23-11-2018 =

  • Fix - Set subscription to On-Hold if renewal order gets a charge-back, add action hooks after refunds and chargebacks

  • Fix - Update translation function call

Download this release

Release Info

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

Code changes from version 5.0.5 to 5.0.6

includes/mollie/wc/gateway/abstract.php CHANGED
@@ -959,6 +959,8 @@ abstract class Mollie_WC_Gateway_Abstract extends WC_Payment_Gateway
959
 
960
  $order->save();
961
 
 
 
962
  return;
963
 
964
  }
@@ -1037,7 +1039,7 @@ abstract class Mollie_WC_Gateway_Abstract extends WC_Payment_Gateway
1037
  $data_helper = Mollie_WC_Plugin::getDataHelper();
1038
  $order = $data_helper->getWcOrder( $order_id );
1039
 
1040
- // Update order notes, add message ahout chargeback
1041
  foreach ( $chargebacks_to_process as $chargeback_to_process ) {
1042
 
1043
  Mollie_WC_Plugin::debug( __METHOD__ . ' New chargeback ' . $chargeback_to_process . ' for ' . $log_id . '. Order note and order status updated.' );
@@ -1050,7 +1052,9 @@ abstract class Mollie_WC_Gateway_Abstract extends WC_Payment_Gateway
1050
  $processed_chargeback_ids[] = $chargeback_to_process;
1051
  }
1052
 
 
1053
  // Update order status and add general note
 
1054
 
1055
  // New order status
1056
  $new_order_status = self::STATUS_ON_HOLD;
@@ -1069,7 +1073,7 @@ abstract class Mollie_WC_Gateway_Abstract extends WC_Payment_Gateway
1069
  $new_order_status,
1070
  sprintf(
1071
  /* translators: Placeholder 1: payment method title, placeholder 2: payment ID */
1072
- __( '%s payment charged back via Mollie (%s). You will need to manually review the payment and adjust product stocks if you use them.', 'mollie-payments-for-woocommerce' ),
1073
  $payment_method_title,
1074
  $payment->id . ( $payment->mode == 'test' ? ( ' - ' . __( 'test mode', 'mollie-payments-for-woocommerce' ) ) : '' )
1075
  ),
@@ -1088,6 +1092,40 @@ abstract class Mollie_WC_Gateway_Abstract extends WC_Payment_Gateway
1088
 
1089
  $order->save();
1090
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1091
  return;
1092
 
1093
  }
@@ -1213,13 +1251,6 @@ abstract class Mollie_WC_Gateway_Abstract extends WC_Payment_Gateway
1213
  return false;
1214
  }
1215
 
1216
- // Payment method for order isn't the same as payment object method
1217
- if ( $payment->method != $this->getMollieMethodId() ) {
1218
- Mollie_WC_Plugin::debug( __METHOD__ . ' - Invalid refund gateway for order ' . $order_id );
1219
-
1220
- return false;
1221
- }
1222
-
1223
  // TODO David: Continue improving the refund process
1224
  $payment_object = Mollie_WC_Plugin::getPaymentFactoryHelper()->getPaymentObject( $payment );
1225
 
959
 
960
  $order->save();
961
 
962
+ do_action( Mollie_WC_Plugin::PLUGIN_ID . '_refunds_processed', $payment, $order );
963
+
964
  return;
965
 
966
  }
1039
  $data_helper = Mollie_WC_Plugin::getDataHelper();
1040
  $order = $data_helper->getWcOrder( $order_id );
1041
 
1042
+ // Update order notes, add message about chargeback
1043
  foreach ( $chargebacks_to_process as $chargeback_to_process ) {
1044
 
1045
  Mollie_WC_Plugin::debug( __METHOD__ . ' New chargeback ' . $chargeback_to_process . ' for ' . $log_id . '. Order note and order status updated.' );
1052
  $processed_chargeback_ids[] = $chargeback_to_process;
1053
  }
1054
 
1055
+ //
1056
  // Update order status and add general note
1057
+ //
1058
 
1059
  // New order status
1060
  $new_order_status = self::STATUS_ON_HOLD;
1073
  $new_order_status,
1074
  sprintf(
1075
  /* translators: Placeholder 1: payment method title, placeholder 2: payment ID */
1076
+ __( '%s payment charged back via Mollie (%s). You will need to manually review the payment (and adjust product stocks if you use it).', 'mollie-payments-for-woocommerce' ),
1077
  $payment_method_title,
1078
  $payment->id . ( $payment->mode == 'test' ? ( ' - ' . __( 'test mode', 'mollie-payments-for-woocommerce' ) ) : '' )
1079
  ),
1092
 
1093
  $order->save();
1094
 
1095
+ //
1096
+ // Check if this is a renewal order, and if so set subscription to "On-Hold"
1097
+ //
1098
+
1099
+ // Do extra checks if WooCommerce Subscriptions is installed
1100
+ if ( class_exists( 'WC_Subscriptions' ) && class_exists( 'WC_Subscriptions_Admin' ) ) {
1101
+ // Also store it on the subscriptions being purchased or paid for in the order
1102
+ if ( wcs_order_contains_subscription( $order_id ) ) {
1103
+ $subscriptions = wcs_get_subscriptions_for_order( $order_id );
1104
+ } elseif ( wcs_order_contains_renewal( $order_id ) ) {
1105
+ $subscriptions = wcs_get_subscriptions_for_renewal_order( $order_id );
1106
+ } else {
1107
+ $subscriptions = array ();
1108
+ }
1109
+
1110
+ foreach ( $subscriptions as $subscription ) {
1111
+
1112
+ $this->updateOrderStatus(
1113
+ $subscription,
1114
+ $new_order_status,
1115
+ sprintf(
1116
+ /* translators: Placeholder 1: payment method title, placeholder 2: payment ID */
1117
+ __( '%s payment charged back via Mollie (%s). Subscription status updated, please review (and adjust product stocks if you use it).', 'mollie-payments-for-woocommerce' ),
1118
+ $payment_method_title,
1119
+ $payment->id . ( $payment->mode == 'test' ? ( ' - ' . __( 'test mode', 'mollie-payments-for-woocommerce' ) ) : '' )
1120
+ ),
1121
+ $restore_stock = false
1122
+ );
1123
+
1124
+ }
1125
+ }
1126
+
1127
+ do_action( Mollie_WC_Plugin::PLUGIN_ID . '_chargebacks_processed', $payment, $order );
1128
+
1129
  return;
1130
 
1131
  }
1251
  return false;
1252
  }
1253
 
 
 
 
 
 
 
 
1254
  // TODO David: Continue improving the refund process
1255
  $payment_object = Mollie_WC_Plugin::getPaymentFactoryHelper()->getPaymentObject( $payment );
1256
 
includes/mollie/wc/gateway/abstractsubscription.php CHANGED
@@ -64,7 +64,7 @@ abstract class Mollie_WC_Gateway_AbstractSubscription extends Mollie_WC_Gateway_
64
 
65
  // TODO David: is this still used?
66
  $settings_helper = Mollie_WC_Plugin::getSettingsHelper();
67
- $payment_description = _( 'Order', 'woocommerce' ) . ' ' . $order->get_order_number();
68
  $payment_locale = $settings_helper->getPaymentLocale();
69
  $mollie_method = $this->getMollieMethodId();
70
  $selected_issuer = $this->getSelectedIssuer();
64
 
65
  // TODO David: is this still used?
66
  $settings_helper = Mollie_WC_Plugin::getSettingsHelper();
67
+ $payment_description = __( 'Order', 'woocommerce' ) . ' ' . $order->get_order_number();
68
  $payment_locale = $settings_helper->getPaymentLocale();
69
  $mollie_method = $this->getMollieMethodId();
70
  $selected_issuer = $this->getSelectedIssuer();
includes/mollie/wc/payment/payment.php CHANGED
@@ -32,7 +32,7 @@ class Mollie_WC_Payment_Payment extends Mollie_WC_Payment_Object {
32
  */
33
  public function getPaymentRequestData( $order, $customer_id ) {
34
  $settings_helper = Mollie_WC_Plugin::getSettingsHelper();
35
- $payment_description = _( 'Order', 'woocommerce' ) . ' ' . $order->get_order_number();
36
  $payment_locale = $settings_helper->getPaymentLocale();
37
  $store_customer = $settings_helper->shouldStoreCustomer();
38
 
32
  */
33
  public function getPaymentRequestData( $order, $customer_id ) {
34
  $settings_helper = Mollie_WC_Plugin::getSettingsHelper();
35
+ $payment_description = __( 'Order', 'woocommerce' ) . ' ' . $order->get_order_number();
36
  $payment_locale = $settings_helper->getPaymentLocale();
37
  $store_customer = $settings_helper->shouldStoreCustomer();
38
 
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.0.5';
11
 
12
  const DB_VERSION = '1.0';
13
  const DB_VERSION_PARAM_NAME = 'mollie-db-version';
7
  {
8
  const PLUGIN_ID = 'mollie-payments-for-woocommerce';
9
  const PLUGIN_TITLE = 'Mollie Payments for WooCommerce';
10
+ const PLUGIN_VERSION = '5.0.6';
11
 
12
  const DB_VERSION = '1.0';
13
  const DB_VERSION_PARAM_NAME = 'mollie-db-version';
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.0.5
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.0.6
7
  * Author: Mollie
8
  * Author URI: https://www.mollie.com
9
  * Requires at least: 3.8
readme.txt CHANGED
@@ -3,7 +3,7 @@ Contributors: daanvm, davdebcom, l.vangunst, ndijkstra, robin-mollie
3
  Tags: mollie, payments, woocommerce, payment gateway, e-commerce, credit card, ideal, sofort, bancontact, bitcoin, direct debit, subscriptions
4
  Requires at least: 3.8
5
  Tested up to: 4.9
6
- Stable tag: 5.0.5
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.0.5 - 22-11-2018 =
185
 
186
  * Fix - WooCommerce Subscriptions: improve support for options "Accept Manual Renewals" and "Turn off Automatic Payments"
3
  Tags: mollie, payments, woocommerce, payment gateway, e-commerce, credit card, ideal, sofort, bancontact, bitcoin, direct debit, subscriptions
4
  Requires at least: 3.8
5
  Tested up to: 4.9
6
+ Stable tag: 5.0.6
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.0.6 - 23-11-2018 =
185
+
186
+ * Fix - Set subscription to On-Hold if renewal order gets a charge-back, add action hooks after refunds and chargebacks
187
+ * Fix - Update translation function call
188
+
189
  = 5.0.5 - 22-11-2018 =
190
 
191
  * Fix - WooCommerce Subscriptions: improve support for options "Accept Manual Renewals" and "Turn off Automatic Payments"