getContainer()->getPermissionsService()->currentUserCanRead(Entities::FINANCE)) { throw new AccessDeniedException('You are not allowed to read payment.'); } $result = new CommandResult(); $this->checkMandatoryFields($command); /** @var PaymentRepository $paymentRepository */ $paymentRepository = $this->container->get('domain.payment.repository'); $payment = $paymentRepository->getById($command->getArg('id')); if (!$payment instanceof Payment) { $result->setResult(CommandResult::RESULT_ERROR); $result->setMessage('Could not get payment payment.'); return $result; } $result->setResult(CommandResult::RESULT_SUCCESS); $result->setMessage('Successfully retrieved payment.'); $result->setData( [ Entities::PAYMENT => $payment->toArray(), ] ); return $result; } }