public ActionResult BonusTimeReservationSubmit(ReservationParameters model) { model.AcceptTermsAndConditions = (HttpContext.Request.Form["confirm_toc"] != null); ReservationParameters reservationContext = ReservationUtils.GetContextReservation(); reservationContext.CreditCard_Type = FormatUtils.ConvertCreditCard(model.CreditCard_Type); //Required for the validation var listOfError = ValidationUtils.GetCreditCardViolations(model); listOfError.AddRange(ValidationUtils.GetAddressViolations(model)); listOfError.AddRange(ValidationUtils.GetGuestViolations(model, reservationContext.MaxOccupancy)); Session["ChangedCountry"] = null; if (listOfError.Count > 0) { Session["ChangedCountry"] = model.Address_Country; foreach (var vi in listOfError) { ModelState.AddModelError("", vi.ErrorMessage); } } else { reservationContext = ReservationUtils.MapGuestValues(model, reservationContext); reservationContext = ReservationUtils.MapAddressValues(model, reservationContext); reservationContext = ReservationUtils.MapCreditCardValues(model, reservationContext); var reservationResponse = ExecuteBook(reservationContext); if (reservationResponse != null && reservationResponse.Errors == null) { ReservationUtils.DeleteContextReservation(); //Response.Flush(); Response.Redirect("/owner/reservation-confirmation?type=Future&reservationNo=" + reservationResponse.ConfirmReservation.ReservationNumber, false); HttpContext.ApplicationInstance.CompleteRequest(); return(null); } else { ModelState.AddModelError("", "We're sorry, but since you began your search, that villa type is no longer available. Please select BACK to begin a new search."); } } return(base.Index()); }
public ActionResult SubmitPPP(BGSitecore.Models.ReservationParameters model) { DebugUtils.StartLogEvent("ReservationController.SubmitPPP"); ReservationParameters reservationContext = ReservationUtils.GetContextReservation(); model.CreditCard_Type = FormatUtils.ConvertCreditCard(reservationContext.CreditCard_Type); if (model.btnSubmit == "action:nocreditcard") { DeclinePointsProtectionRequest request = new DeclinePointsProtectionRequest(); request.SiteName = ""; request.ReservationNumber = Session["ReservationNumber"].ToString(); ResortService service = new ResortService(); var response = service.DeclinePointsProtection(request); var reservationNUmber = Session["ReservationNumber"].ToString(); PPPOwnerWebStats(reservationContext, false); ReservationUtils.DeleteContextReservation(); Response.Redirect("/owner/reservation-confirmation?bv=true&type=Future&reservationNo=" + reservationNUmber, false); return(null); } else { var listOfError = ValidationUtils.GetCreditCardViolations(model); if (listOfError.Count() <= 0) { AcceptPointsProtectionRequest request = new AcceptPointsProtectionRequest(); request.SiteName = "OnlinePoints"; request.ReservationNumber = Session["ReservationNumber"].ToString(); request.Payment = new Models.ResortService.AcceptPointsProtection.Payment(); request.Payment.CreditCardNumber = model.CreditCard_Number; request.Payment.CreditCardExpirationDate = ReservationUtils.GetExpDate(model.CreditCard_ExpDateMonth, model.CreditCard_ExpDateYear); request.Payment.CreditCardType = "V"; // model.CreditCard_Type; request.Payment.CreditCardName = model.CreditCard_Name; request.Payment.CreditCardAuthorization = model.CreditCard_VerificationNumber; request.Payment.CreditCardTotal = Convert.ToString(reservationContext.PPPCost); request.Payment.NonTaxTotal = ""; ResortService service = new ResortService(); var pppResponse = service.AcceptPointsProtection(request); if (pppResponse == null || pppResponse.Errors != null) { //TODO move this message in sitecore listOfError.Add(new RuleViolation("", "", "Unfortunately, we have encountered a technical error while processing Points Protection Plan.Please call 800.456.CLUB(2582) to report the problem and receive assistance.Thank you.")); Session["PPPUiError"] = listOfError; } else { var reservationNUmber = Session["ReservationNumber"].ToString(); PPPOwnerWebStats(reservationContext, true); ReservationUtils.DeleteContextReservation(); DebugUtils.StartLogEvent("ReservationController.SubmitPPP"); Response.Redirect("/owner/reservation-confirmation?bv=true&reservationNo=" + reservationNUmber, false); return(null); } } else { Session["PPPUiError"] = listOfError; } } DebugUtils.StartLogEvent("ReservationController.SubmitPPP"); return(base.Index()); }
private BookReservationResponse ExecuteBook(ReservationParameters reservationContext) { // bool statusExecuteBook = false; BlueGreenContext bgContext = new BlueGreenContext(); BookReservationRequest request = new BookReservationRequest(); request.ReservationProjectNumber = reservationContext.ProjectNumber.ToString(); request.OwnerID = reservationContext.OwnerId; request.UnitTypeCode = reservationContext.UnitType; request.CheckInDate = reservationContext.CheckInDate.ToString("MM/dd/yyyy"); request.LengthOfStay = Convert.ToInt16((reservationContext.CheckOutDate - reservationContext.CheckInDate).TotalDays); request.NumberOfAdults = int.Parse(reservationContext.Guest_NumberOfGuest); //TODO get value from context request.AccountNumber = bgContext.GetPrimaryAccountNumber(); request.OwnerProjectNumber = bgContext.GetOwnerAccountProject().ToString(); //Changed to Enclose Special Requests with Special Request for BGO only string specialCharacter = Sitecore.Configuration.Settings.GetSetting("IdentifierForSpecialRequestFromBGO"); request.Comments = (reservationContext.text_SpecialRequests == null) ? "" : specialCharacter + reservationContext.text_SpecialRequests + specialCharacter; if (!string.IsNullOrEmpty(reservationContext.wheelchairaccessible) && reservationContext.wheelchairaccessible == "1") { request.HandicapAccessible = "Y"; request.Comments = "REQHANDICAP " + request.Comments; } if (reservationContext.ReservationType == SearchParameters.RESERVATION_TYPE_BONUSTIME) { request.ReservationType = "B"; request.SiteName = "BonusTime"; } else { request.ReservationType = "P"; request.SiteName = "onlinepoints"; request.Points = reservationContext.PointsRequired; } if (reservationContext.hasCreditcard) { request.Payment = new Models.ResortService.BookReservationRequest.Payment(); request.Payment.CreditCardAuthorization = reservationContext.CreditCard_VerificationNumber; request.Payment.CreditCardName = reservationContext.CreditCard_Name; request.Payment.CreditCardNumber = reservationContext.CreditCard_Number; request.Payment.CreditCardType = FormatUtils.ConvertCreditCard(reservationContext.CreditCard_Type); request.Payment.CreditCardExpirationDate = ReservationUtils.GetExpDate(reservationContext.CreditCard_ExpDateMonth, reservationContext.CreditCard_ExpDateYear); request.Payment.CreditCardTotal = Convert.ToDouble(reservationContext.BT_TotalCost); request.Payment.NonTaxTotal = Convert.ToDouble(Convert.ToDecimal(reservationContext.DailyPrice) * reservationContext.NumberOfNightChanged); } if (reservationContext.hasGuest) { request.Guests = new List <Models.ResortService.BookReservationRequest.Guest>(); var guestOld = new Models.ResortService.BookReservationRequest.Guest(); guestOld.GuestType = "Primary"; guestOld.GuestID = ""; guestOld.FirstName = reservationContext.Guest_FirstName; guestOld.LastName = reservationContext.Guest_LastName; guestOld.Relationship = reservationContext.Guest_Relationship; request.Guests.Add(guestOld); if (!string.IsNullOrEmpty(reservationContext.Guest_Email)) { guestOld.EmailAddresses = new List <Models.ResortService.BookReservationRequest.EmailAddress>(); var email = new Models.ResortService.BookReservationRequest.EmailAddress(); email.AddressType = "Home"; email.Email = reservationContext.Guest_Email; guestOld.EmailAddresses.Add(email); } else { guestOld.EmailAddresses = new List <Models.ResortService.BookReservationRequest.EmailAddress>(); var email = new Models.ResortService.BookReservationRequest.EmailAddress(); email.AddressType = "Home"; email.Email = bgContext.bxgOwner.Email; guestOld.EmailAddresses.Add(email); } if (reservationContext.Guest_AddNew != "AddNew") { if (!string.IsNullOrEmpty(reservationContext.Guest_PhoneNumber)) { guestOld.Phones = new List <Models.ResortService.BookReservationRequest.Phone>(); var phone = new Models.ResortService.BookReservationRequest.Phone(); phone.PhoneNumberType = "Home"; phone.PhoneNumber = reservationContext.Guest_PhoneNumber; guestOld.Phones.Add(phone); } if (!string.IsNullOrEmpty(reservationContext.Guest_City)) { guestOld.Addresses = new List <Models.ResortService.BookReservationRequest.Address>(); var address = new Models.ResortService.BookReservationRequest.Address(); address.AddressLine1 = " "; address.AddressLine2 = " "; address.CountryCode = " "; address.PostalCode = " "; address.AddressType = "Home"; address.City = reservationContext.Guest_City; // Here I'm assuming that no one will select state without city (they are both required fields anyway) if (!string.IsNullOrEmpty(reservationContext.Guest_State)) { address.ProvinceCode = reservationContext.Guest_State; } guestOld.Addresses.Add(address); } } else { var guest = new Models.ResortService.BookReservationRequest.Guest(); guest.GuestType = "GuestOnPrimary"; guest.FirstName = reservationContext.Guest_FirstName; guest.LastName = reservationContext.Guest_LastName; guest.Relationship = reservationContext.Guest_Relationship; guest.GuestID = ""; if (!string.IsNullOrEmpty(reservationContext.Guest_Email)) { guest.EmailAddresses = new List <Models.ResortService.BookReservationRequest.EmailAddress>(); var email = new Models.ResortService.BookReservationRequest.EmailAddress(); email.AddressType = "Home"; email.Email = reservationContext.Guest_Email; guest.EmailAddresses.Add(email); } if (!string.IsNullOrEmpty(reservationContext.Guest_City)) { guest.Addresses = new List <Models.ResortService.BookReservationRequest.Address>(); var address = new Models.ResortService.BookReservationRequest.Address(); address.AddressLine1 = " "; address.AddressLine2 = " "; address.CountryCode = " "; address.PostalCode = " "; address.AddressType = "Home"; address.City = reservationContext.Guest_City; // Here I'm assuming that no one will select state without city (they are both required fields anyway) if (!string.IsNullOrEmpty(reservationContext.Guest_State)) { address.ProvinceCode = reservationContext.Guest_State; } guest.Addresses.Add(address); } if (!string.IsNullOrEmpty(reservationContext.Guest_PhoneNumber)) { guest.Phones = new List <Models.ResortService.BookReservationRequest.Phone>(); var phone = new Models.ResortService.BookReservationRequest.Phone(); phone.PhoneNumberType = "Home"; phone.PhoneNumber = reservationContext.Guest_PhoneNumber; guest.Phones.Add(phone); } request.Guests.Add(guest); } } if (reservationContext.hasAddress) { } if (Session["AgentLoginID"] == null) { request.Agent = "OWNER"; } else { request.Agent = (string)Session["AgentLoginID"]; } ResortService resortService = new ResortService(); var reservationResponse = resortService.BookReservation(request); OwnerWebStats(request, reservationResponse); return(reservationResponse); }
public ActionResult SubmitSaveMyPoint(string CCName, string CCNumber, string CVV, string ExpMonth, string ExpYear, string ZipCode, string cctype, bool InternationalZipCode) { SaveMyPointsResponse response = new SaveMyPointsResponse(); ReservationParameters model = new ReservationParameters(); model.CreditCard_ExpDateMonth = ExpMonth; model.CreditCard_ExpDateYear = ExpYear; model.CreditCard_Name = CCName; model.CreditCard_Number = CCNumber; model.CreditCard_VerificationNumber = CVV; model.CreditCard_ZipCode = ZipCode; model.CreditCard_InternationalZipCode = InternationalZipCode; BlueGreenContext bgContext = new BlueGreenContext(); model.CreditCard_Type = FormatUtils.ConvertCreditCard(cctype); var listOfError = ValidationUtils.GetCreditCardViolations(model); if (listOfError.Count() <= 0) { BGSitecore.Models.OwnerService.OwnerSavePointsElectRequest.OwnerSavePointsElectRequest request = new BGSitecore.Models.OwnerService.OwnerSavePointsElectRequest.OwnerSavePointsElectRequest(); request.Identifier = bgContext.OwnerId; request.AgentID = "OWNER"; request.NameOnCard = model.CreditCard_Name; request.Amount = bgContext.GetSavePointsFee; request.CreditCardInfo = new BGSitecore.Models.OwnerService.OwnerSavePointsElectRequest.CreditCardInfo(); request.CreditCardInfo.CreditCardNumber = model.CreditCard_Number; request.CreditCardInfo.CreditCardExpirationDate = ReservationUtils.GetExpDate(model.CreditCard_ExpDateMonth, model.CreditCard_ExpDateYear); request.CreditCardInfo.CreditCardType = model.CreditCard_Type; request.CreditCardInfo.CreditCardCVV = model.CreditCard_VerificationNumber; ProfileService service = new ProfileService(); var pointResponse = service.OwnerSavePointsElect(request); if (pointResponse != null && pointResponse.RetCode == "0") { response.RetCode = "0"; //TODO move this code bgContext.bxgOwner.AnnualPointsExpiration.SavePointsEligible = false; bgContext.bxgOwner.AnnualPointsExpiration.SavePointsFee = "0.00"; bgContext.bxgOwner.AnnualPointsExpiration.SavePointsMessage = ""; //save owner object with updated annualpoints expiration Session["BXGOwner"] = bgContext.bxgOwner; response.AuthorizationNumber = pointResponse.AuthorizationNumber; OwnerUtils.SetContextToReloadPalett(); } else { response.RetCode = "-1"; response.errors = new List <string>(); response.errors.Add("Internal error try again later."); } } else { response.RetCode = "-1"; response.errors = new List <string>(); foreach (var item in listOfError) { response.errors.Add(item.ErrorMessage); } return(Json(response)); } return(Json(response)); }