-
-
Notifications
You must be signed in to change notification settings - Fork 2.1k
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
[CatalogPromotions][API] Removal of catalog promotions #14270
[CatalogPromotions][API] Removal of catalog promotions #14270
Conversation
features/promotion/removing_catalog_promotions/removing_catalog_promotions.feature
Outdated
Show resolved
Hide resolved
src/Sylius/Bundle/CoreBundle/Resources/config/app/messenger.yaml
Outdated
Show resolved
Hide resolved
...ylius/Bundle/CoreBundle/CatalogPromotion/CommandHandler/TerminateCatalogPromotionHandler.php
Outdated
Show resolved
Hide resolved
src/Sylius/Bundle/ApiBundle/Controller/TerminateCatalogPromotionAction.php
Outdated
Show resolved
Hide resolved
...ylius/Bundle/CoreBundle/CatalogPromotion/CommandHandler/TerminateCatalogPromotionHandler.php
Outdated
Show resolved
Hide resolved
...dle/CoreBundle/spec/CatalogPromotion/CommandHandler/TerminateCatalogPromotionHandlerSpec.php
Outdated
Show resolved
Hide resolved
...Bundle/CoreBundle/spec/CatalogPromotion/CommandHandler/RemoveCatalogPromotionHandlerSpec.php
Outdated
Show resolved
Hide resolved
src/Sylius/Bundle/CoreBundle/Resources/config/app/state_machine/sylius_catalog_promotion.yaml
Outdated
Show resolved
Hide resolved
src/Sylius/Bundle/CoreBundle/CatalogPromotion/CommandHandler/RemoveCatalogPromotionHandler.php
Outdated
Show resolved
Hide resolved
src/Sylius/Bundle/ApiBundle/Controller/TerminateCatalogPromotionAction.php
Outdated
Show resolved
Hide resolved
src/Sylius/Bundle/ApiBundle/Controller/TerminateCatalogPromotionAction.php
Outdated
Show resolved
Hide resolved
src/Sylius/Bundle/ApiBundle/Controller/TerminateCatalogPromotionAction.php
Outdated
Show resolved
Hide resolved
...ylius/Bundle/CoreBundle/CatalogPromotion/CommandHandler/TerminateCatalogPromotionHandler.php
Outdated
Show resolved
Hide resolved
src/Sylius/Bundle/CoreBundle/Resources/config/app/messenger.yaml
Outdated
Show resolved
Hide resolved
...oreBundle/spec/CatalogPromotion/CommandHandler/RemoveInactiveCatalogPromotionHandlerSpec.php
Outdated
Show resolved
Hide resolved
.../Bundle/CoreBundle/CatalogPromotion/CommandHandler/RemoveInactiveCatalogPromotionHandler.php
Outdated
Show resolved
Hide resolved
.../Bundle/CoreBundle/CatalogPromotion/CommandHandler/RemoveInactiveCatalogPromotionHandler.php
Outdated
Show resolved
Hide resolved
.../Bundle/CoreBundle/CatalogPromotion/CommandHandler/RemoveInactiveCatalogPromotionHandler.php
Show resolved
Hide resolved
src/Sylius/Bundle/CoreBundle/CatalogPromotion/Processor/CatalogPromotionRemovalProcessor.php
Outdated
Show resolved
Hide resolved
src/Sylius/Bundle/CoreBundle/CatalogPromotion/Processor/CatalogPromotionRemovalProcessor.php
Outdated
Show resolved
Hide resolved
src/Sylius/Bundle/CoreBundle/CatalogPromotion/Command/RemoveInactiveCatalogPromotion.php
Show resolved
Hide resolved
src/Sylius/Bundle/CoreBundle/CatalogPromotion/Processor/CatalogPromotionRemovalProcessor.php
Outdated
Show resolved
Hide resolved
src/Sylius/Bundle/CoreBundle/CatalogPromotion/Processor/CatalogPromotionRemovalProcessor.php
Outdated
Show resolved
Hide resolved
src/Sylius/Bundle/ApiBundle/Controller/RemoveCatalogPromotionAction.php
Outdated
Show resolved
Hide resolved
.../Bundle/CoreBundle/CatalogPromotion/CommandHandler/RemoveInactiveCatalogPromotionHandler.php
Show resolved
Hide resolved
...ylius/Bundle/CoreBundle/CatalogPromotion/Exception/InvalidCatalogPromotionStateException.php
Outdated
Show resolved
Hide resolved
… promotion resource
$catalogPromotion = $this->getCatalogPromotion($catalogPromotionCode); | ||
|
||
if ($catalogPromotion->getState() === CatalogPromotionStates::STATE_INACTIVE) { | ||
$this->announceInactiveCatalogPromotionRemoval($catalogPromotionCode); |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
If in this case Catalog Promotion goes into the processing
state and then is removed?
try { | ||
$this->catalogPromotionRemovalProcessor->removeCatalogPromotion($request->attributes->get('code')); | ||
|
||
return new Response(status: Response::HTTP_ACCEPTED); |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
return new Response(status: Response::HTTP_ACCEPTED); | |
return new JsonResponse(status: Response::HTTP_ACCEPTED); |
?
$this->eventBus->dispatch(new CatalogPromotionEnded($catalogPromotionCode)); | ||
} | ||
|
||
private function announceInactiveCatalogPromotionRemoval(string $catalogPromotionCode): void |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
You are dispatching here a command, not an event, so announce
is not the best word in my opinion, I would be for simplifying it to:
private function announceInactiveCatalogPromotionRemoval(string $catalogPromotionCode): void | |
private function removeInactiveCatalogPromotion(string $catalogPromotionCode): void |
Thanks, Rafał! 🥇 |
…mented for CatalogPromotion removing (Rafikooo) This PR was merged into the 1.12 branch. Discussion ---------- | Q | A | |-----------------|--------------------------------------------------------------| | Branch? | 1.12 <!-- see the comment below --> | | Bug fix? | yes | | New feature? | no | | BC breaks? | no | | Deprecations? | no <!-- don't forget to update the UPGRADE-*.md file --> | | Related tickets | #14270 | License | MIT | Missing swagger responses block: <img width="1049" alt="image" src="https://user-images.githubusercontent.com/40125720/190454287-24f1268f-51b3-4998-a01c-33825f3e68e5.png"> Commits ------- 0140915 [CatalogPromotions][Swagger] HTTP Response statuses documented for CatalogPromotion removing
…(Rafikooo) This PR was merged into the 1.12 branch. Discussion ---------- | Q | A | |-----------------|--------------------------------------------------------------| | Branch? | 1.12 <!-- see the comment below --> | | Bug fix? | no | | New feature? | yes | | BC breaks? | yes | | Deprecations? | no <!-- don't forget to update the UPGRADE-*.md file --> | | Related tickets | #14270 | License | MIT | <img width="1159" alt="image" src="https://user-images.githubusercontent.com/40125720/189155094-6d322ff0-d207-4193-9ff4-aa00af69e429.png"> Commits ------- 15f3696 [CatalogPromotions][Behat][UI] Removing catalog promotion scenarios implemented c95d73a [CatalogPromotions][UI] Removing catalog promotion
…ns documented (Rafikooo) This PR was merged into the 1.12 branch. Discussion ---------- | Q | A | |-----------------|--------------------------------------------------------------| | Branch? | 1.12 <!-- see the comment below --> | | Bug fix? | no | | New feature? | yes | | BC breaks? | no | | Deprecations? | no <!-- don't forget to update the UPGRADE-*.md file --> | | Related tickets | #14270 #14291 | License | MIT | <img width="791" alt="image" src="https://user-images.githubusercontent.com/40125720/190518685-4b30f80e-8c19-411f-ab15-6669318391a2.png"> <img width="799" alt="image" src="https://user-images.githubusercontent.com/40125720/190518521-82f1814d-6fc6-4d91-9702-b32c52f24c1e.png"> Commits ------- 620a7ba [CatalogPromotions][Docs] Removing of catalog promotions documented
This PR introduced a way to remove catalog promotions. As this operation may have an impact on the prices of the products, it is divided into two parts. First, ( if catalog promotion is eligible ) disabling considered promotion, and second, actually remove it. We can take advantage of Symfony messenger and the prepared configuration of three transports ( failed included ) or perform it without the messenger - synchronously.
Configuration of transports: