Skip to content

Commit

Permalink
hotfix invalid return type (#84)
Browse files Browse the repository at this point in the history
* hotfix invalid return type

* version bump
  • Loading branch information
tikohov20 authored Jul 12, 2023
1 parent 18d1871 commit e9c967e
Show file tree
Hide file tree
Showing 6 changed files with 15 additions and 13 deletions.
14 changes: 8 additions & 6 deletions Controller/Payment/Checkout/AbstractPaymentController.php
Original file line number Diff line number Diff line change
Expand Up @@ -89,39 +89,41 @@ public function __construct(
$this->jsonResultFactory = $jsonResultFactory;
}


/**
* Redirect user to url
* Redirect to url
*
* @param string $path
* @return void
* @return ResponseInterface
*/
protected function redirect($path)
{
$this->redirect->redirect($this->response, $path);
return $this->response;
}

/**
* Process exceptions
*
* @param \Exception $e
* @param string $message
* @return void
* @return ResponseInterface
*/
protected function processException(\Exception $e, $message)
{
$this->messageManager->addExceptionMessage($e, __($message));
$this->redirect('checkout/cart');
return $this->redirect('checkout/cart');
}

/**
* Redirect with error message
*
* @param string $message
* @return void
* @return ResponseInterface
*/
protected function redirectWithErrorMessage($message)
{
$this->messageManager->addErrorMessage(__($message));
$this->redirect('checkout/cart');
return $this->redirect('checkout/cart');
}
}
2 changes: 1 addition & 1 deletion Controller/Payment/Checkout/Cancel.php
Original file line number Diff line number Diff line change
Expand Up @@ -9,6 +9,6 @@ class Cancel extends AbstractPaymentController
*/
public function execute()
{
$this->redirectWithErrorMessage('Mondu: Order has been canceled');
return $this->redirectWithErrorMessage('Mondu: Order has been canceled');
}
}
2 changes: 1 addition & 1 deletion Controller/Payment/Checkout/Decline.php
Original file line number Diff line number Diff line change
Expand Up @@ -9,6 +9,6 @@ class Decline extends AbstractPaymentController
*/
public function execute()
{
$this->redirectWithErrorMessage('Mondu: Order has been declined');
return $this->redirectWithErrorMessage('Mondu: Order has been declined');
}
}
6 changes: 3 additions & 3 deletions Controller/Payment/Checkout/Success.php
Original file line number Diff line number Diff line change
Expand Up @@ -42,12 +42,12 @@ public function execute()
$this->orderSender->send($order);
}
}
$this->redirect('checkout/onepage/success/');
return $this->redirect('checkout/onepage/success/');

} catch (LocalizedException $e) {
$this->processException($e, 'Mondu: An error occurred while trying to confirm the order');
return $this->processException($e, 'Mondu: An error occurred while trying to confirm the order');
} catch (\Exception $e) {
$this->processException($e, 'Mondu: Error during the order process');
return $this->processException($e, 'Mondu: Error during the order process');
}
}
}
2 changes: 1 addition & 1 deletion composer.json
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@
"name": "mondu_gmbh/magento2-payment",
"description": "Mondu payment method for magento 2",
"type": "magento2-module",
"version": "2.1.0",
"version": "2.1.1",
"license": [
"MIT"
],
Expand Down
2 changes: 1 addition & 1 deletion etc/module.xml
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
<?xml version="1.0"?>
<config xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:noNamespaceSchemaLocation="urn:magento:framework:Module/etc/module.xsd">
<module name="Mondu_Mondu" setup_version="2.1.0">
<module name="Mondu_Mondu" setup_version="2.1.1">
<sequence>
<module name="Magento_Sales"/>
<module name="Magento_Payment"/>
Expand Down

0 comments on commit e9c967e

Please sign in to comment.