/**
  * @param \Heystack\Deals\Events\ConditionEvent $event
  * @param string $eventName
  * @param \Heystack\Core\EventDispatcher $dispatcher
  * @return void
  */
 public function onConditionsNotMet(ConditionEvent $event, $eventName, EventDispatcher $dispatcher)
 {
     $dealIdentifier = $this->getDealHandler()->getIdentifier();
     if ($dealIdentifier->isMatch($event->getDealHandler()->getIdentifier())) {
         if (($purchasable = $this->getPurchasable()) instanceof DealPurchasableInterface) {
             $purchasable->setFreeQuantity($dealIdentifier, 0);
             if ($purchasable->getQuantity() == 0 && array_sum($purchasable->getFreeQuantities()) === 0) {
                 $this->eventService->setEnabled(false);
                 $this->purchasableHolder->removePurchasable($purchasable->getIdentifier());
                 $this->eventService->setEnabled(true);
             }
         }
     }
     $this->purchasableHolder->saveState();
 }
 /**
  * Remove the deals effects
  * @param \Heystack\Deals\Events\ConditionEvent $event
  * @param string $eventName
  * @param \Heystack\Core\EventDispatcher $dispatcher
  * @return void
  */
 public function onConditionsNotMet(ConditionEvent $event, $eventName, EventDispatcher $dispatcher)
 {
     $eventDealHandler = $event->getDealHandler();
     $eventDealIdentifier = $eventDealHandler->getIdentifier();
     $dealIdentifier = $this->getDealHandler()->getIdentifier();
     if ($dealIdentifier->isMatch($eventDealIdentifier)) {
         foreach ($this->getPurchasables() as $purchasable) {
             if ($purchasable instanceof DealPurchasableInterface) {
                 $purchasable->setFreeQuantity($dealIdentifier, 0);
                 $purchasable->setDealDiscount($dealIdentifier, $this->getCurrencyService()->getZeroMoney());
             }
         }
     }
     // We need to save the purchasable Holder's state because it keeps track of the state of each purchasable
     // in the transaction.
     $this->purchasableHolder->saveState();
 }