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());
        }
        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));
        }