statusGateway = $statusGateway; $this->ticketGateway = $ticketGateway; $this->emailSenderHelper = $emailSenderHelper; $this->userGateway = $userGateway; $this->auditTrailGateway = $auditTrailGateway; } /** * @param $replyRequest CreateReplyRequest * @param $heskSettings array * @param $modsForHeskSettings array * @param $userContext UserContext * @throws ApiFriendlyException */ function createReplyByCustomer($replyRequest, $heskSettings, $modsForHeskSettings, $userContext) { $ticket = $this->ticketGateway->getTicketByTrackingId($replyRequest->trackingId, $heskSettings); if ($ticket === null) { throw new ApiFriendlyException("Ticket with tracking ID {$replyRequest->trackingId} not found.", "Ticket not found", 404); } $validationModel = new ValidationModel(); if (!strlen($replyRequest->replyMessage)) { $validationModel->errorKeys[] = 'MESSAGE_REQUIRED'; } if ($modsForHeskSettings['rich_text_for_tickets_for_customers']) { $replyRequest->replyMessage = Helpers::heskMakeUrl($replyRequest->replyMessage); $replyRequest->replyMessage = nl2br($replyRequest->replyMessage); } } }