Exemplo n.º 1
0
        public void GetRequester()
        {
            TicketRequester requester = new TicketRequester();

            requester        = helper.GetRequester(RequesterID);
            FromEmailAddress = requester.Email;
            FromEmailName    = requester.Name;
        }
Exemplo n.º 2
0
        public TicketRequester GetRequester(long requesterID)
        {
            TicketRequester requester = new TicketRequester();

            IResponse <ZendeskApi.Contracts.Models.User> user = client.Users.Get(requesterID);

            requester.Email  = user.Item.Email;
            requester.Name   = user.Item.Name;
            requester.Locale = user.Item.LocalId;

            return(requester);
        }
Exemplo n.º 3
0
        public long?CreateNewZendeskTicketWithPDFFile(MemoryFile file, string rmaNo, string amazonBucketURL, string customerEmail, string customerName,
                                                      bool fileAttached, string ExtDocNo, bool validURL)
        {
            ConnectToZendesk();

            string uploadToken = string.Empty;
            long?  createdTicketID;
            Ticket newTicket       = new Ticket();
            Ticket updateNewTicket = new Ticket();
            Ticket ticketReponse;

            // First we need to create the Zendesk Ticket per the customer request BEFORE we send the return shipping information
            newTicket.Subject = "Return Label Request for: " + ExtDocNo;

            TicketComment newComment = new TicketComment
            {
                IsPublic = true,
                Type     = TicketEventType.Comment,
                Body     = "Return Label Request"
            };

            newTicket.Comment = newComment;

            Via via = new Via
            {
                Channel = "web_service"
            };

            newTicket.Via = via;

            TicketRequester ticketRequester = new TicketRequester
            {
                Name  = customerName,
                Email = customerEmail,
            };

            newTicket.Requester = ticketRequester;
            newTicket.Recipient = customerEmail;

            TicketRequest newRequest = new TicketRequest
            {
                Item = newTicket
            };

            IResponse <Ticket> responseTicket = client.Tickets.Post(newRequest);

            // We need to retrieve the ticket ID of the newly created Ticket

            createdTicketID = responseTicket.Item.Id;
            string ticketID = createdTicketID.ToString();

            long.TryParse(ticketID, out long updateTicketID);

            // Now we immediately update the newly created ticket with the return shipping information
            IResponse <Ticket> updateTicketResponse = client.Tickets.Get(createdTicketID.Value);

            ticketReponse   = updateTicketResponse.Item;
            updateNewTicket = ticketReponse;

            //UpdateZendeskTicketWithPDFFile(updateTicketID, file, rmaNo, amazonBucketURL, fileAttached);

            TicketComment comment = new TicketComment
            {
                IsPublic = true,
                Type     = TicketEventType.Comment,
                Id       = createdTicketID
            };

            if (fileAttached)
            {
                IResponse <Upload> response = client.Upload.Post(new UploadRequest
                {
                    Item = file
                });

                uploadToken = response.Item.Token;
                comment.AddAttachmentToComment(uploadToken);

                comment.HtmlBody = @"Hello,
                <br/><br/>
                Your return request has been approved.  Your Return Merchandise Authorization number is " + rmaNo + @".
                <br/><br/>";

                if (validURL)
                {
                    comment.HtmlBody += @"Please see attached document for return instructions and shipping label. Alternatively <a href = '" + amazonBucketURL + @"'> Click Here </a> to download your return instructions and shipping label manually.
                    <br/><br/>";
                }
                comment.HtmlBody += @"IMPORTANT: Please remove ALL locks and passwords. Any device(s) received locked with your information will be denied, returned at your expense with no refund submitted for processing.
                <br/><br/>
                Thank You";
            }
            else if (validURL)
            {
                comment.HtmlBody = @"Hello,
                <br/><br/>
                Your return request has been approved.  Your Return Merchandise Authorization number is " + rmaNo + @".
                <br/><br/>
                <a href='" + amazonBucketURL + @"'>Click Here</a> to download your return instructions and shipping label.
                <br/><br/>
                IMPORTANT: Please remove ALL locks and passwords. Any device(s) received locked with your information will be denied, returned at your expense with no refund submitted for processing.
                <br/><br/>
                Thank You";
            }

            updateNewTicket.Comment = comment;
            updateNewTicket.Status  = TicketStatus.Solved;

            client.Tickets.Put(new TicketRequest {
                Item = updateNewTicket
            });

            return(createdTicketID);
        }