public IHttpActionResult GetBookings(BasicStructure1 basic) { var content = JsonConvert.SerializeObject(basic); Log.LogDebug(new Carla.Shared.Logging.LoggingMessage.LogMessage("GetBooking", content)); var bs1 = fillbasics(basic); bs1.CustomerId = basic.CustomerId; var bs = Mapper.Map <BasicStructure, NordCar.Carla.Data.Entities.BasicStructure>(bs1); var data = this.ECAPIManagerRepository.SearchBooking(bs, "", "", "", ""); if (data.Item1.Succes) { var result = new { Bookings = Mapper.Map <List <NordCar.Carla.Data.Entities.EC.Booking>, List <NordCar.WebAPI.Models.EC.Booking> >(data.Item2), Status = "OK" }; return(Ok(result)); } else { return(Error(Mapper.Map <NordCar.Carla.Data.Entities.APIMethodControl, APIMethodControl>(data.Item1), HttpStatusCode.NotFound)); } }
public IHttpActionResult CheckPromotionCode(BasicStructure1 basic) { Log.LogInfo(string.Format("promotionCode={0}", basic.VoucherCode)); var bs1 = fillbasics(basic); var bs = Mapper.Map <BasicStructure, NordCar.Carla.Data.Entities.BasicStructure>(bs1); var data = this.ECAPIManagerRepository.CheckPromotionCode(bs); if (data.Item1.Succes) { var result = new { PromotionResult = data.Item2, Status = "OK" }; return(Ok(result)); } else { return(Error(Mapper.Map <NordCar.Carla.Data.Entities.APIMethodControl, APIMethodControl>(data.Item1), HttpStatusCode.NotFound)); } }
public void GetAvailableCars_location29() { var pickUp = new NordCar.WebAPI.Models.EC.Trip() { LocationId = "12", Date = Helpers.ConvertDateTimeToNovicellDateString(DateTime.Now.AddDays(1)), Time = "800" }; //Helpers.ConvertDateTimeToNovicellTime(DateTime.Now) }; var dropOff = new NordCar.WebAPI.Models.EC.Trip() { LocationId = "60", Date = Helpers.ConvertDateTimeToNovicellDateString(DateTime.Now.AddDays(15)), Time = "800" }; //Helpers.ConvertDateTimeToNovicellTime(DateTime.Now) }; var bs = new BasicStructure1() { BookTypes = "ECBOOK" }; var pickDropInfo = new NordCar.WebAPI.Models.EC.PickDropInfo() { CountryId = "DK", PickUp = pickUp, DropOff = dropOff, CarTypeId = "", CarGroupId = "", Basic = bs }; string age = "26"; //Act var response = controller.GetAvailableCars(pickDropInfo, age); //Assert Assert.IsNotNull(response); }
public IHttpActionResult GetPaymentCardTypes(BasicStructure1 basic) { var content = JsonConvert.SerializeObject(basic); Log.LogDebug(new Carla.Shared.Logging.LoggingMessage.LogMessage("GetPaymentCardTypes", content)); var bs1 = fillbasics(basic); var bs = Mapper.Map <BasicStructure, NordCar.Carla.Data.Entities.BasicStructure>(bs1); var data = this.ECAPIManagerRepository.DropDownLists(41, bs); if (data.Item1.Succes) { var result = new { Lists = Mapper.Map <List <NordCar.Carla.Data.Entities.EC.DropDownListItem>, List <NordCar.WebAPI.Models.EC.DropDownListItem> >(data.Item2), Status = "OK" }; return(Ok(result)); } else { return(Error(Mapper.Map <NordCar.Carla.Data.Entities.APIMethodControl, APIMethodControl>(data.Item1), HttpStatusCode.NotFound)); } }
protected BasicStructure fillbasics(string booktypes) { BasicStructure1 tempStructure = new BasicStructure1() { BookTypes = booktypes }; return(fillbasics(tempStructure)); //return new BasicStructure() { FunctionId = flist, Language = LanguageList.DA, BookTypes = booktypes, IPAddress = GetClientIp(Request), CompanyDealId = "", CustomerId = "", ExtraId = "", VoucherCode = "", OrgBookNr = "", StepNr = "" }; }
public void GetCarExtras() { /*Note * { * "CountryId": "DK", * "CarTypeId": "", * "CarGroupId": "A", * "PickUp": { * "LocationId": "4", * "LocationName": "", * "Date": "22052016", * "Time": "1000" * }, * "DropOff": { * "LocationId": "4", * "LocationName": "", * "Date": "25052016", * "Time": "1500" * }, * "Basic": { * "Language": "", * "BookTypes": "ECBOOK", * "IPAddress": "", * "CompanyDealId": "", * "CustomerId": "", * "ExtraId": "", * "VoucherCode": "", * "OrgBookNr": "", * "StepNr": "" * } * } */ var pickUp = new NordCar.WebAPI.Models.EC.Trip() { LocationId = "4", Date = Helpers.ConvertDateTimeToNovicellDateString(DateTime.Now), Time = Helpers.ConvertDateTimeToNovicellTime(DateTime.Now) }; var dropOff = new NordCar.WebAPI.Models.EC.Trip() { LocationId = "4", Date = Helpers.ConvertDateTimeToNovicellDateString(DateTime.Now.AddDays(5)), Time = Helpers.ConvertDateTimeToNovicellTime(DateTime.Now) }; var basic = new BasicStructure1() { BookTypes = "ECBOOK" }; var pickDropInfo = new NordCar.WebAPI.Models.EC.PickDropInfo() { CountryId = "DK", PickUp = pickUp, DropOff = dropOff, CarTypeId = "", CarGroupId = "A", Basic = basic }; //Act var response = controller.GetCarExtras(pickDropInfo, "10"); //Assert Assert.IsNotNull(response); }
protected BasicStructure fillbasics(BasicStructure1 bStruct) { BasicStructure tempStructure = new BasicStructure(); if (bStruct == null) //Default value if empty { tempStructure.BookTypes = ""; tempStructure.Language = LanguageList.DA; if (bStruct == null) { tempStructure.IPAddress = GetClientIp(Request); } else { if (bStruct.IPAddress.Trim() != "") { tempStructure.IPAddress = bStruct.IPAddress; } else { tempStructure.IPAddress = GetClientIp(Request); } } tempStructure.CompanyDealId = ""; tempStructure.CustomerId = ""; tempStructure.ExtraId = ""; tempStructure.VoucherCode = ""; tempStructure.OrgBookNr = ""; tempStructure.StepNr = ""; } else { tempStructure.BookTypes = (bStruct.BookTypes == null ? Organization : bStruct.BookTypes); tempStructure.Language = (bStruct.Language == null ? LanguageList.DA : ConvertLanguageFromString(bStruct.Language)); tempStructure.IPAddress = bStruct.IPAddress ?? GetClientIp(Request); tempStructure.CompanyDealId = bStruct.CompanyDealId ?? ""; tempStructure.CustomerId = bStruct.CustomerId ?? ""; tempStructure.ExtraId = bStruct.ExtraId ?? ""; tempStructure.VoucherCode = bStruct.VoucherCode ?? ""; tempStructure.OrgBookNr = bStruct.OrgBookNr ?? ""; tempStructure.StepNr = bStruct.StepNr ?? ""; } return(new BasicStructure() { Language = tempStructure.Language, BookTypes = tempStructure.BookTypes, IPAddress = tempStructure.IPAddress, CompanyDealId = tempStructure.CompanyDealId, CustomerId = tempStructure.CustomerId, ExtraId = tempStructure.ExtraId, VoucherCode = tempStructure.VoucherCode, OrgBookNr = tempStructure.OrgBookNr, StepNr = tempStructure.StepNr }); }
public void CheckPromotionCode() { string promotionCode = "Gigt"; //brug også test1 ell. test2 var basic = new BasicStructure1() { BookTypes = "ECBOOK", VoucherCode = promotionCode }; //Act var response = controller.CheckPromotionCode(basic); //Assert Assert.IsNotNull(response); }
public void CreateMyAccount_secrets() { var persacc = new NordCar.WebAPI.Models.EC.PersonalAccount(); var account = new NordCar.WebAPI.Models.EC.Person(); var driver = new NordCar.WebAPI.Models.EC.Driver() { BirthDay = "08-02-1971", BirthCity = "Aarhus", BirthCountry = "Danmark", LicenseNumber = "1234554326000", IssueDate = "08-06-1989", ExpiryDate = "08-02-2041", IssueCountry = "Danmark" }; var ident = new NordCar.WebAPI.Models.EC.Identification() { IdentityNumber = "23456712", PassPortNumber = "", IssueDate = "07-07-2012", ExpiryDate = "07-07-2022", IssueCountry = "Danmark" }; var friq = new NordCar.WebAPI.Models.EC.FrequentTravelerProgram() { Id = "0", CardNumber = "", ExpiryDate = "" }; var basic = new BasicStructure1() { IPAddress = "34.34.34.34" }; //Act account.Title = "Mr"; //Mr and Mrs account.Gender = "Male"; //Male and Female account.FirstName = "Claus"; account.LastName = "Skydt8"; account.Address = "Nattergalevej 28"; account.City = "Galten"; account.PostCode = "8464"; account.Country = "Danmark"; account.Email = "*****@*****.**"; account.AccountType = "1"; account.Phone = "22105256"; account.Password = "******"; account.Driver = driver; account.Identification = ident; account.FrequentTravelerProgram = friq; account.SecretQuestionId = "0"; account.SecretQuestionAnswer = "Gravhund"; persacc.basic = basic; persacc.person = account; var response = controller.CreateAccount(persacc); //Assert Assert.IsNotNull(response); }
public void Login_NytLogin_PondEq() { var logininfo = new NordCar.WebAPI.Models.EC.LoginInfo() { UserName = "******", Password = "******", LoginType = Models.EC.LoginType.Company }; var basic = new BasicStructure1() { }; //Act var response = controller.Login(logininfo); //Assert Assert.IsNotNull(response); }
public void ModifyMyAccount_CountryEmpty() { var account2 = new NordCar.WebAPI.Models.EC.PersonalAccount(); var account = new NordCar.WebAPI.Models.EC.Person(); var driver = new NordCar.WebAPI.Models.EC.Driver() { BirthDay = "08-02-1971", BirthCity = "Aarhus", BirthCountry = "Danmark", LicenseNumber = "333455432", IssueDate = "08-06-1989", ExpiryDate = "08-02-2041", IssueCountry = "Danmark" }; var ident = new NordCar.WebAPI.Models.EC.Identification() { IdentityNumber = "23456712", PassPortNumber = "12341234", IssueDate = "07-07-2012", ExpiryDate = "07-07-2022", IssueCountry = "Danmark" }; var friq = new NordCar.WebAPI.Models.EC.FrequentTravelerProgram() { Id = "0", CardNumber = "", ExpiryDate = "" }; var basic = new BasicStructure1() { }; //Act account.Title = "Mr"; //Mr and Mrs account.Gender = "Male"; //Male and Female account.FirstName = "Claus"; account.LastName = "Skydt"; account.Address = "Nattergalevej 28"; account.City = "Galten"; account.PostCode = "8464"; account.Country = ""; account.Email = "*****@*****.**"; account.AccountType = "1"; account.Phone = "22105256"; account.Password = "******"; account.Driver = driver; account.Identification = ident; account.FrequentTravelerProgram = friq; account.CustomerNo = "141316"; account2.person = account; account2.basic = basic; var response = controller.ModifyAccount(account2); //Assert Assert.IsNotNull(response); }
public void Login_NytLogin_Type200() { var basic = new BasicStructure1() { BookTypes = BookTypes.ECBOOK.ToString(), Language = "DK", CustomerId = "910361" }; var logininfo = new NordCar.WebAPI.Models.EC.LoginInfo() { UserName = "******", Password = "", LoginType = Models.EC.LoginType.Agreement }; //Act var response = controller.Login(logininfo); //Assert Assert.IsNotNull(response); }
public void Login_Claus() { var basic = new BasicStructure1() { }; var logininfo = new NordCar.WebAPI.Models.EC.LoginInfo() { UserName = "******", Password = "******", LoginType = Models.EC.LoginType.Personal }; //Act //var response = controller.Login("*****@*****.**", "fisk6fisk7"); logininfo.Basic = basic; var response = controller.Login(logininfo); //Assert Assert.IsNotNull(response); }
public void GetPdfBooking() { //Act var pickUp = new NordCar.WebAPI.Models.EC.Trip() { LocationId = "4", Date = Helpers.ConvertDateTimeToNovicellDateString(DateTime.Now), Time = Helpers.ConvertDateTimeToNovicellTime(DateTime.Now) }; var dropOff = new NordCar.WebAPI.Models.EC.Trip() { LocationId = "4", Date = Helpers.ConvertDateTimeToNovicellDateString(DateTime.Now.AddDays(5)), Time = Helpers.ConvertDateTimeToNovicellTime(DateTime.Now) }; var basis = new BasicStructure1(); basis.BookTypes = BookTypes.ECBOOK.ToString(); var pickDropInfo = new NordCar.WebAPI.Models.EC.PickDropInfo() { CountryId = "DK", PickUp = pickUp, DropOff = dropOff, CarTypeId = "", Basic = basis }; var recommendedExtra = new List <NordCar.WebAPI.Models.EC.SelectedBase>(); recommendedExtra.Add(new NordCar.WebAPI.Models.EC.SelectedBase() { Id = "910", NumbUnit = "1" }); var insurance = new List <NordCar.WebAPI.Models.EC.SelectedBase>(); insurance.Add(new NordCar.WebAPI.Models.EC.SelectedBase() { Id = "PAI", NumbUnit = "1" }); var mileage = new List <NordCar.WebAPI.Models.EC.SelectedBase>(); mileage.Add(new NordCar.WebAPI.Models.EC.SelectedBase() { Id = "969", NumbUnit = "KM200" }); var selectedExtras = new NordCar.WebAPI.Models.EC.SelectedExtras() { RecommendedExtras = recommendedExtra, Insurance = insurance, Mileage = mileage }; var reservation = new NordCar.WebAPI.Models.EC.Reservation(); reservation.PickDropInfo = pickDropInfo; reservation.Title = "Mr"; //Mr and Mrs reservation.Gender = "Male"; //Male and Female reservation.FirstName = "Claus"; reservation.LastName = "Skydt"; reservation.BirthDay = "08-02-1971"; reservation.Address = "Nattergalevej 28"; reservation.City = "Galten"; reservation.PostCode = "8464"; reservation.Country = "Danmark"; reservation.Email = "*****@*****.**"; reservation.ProductId = "prod671-7"; reservation.Extra = selectedExtras; dynamic actionResult = controller.MakeReservation(reservation); dynamic content = actionResult.Content; var actionResult2 = controller.GetPdfBooking(content.ReservationNo); }
public void MakeReservation() { var pickUp = new NordCar.WebAPI.Models.EC.Trip() { LocationId = "4", Date = Helpers.ConvertDateTimeToNovicellDateString(DateTime.Now.AddDays(1)), Time = Helpers.ConvertDateTimeToNovicellTime(DateTime.Now) }; var dropOff = new NordCar.WebAPI.Models.EC.Trip() { LocationId = "4", Date = Helpers.ConvertDateTimeToNovicellDateString(DateTime.Now.AddDays(5)), Time = Helpers.ConvertDateTimeToNovicellTime(DateTime.Now) }; var basic = new BasicStructure1() { BookTypes = "CARLSBERGVIKAR" }; var pickDropInfo = new NordCar.WebAPI.Models.EC.PickDropInfo() { CountryId = "DK", PickUp = pickUp, DropOff = dropOff, CarTypeId = "02", CarGroupId = "A", Basic = basic }; var recommendedExtra = new List <NordCar.WebAPI.Models.EC.SelectedBase>(); recommendedExtra.Add(new NordCar.WebAPI.Models.EC.SelectedBase() { Id = "910", NumbUnit = "1" }); var insurance = new List <NordCar.WebAPI.Models.EC.SelectedBase>(); insurance.Add(new NordCar.WebAPI.Models.EC.SelectedBase() { Id = "PAI", NumbUnit = "1" }); var mileage = new List <NordCar.WebAPI.Models.EC.SelectedBase>(); // mileage.Add(new NordCar.WebAPI.Models.EC.SelectedBase() { Id = "969", NumbUnit = "KM200" }); var selectedExtras = new NordCar.WebAPI.Models.EC.SelectedExtras() { RecommendedExtras = recommendedExtra, Insurance = insurance, Mileage = mileage }; var reservation = new NordCar.WebAPI.Models.EC.Reservation(); reservation.PickDropInfo = pickDropInfo; reservation.Title = "Mr"; //Mr and Mrs reservation.Gender = "Male"; //Male and Female reservation.FirstName = "Claus"; reservation.LastName = "Skydt"; reservation.BirthDay = "08-02-1971"; reservation.Address = "Nattergalevej 28"; reservation.City = "Galten"; reservation.PostCode = "8464"; reservation.Country = "Danmark"; reservation.Email = "*****@*****.**"; reservation.CustomerNo = "141316"; reservation.ProductId = "10"; reservation.paymentType = "1"; reservation.Extra = selectedExtras; reservation.BookStatus = 1; reservation.FlightNo = "Voyager 12"; reservation.Remarks = "Dette er en meget simbel besked........"; reservation.PhoneNumber = "45671234"; reservation.RequisitionNumber = "12345678910"; //Act var response = controller.MakeReservation(reservation); //Assert Assert.IsNotNull(response); }