-
Notifications
You must be signed in to change notification settings - Fork 9.4k
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge pull request #9302 from adobe-commerce-tier-4/PR-14-10-2024
[Support Tier-4 chittima] 14-10-2024 Regular delivery of bugfixes and improvements
- Loading branch information
Showing
20 changed files
with
432 additions
and
186 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
43 changes: 43 additions & 0 deletions
43
app/code/Magento/Quote/Plugin/Webapi/Model/ErrorRedirectProcessor.php
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,43 @@ | ||
<?php | ||
/** | ||
* Copyright 2024 Adobe | ||
* All Rights Reserved. | ||
*/ | ||
declare(strict_types=1); | ||
|
||
namespace Magento\Quote\Plugin\Webapi\Model; | ||
|
||
use Magento\Framework\Validator\Exception as ValidatorException; | ||
use Magento\Framework\Webapi\Rest\Response as RestResponse; | ||
use Magento\Quote\Model\Quote; | ||
use Magento\Quote\Model\QuoteValidator; | ||
|
||
class ErrorRedirectProcessor | ||
{ | ||
/** | ||
* @param RestResponse $restResponse | ||
*/ | ||
public function __construct( | ||
private readonly RestResponse $restResponse | ||
) { | ||
} | ||
|
||
/** | ||
* Set errorRedirectAction in case of exception. | ||
* | ||
* @param QuoteValidator $subject | ||
* @param callable $proceed | ||
* @param Quote $quote | ||
*/ | ||
public function aroundValidateBeforeSubmit(QuoteValidator $subject, callable $proceed, Quote $quote) | ||
{ | ||
try { | ||
$result = $proceed($quote); | ||
} catch (ValidatorException $e) { | ||
$this->restResponse->setHeader('errorRedirectAction', '#shipping'); | ||
throw $e; | ||
} | ||
|
||
return $result; | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Oops, something went wrong.