public void MessageStatus(string[] APIMessageID) { //getMessageStatus MessageStatusResponse messageStatusResponse = _apiClient.GetMessageStatus(new APIMessageRequest(APIMessageID)); for (int i = 0; i < messageStatusResponse.MessageStatuses.Length; i += 1) { MessageStatus messageStatus = new MessageStatus(); messageStatus = messageStatusResponse.MessageStatuses[i]; Response.Write("messageStatus:" + i.ToString() + "<br/>" + "messageStatus.APIMessageID : " + messageStatus.APIMessageID + "<br/>" + "messageStatus.Status : " + messageStatus.Status + "<br/>" + "messageStatus.Description: " + messageStatus.Description + "<br/><br/>"); } }
/// <summary> /// Extract MessageStatus from web response /// </summary> /// <param name="response"></param> /// <returns></returns> /// <example>Raw response - ID: 7cc7f93f441819406a6c839564eb89f7 Status: 001</example> private static MessageStatus GetMessageStatusFromResponse(string response) { var messageStatus = new MessageStatus(); if (response.Contains("ID:") && response.Contains("Status:")) { messageStatus.APIMessageID = response.Substring(response.IndexOf(":") + 1, response.LastIndexOf("Status:") - (response.IndexOf(":") + 1)).Trim(); messageStatus.Status = response.Substring(response.LastIndexOf(":") + 1, response.Length - (response.LastIndexOf(":") + 1)).Trim(); messageStatus.Description = GetStatusCodeDescription(messageStatus.Status); } return messageStatus; }