Mollie Payments for WooCommerce - Version 5.0.2

Version Description

  • 11-10-2018 =

IMPORTANT This version requires PHP 5.6 or higher. If you are using an older PHP version, please read this article: PHP & Mollie API v2.

  • New - Now supports Klarna Pay later and Klara Slice it, read more
  • New - Implemented support for the new Orders API
  • New - Tested with and updated for WooCommerce 3.5 beta compatibility
  • New - EPS, GiroPay: implemented support for SEPA first payments (recurring payments)

  • Fix - Fixed for "Uncaught Error: Call to a member function isOpen() on null"

  • Fix - Fixed issue with Guzzle and PhpScoper

  • Fix - WooCommerce emails: make sure "Payment completed by..." message is only shown once per email

  • Fix - WooCommerce Subscriptions: add support for "Accept Manual Renewals". This enables Bank Transfer and PayPal in checkout for subscription products.

  • Fix - Mollie payment gateways weren't always shows when cart was empty.

  • Fix - Fix for "Link expired" message after refresh methods in WooCommerce settings

  • Fix - Stricter check for valid API key when individual gateways are loaded

  • Fix - Added new action hook in Mollie_WC_Gateway_Abstract::getReturnRedirectUrlForOrder()

  • Fix - Improve log messages for orderNeedsPayment check, old messages where confusing to merchants

  • Fix - Update VVV giftcard logo filename

Download this release

Release Info

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

Code changes from version 5.0.1 to 5.0.2

includes/mollie/wc/gateway/abstract.php CHANGED
@@ -1179,79 +1179,42 @@ abstract class Mollie_WC_Gateway_Abstract extends WC_Payment_Gateway
1179
  return $this->get_return_url( $order );
1180
  }
1181
 
1182
- /**
1183
- * Process a refund if supported
1184
- * @param int $order_id
1185
- * @param float $amount
1186
- * @param string $reason
1187
- * @return bool|wp_error True or false based on success, or a WP_Error object
1188
- * @since WooCommerce 2.2
1189
- */
1190
- public function process_refund($order_id, $amount = null, $reason = '')
1191
- {
1192
- $order = Mollie_WC_Plugin::getDataHelper()->getWcOrder($order_id);
1193
-
1194
- if (!$order)
1195
- {
1196
- Mollie_WC_Plugin::debug('process_refund - could not find order ' . $order_id);
1197
-
1198
- return false;
1199
- }
1200
-
1201
- try
1202
- {
1203
- $payment_object = Mollie_WC_Plugin::getPaymentObject()->getActiveMolliePayment($order_id);
1204
-
1205
- if (!$payment_object)
1206
- {
1207
- Mollie_WC_Plugin::debug('process_refund - could not find active Mollie payment for order ' . $order_id);
1208
-
1209
- return false;
1210
- }
1211
- elseif (!$payment_object->isPaid())
1212
- {
1213
- Mollie_WC_Plugin::debug('process_refund - could not refund payment ' . $payment_object->id . ' (not paid). Order ' . $order_id);
1214
-
1215
- return false;
1216
- }
1217
-
1218
- Mollie_WC_Plugin::debug('process_refund - create refund - payment: ' . $payment_object->id . ', order: ' . $order_id . ', amount: ' . Mollie_WC_Plugin::getDataHelper()->getOrderCurrency( $order ) . $amount . (!empty($reason) ? ', reason: ' . $reason : ''));
1219
 
1220
- do_action(Mollie_WC_Plugin::PLUGIN_ID . '_create_refund', $payment_object, $order);
 
1221
 
1222
- // Is test mode enabled?
1223
- $test_mode = Mollie_WC_Plugin::getSettingsHelper()->isTestModeEnabled();
1224
 
1225
- // Send refund to Mollie
1226
- $refund = Mollie_WC_Plugin::getApiHelper()->getApiClient( $test_mode )->payments->refund( $payment_object, array (
1227
- 'amount' => array (
1228
- 'currency' => Mollie_WC_Plugin::getDataHelper()->getOrderCurrency( $order ),
1229
- 'value' => Mollie_WC_Plugin::getDataHelper()->formatCurrencyValue( $amount, Mollie_WC_Plugin::getDataHelper()->getOrderCurrency( $order ) )
1230
- ),
1231
- 'description' => $reason
1232
- ) );
1233
 
1234
- Mollie_WC_Plugin::debug('process_refund - refund created - refund: ' . $refund->id . ', payment: ' . $payment_object->id . ', order: ' . $order_id . ', amount: ' . Mollie_WC_Plugin::getDataHelper()->getOrderCurrency( $order ) . $amount . (!empty($reason) ? ', reason: ' . $reason : ''));
 
 
 
1235
 
1236
- do_action(Mollie_WC_Plugin::PLUGIN_ID . '_refund_created', $refund, $order);
 
1237
 
1238
- $order->add_order_note(sprintf(
1239
- /* translators: Placeholder 1: currency, placeholder 2: refunded amount, placeholder 3: optional refund reason, placeholder 4: payment ID, placeholder 5: refund ID */
1240
- __('Refunded %s%s%s - Payment: %s, Refund: %s', 'mollie-payments-for-woocommerce'),
1241
- Mollie_WC_Plugin::getDataHelper()->getOrderCurrency( $order ),
1242
- $amount,
1243
- (!empty($reason) ? ' (reason: ' . $reason . ')' : ''),
1244
- $refund->paymentId,
1245
- $refund->id
1246
- ));
1247
 
1248
- return true;
1249
- }
1250
- catch ( \Mollie\Api\Exceptions\ApiException $e )
1251
- {
1252
- return new WP_Error(1, $e->getMessage());
1253
- }
1254
- }
1255
 
