private float GetDocumentPrice(Guid citySender, Guid cityRecipient, enNovaPoshtaDeliveryType serviceType, float weight, float coast) { var model = new NovaPoshtaRequest <NovaRequestPrice> { ApiKey = ApiKey, Language = Language, ModelName = "InternetDocument", CalledMethod = "getDocumentPrice", MethodProperties = new NovaRequestPrice { CitySender = citySender, CityRecipient = cityRecipient, ServiceType = serviceType.ToString(), Weight = weight, Cost = coast } }; var str = MakeRequest(JsonConvert.SerializeObject(model)); var obj = JsonConvert.DeserializeObject <NovaResponse <NovaResponsePrice> >(str); if (obj.Errors != null && obj.Errors.ToString() != "[]") { throw new Exception(obj.Errors.ToString()); } return(obj.Data.First().Cost); }
private DateTime GetDocumentDeliveryDate(Guid citySender, Guid cityRecipient, enNovaPoshtaDeliveryType serviceType, DateTime dateTime) { var model = new NovaPoshtaRequest <NovaRequestDelivery> { ApiKey = ApiKey, Language = Language, ModelName = "InternetDocument", CalledMethod = "getDocumentDeliveryDate", MethodProperties = new NovaRequestDelivery { CitySender = citySender, CityRecipient = cityRecipient, ServiceType = serviceType.ToString(), DateTime = dateTime.ToString("dd.MM.yyyy") } }; var str = MakeRequest(JsonConvert.SerializeObject(model)); var obj = JsonConvert.DeserializeObject <NovaResponse <NovaResponseDeliveryDate> >(str); if (obj.Errors != null && obj.Errors.ToString() != "[]") { throw new Exception(obj.Errors.ToString()); } return(obj.Data.First().DeliveryDate.Date); }