protected void Page_Load(object sender, EventArgs e) { FileLog objEventLog = (FileLog)Application["EventLog"]; ExceptionLog objExceptionEventLog = (ExceptionLog)Application["ExceptionEventLog"]; StringBuilder sbReturnURL = new StringBuilder(); if (Request.IsSecureConnection) sbReturnURL.Append("https://"); else sbReturnURL.Append("http://"); sbReturnURL.Append(Request.ServerVariables["HTTP_HOST"]); Uri baseURL = new Uri(sbReturnURL.ToString()); string strResultURL = (new Uri(baseURL, Response.ApplyAppPathModifier("Response.aspx"))).ToString(); string strErrorURL = (new Uri(baseURL, Response.ApplyAppPathModifier("Error.aspx"))).ToString(); HDFCDataProcessor objHDFCDataProcessor = new HDFCDataProcessor(objEventLog, objExceptionEventLog); string strOutput = objHDFCDataProcessor.ProcessRedirect(this, this.Context, strResultURL, strErrorURL); Response.Write(strOutput); }
protected void Page_Load(object sender, EventArgs e) { bool bPaymentGatewayResponseActive = (bool)Session["PaymentGatewayResponseActive"]; if (!bPaymentGatewayResponseActive) { Response.Redirect("~/Default.aspx"); } else { Session["PaymentGatewayResponseActive"] = false; FileLog objEventLog = (FileLog)Application["EventLog"]; ExceptionLog objExceptionEventLog = (ExceptionLog)Application["ExceptionEventLog"]; HotelPaymentRQ objHotelPaymentRQ = (HotelPaymentRQ)Session["HotelPaymentRQ"]; HDFCDataProcessor objHDFCDataProcessor = new HDFCDataProcessor(objEventLog, objExceptionEventLog); PayRsData objPayRsData = objHDFCDataProcessor.ProcessErrorPageResponse(this, this.Context); HotelPaymentRS objHotelPaymentRS = new HotelPaymentRS(); objHotelPaymentRS.RequestTransID = objHotelPaymentRQ.RequestTransID; objHotelPaymentRS.PaymentAuthCode = ""; objHotelPaymentRS.PaymentTransRefID = ""; objHotelPaymentRS.PaymentGatewayCardType = ""; objHotelPaymentRS.PaymentCard = null; objHotelPaymentRS.Success = false; objHotelPaymentRS.Errors = new Error[1]; objHotelPaymentRS.Errors[0] = new Error(); objHotelPaymentRS.Errors[0].Code = objPayRsData.enumStatus.ToString(); objHotelPaymentRS.Errors[0].Description = objPayRsData.strMessage; objHotelPaymentRS.Warnings = new Warning[0]; Session["HotelPaymentRS"] = objHotelPaymentRS; Server.Transfer("~/Pages/ProcessPaymentRS.aspx"); } return; }
protected void Page_Load(object sender, EventArgs e) { bool bPaymentGatewayResponseActive = (bool)Session["PaymentGatewayResponseActive"]; if (!bPaymentGatewayResponseActive) { Response.Redirect("~/Default.aspx"); } else { Session["PaymentGatewayResponseActive"] = false; FileLog objEventLog = (FileLog)Application["EventLog"]; ExceptionLog objExceptionEventLog = (ExceptionLog)Application["ExceptionEventLog"]; HotelPaymentRQ objHotelPaymentRQ = (HotelPaymentRQ)Session["HotelPaymentRQ"]; HDFCDataProcessor objHDFCDataProcessor = new HDFCDataProcessor(objEventLog, objExceptionEventLog); PayRsData objPayRsData = objHDFCDataProcessor.ProcessPayResponse(this, this.Context); HotelPaymentRS objHotelPaymentRS = new HotelPaymentRS(); objHotelPaymentRS.RequestTransID = objHotelPaymentRQ.RequestTransID; if (objPayRsData.enumStatus == PayRSStatus.Authorized) { objHotelPaymentRS.PaymentAuthCode = objPayRsData.strAuthCode; objHotelPaymentRS.PaymentTransRefID = objPayRsData.strTranID; objHotelPaymentRS.PaymentGatewayCardType = ""; objHotelPaymentRS.PaymentCard = new HotelBookingPaymentCard(); objHotelPaymentRS.PaymentCard.PaymentCardType = WBSPGHelper.HDFCPostingCardType(); objHotelPaymentRS.PaymentCard.PaymentCardNumber = "xxxxxxxxxxxxxxxx"; objHotelPaymentRS.PaymentCard.PaymentCardHolder = objPayRsData.strTranID; objHotelPaymentRS.PaymentCard.PaymentCardEffectiveDate = ""; objHotelPaymentRS.PaymentCard.PaymentCardExpireDate = ""; objHotelPaymentRS.PaymentCard.PaymentCardIssueNumber = ""; objHotelPaymentRS.PaymentCard.PaymentCardSecurityCode = ""; objHotelPaymentRS.Success = true; objHotelPaymentRS.Errors = new Error[0]; objHotelPaymentRS.Warnings = new Warning[0]; } else // should never land here -- should have gone to Error.aspx page { objHotelPaymentRS.PaymentAuthCode = ""; objHotelPaymentRS.PaymentTransRefID = ""; objHotelPaymentRS.PaymentGatewayCardType = ""; objHotelPaymentRS.PaymentCard = null; objHotelPaymentRS.Success = false; objHotelPaymentRS.Errors = new Error[1]; objHotelPaymentRS.Errors[0] = new Error(); objHotelPaymentRS.Errors[0].Code = objPayRsData.enumStatus.ToString(); objHotelPaymentRS.Errors[0].Description = objPayRsData.strMessage; objHotelPaymentRS.Warnings = new Warning[0]; } Session["HotelPaymentRS"] = objHotelPaymentRS; Server.Transfer("~/Pages/ProcessPaymentRS.aspx"); } return; }
protected void Page_Load(object sender, EventArgs e) { Response.Cache.SetCacheability(HttpCacheability.NoCache); Response.Cache.SetExpires(DateTime.Now); Response.Cache.SetNoStore(); Response.AppendHeader("Pragma", "no-cache"); bool bPaymentGatewayRequestActive = (bool)Session["PaymentGatewayRequestActive"]; if (!bPaymentGatewayRequestActive) { Response.Redirect("~/Default.aspx"); } else { Session["PaymentGatewayRequestActive"] = false; FileLog objEventLog = (FileLog)Application["EventLog"]; ExceptionLog objExceptionEventLog = (ExceptionLog)Application["ExceptionEventLog"]; HotelPaymentRQ objHotelPaymentRQ = (HotelPaymentRQ)Session["HotelPaymentRQ"]; HotelDescriptiveInfoRS objHotelDescriptiveInfoRS = (HotelDescriptiveInfoRS)Session["HotelDescriptiveInfoRS"]; StayCriteriaSelection objStayCriteriaSelection = (StayCriteriaSelection)Session[Constants.Sessions.StayCriteriaSelection]; RoomRateSelection[] objRoomRateSelections = (RoomRateSelection[])Session["RoomRateSelections"]; GuestDetailsEntryInfo objGuestDetailsEntryInfo = (GuestDetailsEntryInfo)Session["GuestDetailsEntryInfo"]; PayRqData objPayRqData = new PayRqData(); objPayRqData.strAlias = objHotelPaymentRQ.PaymentGateway.ConfigurationParameters[WBSPGHelper.HDFC_TID_ALIAS]; objPayRqData.strResourcePath = objHotelPaymentRQ.PaymentGateway.ConfigurationParameters[WBSPGHelper.HDFC_TID_RESOURCE_PATH]; objPayRqData.strTrnRefNumber = objHotelPaymentRQ.PaymentTransRefID; objPayRqData.decAmount = WBSPGHelper.GetTotalPaymentCardPayment(objHotelPaymentRQ.PaymentAmounts); objPayRqData.strCurrency = "356"; objPayRqData.strLanguage = "USA"; if (objHotelDescriptiveInfoRS != null && objHotelDescriptiveInfoRS.HotelDescriptiveInfos != null && objHotelDescriptiveInfoRS.HotelDescriptiveInfos.Length > 0) objPayRqData.strHotelName = objHotelDescriptiveInfoRS.HotelDescriptiveInfos[0].HotelName; else objPayRqData.strHotelName = "Unknown"; // should never happen if (objStayCriteriaSelection.RoomOccupantSelections != null && objStayCriteriaSelection.RoomOccupantSelections.Length > 0) objPayRqData.intNumberGuests = objStayCriteriaSelection.RoomOccupantSelections[0].NumberAdults; else objPayRqData.intNumberGuests = 0; // should never happen if (objRoomRateSelections != null && objRoomRateSelections.Length > 0) objPayRqData.strRoomTypeName = objRoomRateSelections[0].RoomTypeCode; else objPayRqData.strRoomTypeName = "Unknown"; // should never happen objPayRqData.dtCheckinDate = objStayCriteriaSelection.ArrivalDate.Date; objPayRqData.dtCheckoutDate = objStayCriteriaSelection.DepartureDate.Date; objPayRqData.strGuestEmail = objGuestDetailsEntryInfo.Email; objPayRqData.strGuestAddress = objGuestDetailsEntryInfo.Address1 + " " + objGuestDetailsEntryInfo.Address2 + " " + objGuestDetailsEntryInfo.City + " " + objGuestDetailsEntryInfo.StateRegion + " " + objGuestDetailsEntryInfo.PostalCode + " " + objGuestDetailsEntryInfo.Country; objPayRqData.strGuestPhoneNumber = objGuestDetailsEntryInfo.Phone; StringBuilder sbReturnURL = new StringBuilder(); if (Request.IsSecureConnection) sbReturnURL.Append("https://"); else sbReturnURL.Append("http://"); sbReturnURL.Append(Request.ServerVariables["HTTP_HOST"]); Uri baseURL = new Uri(sbReturnURL.ToString()); objPayRqData.strReturnURL = (new Uri(baseURL, Response.ApplyAppPathModifier("Redirect.aspx"))).ToString(); objPayRqData.strErrorURL = (new Uri(baseURL, Response.ApplyAppPathModifier("Error.aspx"))).ToString(); HDFCDataProcessor objHDFCDataProcessor = new HDFCDataProcessor(objEventLog, objExceptionEventLog); HDFCInitResult objHDFCInitResult = objHDFCDataProcessor.PreparePayRequest(objPayRqData, this); if (objHDFCInitResult.bSuccess) { Session["PaymentGatewayResponseActive"] = true; Response.Redirect(objHDFCInitResult.strRedirectURL); } else { HotelPaymentRS objHotelPaymentRS = new HotelPaymentRS(); objHotelPaymentRS.RequestTransID = objHotelPaymentRQ.RequestTransID; objHotelPaymentRS.PaymentAuthCode = ""; objHotelPaymentRS.PaymentTransRefID = ""; objHotelPaymentRS.PaymentGatewayCardType = ""; objHotelPaymentRS.PaymentCard = null; objHotelPaymentRS.Success = false; objHotelPaymentRS.Errors = new Error[1]; objHotelPaymentRS.Errors[0] = new Error(); objHotelPaymentRS.Errors[0].Code = "FatalError"; objHotelPaymentRS.Warnings = new Warning[0]; Session["HotelPaymentRS"] = objHotelPaymentRS; Server.Transfer("~/Pages/ProcessPaymentRS.aspx"); } } return; }