1256
  /**
1257
  * Output for the order received page.
1179
  return $this->get_return_url( $order );
1180
  }
1181
 
1182
+ /**
1183
+ * Process a refund if supported
1184
+ *
1185
+ * @param int $order_id
1186
+ * @param float $amount
1187
+ * @param string $reason
1188
+ *
1189
+ * @return bool|wp_error True or false based on success, or a WP_Error object
1190
+ * @since WooCommerce 2.2
1191
+ */
1192
+ public function process_refund( $order_id, $amount = null, $reason = '' ) {
1193
+ $order = Mollie_WC_Plugin::getDataHelper()->getWcOrder( $order_id );
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1194
 
1195
+ if ( ! $order ) {
1196
+ Mollie_WC_Plugin::debug( __METHOD__ . ' - Could not find order ' . $order_id );
1197
 
1198
+ return false;
1199
+ }
1200
 
1201
+ if ( version_compare( WC_VERSION, '3.0', '<' ) ) {
1202
+ $payment = Mollie_WC_Plugin::getPaymentObject()->getActiveMolliePayment( $order->id );
1203
+ } else {
1204
+ $payment = Mollie_WC_Plugin::getPaymentObject()->getActiveMolliePayment( $order->get_id() );
1205
+ }
 
 
 
1206
 
1207
+ // Mollie payment not found or invalid gateway
1208
+ if ( ! $payment || $payment->method != $this->getMollieMethodId() ) {
1209
+ return false;
1210
+ }
1211
 
1212
+ // TODO David: Continue improving the refund process
1213
+ $payment_object = Mollie_WC_Plugin::getPaymentFactoryHelper()->getPaymentObject( $payment );
1214
 
1215
+ return $payment_object->refund( $order, $order_id, $amount, $reason );
 
 
 
 
 
 
 
 
1216
 
1217
+ }
 
 
 
 
 
 
1218
 
1219
  /**
1220
  * Output for the order received page.
includes/mollie/wc/gateway/giftcard.php CHANGED
@@ -11,7 +11,6 @@ class Mollie_WC_Gateway_Giftcard extends Mollie_WC_Gateway_Abstract
11
  {
12
  $this->supports = array(
13
  'products',
14
- 'refunds',
15
  );
16
 
17
  /* Has issuers dropdown */
