From 635bedc67ff576fd9902afefd8708196756e044a Mon Sep 17 00:00:00 2001 From: Michiel Gerritsen Date: Wed, 15 Jan 2020 09:54:33 +0100 Subject: [PATCH 1/4] Bugfix: If a Klarna order fails, cancel the orders --- .../community/Mollie/Mpm/controllers/ApiController.php | 9 +++++---- 1 file changed, 5 insertions(+), 4 deletions(-) diff --git a/app/code/community/Mollie/Mpm/controllers/ApiController.php b/app/code/community/Mollie/Mpm/controllers/ApiController.php index 9218dcdf..7d0510c1 100644 --- a/app/code/community/Mollie/Mpm/controllers/ApiController.php +++ b/app/code/community/Mollie/Mpm/controllers/ApiController.php @@ -108,7 +108,7 @@ public function paymentAction() $this->mollieHelper->setError(self::KLARNA_REJECTION_ERR_MSG); $this->mollieHelper->addToLog('error', $exception->getMessage()); $this->mollieHelper->restoreCart(); - $this->_cancelUnprocessedOrder($order, $exception->getMessage()); + $this->_cancelUnprocessedOrder($order, $exception->getMessage(), true); $this->_redirect('checkout/cart'); return; } catch (\Exception $e) { @@ -126,11 +126,12 @@ public function paymentAction() * * @param Mage_Sales_Model_Order $order * @param string $message If provided, add this message to the order status history comment + * @param bool $forceCancel * @return void */ - protected function _cancelUnprocessedOrder($order, $message = null) + protected function _cancelUnprocessedOrder($order, $message = null, $forceCancel = false) { - if (empty($order) || empty($order->getMollieTransactionId())) { + if (empty($order) || (empty($order->getMollieTransactionId()) && !$forceCancel)) { return; } @@ -139,7 +140,7 @@ protected function _cancelUnprocessedOrder($order, $message = null) $order->getStoreId() ); - if (!$cancelFailedOrders) { + if (!$forceCancel && !$cancelFailedOrders) { return; } From 36ba5626efe8a461bd14e8ac7ac278514cf87c06 Mon Sep 17 00:00:00 2001 From: Michiel Gerritsen Date: Mon, 17 Feb 2020 20:37:21 +0100 Subject: [PATCH 2/4] Save the order after processing --- app/code/community/Mollie/Mpm/Model/Mollie.php | 1 + 1 file changed, 1 insertion(+) diff --git a/app/code/community/Mollie/Mpm/Model/Mollie.php b/app/code/community/Mollie/Mpm/Model/Mollie.php index 1dfa3177..1d4e11b9 100644 --- a/app/code/community/Mollie/Mpm/Model/Mollie.php +++ b/app/code/community/Mollie/Mpm/Model/Mollie.php @@ -171,6 +171,7 @@ public function processTransaction($orderId, $type = 'webhook', $paymentToken = $connection->rollback(); throw $exception; } finally { + $order->save(); $this->commitOrder($order); $connection->commit(); } From ddfdcb8a58d31909c8fd4fa9047984a4e02ca4cb Mon Sep 17 00:00:00 2001 From: Michiel Gerritsen Date: Wed, 19 Feb 2020 09:25:48 +0100 Subject: [PATCH 3/4] #159: Do not include the qr code in the payment create request --- app/code/community/Mollie/Mpm/Model/Client/Payments.php | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/app/code/community/Mollie/Mpm/Model/Client/Payments.php b/app/code/community/Mollie/Mpm/Model/Client/Payments.php index 982f766f..52eb8a37 100644 --- a/app/code/community/Mollie/Mpm/Model/Client/Payments.php +++ b/app/code/community/Mollie/Mpm/Model/Client/Payments.php @@ -105,7 +105,7 @@ public function startTransaction(Mage_Sales_Model_Order $order) $paymentData = $this->mollieHelper->validatePaymentData($paymentData); $this->mollieHelper->addTolog('request', $paymentData); - $payment = $mollieApi->payments->create($paymentData, array('include' => 'details.qrCode')); + $payment = $mollieApi->payments->create($paymentData); $this->processResponse($order, $payment); return $payment->getCheckoutUrl(); From 9f92561b678f030f2da98c0b988409a09e053228 Mon Sep 17 00:00:00 2001 From: Marvin-Magmodules Date: Fri, 21 Feb 2020 09:52:53 +0100 Subject: [PATCH 4/4] Version bump --- app/code/community/Mollie/Mpm/etc/config.xml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/app/code/community/Mollie/Mpm/etc/config.xml b/app/code/community/Mollie/Mpm/etc/config.xml index 90f26fdc..600e7ea7 100644 --- a/app/code/community/Mollie/Mpm/etc/config.xml +++ b/app/code/community/Mollie/Mpm/etc/config.xml @@ -33,7 +33,7 @@ - 5.5.4 + 5.5.5