src/Controllers/AccountTicketController.php
public function createTicket(Ticket $ticket, $author, $authorEmail)
    {
        if (filter_var($authorEmail, FILTER_VALIDATE_EMAIL) === false)
        {
            throw new InvalidArgumentException($authorEmail . " is not a valid email address.");
        }

        $result = $this->httpHelper->post("/tickets", [
            'subject' => $ticket->getSubject(),
            'type' => 'public',
            'inbound_email_account_id' => $ticket->getInboundEmailAccountID(),
            'ticket_group_id' => $ticket->getTicketGroupID(),
            'user_id' => $ticket->getUserID(),
            'assignee' => 'accounts',
            'assignee_id' => $ticket->getAccountID(),
            'email_address' => $ticket->getEmailAddress(),
            'priority' => $ticket->getPriority(),
            'comment' => "Created via the customer portal framework.",
        ]);

        $this->httpHelper->post("/tickets/" . $result->id . "/ticket_replies", [
            'text' => $ticket->getDescription(),
            'incoming' => true,
            'author' => $author,
            'author_email' => $authorEmail,
        ]);

        return $result;
    }
public function createTicket(Ticket $ticket, $author, $authorEmail)
    {
        if (filter_var($authorEmail, FILTER_VALIDATE_EMAIL) === false)
        {
            throw new InvalidArgumentException($authorEmail . " is not a valid email address.");
        }

        $result = $this->httpHelper->post("/tickets", [
            'subject' => $ticket->getSubject(),
            'type' => 'public',
            'inbound_email_account_id' => $ticket->getInboundEmailAccountID(),
            'ticket_group_id' => $ticket->getTicketGroupID(),
            'user_id' => $ticket->getUserID(),
            'assignee' => 'accounts',
            'assignee_id' => $ticket->getAccountID(),
            'email_address' => $ticket->getEmailAddress(),
            'priority' => $ticket->getPriority(),
            'comment' => "Created via the customer portal framework.",
        ]);

        $this->httpHelper->post("/tickets/" . $result->id . "/ticket_replies", [
            'text' => $ticket->getDescription(),
            'incoming' => true,
            'author' => $author,
            'author_email' => $authorEmail,
        ]);

        return $result;
    }
public function createTicket ( Ticket $ ticket , $ author , $ authorEmail ) { if ( filter_var ( $ authorEmail , FILTER_VALIDATE_EMAIL ) === false ) { throw new InvalidArgumentException ( $ authorEmail . " is not a valid email address." ) ; } $ result = $ this -> httpHelper -> post ( "/tickets" , [ 'subject' => $ ticket -> getSubject ( ) , 'type' => 'public' , 'inbound_email_account_id' => $ ticket -> getInboundEmailAccountID ( ) , 'ticket_group_id' => $ ticket -> getTicketGroupID ( ) , 'user_id' => $ ticket -> getUserID ( ) , 'assignee' => 'accounts' , 'assignee_id' => $ ticket -> getAccountID ( ) , 'email_address' => $ ticket -> getEmailAddress ( ) , 'priority' => $ ticket -> getPriority ( ) , 'comment' => "Created via the customer portal framework." , ] ) ; $ this -> httpHelper -> post ( "/tickets/" . $ result -> id . "/ticket_replies" , [ 'text' => $ ticket -> getDescription ( ) , 'incoming' => true , 'author' => $ author , 'author_email' => $ authorEmail , ] ) ; return $ result ; }
Create a new ticket. The first input from the customer will be posted as an incoming reply.
@param Ticket $ticket
@param $author
@param $authorEmail
@return mixed
@throws \SonarSoftware\CustomerPortalFramework\Exceptions\ApiException
Create a new ticket . The first input from the customer will be posted as an incoming reply .