private static void AddNewOrder() { var clientInfo = new ClientInfo { Phone = "0674050505", Name = "Александр Петрович Михайлов", Birthdate = new DateTime( 1958, 2, 17 ), NoSMS = false }; var orderTypes = new[] { OrderTypes.Conditioner }; var orderPoints = new[] { new OrderPointInfo { Number = 1, Address = "Цирк", StreetName = "Победы пл.", House = "2" } }; var orderInfo = new OrderInfo { Client = clientInfo, CarClass = CarClasses.Standard, Passenger = "=== Тест API клиента ===", Address = "Офис", TownName = "Киев", StreetName = "Новоконстантиновская ул.", House = "9", Meet = "Встречайте меня", PayType = PayTypes.Currency, //Preorder = true, //PlannedSupply = DateTime.Now.AddHours( 2 ), //OrderTypes = orderTypes, OrderPoints = orderPoints }; var query = new RequestAddNewOrder { Lang = SysLangs.RU, OrderInfo = orderInfo }; var request = JsonConvert.SerializeObject( query ); var response = service.Execute( _provider, request ); var result = JsonConvert.DeserializeObject<ResponseAddNewOrder>( response ); Console.WriteLine( response ); Console.WriteLine( result ); if( result.Result == ResultCodes.Success ) { _orderId = result.Id; } else { throw new Exception( result.Result.ToString() ); } }
private static void OrderInfoQuery() { var query = new RequestOrderInfoQuery { Lang = SysLangs.RU, Id = _orderId, IncludeRoute = true, IncludeCalcLog = true }; var request = JsonConvert.SerializeObject( query ); var response = service.Execute( _provider, request ); var result = JsonConvert.DeserializeObject<ResponseOrderInfoQuery>( response ); Console.WriteLine( response ); Console.WriteLine( result ); if( result.Result == ResultCodes.Success ) { _orderInfo = result.OrderInfo; } else { throw new Exception( result.Result.ToString() ); } }