/** * Applies Coupon in Cart, and flushes it * * @param CartCouponOnApplyEvent $event Event * * @throws CouponRulesNotValidateException Invalid rules */ public function onCartCouponApply(CartCouponOnApplyEvent $event) { $cart = $event->getCart(); $coupon = $event->getCoupon(); if (!$this->cartCouponRuleManager->checkCouponValidity($cart, $coupon)) { $this->cartCouponEventDispatcher->dispatchCartCouponOnRejectedEvent($cart, $coupon); $event->stopPropagation(); } }