public static HotelPaymentRQ GetHotelPaymentRQ(PaymentGatewayInfo objPaymentGatewayInfo, HotelBookingPaymentAllocation[] objHotelBookingPaymentAllocations, HotelDescriptiveInfo objHotelDescriptiveInfo, GuestDetailsEntryInfo objGuestDetailsEntryInfo, string strCultureCode, string strUICultureCode) { HotelPaymentRQ objHotelPaymentRQ = new HotelPaymentRQ(); objHotelPaymentRQ.RequestTransID = Guid.NewGuid().ToString(); objHotelPaymentRQ.PaymentGateway = objPaymentGatewayInfo; objHotelPaymentRQ.PaymentType = PaymentType.Payment; objHotelPaymentRQ.PaymentMethod = PaymentMethod.PaymentCard; objHotelPaymentRQ.PaymentAmounts = objHotelBookingPaymentAllocations; objHotelPaymentRQ.PaymentTransRefID = DateTime.UtcNow.Ticks.ToString("00000000000000000000"); objHotelPaymentRQ.PaymentTransInfo = "Hotel Accommodation"; objHotelPaymentRQ.PaymentCard = new HotelBookingPaymentCard(); if (objPaymentGatewayInfo.Mode == PaymentGatewayMode.MerchantSiteCapturesCardDetails) { objHotelPaymentRQ.PaymentCard.PaymentCardType = objGuestDetailsEntryInfo.PaymentCardType; objHotelPaymentRQ.PaymentCard.PaymentCardNumber = objGuestDetailsEntryInfo.PaymentCardNumber; objHotelPaymentRQ.PaymentCard.PaymentCardHolder = objGuestDetailsEntryInfo.PaymentCardHolder; objHotelPaymentRQ.PaymentCard.PaymentCardEffectiveDate = objGuestDetailsEntryInfo.PaymentCardEffectiveDate; objHotelPaymentRQ.PaymentCard.PaymentCardExpireDate = objGuestDetailsEntryInfo.PaymentCardExpireDate; objHotelPaymentRQ.PaymentCard.PaymentCardIssueNumber = objGuestDetailsEntryInfo.PaymentCardIssueNumber; objHotelPaymentRQ.PaymentCard.PaymentCardSecurityCode = objGuestDetailsEntryInfo.PaymentCardSecurityCode; } else if (objPaymentGatewayInfo.Mode == PaymentGatewayMode.PaymentGatewayCapturesCardDetails) { objHotelPaymentRQ.PaymentCard.PaymentCardType = ""; objHotelPaymentRQ.PaymentCard.PaymentCardNumber = ""; objHotelPaymentRQ.PaymentCard.PaymentCardHolder = ""; objHotelPaymentRQ.PaymentCard.PaymentCardEffectiveDate = ""; objHotelPaymentRQ.PaymentCard.PaymentCardExpireDate = ""; objHotelPaymentRQ.PaymentCard.PaymentCardIssueNumber = ""; objHotelPaymentRQ.PaymentCard.PaymentCardSecurityCode = ""; } objHotelPaymentRQ.HotelCode = objHotelDescriptiveInfo.HotelCode; objHotelPaymentRQ.CurrencyCode = objHotelDescriptiveInfo.CurrencyCode; objHotelPaymentRQ.CultureCode = strCultureCode; objHotelPaymentRQ.UICultureCode = strUICultureCode; return objHotelPaymentRQ; }
private void ValidateGuestDetails(GuestDetailsEntryInfo objGuestDetailsEntryInfo, bool bBookingTermsConditionsAccepted) { PaymentGatewayInfo objPaymentGatewayInfo = (PaymentGatewayInfo)Session[Constants.Sessions.PaymentGatewayInfo]; DateTime dtNow = TZNet.ToLocal(WbsUiHelper.GetTimeZone(StayCriteriaSelection.HotelCode), DateTime.UtcNow).Date; if (objGuestDetailsEntryInfo.FirstName.Trim() == "") this.AddPageError(PageErrorType.ValidationError, (String)GetGlobalResourceObject("SiteErrorMessages", "NoFirstNameEntry")); if (objGuestDetailsEntryInfo.LastName.Trim() == "") this.AddPageError(PageErrorType.ValidationError, (String)GetGlobalResourceObject("SiteErrorMessages", "NoLastNameEntry")); if (objGuestDetailsEntryInfo.Email.Trim() == "" || objGuestDetailsEntryInfo.EmailConfirmEntry.Trim() == "") this.AddPageError(PageErrorType.ValidationError, (String)GetGlobalResourceObject("SiteErrorMessages", "NoEmailEntry")); else if (objGuestDetailsEntryInfo.Email.Trim() != objGuestDetailsEntryInfo.EmailConfirmEntry.Trim()) this.AddPageError(PageErrorType.ValidationError, (String)GetGlobalResourceObject("SiteErrorMessages", "IncorrectEmailEntry")); if (objGuestDetailsEntryInfo.Phone.Trim() == "") this.AddPageError(PageErrorType.ValidationError, (String)GetGlobalResourceObject("SiteErrorMessages", "NoPhoneEntry")); if (objGuestDetailsEntryInfo.Address1.Trim() == "") this.AddPageError(PageErrorType.ValidationError, (String)GetGlobalResourceObject("SiteErrorMessages", "NoStreetAddressEntry")); if (objGuestDetailsEntryInfo.City.Trim() == "") this.AddPageError(PageErrorType.ValidationError, (String)GetGlobalResourceObject("SiteErrorMessages", "NoCityAddressEntry")); if (ConfigurationManager.AppSettings["EnterGuestDetailsPage.RequireStateRegion"] == "1") { if (objGuestDetailsEntryInfo.StateRegion.Trim() == "") this.AddPageError(PageErrorType.ValidationError, (String)GetGlobalResourceObject("SiteErrorMessages", "NoStateRegionAddressEntry")); } if (ConfigurationManager.AppSettings["EnterGuestDetailsPage.RequirePostalCode"] == "1") { if (objGuestDetailsEntryInfo.PostalCode.Trim() == "") this.AddPageError(PageErrorType.ValidationError, (String)GetGlobalResourceObject("SiteErrorMessages", "NoPostalCodeEntry")); } if (objGuestDetailsEntryInfo.Country.Trim() == "") this.AddPageError(PageErrorType.ValidationError, (String)GetGlobalResourceObject("SiteErrorMessages", "NoCountryAddressEntry")); if (objGuestDetailsEntryInfo.AirlineProgramCode.Trim() == "" && objGuestDetailsEntryInfo.AirlineProgramIdentifier != "") this.AddPageError(PageErrorType.ValidationError, (String)GetGlobalResourceObject("SiteErrorMessages", "AirlineProgramInfoNotComplete")); if (objGuestDetailsEntryInfo.AirlineProgramCode.Trim() != "" && objGuestDetailsEntryInfo.AirlineProgramIdentifier == "") this.AddPageError(PageErrorType.ValidationError, (String)GetGlobalResourceObject("SiteErrorMessages", "AirlineProgramInfoNotComplete")); if (objGuestDetailsEntryInfo.HotelProgramCode.Trim() == "" && objGuestDetailsEntryInfo.HotelProgramIdentifier != "") this.AddPageError(PageErrorType.ValidationError, (String)GetGlobalResourceObject("SiteErrorMessages", "HotelProgramInfoNotComplete")); if (objGuestDetailsEntryInfo.HotelProgramCode.Trim() != "" && objGuestDetailsEntryInfo.HotelProgramIdentifier == "") this.AddPageError(PageErrorType.ValidationError, (String)GetGlobalResourceObject("SiteErrorMessages", "HotelProgramInfoNotComplete")); if (!string.IsNullOrEmpty(objGuestDetailsEntryInfo.ArrivalTime)) { if (objGuestDetailsEntryInfo.ArrivalTime == "error") this.AddPageError(PageErrorType.ValidationError, (String)GetGlobalResourceObject("SiteErrorMessages", "IncorrectArrivalTimeEntry")); else { DateTime dtArrivalTime; if (!DateTime.TryParse(objGuestDetailsEntryInfo.ArrivalTime, out dtArrivalTime)) this.AddPageError(PageErrorType.ValidationError, (String)GetGlobalResourceObject("SiteErrorMessages", "IncorrectArrivalTimeEntry")); } } if (this.WbsUiHelper.IsCreditCardInfoRequired(HotelAvailabilityRS, RoomRateSelections, objPaymentGatewayInfo, objGuestDetailsEntryInfo.ProfileGuaranteeRequested)) { if (objGuestDetailsEntryInfo.PaymentCardHolder.Trim() == "") this.AddPageError(PageErrorType.ValidationError, (String)GetGlobalResourceObject("SiteErrorMessages", "NoPaymentCardHolderEntry")); if (objGuestDetailsEntryInfo.PaymentCardType.Trim() == "") this.AddPageError(PageErrorType.ValidationError, (String)GetGlobalResourceObject("SiteErrorMessages", "NoPaymentCardTypeEntry")); else if (objGuestDetailsEntryInfo.PaymentCardNumber.Trim() == "") this.AddPageError(PageErrorType.ValidationError, (String)GetGlobalResourceObject("SiteErrorMessages", "NoPaymentCardNumberEntry")); else if (!CCValidator.ValidateNumber(objGuestDetailsEntryInfo.PaymentCardNumber.Trim())) this.AddPageError(PageErrorType.ValidationError, (String)GetGlobalResourceObject("SiteErrorMessages", "PaymentCardNumberEntryInvalid")); else if (!CCValidator.ValidateType(CCValidator.CreditCardType(objGuestDetailsEntryInfo.PaymentCardType.Trim()), objGuestDetailsEntryInfo.PaymentCardNumber.Trim())) this.AddPageError(PageErrorType.ValidationError, (String)GetGlobalResourceObject("SiteErrorMessages", "PaymentCardTypeEntryInvalid")); int intExpireMonth = Convert.ToInt32(objGuestDetailsEntryInfo.PaymentCardExpireDate.Substring(0, 2)); int intExpireYear = Convert.ToInt32(objGuestDetailsEntryInfo.PaymentCardExpireDate.Substring(2)) + 2000; if (intExpireYear < dtNow.Year) this.AddPageError(PageErrorType.ValidationError, (String)GetGlobalResourceObject("SiteErrorMessages", "PaymentCardIsExpired")); else if (intExpireYear == dtNow.Year && intExpireMonth < dtNow.Month) this.AddPageError(PageErrorType.ValidationError, (String)GetGlobalResourceObject("SiteErrorMessages", "PaymentCardIsExpired")); if (ConfigurationManager.AppSettings["EnterGuestDetailsPage.RequirePaymentCardSecurityCode"] == "1") { if (objGuestDetailsEntryInfo.PaymentCardSecurityCode.Trim() == "") this.AddPageError(PageErrorType.ValidationError, (String)GetGlobalResourceObject("SiteErrorMessages", "NoPaymentCardSecurityCodeEntry")); } } if (!bBookingTermsConditionsAccepted) this.AddPageError(PageErrorType.ValidationError, (String)GetGlobalResourceObject("SiteErrorMessages", "BookingTermsConditionsNotAccepted")); return; }
public void InitGuestDetailsEntryInfo() { Profile[] objProfiles = (Profile[])Session["LoginProfiles"]; Profile objCompanyProfile = ProfileHelper.GetProfile(objProfiles, ProfileType.Corporation); Profile objAgencyProfile = ProfileHelper.GetProfile(objProfiles, ProfileType.TravelAgent); ProfileIdentifier objAgencyIATA = ProfileHelper.GetProfileIdentifier(objAgencyProfile, ProfileIdentifierType.IATA); GuestDetailsEntryInfo objGuestDetailsEntryInfo = new GuestDetailsEntryInfo(); objGuestDetailsEntryInfo.NamePrefix = ""; objGuestDetailsEntryInfo.FirstName = ""; objGuestDetailsEntryInfo.LastName = ""; objGuestDetailsEntryInfo.Address1 = ""; objGuestDetailsEntryInfo.Address2 = ""; objGuestDetailsEntryInfo.City = ""; objGuestDetailsEntryInfo.StateRegion = ""; objGuestDetailsEntryInfo.PostalCode = ""; objGuestDetailsEntryInfo.Country = ""; objGuestDetailsEntryInfo.Phone = ""; objGuestDetailsEntryInfo.Fax = ""; objGuestDetailsEntryInfo.Email = ""; objGuestDetailsEntryInfo.EmailConfirmEntry = ""; if (objCompanyProfile != null) objGuestDetailsEntryInfo.CompanyName = objCompanyProfile.CompanyName; else objGuestDetailsEntryInfo.CompanyName = ""; if (objAgencyIATA != null) objGuestDetailsEntryInfo.TravelAgencyIATA = objAgencyIATA.Identifier; else objGuestDetailsEntryInfo.TravelAgencyIATA = ""; objGuestDetailsEntryInfo.SubscribeToNewsletter = false; objGuestDetailsEntryInfo.TravelPurpose = TravelPurpose.NotIdentified; objGuestDetailsEntryInfo.FlightNumber = ""; objGuestDetailsEntryInfo.AirlineProgramIdentifier = ""; objGuestDetailsEntryInfo.AirlineProgramCode = ""; objGuestDetailsEntryInfo.HotelProgramIdentifier = ""; objGuestDetailsEntryInfo.HotelProgramCode = ""; objGuestDetailsEntryInfo.NumberCribs = 0; objGuestDetailsEntryInfo.NumberRollawaysAdult = 0; objGuestDetailsEntryInfo.NumberRollawaysChild = 0; objGuestDetailsEntryInfo.SpecialInstructions = ""; objGuestDetailsEntryInfo.PaymentCardType = ""; objGuestDetailsEntryInfo.PaymentCardNumber = ""; objGuestDetailsEntryInfo.PaymentCardHolder = ""; objGuestDetailsEntryInfo.PaymentCardEffectiveDate = ""; objGuestDetailsEntryInfo.PaymentCardExpireDate = ""; objGuestDetailsEntryInfo.PaymentCardIssueNumber = ""; objGuestDetailsEntryInfo.PaymentCardSecurityCode = ""; objGuestDetailsEntryInfo.ProfileGuaranteeRequested = false; Session["GuestDetailsEntryInfo"] = objGuestDetailsEntryInfo; Session["BookingTermsConditionsAccepted"] = false; Session[Constants.Sessions.PaymentGatewayInfos] = new PaymentGatewayInfo[0]; Session[Constants.Sessions.PaymentGatewayInfo] = null; Session[Constants.Sessions.HotelBookingPaymentAllocations] = new HotelBookingPaymentAllocation[0]; Session["HotelPaymentRQ"] = null; Session["HotelPaymentRS"] = null; Session["PaymentGatewayRequestActive"] = false; Session["PaymentGatewayResponseActive"] = false; return; }
protected void btnConfirmBooking_Click(object sender, EventArgs e) { GuestDetailsEntryInfo objGuestDetailsEntryInfo = new GuestDetailsEntryInfo(); objGuestDetailsEntryInfo.NamePrefix = ddlNamePrefix.Text.Trim(); objGuestDetailsEntryInfo.FirstName = tbFirstName.Text.Trim(); objGuestDetailsEntryInfo.LastName = tbLastName.Text.Trim(); objGuestDetailsEntryInfo.Email = tbEmail.Text.Trim(); objGuestDetailsEntryInfo.EmailConfirmEntry = tbConfirmEmail.Text.Trim(); objGuestDetailsEntryInfo.Phone = tbTelephone.Text.Trim(); objGuestDetailsEntryInfo.Fax = ""; objGuestDetailsEntryInfo.Address1 = tbAddress1.Text.Trim(); objGuestDetailsEntryInfo.Address2 = tbAddress2.Text.Trim(); objGuestDetailsEntryInfo.StateRegion = tbStateRegion.Text.Trim(); objGuestDetailsEntryInfo.City = tbCity.Text.Trim(); objGuestDetailsEntryInfo.PostalCode = tbPostalCode.Text.Trim(); objGuestDetailsEntryInfo.SpecialInstructions = tbSpecialInstructions.Text.Trim(); objGuestDetailsEntryInfo.CompanyName = tbCompanyName.Text.Trim(); objGuestDetailsEntryInfo.TravelAgencyIATA = tbTravelAgencyIATA.Text.Trim(); objGuestDetailsEntryInfo.Country = ddlCountry.SelectedValue.Trim(); objGuestDetailsEntryInfo.SubscribeToNewsletter = cbSubscribeToNewsletter.Checked; objGuestDetailsEntryInfo.TravelPurpose = (TravelPurpose)Convert.ToInt32(ddlTravelPurpose.SelectedValue); objGuestDetailsEntryInfo.FlightNumber = tbFltNumber.Text.Trim(); objGuestDetailsEntryInfo.AirlineProgramCode = ddlAirlineProgram.SelectedValue; objGuestDetailsEntryInfo.AirlineProgramIdentifier = tbAirlineProgramNumber.Text.Trim(); objGuestDetailsEntryInfo.HotelProgramCode = ddlHotelProgram.SelectedValue; objGuestDetailsEntryInfo.HotelProgramIdentifier = tbHotelProgramNumber.Text.Trim(); if ((tbArrivalTimeHours.Text != null && tbArrivalTimeHours.Text != "") && (tbArrivalTimeMinutes.Text != null && tbArrivalTimeMinutes.Text != "")) { bool bReturnTimeForValidationCheck = true; int intHours; if (Int32.TryParse(tbArrivalTimeHours.Text, out intHours)) { if (intHours == 0 && rbArrivalTimePM.Checked) // Microsoft DateTime parser permits this entry (00:15pm accepted as 12:15pm) { objGuestDetailsEntryInfo.ArrivalTime = "error"; bReturnTimeForValidationCheck = false; } } if (bReturnTimeForValidationCheck) { StringBuilder sb = new StringBuilder(); sb.Append(tbArrivalTimeHours.Text); sb.Append(":"); sb.Append(tbArrivalTimeMinutes.Text); if (rbArrivalTimeAM.Checked) sb.Append(" AM"); else sb.Append(" PM"); objGuestDetailsEntryInfo.ArrivalTime = sb.ToString(); } } else if ((tbArrivalTimeHours.Text != null && tbArrivalTimeHours.Text != "") || (tbArrivalTimeMinutes.Text != null && tbArrivalTimeMinutes.Text != "")) { objGuestDetailsEntryInfo.ArrivalTime = "error"; } else { objGuestDetailsEntryInfo.ArrivalTime = ""; } objGuestDetailsEntryInfo.NumberRollawaysAdult = Convert.ToInt32(ddlAdultRollaway.SelectedValue); objGuestDetailsEntryInfo.NumberRollawaysChild = Convert.ToInt32(ddlChildRollaway.SelectedValue); objGuestDetailsEntryInfo.NumberCribs = Convert.ToInt32(ddlCrib.SelectedValue); objGuestDetailsEntryInfo.PaymentCardHolder = tbCardholderName.Text.Trim(); objGuestDetailsEntryInfo.PaymentCardIssueNumber = tbCardIssueNumber.Text.Trim(); objGuestDetailsEntryInfo.PaymentCardNumber = tbCardNumber.Text.Replace(" ", "").Trim(); objGuestDetailsEntryInfo.PaymentCardSecurityCode = tbCardSecurityCode.Text.Trim(); objGuestDetailsEntryInfo.PaymentCardType = ddlCardType.SelectedValue.Trim(); objGuestDetailsEntryInfo.PaymentCardExpireDate = ddlCardExpiryMonth.SelectedValue.PadLeft(2, '0') + ddlCardExpiryYear.SelectedValue.Substring(2); objGuestDetailsEntryInfo.PaymentCardEffectiveDate = ddlCardStartMonth.SelectedValue.PadLeft(2, '0') + ddlCardStartYear.SelectedValue.Substring(2); objGuestDetailsEntryInfo.ProfileGuaranteeRequested = cbProfileGuarantee.Checked; _GuestDetailsEntryInfo = objGuestDetailsEntryInfo; _TermsConditionsAccepted = cbTermsAgreement.Checked; if (_SelectedPaymentGateway == null && (_PaymentCardApplicationStatus == PaymentCardApplication.DepositOnly || PaymentCardApplicationStatus == PaymentCardApplication.GuaranteeAndDeposit)) { _SelectedPaymentGateway = WBSPGHelper.GetPaymentGatewayByCardType(_PaymentGatewayInfos, ddlCardType.SelectedValue.Trim()); } if (_SelectedPaymentGateway != null && _SelectedPaymentGateway.Mode == PaymentGatewayMode.PaymentGatewayCapturesCardDetails) { objGuestDetailsEntryInfo.PaymentCardType = "XX"; } GuestDetailsCompleted(this, new EventArgs()); return; }