-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
CC-34501: Initialisation Order Amendment Process (#11163)
CC-34501 Initialisation Order Amendment Process
- Loading branch information
Showing
3 changed files
with
55 additions
and
0 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
46 changes: 46 additions & 0 deletions
46
...tList/Communication/Plugin/CartReorder/ProductListRestrictedItemsCartPreReorderPlugin.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,46 @@ | ||
<?php | ||
|
||
/** | ||
* Copyright © 2016-present Spryker Systems GmbH. All rights reserved. | ||
* Use of this software requires acceptance of the Evaluation License Agreement. See LICENSE file. | ||
*/ | ||
|
||
namespace Spryker\Zed\ProductList\Communication\Plugin\CartReorder; | ||
|
||
use Generated\Shared\Transfer\CartReorderRequestTransfer; | ||
use Generated\Shared\Transfer\CartReorderTransfer; | ||
use Generated\Shared\Transfer\QuoteTransfer; | ||
use Spryker\Zed\CartReorderExtension\Dependency\Plugin\CartPreReorderPluginInterface; | ||
use Spryker\Zed\Kernel\Communication\AbstractPlugin; | ||
|
||
/** | ||
* @method \Spryker\Zed\ProductList\Business\ProductListFacadeInterface getFacade() | ||
* @method \Spryker\Zed\ProductList\ProductListConfig getConfig() | ||
*/ | ||
class ProductListRestrictedItemsCartPreReorderPlugin extends AbstractPlugin implements CartPreReorderPluginInterface | ||
{ | ||
/** | ||
* {@inheritDoc} | ||
* - Filters out restricted items from the cart reorder request. | ||
* - Adds note to messages about removed items. | ||
* | ||
* @api | ||
* | ||
* @param \Generated\Shared\Transfer\CartReorderRequestTransfer $cartReorderRequestTransfer | ||
* @param \Generated\Shared\Transfer\CartReorderTransfer $cartReorderTransfer | ||
* | ||
* @return \Generated\Shared\Transfer\CartReorderTransfer | ||
*/ | ||
public function preReorder( | ||
CartReorderRequestTransfer $cartReorderRequestTransfer, | ||
CartReorderTransfer $cartReorderTransfer | ||
): CartReorderTransfer { | ||
$quoteTransfer = (new QuoteTransfer()) | ||
->setCustomer($cartReorderTransfer->getQuoteOrFail()->getCustomer()) | ||
->setItems($cartReorderTransfer->getOrderItems()); | ||
|
||
$quoteTransfer = $this->getFacade()->filterRestrictedItems($quoteTransfer); | ||
|
||
return $cartReorderTransfer->setOrderItems($quoteTransfer->getItems()); | ||
} | ||
} |