Skip to content

Commit

Permalink
Merge pull request #161 from mollie/5.5.5
Browse files Browse the repository at this point in the history
5.5.5
  • Loading branch information
Marvin-Magmodules authored Feb 26, 2020
2 parents f3e6c8d + af6abe8 commit 18a6b25
Show file tree
Hide file tree
Showing 4 changed files with 8 additions and 6 deletions.
2 changes: 1 addition & 1 deletion app/code/community/Mollie/Mpm/Model/Client/Payments.php
Original file line number Diff line number Diff line change
Expand Up @@ -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();
Expand Down
1 change: 1 addition & 0 deletions app/code/community/Mollie/Mpm/Model/Mollie.php
Original file line number Diff line number Diff line change
Expand Up @@ -171,6 +171,7 @@ public function processTransaction($orderId, $type = 'webhook', $paymentToken =
$connection->rollback();
throw $exception;
} finally {
$order->save();
$this->commitOrder($order);
$connection->commit();
}
Expand Down
9 changes: 5 additions & 4 deletions app/code/community/Mollie/Mpm/controllers/ApiController.php
Original file line number Diff line number Diff line change
Expand Up @@ -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) {
Expand All @@ -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;
}

Expand All @@ -139,7 +140,7 @@ protected function _cancelUnprocessedOrder($order, $message = null)
$order->getStoreId()
);

if (!$cancelFailedOrders) {
if (!$forceCancel && !$cancelFailedOrders) {
return;
}

Expand Down
2 changes: 1 addition & 1 deletion app/code/community/Mollie/Mpm/etc/config.xml
Original file line number Diff line number Diff line change
Expand Up @@ -33,7 +33,7 @@
<config>
<modules>
<Mollie_Mpm>
<version>5.5.4</version>
<version>5.5.5</version>
</Mollie_Mpm>
</modules>
<global>
Expand Down

0 comments on commit 18a6b25

Please sign in to comment.