/** * @param \Orm\Zed\Discount\Persistence\SpyDiscountVoucher $discountVoucherEntity * * @return array|string[] */ protected function validateDiscountVoucher(SpyDiscountVoucher $discountVoucherEntity) { if (!$discountVoucherEntity->getIsActive()) { $this->addMessage(self::REASON_VOUCHER_CODE_NOT_ACTIVE); return false; } $voucherPoolEntity = $discountVoucherEntity->getVoucherPool(); if (!$voucherPoolEntity) { $this->addMessage(self::REASON_VOUCHER_CODE_POOL_MISSING); return false; } if (!$voucherPoolEntity->getIsActive()) { $this->addMessage(self::REASON_VOUCHER_CODE_POOL_NOT_ACTIVE); return false; } if (!$this->isValidNumberOfUses($discountVoucherEntity)) { $this->addMessage(self::REASON_VOUCHER_CODE_LIMIT_REACHED); return false; } return true; }