Skip to content

Commit

Permalink
2.4.4 - when cart id on recovery link is invalid then redirect to the…
Browse files Browse the repository at this point in the history
… cart page instead of showing 404
  • Loading branch information
bnayalivne committed Sep 7, 2020
1 parent 6ffb1e5 commit 2891810
Show file tree
Hide file tree
Showing 4 changed files with 12 additions and 17 deletions.
23 changes: 9 additions & 14 deletions Controller/Frontend/Recovery.php
Original file line number Diff line number Diff line change
Expand Up @@ -20,8 +20,6 @@

class Recovery extends \Magento\Framework\App\Action\Action
{
const MESSAGE_ERROR_WRONG_QUOTE_ID = 'Quote identifier has been not passed or it does not exists.';

protected $quoteFactory;
protected $checkoutSession;
protected $responseFactory;
Expand Down Expand Up @@ -61,19 +59,16 @@ public function __construct(
*/
public function execute()
{
$hashCart = $this->getRequest()->getParam('cart');

if (!$hashCart) {
throw new NotFoundException(__(self::MESSAGE_ERROR_WRONG_QUOTE_ID));
}

$quote_id = $this->recoveryHelper->decodeQuoteId($hashCart);

if (!is_int($quote_id)) {
throw new NotFoundException(__(self::MESSAGE_ERROR_WRONG_QUOTE_ID));
}

try {
$hashCart = $this->getRequest()->getParam('cart');
if (!$hashCart) {
throw new NotFoundException(__('Missing cart id in URL'));
}
$quote_id = $this->recoveryHelper->decodeQuoteId($hashCart);
if (!is_int($quote_id)) {
throw new NotFoundException(__('Invalid cart id from URL'));
}

$current_quote = $this->checkoutSession->getQuoteId();
if($current_quote != $quote_id) {
$quote = $this->quoteFactory->create()->load($quote_id);
Expand Down
2 changes: 1 addition & 1 deletion Model/Api/Data.php
Original file line number Diff line number Diff line change
Expand Up @@ -1369,7 +1369,7 @@ public function setConfig($mage_store_id, $configName, $scope, $newValue)
*/
public function getVersion()
{
return '2.4.3';
return '2.4.4';
}

/**
Expand Down
2 changes: 1 addition & 1 deletion composer.json
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,7 @@
"lib-libxml": "*"
},
"type": "magento2-module",
"version": "2.4.3",
"version": "2.4.4",
"license": [
"OSL-3.0",
"AFL-3.0"
Expand Down
2 changes: 1 addition & 1 deletion etc/module.xml
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
<?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="Remarkety_Mgconnector" setup_version="2.4.3">
<module name="Remarkety_Mgconnector" setup_version="2.4.4">
</module>
</config>

0 comments on commit 2891810

Please sign in to comment.