From 003180d725fb0d570fb60f7d5b7048bb16ac5145 Mon Sep 17 00:00:00 2001 From: Marvin-Magmodules Date: Wed, 23 Jan 2019 14:42:24 +0100 Subject: [PATCH 1/5] Fixed Orderline matches for SKUs with leading/trailing whitespace --- Model/OrderLines.php | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/Model/OrderLines.php b/Model/OrderLines.php index 2719ee71ee0..0464bfd86eb 100644 --- a/Model/OrderLines.php +++ b/Model/OrderLines.php @@ -224,7 +224,7 @@ public function linkOrderLines($orderLines, Order $order) throw new LocalizedException(__('Could not save Order Lines. Error: order line not found')); } - if ($orderLines[$key]->sku != $orderLineRow->getSku()) { + if ($orderLines[$key]->sku != trim($orderLineRow->getSku())) { throw new LocalizedException(__('Could not save Order Lines. Error: sku\'s do not match')); } From 162f1bba9e876fe9b63e6c6aadccbc49bcc106ae Mon Sep 17 00:00:00 2001 From: Marvin-Magmodules Date: Wed, 23 Jan 2019 14:42:57 +0100 Subject: [PATCH 2/5] Added missing depends --- etc/adminhtml/methods/ideal.xml | 3 +++ 1 file changed, 3 insertions(+) diff --git a/etc/adminhtml/methods/ideal.xml b/etc/adminhtml/methods/ideal.xml index 717ee2899de..24bbeaa149e 100644 --- a/etc/adminhtml/methods/ideal.xml +++ b/etc/adminhtml/methods/ideal.xml @@ -45,6 +45,9 @@ Magento\Config\Model\Config\Source\Yesno payment/mollie_methods_ideal/add_qr + + 1 + From a154bb83bcf543a4585710588072a1c60b98d723 Mon Sep 17 00:00:00 2001 From: Marvin-Magmodules Date: Wed, 23 Jan 2019 14:59:08 +0100 Subject: [PATCH 3/5] Refactored refund check as isRefunded() is deprecated #107 --- Model/Client/Orders.php | 7 ++++--- 1 file changed, 4 insertions(+), 3 deletions(-) diff --git a/Model/Client/Orders.php b/Model/Client/Orders.php index 39f36aa356f..028a6356705 100644 --- a/Model/Client/Orders.php +++ b/Model/Client/Orders.php @@ -258,10 +258,11 @@ public function processTransaction(Order $order, $mollieApi, $type = 'webhook', return $msg; } + $refunded = $mollieOrder->amountRefunded !== null ? true : false; $order->getPayment()->setAdditionalInformation('payment_status', $status); $this->orderRepository->save($order); - if ($mollieOrder->isPaid() || $mollieOrder->isAuthorized()) { + if (($mollieOrder->isPaid() || $mollieOrder->isAuthorized()) && !$refunded) { $amount = $mollieOrder->amount->value; $currency = $mollieOrder->amount->currency; $orderAmount = $this->mollieHelper->getOrderAmountByOrder($order); @@ -352,8 +353,8 @@ public function processTransaction(Order $order, $mollieApi, $type = 'webhook', return $msg; } - if ($mollieOrder->isRefunded()) { - $msg = ['success' => true, 'status' => $status, 'order_id' => $orderId, 'type' => $type]; + if ($refunded) { + $msg = ['success' => true, 'status' => 'refunded', 'order_id' => $orderId, 'type' => $type]; $this->mollieHelper->addTolog('success', $msg); return $msg; } From 82e5a2c013d1fc0855ab33ffd97b41ffc75d2b57 Mon Sep 17 00:00:00 2001 From: Marvin-Magmodules Date: Wed, 23 Jan 2019 16:17:26 +0100 Subject: [PATCH 4/5] Added error message for failed payments --- Controller/Checkout/Success.php | 6 ++++-- Model/Client/Orders.php | 3 ++- i18n/de_DE.csv | 3 ++- i18n/en_US.csv | 3 ++- i18n/fr_FR.csv | 3 ++- i18n/nl_NL.csv | 3 ++- 6 files changed, 14 insertions(+), 7 deletions(-) diff --git a/Controller/Checkout/Success.php b/Controller/Checkout/Success.php index 1c342d88a32..174063ec011 100644 --- a/Controller/Checkout/Success.php +++ b/Controller/Checkout/Success.php @@ -89,15 +89,17 @@ public function execute() $this->_redirect('checkout/onepage/success?utm_nooverride=1'); } catch (\Exception $e) { $this->mollieHelper->addTolog('error', $e->getMessage()); - $this->messageManager->addNoticeMessage(__('Something went wrong.')); + $this->messageManager->addErrorMessage(__('Something went wrong.')); $this->_redirect('checkout/cart'); } } else { $this->checkoutSession->restoreQuote(); if (isset($status['status']) && ($status['status'] == 'canceled')) { $this->messageManager->addNoticeMessage(__('Payment canceled, please try again.')); + } elseif (isset($status['status']) && ($status['status'] == 'failed') && isset($status['method'])) { + $this->messageManager->addErrorMessage(__('Payment of type %1 has been rejected. Decision is based on order and outcome of risk assessment.', $status['method'])); } else { - $this->messageManager->addNoticeMessage(__('Something went wrong.')); + $this->messageManager->addErrorMessage(__('Something went wrong.')); } $this->_redirect('checkout/cart'); diff --git a/Model/Client/Orders.php b/Model/Client/Orders.php index 028a6356705..7468162ae50 100644 --- a/Model/Client/Orders.php +++ b/Model/Client/Orders.php @@ -250,10 +250,11 @@ public function processTransaction(Order $order, $mollieApi, $type = 'webhook', $lastPayment = isset($mollieOrder->_embedded->payments) ? end($mollieOrder->_embedded->payments) : null; $lastPaymentStatus = isset($lastPayment) ? $lastPayment->status : null; if ($lastPaymentStatus == 'canceled' || $lastPaymentStatus == 'failed' || $lastPaymentStatus == 'expired') { + $method = $order->getPayment()->getMethodInstance()->getTitle(); $order->getPayment()->setAdditionalInformation('payment_status', $lastPaymentStatus); $this->orderRepository->save($order); $this->mollieHelper->registerCancellation($order, $status); - $msg = ['success' => false, 'status' => $lastPaymentStatus, 'order_id' => $orderId, 'type' => $type]; + $msg = ['success' => false, 'status' => $lastPaymentStatus, 'order_id' => $orderId, 'type' => $type, 'method' => $method]; $this->mollieHelper->addTolog('success', $msg); return $msg; } diff --git a/i18n/de_DE.csv b/i18n/de_DE.csv index 6c37fd3d03e..003589f7f9c 100644 --- a/i18n/de_DE.csv +++ b/i18n/de_DE.csv @@ -79,4 +79,5 @@ "API Details","API-Details" "Api Test","API-Test" "Language Payment Page","Sprache Zahlungsseite" -"Let Mollie automatically detect the language or force the language from the store view.","Lassen Sie Mollie automatisch die Sprache erkennen oder stellen Sie diese für den entsprechenden Store View ein." \ No newline at end of file +"Let Mollie automatically detect the language or force the language from the store view.","Lassen Sie Mollie automatisch die Sprache erkennen oder stellen Sie diese für den entsprechenden Store View ein." +"Payment of type %1 has been rejected. Decision is based on order and outcome of risk assessment.","%1 -Zahlung wurde abgelehnt. Die Entscheidung wurde basierend auf einer Risikobewertung getroffen." \ No newline at end of file diff --git a/i18n/en_US.csv b/i18n/en_US.csv index 16119a253b0..1f25a9b1f40 100644 --- a/i18n/en_US.csv +++ b/i18n/en_US.csv @@ -79,4 +79,5 @@ "API Details","API Details" "Api Test","Api Test" "Language Payment Page","Language Payment Page" -"Let Mollie automatically detect the language or force the language from the store view.","Let Mollie automatically detect the language or force a language for your store view." \ No newline at end of file +"Let Mollie automatically detect the language or force the language from the store view.","Let Mollie automatically detect the language or force a language for your store view." +"Payment of type %1 has been rejected. Decision is based on order and outcome of risk assessment.","Payment of type %1 has been rejected. Decision is based on order and outcome of risk assessment." \ No newline at end of file diff --git a/i18n/fr_FR.csv b/i18n/fr_FR.csv index 364edcf1f76..35d540dd913 100644 --- a/i18n/fr_FR.csv +++ b/i18n/fr_FR.csv @@ -79,4 +79,5 @@ "API Details","Détails de l'API" "Api Test","Test Api" "Language Payment Page","Page de paiement linguistique" -"Let Mollie automatically detect the language or force the language from the store view.","Laissez Mollie détecter automatiquement la langue ou forcer une langue pour votre vue de magasin." \ No newline at end of file +"Let Mollie automatically detect the language or force the language from the store view.","Laissez Mollie détecter automatiquement la langue ou forcer une langue pour votre vue de magasin." +"Payment of type %1 has been rejected. Decision is based on order and outcome of risk assessment.","Le paiement de type %1 a été refusé. La décision est basée la commande et l'évaluation des risques" \ No newline at end of file diff --git a/i18n/nl_NL.csv b/i18n/nl_NL.csv index ac134745eb5..2fa586177d2 100644 --- a/i18n/nl_NL.csv +++ b/i18n/nl_NL.csv @@ -79,4 +79,5 @@ "API Details","API-gegevens" "Api Test","Api Test" "Language Payment Page","Taal Betaalpagina" -"Let Mollie automatically detect the language or force the language from the store view.","Laat Mollie de taal automatisch detecteren of forceer een taal voor deze store-view." \ No newline at end of file +"Let Mollie automatically detect the language or force the language from the store view.","Laat Mollie de taal automatisch detecteren of forceer een taal voor deze store-view." +"Payment of type %1 has been rejected. Decision is based on order and outcome of risk assessment.","Betaling van het type %1 is geweigerd. Deze beslissing is gebaseerd op de bestelling en de uitkomst van de risicobeoordeling." \ No newline at end of file From bd75547402f3a3adc01f039e2da5c50b771b1b79 Mon Sep 17 00:00:00 2001 From: Marvin-Magmodules Date: Wed, 23 Jan 2019 16:18:02 +0100 Subject: [PATCH 5/5] Version bump --- composer.json | 2 +- etc/module.xml | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-) diff --git a/composer.json b/composer.json index 2ba3f8e5eef..ad93750e63d 100644 --- a/composer.json +++ b/composer.json @@ -1,7 +1,7 @@ { "name": "mollie/magento2", "description": "Mollie Payment Module for Magento 2", - "version": "1.4.6", + "version": "1.4.7", "require": { "mollie/mollie-api-php": "^2.1", "magento/framework": ">=100.1.0", diff --git a/etc/module.xml b/etc/module.xml index 4ef03ff5479..e150af5d884 100644 --- a/etc/module.xml +++ b/etc/module.xml @@ -1,4 +1,4 @@ - +