/// <summary> /// Fetch a single notification from the Plot back-end server /// </summary> /// <param name="notificationId">Id og the notification to fetch</param> /// <returns>Entity containing the notification data</returns> public SelectNotification GetNotification(string notificationId) { CheckNotAdmin(); const string Function = "notification"; HttpWebRequest webRequest = GetWebRequest("GET", Function, null, notificationId); GetNotificationResponse response = GetJSONresponse <GetNotificationResponse>(webRequest); if (response == null) { throw new Exception("No response."); } // check the result codes: response.Check(); SelectNotification ret = null; if (response.Result != null) { ret = new SelectNotification() { ID = response.Result.ID, StoreId = response.Result.PlaceId, State = response.Result.State.AsEnum <State>(), Message = response.Result.Message, Data = response.Result.Data, MatchRange = response.Result.MatchRange, Created = response.Result.Created.AsDateTime(true).Value, Timespans = response.Result.Timespans == null ? new Plot.Entities.SelectNotification.Timespan[] { } : response.Result.Timespans.Select(t => new Plot.Entities.SelectNotification.Timespan() { Start = t.Start.AsDateTime(), End = t.End.AsDateTime() }).ToArray() } } ; return(ret); }
public static async Task <GetNotificationResponse> GetNotificationUserForApiPartnerByNodeExample(int nodeId) { GetNotificationResponse response = await DataExchangeAPI.GetNotificationForApiPartnerByNode(nodeId); return(response); }
/// <summary> /// Crea el response del API Movilway dependiendo de la operacion /// </summary> protected override AGenericApiResponse CreateResponseObject(string PageContent, int BranchId = -1, string CountryAcronym = null) { AGenericApiResponse objectData = null; XmlDocument xmlDoc = new XmlDocument(); string statuscode = ""; string message = ""; xmlDoc.LoadXml(PageContent); statuscode = xmlDoc.DocumentElement.SelectSingleNode("response/operation/result/statuscode").InnerText; message = xmlDoc.DocumentElement.SelectSingleNode("response/operation/result/message").InnerText; XmlNode NodeDetails = xmlDoc.DocumentElement.SelectSingleNode("response/operation/Details"); objectData = new GetNotificationResponse(); if (NodeDetails != null && statuscode.Equals("200")) { ((GetNotificationResponse)objectData).ResponseCode = 0; ((GetNotificationResponse)objectData).ResponseMessage = "Transacción aprobada"; string[] camposxmlResponseGet = GetcamposxmlOutput; foreach (string nameItem in camposxmlResponseGet) { XmlNode tempNode = NodeDetails.SelectSingleNode("parameter[name[text() = '" + nameItem.ToUpper() + "']]"); if (tempNode != null) { string valueItem = tempNode.SelectSingleNode("value").InnerText; if (nameItem.Equals("notifyid")) { ((GetNotificationResponse)objectData).Notificationid = Convert.ToInt32(valueItem); } else if (nameItem.Equals("from")) { ((GetNotificationResponse)objectData).From = valueItem; } else if (nameItem.Equals("createddate")) { ((GetNotificationResponse)objectData).Createdate = UtilsSOSIT.FromUtcToLocalTime(valueItem); } else if (nameItem.Equals("title")) { ((GetNotificationResponse)objectData).Title = valueItem; } else if (nameItem.Equals("description")) { ((GetNotificationResponse)objectData).Description = Encoding.UTF8.GetString(Encoding.Default.GetBytes(valueItem));; } else if (nameItem.Equals("toaddress")) { ((GetNotificationResponse)objectData).Toaddress = valueItem; } } } } else { ((GetNotificationResponse)objectData).ResponseCode = 07; ((GetNotificationResponse)objectData).ResponseMessage = "No fue posible consultar la Nota de una solicitud"; } return(objectData); }
public static async Task <GetNotificationResponse> GetNotificationUserForApiPartnerExample() { GetNotificationResponse response = await DataExchangeAPI.GetNotificationForApiPartner(); return(response); }