11
  {
12
  $this->supports = array(
13
  'products',
 
14
  );
15
 
16
  /* Has issuers dropdown */
includes/mollie/wc/gateway/klarnapaylater.php CHANGED
@@ -11,7 +11,7 @@ class Mollie_WC_Gateway_KlarnaPayLater extends Mollie_WC_Gateway_Abstract
11
  {
12
  $this->supports = array(
13
  'products',
14
- 'refunds',
15
  );
16
 
17
  parent::__construct();
11
  {
12
  $this->supports = array(
13
  'products',
14
+ //'refunds', TODO David: Re-add support for refunds (via Order Refund API)
15
  );
16
 
17
  parent::__construct();
includes/mollie/wc/gateway/klarnasliceit.php CHANGED
@@ -11,7 +11,7 @@ class Mollie_WC_Gateway_KlarnaSliceIt extends Mollie_WC_Gateway_Abstract
11
  {
12
  $this->supports = array(
13
  'products',
14
- 'refunds',
15
  );
16
 
17
  parent::__construct();
11
  {
12
  $this->supports = array(
13
  'products',
14
+ //'refunds', TODO David: Re-add support for refunds (via Order Refund API)
15
  );
16
 
17
  parent::__construct();
includes/mollie/wc/helper/orderlines.php CHANGED
@@ -17,9 +17,8 @@ class Mollie_WC_Helper_OrderLines {
17
  private $order;
18
 
19
  /**
20
- * WooCommerce order.
21
  *
22
- * @var WC_Order
23
  */
24
  private $currency;
25
 
@@ -88,15 +87,15 @@ class Mollie_WC_Helper_OrderLines {
88
  $this->currency = Mollie_WC_Plugin::getDataHelper()->getOrderCurrency( $this->order );
89
 
90
  $mollie_order_item = array (
91
- 'sku' => $this->get_item_reference( $product ),
92
- 'name' => $this->get_item_name( $cart_item ),
93
- 'quantity' => $this->get_item_quantity( $cart_item ),
94
- 'vatRate' => $this->get_item_vatRate( $cart_item, $product ),
95
- 'unitPrice' => array (
96
  'currency' => $this->currency,
97
  'value' => Mollie_WC_Plugin::getDataHelper()->formatCurrencyValue( $this->get_item_price( $cart_item ), $this->currency ),
98
  ),
99
- 'totalAmount' => array (
100
  'currency' => $this->currency,
101
  'value' => Mollie_WC_Plugin::getDataHelper()->formatCurrencyValue( $this->get_item_total_amount( $cart_item ), $this->currency ),
102
  ),
@@ -184,22 +183,18 @@ class Mollie_WC_Helper_OrderLines {
184
  // Add separate discount line item, but only if it's a smart coupon or country is US.
185
  if ( 'smart_coupon' === $coupon->get_discount_type() || 'US' === $this->shop_country ) {
186
  $discount = array (
187
- 'name' => $coupon_key,
188
- 'quantity' => 1,
189
- 'unitPrice' => array (
190
  'currency' => $this->currency,
191
  'value' => Mollie_WC_Plugin::getDataHelper()->formatCurrencyValue( $coupon_amount, $this->currency ),
192
  ),
193
- 'vatRate' => 0,
194
- 'totalAmount' => array (
195
  'currency' => $this->currency,
196
  'value' => Mollie_WC_Plugin::getDataHelper()->formatCurrencyValue( $coupon_amount, $this->currency ),
197
  ),
198
- 'discountAmount' => array (
199
- 'currency' => $this->currency,
200
- 'value' => Mollie_WC_Plugin::getDataHelper()->formatCurrencyValue( 0, $this->currency ),
201
- ),
202
- 'vatAmount' => array (
203
  'currency' => $this->currency,
204
  'value' => Mollie_WC_Plugin::getDataHelper()->formatCurrencyValue( $coupon_tax_amount, $this->currency ),
205
  ),
@@ -242,23 +237,19 @@ class Mollie_WC_Helper_OrderLines {
242
  }
243
 
244
  $fee = array (
245
- 'type' => 'surcharge',
246
- 'name' => $cart_fee->name,
247
- 'quantity' => 1,
248
- 'unitPrice' => array (
 
249
  'currency' => $this->currency,
250
  'value' => Mollie_WC_Plugin::getDataHelper()->formatCurrencyValue( $cart_fee_total, $this->currency ),
251
  ),
252
- 'vatRate' => array (
253
- 'currency' => $this->currency,
254
- 'value' => Mollie_WC_Plugin::getDataHelper()->formatCurrencyValue( $cart_fee_vat_rate, $this->currency ),
255
- ),
256
- 'totalAmount' => array (
257
  'currency' => $this->currency,
258
  'value' => Mollie_WC_Plugin::getDataHelper()->formatCurrencyValue( $cart_fee_total, $this->currency ),
259
  ),
260
- 'discountAmount' => 0,
261
- 'vatAmount' => array (
262
  'currency' => $this->currency,
263
  'value' => Mollie_WC_Plugin::getDataHelper()->formatCurrencyValue( $cart_fee_tax_amount, $this->currency ),
264
  ),
@@ -349,7 +340,7 @@ class Mollie_WC_Helper_OrderLines {
349
  private function get_item_price( $cart_item ) {
350
 
351
  $item_subtotal = $cart_item['line_subtotal'] + $cart_item['line_subtotal_tax'];
352
- $item_price = $item_subtotal / $cart_item['quantity'];
353
 
354
  return $item_price;
355
  }
@@ -405,7 +396,6 @@ class Mollie_WC_Helper_OrderLines {
405
 
406
  $item_discount_amount = $cart_item['line_subtotal'] + $cart_item['line_subtotal_tax'] - $cart_item['line_total'] - $cart_item['line_tax'];
407
 
408
-
409
  } else {
410
  $item_discount_amount = 0;
411
  }
@@ -472,7 +462,7 @@ class Mollie_WC_Helper_OrderLines {
472
 
473
  $shipping_amount = number_format( ( WC()->cart->shipping_total + WC()->cart->shipping_tax_total ), 2, '.', '' );
474
 
475
- return $shipping_amount ;
476
  }
477
 
478
  /**
@@ -486,10 +476,10 @@ class Mollie_WC_Helper_OrderLines {
486
  private function get_shipping_vat_rate() {
487
  $shipping_vat_rate = 0;
488
  if ( WC()->cart->shipping_tax_total > 0 ) {
489
- $shipping_vat_rate = round( WC()->cart->shipping_tax_total / WC()->cart->shipping_total, 2 )*100;
490
  }
491
 
492
- return $shipping_vat_rate ;
493
  }
494
 
495
  /**
17
  private $order;
18
 
19
  /**
20
+ * WooCommerce currency.
21
  *
 
22
  */
23
  private $currency;
24
 
87
  $this->currency = Mollie_WC_Plugin::getDataHelper()->getOrderCurrency( $this->order );
88
 
89
  $mollie_order_item = array (
90
+ 'sku' => $this->get_item_reference( $product ),
91
+ 'name' => $this->get_item_name( $cart_item ),
92
+ 'quantity' => $this->get_item_quantity( $cart_item ),
93
+ 'vatRate' => $this->get_item_vatRate( $cart_item, $product ),
94
+ 'unitPrice' => array (
95
  'currency' => $this->currency,
96
  'value' => Mollie_WC_Plugin::getDataHelper()->formatCurrencyValue( $this->get_item_price( $cart_item ), $this->currency ),
97
  ),
98
+ 'totalAmount' => array (
99
  'currency' => $this->currency,
100
  'value' => Mollie_WC_Plugin::getDataHelper()->formatCurrencyValue( $this->get_item_total_amount( $cart_item ), $this->currency ),
101
  ),
183
  // Add separate discount line item, but only if it's a smart coupon or country is US.
184
  if ( 'smart_coupon' === $coupon->get_discount_type() || 'US' === $this->shop_country ) {
185
  $discount = array (
186
+ 'name' => $coupon_key,
187
+ 'quantity' => 1,
188
+ 'unitPrice' => array (
189
  'currency' => $this->currency,
190
  'value' => Mollie_WC_Plugin::getDataHelper()->formatCurrencyValue( $coupon_amount, $this->currency ),
191
  ),
192
+ 'vatRate' => 0,
193
+ 'totalAmount' => array (
194
  'currency' => $this->currency,
195
  'value' => Mollie_WC_Plugin::getDataHelper()->formatCurrencyValue( $coupon_amount, $this->currency ),
196
  ),
197
+ 'vatAmount' => array (
 
 
 
 
198
  'currency' => $this->currency,
199
  'value' => Mollie_WC_Plugin::getDataHelper()->formatCurrencyValue( $coupon_tax_amount, $this->currency ),
200
  ),
237
  }
238
 
239
  $fee = array (
240
+ 'type' => 'surcharge',
241
+ 'name' => $cart_fee->name,
242
+ 'quantity' => 1,
243
+ 'vatRate' => Mollie_WC_Plugin::getDataHelper()->formatCurrencyValue( $cart_fee_vat_rate, $this->currency ),
244
+ 'unitPrice' => array (
245
  'currency' => $this->currency,
246
  'value' => Mollie_WC_Plugin::getDataHelper()->formatCurrencyValue( $cart_fee_total, $this->currency ),
247
  ),
248
+ 'totalAmount' => array (
 
 
 
 
249
  'currency' => $this->currency,
250
  'value' => Mollie_WC_Plugin::getDataHelper()->formatCurrencyValue( $cart_fee_total, $this->currency ),
251
  ),
252
+ 'vatAmount' => array (
 
253
  'currency' => $this->currency,
254
  'value' => Mollie_WC_Plugin::getDataHelper()->formatCurrencyValue( $cart_fee_tax_amount, $this->currency ),
255
  ),
340
  private function get_item_price( $cart_item ) {
341
 
342
  $item_subtotal = $cart_item['line_subtotal'] + $cart_item['line_subtotal_tax'];
343
+ $item_price = $item_subtotal / $cart_item['quantity'];
344
 
345
  return $item_price;
346
  }
396
 
397
  $item_discount_amount = $cart_item['line_subtotal'] + $cart_item['line_subtotal_tax'] - $cart_item['line_total'] - $cart_item['line_tax'];
398
 
 
399
  } else {
400
  $item_discount_amount = 0;
401
  }
462
 
463
  $shipping_amount = number_format( ( WC()->cart->shipping_total + WC()->cart->shipping_tax_total ), 2, '.', '' );
464
 
465
+ return $shipping_amount;
466
  }
467
 
468
  /**
476
  private function get_shipping_vat_rate() {
477
  $shipping_vat_rate = 0;
478
  if ( WC()->cart->shipping_tax_total > 0 ) {
479
+ $shipping_vat_rate = round( WC()->cart->shipping_tax_total / WC()->cart->shipping_total, 2 ) * 100;
480
  }
481
 
482
+ return $shipping_vat_rate;
483
  }
484
 
485
  /**
includes/mollie/wc/payment/object.php CHANGED
@@ -45,6 +45,10 @@ class Mollie_WC_Payment_Object {
45
  public function getPaymentObjectPayment( $payment_id, $test_mode = false, $use_cache = true ) {
46
  try {
47
 
 
 
 
 
48
  $payment = Mollie_WC_Plugin::getApiHelper()->getApiClient( $test_mode )->payments->get( $payment_id );
49
 
50
  return $payment;
45
  public function getPaymentObjectPayment( $payment_id, $test_mode = false, $use_cache = true ) {
46
  try {
47
 
48
+ // Is test mode enabled?
49
+ $settings_helper = Mollie_WC_Plugin::getSettingsHelper();
50
+ $test_mode = $settings_helper->isTestModeEnabled();
51
+
52
  $payment = Mollie_WC_Plugin::getApiHelper()->getApiClient( $test_mode )->payments->get( $payment_id );
53
 
54
  return $payment;
includes/mollie/wc/payment/order.php CHANGED
@@ -14,6 +14,11 @@ class Mollie_WC_Payment_Order extends Mollie_WC_Payment_Object {
14
 
15
  public function getPaymentObject( $payment_id, $test_mode = false, $use_cache = true ) {
16
  try {
 
 
 
 
 
17
  self::$payment = Mollie_WC_Plugin::getApiHelper()->getApiClient( $test_mode )->orders->get( $payment_id, [ "embed" => "payments" ] );
18
 
19
  return parent::getPaymentObject( $payment_id, $test_mode = false, $use_cache = true );
@@ -150,9 +155,12 @@ class Mollie_WC_Payment_Order extends Mollie_WC_Payment_Object {
150
 
151
  public function getMolliePaymentIdFromPaymentObject() {
152
 
153
- if ( isset( $this->data->_embedded->payments{0}->id ) ) {
 
 
 
154
 
155
- return $this->data->_embedded->payments{0}->id;
156
 
157
  }
158
 
14
 
15
  public function getPaymentObject( $payment_id, $test_mode = false, $use_cache = true ) {
16
  try {
17
+
18
+ // Is test mode enabled?
19
+ $settings_helper = Mollie_WC_Plugin::getSettingsHelper();
20
+ $test_mode = $settings_helper->isTestModeEnabled();
21
+
22
  self::$payment = Mollie_WC_Plugin::getApiHelper()->getApiClient( $test_mode )->orders->get( $payment_id, [ "embed" => "payments" ] );
23
 
24
  return parent::getPaymentObject( $payment_id, $test_mode = false, $use_cache = true );
155
 
156
  public function getMolliePaymentIdFromPaymentObject() {
157
 
158
+ // TODO David: Quick fix, there needs to be a better way to do this!
159
+ $payment = $this->getPaymentObject($this->data->id);
160
+
161
+ if ( isset( $payment->_embedded->payments{0}->id ) ) {
162
 
163
+ return $payment->_embedded->payments{0}->id;
164
 
165
  }
166
 
includes/mollie/wc/payment/payment.php CHANGED
@@ -9,6 +9,10 @@ class Mollie_WC_Payment_Payment extends Mollie_WC_Payment_Object {
9
  public function getPaymentObject( $payment_id, $test_mode = false, $use_cache = true ) {
10
  try {
11
 
 
 
 
 
12
  self::$payment = Mollie_WC_Plugin::getApiHelper()->getApiClient( $test_mode )->payments->get( $payment_id );
13
 
14
  return parent::getPaymentObject( $payment_id, $test_mode = false, $use_cache = true );
@@ -413,4 +417,65 @@ class Mollie_WC_Payment_Payment extends Mollie_WC_Payment_Object {
413
 
414
  }
415
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
416
  }
9
  public function getPaymentObject( $payment_id, $test_mode = false, $use_cache = true ) {
10
  try {
11
 
12
+ // Is test mode enabled?
13
+ $settings_helper = Mollie_WC_Plugin::getSettingsHelper();
14
+ $test_mode = $settings_helper->isTestModeEnabled();
15
+
16
  self::$payment = Mollie_WC_Plugin::getApiHelper()->getApiClient( $test_mode )->payments->get( $payment_id );
17
 
18
  return parent::getPaymentObject( $payment_id, $test_mode = false, $use_cache = true );
417
 
418
  }
419
 
420
+ /**
421
+ * Process a refund if supported
422
+ * @param int $order_id
423
+ * @param float $amount
424
+ * @param string $reason
425
+ * @return bool|wp_error True or false based on success, or a WP_Error object
426
+ * @since WooCommerce 2.2
427
+ */
428
+ public function refund( $order, $order_id, $amount = null, $reason = '' ) {
429
+
430
+ try {
431
+ $payment_object = Mollie_WC_Plugin::getPaymentObject()->getActiveMolliePayment( $order_id );
432
+
433
+ if ( ! $payment_object ) {
434
+ Mollie_WC_Plugin::debug( __METHOD__ . ' - Could not find active Mollie payment for order ' . $order_id );
435
+
436
+ return false;
437
+ } elseif ( ! $payment_object->isPaid() ) {
438
+ Mollie_WC_Plugin::debug( __METHOD__ . ' - Could not refund payment ' . $payment_object->id . ' (not paid). Order ' . $order_id );
439
+
440
+ return false;
441
+ }
442
+
443
+ Mollie_WC_Plugin::debug( __METHOD__ . ' - Create refund - payment: ' . $payment_object->id . ', order: ' . $order_id . ', amount: ' . Mollie_WC_Plugin::getDataHelper()->getOrderCurrency( $order ) . $amount . ( ! empty( $reason ) ? ', reason: ' . $reason : '' ) );
444
+
445
+ do_action( Mollie_WC_Plugin::PLUGIN_ID . '_create_refund', $payment_object, $order );
446
+
447
+ // Is test mode enabled?
448
+ $test_mode = Mollie_WC_Plugin::getSettingsHelper()->isTestModeEnabled();
449
+
450
+ // Send refund to Mollie
451
+ $refund = Mollie_WC_Plugin::getApiHelper()->getApiClient( $test_mode )->payments->refund( $payment_object, array (
452
+ 'amount' => array (
453
+ 'currency' => Mollie_WC_Plugin::getDataHelper()->getOrderCurrency( $order ),
454
+ 'value' => Mollie_WC_Plugin::getDataHelper()->formatCurrencyValue( $amount, Mollie_WC_Plugin::getDataHelper()->getOrderCurrency( $order ) )
455
+ ),
456
+ 'description' => $reason
457
+ ) );
458
+
459
+ Mollie_WC_Plugin::debug( __METHOD__ . ' - Refund created - refund: ' . $refund->id . ', payment: ' . $payment_object->id . ', order: ' . $order_id . ', amount: ' . Mollie_WC_Plugin::getDataHelper()->getOrderCurrency( $order ) . $amount . ( ! empty( $reason ) ? ', reason: ' . $reason : '' ) );
460
+
461
+ do_action( Mollie_WC_Plugin::PLUGIN_ID . '_refund_created', $refund, $order );
462
+
463
+ $order->add_order_note( sprintf(
464
+ /* translators: Placeholder 1: currency, placeholder 2: refunded amount, placeholder 3: optional refund reason, placeholder 4: payment ID, placeholder 5: refund ID */
465
+ __( 'Refunded %s%s%s - Payment: %s, Refund: %s', 'mollie-payments-for-woocommerce' ),
466
+ Mollie_WC_Plugin::getDataHelper()->getOrderCurrency( $order ),
467
+ $amount,
468
+ ( ! empty( $reason ) ? ' (reason: ' . $reason . ')' : '' ),
469
+ $refund->paymentId,
470
+ $refund->id
471
+ ) );
472
+
473
+
474
+ return true;
475
+ }
476
+ catch ( \Mollie\Api\Exceptions\ApiException $e ) {
477
+ return new WP_Error( 1, $e->getMessage() );
478
+ }
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.0.1';
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.2';
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.1
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.2
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.1
7
  Requires PHP: 5.6
8
  License: GPLv2 or later
9
  License URI: http://www.gnu.org/licenses/gpl-2.0.html
@@ -181,7 +181,7 @@ Automatic updates should work like a charm; as always though, ensure you backup
181
 
182
  == Changelog ==
183
 
184
- = 5.0.1 - 11-10-2018 =
185
 
186
  IMPORTANT
187
  This version requires PHP 5.6 or higher. If you are using an older PHP version, please read this article: [PHP & Mollie API v2](https://github.com/mollie/WooCommerce/wiki/PHP-&-Mollie-API-v2).
@@ -191,6 +191,7 @@ This version requires PHP 5.6 or higher. If you are using an older PHP version,
191
  * New - Tested with and updated for WooCommerce 3.5 beta compatibility
192
  * New - EPS, GiroPay: implemented support for SEPA first payments (recurring payments)
193
 
 
194
  * Fix - Fixed issue with Guzzle and PhpScoper
195
 
196
  * Fix - WooCommerce emails: make sure "Payment completed by..." message is only shown once per email
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.2
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.2 - 11-10-2018 =
185
 
186
  IMPORTANT
187
  This version requires PHP 5.6 or higher. If you are using an older PHP version, please read this article: [PHP & Mollie API v2](https://github.com/mollie/WooCommerce/wiki/PHP-&-Mollie-API-v2).
191
  * New - Tested with and updated for WooCommerce 3.5 beta compatibility
192
  * New - EPS, GiroPay: implemented support for SEPA first payments (recurring payments)
193
 
194
+ * Fix - Fixed for "Uncaught Error: Call to a member function isOpen() on null"
195
  * Fix - Fixed issue with Guzzle and PhpScoper
196
 
197
  * Fix - WooCommerce emails: make sure "Payment completed by..." message is only shown once per email