Version Description
19-03-2019 =
New - Added two new actions when processing items for Orders API, mollie-payments-for-woocommerce_orderlines_process_items_before_getting_product_id and mollie-payments-for-woocommerce_orderlines_process_items_after_processing_item
Fix - Fixed bug where expired orders weren't updated in WooCommerce because of check for payment ID instead of order ID
Fix - Use get_home_url() to solve issues where people have different URLs for admin/site (also influences Polylang)
Fix - Extended refund processing: make sure people can't do a partial order line amount refund during an order line refund
Fix - Permanent fix for PHP 7.3 with sporadic caching issues of methods
Download this release
Release Info
Developer | davdebcom |
Plugin | Mollie Payments for WooCommerce |
Version | 5.1.1 |
Comparing to | |
See all releases |
Code changes from version 5.1.0 to 5.1.1
- includes/mollie-api-php/composer.lock +13 -13
- includes/mollie/wc/gateway/abstract.php +28 -8
- includes/mollie/wc/helper/data.php +30 -19
- includes/mollie/wc/helper/orderlines.php +5 -0
- includes/mollie/wc/payment/order.php +20 -5
- includes/mollie/wc/plugin.php +1 -1
- mollie-payments-for-woocommerce.php +1 -1
- readme.txt +9 -1
includes/mollie-api-php/composer.lock
CHANGED
@@ -1010,16 +1010,16 @@
|
|
1010 |
},
|
1011 |
{
|
1012 |
"name": "phpunit/php-timer",
|
1013 |
-
"version": "2.
|
1014 |
"source": {
|
1015 |
"type": "git",
|
1016 |
"url": "https://github.com/sebastianbergmann/php-timer.git",
|
1017 |
-
"reference": "
|
1018 |
},
|
1019 |
"dist": {
|
1020 |
"type": "zip",
|
1021 |
-
"url": "https://api.github.com/repos/sebastianbergmann/php-timer/zipball/
|
1022 |
-
"reference": "
|
1023 |
"shasum": ""
|
1024 |
},
|
1025 |
"require": {
|
@@ -1031,7 +1031,7 @@
|
|
1031 |
"type": "library",
|
1032 |
"extra": {
|
1033 |
"branch-alias": {
|
1034 |
-
"dev-master": "2.
|
1035 |
}
|
1036 |
},
|
1037 |
"autoload": {
|
@@ -1055,7 +1055,7 @@
|
|
1055 |
"keywords": [
|
1056 |
"timer"
|
1057 |
],
|
1058 |
-
"time": "
|
1059 |
},
|
1060 |
{
|
1061 |
"name": "phpunit/php-token-stream",
|
@@ -1108,16 +1108,16 @@
|
|
1108 |
},
|
1109 |
{
|
1110 |
"name": "phpunit/phpunit",
|
1111 |
-
"version": "7.5.
|
1112 |
"source": {
|
1113 |
"type": "git",
|
1114 |
"url": "https://github.com/sebastianbergmann/phpunit.git",
|
1115 |
-
"reference": "
|
1116 |
},
|
1117 |
"dist": {
|
1118 |
"type": "zip",
|
1119 |
-
"url": "https://api.github.com/repos/sebastianbergmann/phpunit/zipball/
|
1120 |
-
"reference": "
|
1121 |
"shasum": ""
|
1122 |
},
|
1123 |
"require": {
|
@@ -1135,7 +1135,7 @@
|
|
1135 |
"phpunit/php-code-coverage": "^6.0.7",
|
1136 |
"phpunit/php-file-iterator": "^2.0.1",
|
1137 |
"phpunit/php-text-template": "^1.2.1",
|
1138 |
-
"phpunit/php-timer": "^2.
|
1139 |
"sebastian/comparator": "^3.0",
|
1140 |
"sebastian/diff": "^3.0",
|
1141 |
"sebastian/environment": "^4.0",
|
@@ -1188,7 +1188,7 @@
|
|
1188 |
"testing",
|
1189 |
"xunit"
|
1190 |
],
|
1191 |
-
"time": "2019-
|
1192 |
},
|
1193 |
{
|
1194 |
"name": "sebastian/code-unit-reverse-lookup",
|
@@ -1801,7 +1801,7 @@
|
|
1801 |
},
|
1802 |
{
|
1803 |
"name": "Gert de Pagter",
|
1804 |
-
"email": "
|
1805 |
}
|
1806 |
],
|
1807 |
"description": "Symfony polyfill for ctype functions",
|
1010 |
},
|
1011 |
{
|
1012 |
"name": "phpunit/php-timer",
|
1013 |
+
"version": "2.1.1",
|
1014 |
"source": {
|
1015 |
"type": "git",
|
1016 |
"url": "https://github.com/sebastianbergmann/php-timer.git",
|
1017 |
+
"reference": "8b389aebe1b8b0578430bda0c7c95a829608e059"
|
1018 |
},
|
1019 |
"dist": {
|
1020 |
"type": "zip",
|
1021 |
+
"url": "https://api.github.com/repos/sebastianbergmann/php-timer/zipball/8b389aebe1b8b0578430bda0c7c95a829608e059",
|
1022 |
+
"reference": "8b389aebe1b8b0578430bda0c7c95a829608e059",
|
1023 |
"shasum": ""
|
1024 |
},
|
1025 |
"require": {
|
1031 |
"type": "library",
|
1032 |
"extra": {
|
1033 |
"branch-alias": {
|
1034 |
+
"dev-master": "2.1-dev"
|
1035 |
}
|
1036 |
},
|
1037 |
"autoload": {
|
1055 |
"keywords": [
|
1056 |
"timer"
|
1057 |
],
|
1058 |
+
"time": "2019-02-20T10:12:59+00:00"
|
1059 |
},
|
1060 |
{
|
1061 |
"name": "phpunit/php-token-stream",
|
1108 |
},
|
1109 |
{
|
1110 |
"name": "phpunit/phpunit",
|
1111 |
+
"version": "7.5.7",
|
1112 |
"source": {
|
1113 |
"type": "git",
|
1114 |
"url": "https://github.com/sebastianbergmann/phpunit.git",
|
1115 |
+
"reference": "eb343b86753d26de07ecba7868fa983104361948"
|
1116 |
},
|
1117 |
"dist": {
|
1118 |
"type": "zip",
|
1119 |
+
"url": "https://api.github.com/repos/sebastianbergmann/phpunit/zipball/eb343b86753d26de07ecba7868fa983104361948",
|
1120 |
+
"reference": "eb343b86753d26de07ecba7868fa983104361948",
|
1121 |
"shasum": ""
|
1122 |
},
|
1123 |
"require": {
|
1135 |
"phpunit/php-code-coverage": "^6.0.7",
|
1136 |
"phpunit/php-file-iterator": "^2.0.1",
|
1137 |
"phpunit/php-text-template": "^1.2.1",
|
1138 |
+
"phpunit/php-timer": "^2.1",
|
1139 |
"sebastian/comparator": "^3.0",
|
1140 |
"sebastian/diff": "^3.0",
|
1141 |
"sebastian/environment": "^4.0",
|
1188 |
"testing",
|
1189 |
"xunit"
|
1190 |
],
|
1191 |
+
"time": "2019-03-16T07:31:17+00:00"
|
1192 |
},
|
1193 |
{
|
1194 |
"name": "sebastian/code-unit-reverse-lookup",
|
1801 |
},
|
1802 |
{
|
1803 |
"name": "Gert de Pagter",
|
1804 |
+
"email": "backendtea@gmail.com"
|
1805 |
}
|
1806 |
],
|
1807 |
"description": "Symfony polyfill for ctype functions",
|
includes/mollie/wc/gateway/abstract.php
CHANGED
@@ -1594,7 +1594,7 @@ abstract class Mollie_WC_Gateway_Abstract extends WC_Payment_Gateway
|
|
1594 |
*/
|
1595 |
public function getReturnUrl (WC_Order $order)
|
1596 |
{
|
1597 |
-
$site_url =
|
1598 |
|
1599 |
$return_url = WC()->api_request_url( 'mollie_return' );
|
1600 |
$return_url = $this->removeTrailingSlashAfterParamater( $return_url );
|
@@ -1620,6 +1620,12 @@ abstract class Mollie_WC_Gateway_Abstract extends WC_Payment_Gateway
|
|
1620 |
|
1621 |
$return_url = str_replace($site_url, $lang_url, $return_url);
|
1622 |
|
|
|
|
|
|
|
|
|
|
|
|
|
1623 |
return apply_filters(Mollie_WC_Plugin::PLUGIN_ID . '_return_url', $return_url, $order);
|
1624 |
}
|
1625 |
|
@@ -1629,7 +1635,7 @@ abstract class Mollie_WC_Gateway_Abstract extends WC_Payment_Gateway
|
|
1629 |
*/
|
1630 |
public function getWebhookUrl (WC_Order $order)
|
1631 |
{
|
1632 |
-
$site_url =
|
1633 |
|
1634 |
$webhook_url = WC()->api_request_url( strtolower( get_class( $this ) ) );
|
1635 |
$webhook_url = $this->removeTrailingSlashAfterParamater( $webhook_url );
|
@@ -1645,6 +1651,7 @@ abstract class Mollie_WC_Gateway_Abstract extends WC_Payment_Gateway
|
|
1645 |
'key' => $order->get_order_key(),
|
1646 |
), $webhook_url);
|
1647 |
}
|
|
|
1648 |
|
1649 |
$lang_url = $this->getSiteUrlWithLanguage();
|
1650 |
|
@@ -1891,12 +1898,10 @@ abstract class Mollie_WC_Gateway_Abstract extends WC_Payment_Gateway
|
|
1891 |
$filters_key = $filters['amount']['currency'] . '_' . str_replace( '.', '', $filters['amount']['value'] ) . '_' . $filters['billingCountry'] . '_' . $filters['locale'] . '_' . $filters['sequenceType'];
|
1892 |
$transient_id = Mollie_WC_Plugin::getDataHelper()->getTransientId( 'api_methods_' . ( $test_mode ? 'test' : 'live' ) . '_' . $filters_key );
|
1893 |
|
1894 |
-
|
1895 |
-
$cached = unserialize( get_transient( $transient_id ) );
|
1896 |
|
1897 |
-
|
1898 |
-
|
1899 |
-
}
|
1900 |
}
|
1901 |
|
1902 |
if ( empty ( $methods ) ) {
|
@@ -1907,6 +1912,21 @@ abstract class Mollie_WC_Gateway_Abstract extends WC_Payment_Gateway
|
|
1907 |
// Get payment methods at Mollie
|
1908 |
$methods = Mollie_WC_Plugin::getApiHelper()->getApiClient( $test_mode )->methods->all( $filters );
|
1909 |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
1910 |
// Set new transients (as cache)
|
1911 |
try {
|
1912 |
set_transient( $transient_id, serialize( $methods ), MINUTE_IN_SECONDS * 5 );
|
@@ -1923,7 +1943,7 @@ abstract class Mollie_WC_Gateway_Abstract extends WC_Payment_Gateway
|
|
1923 |
// Set all other payment methods to false, so they can be updated if available
|
1924 |
foreach ( $methods as $method ) {
|
1925 |
|
1926 |
-
if ( $method
|
1927 |
return true;
|
1928 |
}
|
1929 |
}
|
1594 |
*/
|
1595 |
public function getReturnUrl (WC_Order $order)
|
1596 |
{
|
1597 |
+
$site_url = get_home_url();
|
1598 |
|
1599 |
$return_url = WC()->api_request_url( 'mollie_return' );
|
1600 |
$return_url = $this->removeTrailingSlashAfterParamater( $return_url );
|
1620 |
|
1621 |
$return_url = str_replace($site_url, $lang_url, $return_url);
|
1622 |
|
1623 |
+
if ( version_compare( WC_VERSION, '3.0', '<' ) ) {
|
1624 |
+
Mollie_WC_Plugin::debug( $this->id . ': Order ' . $order->id . ' returnUrl: ' . $return_url, true );
|
1625 |
+
} else {
|
1626 |
+
Mollie_WC_Plugin::debug( $this->id . ': Order ' . $order->get_id() . ' returnUrl: ' . $return_url, true );
|
1627 |
+
}
|
1628 |
+
|
1629 |
return apply_filters(Mollie_WC_Plugin::PLUGIN_ID . '_return_url', $return_url, $order);
|
1630 |
}
|
1631 |
|
1635 |
*/
|
1636 |
public function getWebhookUrl (WC_Order $order)
|
1637 |
{
|
1638 |
+
$site_url = get_home_url();
|
1639 |
|
1640 |
$webhook_url = WC()->api_request_url( strtolower( get_class( $this ) ) );
|
1641 |
$webhook_url = $this->removeTrailingSlashAfterParamater( $webhook_url );
|
1651 |
'key' => $order->get_order_key(),
|
1652 |
), $webhook_url);
|
1653 |
}
|
1654 |
+
$webhook_url = $this->removeTrailingSlashAfterParamater( $webhook_url );
|
1655 |
|
1656 |
$lang_url = $this->getSiteUrlWithLanguage();
|
1657 |
|
1898 |
$filters_key = $filters['amount']['currency'] . '_' . str_replace( '.', '', $filters['amount']['value'] ) . '_' . $filters['billingCountry'] . '_' . $filters['locale'] . '_' . $filters['sequenceType'];
|
1899 |
$transient_id = Mollie_WC_Plugin::getDataHelper()->getTransientId( 'api_methods_' . ( $test_mode ? 'test' : 'live' ) . '_' . $filters_key );
|
1900 |
|
1901 |
+
$cached = unserialize( get_transient( $transient_id ) );
|
|
|
1902 |
|
1903 |
+
if ( $cached ) {
|
1904 |
+
$methods = $cached;
|
|
|
1905 |
}
|
1906 |
|
1907 |
if ( empty ( $methods ) ) {
|
1912 |
// Get payment methods at Mollie
|
1913 |
$methods = Mollie_WC_Plugin::getApiHelper()->getApiClient( $test_mode )->methods->all( $filters );
|
1914 |
|
1915 |
+
$methods_cleaned = array();
|
1916 |
+
|
1917 |
+
foreach ( $methods as $method ) {
|
1918 |
+
|
1919 |
+
$public_properties = get_object_vars( $method ); // get only the public properties of the object
|
1920 |
+
$methods_cleaned[] = $public_properties;
|
1921 |
+
|
1922 |
+
}
|
1923 |
+
|
1924 |
+
if ( $methods_cleaned === NULL ) {
|
1925 |
+
$methods_cleaned = array(0);
|
1926 |
+
}
|
1927 |
+
|
1928 |
+
$methods = $methods_cleaned;
|
1929 |
+
|
1930 |
// Set new transients (as cache)
|
1931 |
try {
|
1932 |
set_transient( $transient_id, serialize( $methods ), MINUTE_IN_SECONDS * 5 );
|
1943 |
// Set all other payment methods to false, so they can be updated if available
|
1944 |
foreach ( $methods as $method ) {
|
1945 |
|
1946 |
+
if ( $method['id'] == $woocommerce_method ) {
|
1947 |
return true;
|
1948 |
}
|
1949 |
}
|
includes/mollie/wc/helper/data.php
CHANGED
@@ -253,10 +253,10 @@ class Mollie_WC_Helper_Data
|
|
253 |
|
254 |
|
255 |
/**
|
256 |
-
* @param bool
|
257 |
-
* @param bool
|
258 |
*
|
259 |
-
* @return array|\Mollie\Api\Resources\MethodCollection
|
260 |
*/
|
261 |
public function getAllPaymentMethods( $test_mode = false, $use_cache = true ) {
|
262 |
|
@@ -266,7 +266,7 @@ class Mollie_WC_Helper_Data
|
|
266 |
foreach ( $recurringPaymentMethods as $recurringItem ) {
|
267 |
$notFound = true;
|
268 |
foreach ( $result as $item ) {
|
269 |
-
if ( $item
|
270 |
$notFound = false;
|
271 |
break;
|
272 |
}
|
@@ -280,10 +280,10 @@ class Mollie_WC_Helper_Data
|
|
280 |
}
|
281 |
|
282 |
/**
|
283 |
-
* @param bool $test_mode
|
284 |
-
* @param bool $use_cache
|
285 |
*
|
286 |
-
* @return
|
287 |
*/
|
288 |
public function getRegularPaymentMethods( $test_mode = false, $use_cache = true ) {
|
289 |
// Already initialized
|
@@ -312,10 +312,6 @@ class Mollie_WC_Helper_Data
|
|
312 |
|
313 |
$methods = array ();
|
314 |
|
315 |
-
if ( version_compare( PHP_VERSION, '7.3.0' >= 0 ) ) {
|
316 |
-
$use_cache = false;
|
317 |
-
}
|
318 |
-
|
319 |
try {
|
320 |
|
321 |
$filters_key = ( ! empty ( $filters['sequenceType'] ) ) ? '_' . $filters['sequenceType'] : '';
|
@@ -324,7 +320,7 @@ class Mollie_WC_Helper_Data
|
|
324 |
if ( $use_cache ) {
|
325 |
$cached_methods = unserialize( get_transient( $transient_id ) );
|
326 |
|
327 |
-
if ( $cached_methods
|
328 |
$methods = $cached_methods;
|
329 |
}
|
330 |
}
|
@@ -334,11 +330,25 @@ class Mollie_WC_Helper_Data
|
|
334 |
// Remove existing expired transients
|
335 |
delete_transient( $transient_id );
|
336 |
|
337 |
-
// TODO David: Support orders and payment resource?
|
338 |
$filters['resource'] = 'orders';
|
339 |
|
340 |
$methods = $this->api_helper->getApiClient( $test_mode )->methods->all( $filters );
|
341 |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
342 |
// Set new transients (as cache)
|
343 |
try {
|
344 |
set_transient( $transient_id, serialize( $methods ), MINUTE_IN_SECONDS * 5 );
|
@@ -358,18 +368,19 @@ class Mollie_WC_Helper_Data
|
|
358 |
return $methods;
|
359 |
}
|
360 |
|
361 |
-
|
362 |
-
|
363 |
-
|
364 |
-
|
365 |
-
|
|
|
366 |
public function getPaymentMethod ($test_mode = false, $method)
|
367 |
{
|
368 |
$payment_methods = $this->getAllPaymentMethods($test_mode);
|
369 |
|
370 |
foreach ($payment_methods as $payment_method)
|
371 |
{
|
372 |
-
if ($payment_method
|
373 |
{
|
374 |
return $payment_method;
|
375 |
}
|
253 |
|
254 |
|
255 |
/**
|
256 |
+
* @param bool $test_mode
|
257 |
+
* @param bool $use_cache
|
258 |
*
|
259 |
+
* @return array|mixed|\Mollie\Api\Resources\Method[]|\Mollie\Api\Resources\MethodCollection
|
260 |
*/
|
261 |
public function getAllPaymentMethods( $test_mode = false, $use_cache = true ) {
|
262 |
|
266 |
foreach ( $recurringPaymentMethods as $recurringItem ) {
|
267 |
$notFound = true;
|
268 |
foreach ( $result as $item ) {
|
269 |
+
if ( $item['id'] == $recurringItem['id'] ) {
|
270 |
$notFound = false;
|
271 |
break;
|
272 |
}
|
280 |
}
|
281 |
|
282 |
/**
|
283 |
+
* @param bool $test_mode
|
284 |
+
* @param bool $use_cache
|
285 |
*
|
286 |
+
* @return array|mixed|\Mollie\Api\Resources\Method[]|\Mollie\Api\Resources\MethodCollection
|
287 |
*/
|
288 |
public function getRegularPaymentMethods( $test_mode = false, $use_cache = true ) {
|
289 |
// Already initialized
|
312 |
|
313 |
$methods = array ();
|
314 |
|
|
|
|
|
|
|
|
|
315 |
try {
|
316 |
|
317 |
$filters_key = ( ! empty ( $filters['sequenceType'] ) ) ? '_' . $filters['sequenceType'] : '';
|
320 |
if ( $use_cache ) {
|
321 |
$cached_methods = unserialize( get_transient( $transient_id ) );
|
322 |
|
323 |
+
if ( $cached_methods ) {
|
324 |
$methods = $cached_methods;
|
325 |
}
|
326 |
}
|
330 |
// Remove existing expired transients
|
331 |
delete_transient( $transient_id );
|
332 |
|
|
|
333 |
$filters['resource'] = 'orders';
|
334 |
|
335 |
$methods = $this->api_helper->getApiClient( $test_mode )->methods->all( $filters );
|
336 |
|
337 |
+
$methods_cleaned = array();
|
338 |
+
|
339 |
+
foreach ( $methods as $method ) {
|
340 |
+
|
341 |
+
$public_properties = get_object_vars( $method ); // get only the public properties of the object
|
342 |
+
$methods_cleaned[] = $public_properties;
|
343 |
+
|
344 |
+
}
|
345 |
+
|
346 |
+
if ( $methods_cleaned === NULL ) {
|
347 |
+
$methods_cleaned = array(0);
|
348 |
+
}
|
349 |
+
|
350 |
+
$methods = $methods_cleaned;
|
351 |
+
|
352 |
// Set new transients (as cache)
|
353 |
try {
|
354 |
set_transient( $transient_id, serialize( $methods ), MINUTE_IN_SECONDS * 5 );
|
368 |
return $methods;
|
369 |
}
|
370 |
|
371 |
+
/**
|
372 |
+
* @param bool $test_mode
|
373 |
+
* @param $method
|
374 |
+
*
|
375 |
+
* @return mixed|\Mollie\Api\Resources\Method|null
|
376 |
+
*/
|
377 |
public function getPaymentMethod ($test_mode = false, $method)
|
378 |
{
|
379 |
$payment_methods = $this->getAllPaymentMethods($test_mode);
|
380 |
|
381 |
foreach ($payment_methods as $payment_method)
|
382 |
{
|
383 |
+
if ($payment_method['id'] == $method)
|
384 |
{
|
385 |
return $payment_method;
|
386 |
}
|
includes/mollie/wc/helper/orderlines.php
CHANGED
@@ -78,6 +78,9 @@ class Mollie_WC_Helper_OrderLines {
|
|
78 |
foreach ( $this->order->get_items() as $cart_item ) {
|
79 |
|
80 |
if ( $cart_item['quantity'] ) {
|
|
|
|
|
|
|
81 |
if ( $cart_item['variation_id'] ) {
|
82 |
$product = wc_get_product( $cart_item['variation_id'] );
|
83 |
} else {
|
@@ -118,6 +121,8 @@ class Mollie_WC_Helper_OrderLines {
|
|
118 |
// TODO David: Continue testing adding WooCommerce images to Mollie Orders
|
119 |
|
120 |
$this->order_lines[] = $mollie_order_item;
|
|
|
|
|
121 |
}
|
122 |
}
|
123 |
}
|
78 |
foreach ( $this->order->get_items() as $cart_item ) {
|
79 |
|
80 |
if ( $cart_item['quantity'] ) {
|
81 |
+
|
82 |
+
do_action( Mollie_WC_Plugin::PLUGIN_ID . '_orderlines_process_items_before_getting_product_id', $cart_item );
|
83 |
+
|
84 |
if ( $cart_item['variation_id'] ) {
|
85 |
$product = wc_get_product( $cart_item['variation_id'] );
|
86 |
} else {
|
121 |
// TODO David: Continue testing adding WooCommerce images to Mollie Orders
|
122 |
|
123 |
$this->order_lines[] = $mollie_order_item;
|
124 |
+
|
125 |
+
do_action( Mollie_WC_Plugin::PLUGIN_ID . '_orderlines_process_items_after_processing_item', $cart_item );
|
126 |
}
|
127 |
}
|
128 |
}
|
includes/mollie/wc/payment/order.php
CHANGED
@@ -638,10 +638,10 @@ class Mollie_WC_Payment_Order extends Mollie_WC_Payment_Object {
|
|
638 |
// Get order ID in correct way depending on WooCommerce version
|
639 |
if ( version_compare( WC_VERSION, '3.0', '<' ) ) {
|
640 |
$order_id = $order->id;
|
641 |
-
$mollie_payment_id = get_post_meta( $order_id, '
|
642 |
} else {
|
643 |
$order_id = $order->get_id();
|
644 |
-
$mollie_payment_id = $order->get_meta( '
|
645 |
}
|
646 |
|
647 |
// Add messages to log
|
@@ -854,10 +854,25 @@ class Mollie_WC_Payment_Order extends Mollie_WC_Payment_Object {
|
|
854 |
|
855 |
if ( $original_order_item_id == $line->metadata->order_item_id ) {
|
856 |
|
857 |
-
//
|
858 |
-
|
859 |
|
860 |
-
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
861 |
$original_order_item_id,
|
862 |
$line->id
|
863 |
);
|
638 |
// Get order ID in correct way depending on WooCommerce version
|
639 |
if ( version_compare( WC_VERSION, '3.0', '<' ) ) {
|
640 |
$order_id = $order->id;
|
641 |
+
$mollie_payment_id = get_post_meta( $order_id, '_mollie_order_id', $single = true );
|
642 |
} else {
|
643 |
$order_id = $order->get_id();
|
644 |
+
$mollie_payment_id = $order->get_meta( '_mollie_order_id', true );
|
645 |
}
|
646 |
|
647 |
// Add messages to log
|
854 |
|
855 |
if ( $original_order_item_id == $line->metadata->order_item_id ) {
|
856 |
|
857 |
+
// Calculate the total refund amount for one order line
|
858 |
+
$line_total_refund_amount = abs( $item->get_quantity() ) * $line->unitPrice->value;
|
859 |
|
860 |
+
// Mollie doesn't allow a partial refund of the full amount of at least one order line, so when merchants try that, warn them and block the process
|
861 |
+
if ( number_format($line_total_refund_amount, 2 ) != number_format($item_refund_amount, 2 ) ) {
|
862 |
+
|
863 |
+
$note_message = sprintf( "Mollie doesn't allow a partial refund of the full amount of at least one order line. Use 'Refund amount' instead. The WooCommerce order item ID is %s, Mollie order line ID is %s.",
|
864 |
+
$original_order_item_id,
|
865 |
+
$line->id
|
866 |
+
);
|
867 |
+
|
868 |
+
Mollie_WC_Plugin::debug( __METHOD__ . " - Order $order_id: " . $note_message );
|
869 |
+
throw new Exception ( $note_message );
|
870 |
+
}
|
871 |
+
|
872 |
+
// Mollie doesn't allow a partial refund of less than one quantity, so when merchants try that, warn them and block the process
|
873 |
+
if ( abs($item->get_quantity()) < 1 || ( $item_refund_amount == $line->unitPrice->value ) ) {
|
874 |
+
|
875 |
+
$note_message = sprintf( "Mollie doesn't allow a partial refund of less than one quantity per order line. Use 'Refund amount' instead. The WooCommerce order item ID is %s, Mollie order line ID is %s.",
|
876 |
$original_order_item_id,
|
877 |
$line->id
|
878 |
);
|
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.
|
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.1.1';
|
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.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.1.1
|
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, payment gateway, woocommerce, credit card
|
4 |
Requires at least: 3.8
|
5 |
Tested up to: 5.1
|
6 |
-
Stable tag: 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,6 +181,14 @@ Automatic updates should work like a charm; as always though, ensure you backup
|
|
181 |
|
182 |
== Changelog ==
|
183 |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
184 |
= 5.1.0 - 19-02-2019 =
|
185 |
|
186 |
* New - Enable 'refunds' for Klarna and SEPA Direct Debit payments
|
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.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.1.1 - 19-03-2019 =
|
185 |
+
|
186 |
+
* New - Added two new actions when processing items for Orders API, mollie-payments-for-woocommerce_orderlines_process_items_before_getting_product_id and mollie-payments-for-woocommerce_orderlines_process_items_after_processing_item
|
187 |
+
* Fix - Fixed bug where expired orders weren't updated in WooCommerce because of check for payment ID instead of order ID
|
188 |
+
* Fix - Use get_home_url() to solve issues where people have different URLs for admin/site (also influences Polylang)
|
189 |
+
* Fix - Extended refund processing: make sure people can't do a partial order line amount refund during an order line refund
|
190 |
+
* Fix - Permanent fix for PHP 7.3 with sporadic caching issues of methods
|
191 |
+
|
192 |
= 5.1.0 - 19-02-2019 =
|
193 |
|
194 |
* New - Enable 'refunds' for Klarna and SEPA Direct Debit payments
|