Example #1
0
 /**
  * {@inheritdoc}
  */
 public function isEligible(PromotionSubjectInterface $subject, array $configuration)
 {
     if (!$subject instanceof OrderInterface) {
         throw new UnsupportedTypeException($subject, 'Sylius\\Component\\Core\\Model\\OrderInterface');
     }
     if (null === ($user = $subject->getUser())) {
         return false;
     }
     return $this->orderRepository->countByUserAndPaymentState($user, PaymentInterface::STATE_COMPLETED) === $configuration['nth'] - 1;
 }