/** * Validate an operation * * @param OperationInterface $operation * * @return bool */ public function isOperationValid(OperationInterface $operation) { try { if ($this->operationManager->findByMiraklIdAndPaymentVoucherNumber($operation->getMiraklId(), $operation->getPaymentVoucher())) { throw new AlreadyCreatedOperationException($operation); } if (!$this->operationManager->isValid($operation)) { throw new InvalidOperationException($operation); } ModelValidator::validate($operation); } catch (Exception $e) { $this->handleException($e); return false; } return true; }