public function validateCartCoupons(CartInterface $cart)
    {
        $cartCoupons = $this
            ->cartCouponManager
            ->getCartCoupons($cart);

        foreach ($cartCoupons as $cartCoupon) {
            $coupon = $cartCoupon->getCoupon();

            try {
                $this
                    ->cartCouponEventDispatcher
                    ->dispatchCartCouponOnCheckEvent(
                        $cart,
                        $coupon
                    );
            } catch (AbstractCouponException $exception) {
                $this
                    ->cartCouponManager
                    ->removeCoupon(
                        $cart,
                        $coupon
                    );

                $this
                    ->cartCouponEventDispatcher
                    ->dispatchCartCouponOnRejectedEvent(
                        $cart,
                        $coupon
                    );
            }
        }
    }
public function validateCartCoupons(CartInterface $cart)
    {
        $cartCoupons = $this
            ->cartCouponManager
            ->getCartCoupons($cart);

        foreach ($cartCoupons as $cartCoupon) {
            $coupon = $cartCoupon->getCoupon();

            try {
                $this
                    ->cartCouponEventDispatcher
                    ->dispatchCartCouponOnCheckEvent(
                        $cart,
                        $coupon
                    );
            } catch (AbstractCouponException $exception) {
                $this
                    ->cartCouponManager
                    ->removeCoupon(
                        $cart,
                        $coupon
                    );

                $this
                    ->cartCouponEventDispatcher
                    ->dispatchCartCouponOnRejectedEvent(
                        $cart,
                        $coupon
                    );
            }
        }
    }
public function validateCartCoupons ( CartInterface $ cart ) { $ cartCoupons = $ this -> cartCouponManager -> getCartCoupons ( $ cart ) ; foreach ( $ cartCoupons as $ cartCoupon ) { $ coupon = $ cartCoupon -> getCoupon ( ) ; try { $ this -> cartCouponEventDispatcher -> dispatchCartCouponOnCheckEvent ( $ cart , $ coupon ) ; } catch ( AbstractCouponException $ exception ) { $ this -> cartCouponManager -> removeCoupon ( $ cart , $ coupon ) ; $ this -> cartCouponEventDispatcher -> dispatchCartCouponOnRejectedEvent ( $ cart , $ coupon ) ; } } }
Checks if all Coupons applied to current cart are still valid.
If are not, they will be deleted from the Cart and new Event typeof
CartCouponOnRejected will be dispatched.

@param CartInterface $cart Cart
Checks if all Coupons applied to current cart are still valid . If are not they will be deleted from the Cart and new Event typeof CartCouponOnRejected will be dispatched .