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)
    {
        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"];

            PayRqData objPayRqData = new PayRqData();

            objPayRqData.strMerchantID = objHotelPaymentRQ.PaymentGateway.ConfigurationParameters[WBSPGHelper.CBA_MERCHANT_ID];
            objPayRqData.strMerchantAccessCode = objHotelPaymentRQ.PaymentGateway.ConfigurationParameters[WBSPGHelper.CBA_MERCHANT_ACCESS_CODE];
            objPayRqData.strSecureHashSecret = objHotelPaymentRQ.PaymentGateway.ConfigurationParameters[WBSPGHelper.CBA_SECURE_HASH_SECRET];

            objPayRqData.litPayData = litPayData;

            objPayRqData.strTrnRefNumber = objHotelPaymentRQ.PaymentTransRefID;
            objPayRqData.strTrnOrderInfo = objHotelPaymentRQ.PaymentTransInfo;

            objPayRqData.decAmount = WBSPGHelper.GetTotalPaymentCardPayment(objHotelPaymentRQ.PaymentAmounts);

            DateTime dtPaymentCardExpirationDate = WBSPGHelper.ExpirationDate(objHotelPaymentRQ.PaymentCard.PaymentCardExpireDate);

            objPayRqData.enumCardType = WBSPGHelper.CBACardType(objHotelPaymentRQ.PaymentCard.PaymentCardType);
            objPayRqData.strCardNumber = objHotelPaymentRQ.PaymentCard.PaymentCardNumber;
            objPayRqData.intCardExpirationMonth = dtPaymentCardExpirationDate.Month;
            objPayRqData.intCardExpirationYear = dtPaymentCardExpirationDate.Year;
            objPayRqData.strCardSecurityCode = objHotelPaymentRQ.PaymentCard.PaymentCardSecurityCode;

            objPayRqData.strDisplayLocale = objHotelPaymentRQ.UICultureCode;

            objPayRqData.strTicketNo = "";

            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("PayReceipt.aspx"))).ToString();

            VPCDataProcessor objProcessor = new VPCDataProcessor(objEventLog, objExceptionEventLog, true);

            if (objProcessor.PreparePayRequest(objPayRqData, out strAction))
            {
                Session["PaymentGatewayResponseActive"] = true;
            }

            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;
    }
    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"];

            OgoneDataProcessor objDataProcessor = new OgoneDataProcessor(objEventLog, objExceptionEventLog);
            PayRsData objPayRsData = objDataProcessor.ProcessPayResponse(Page.Request, objHotelPaymentRQ.PaymentGateway.ConfigurationParameters[WBSPGHelper.OGONE_SECURE_SECRET]);

            HotelPaymentRS objHotelPaymentRS = new HotelPaymentRS();

            objHotelPaymentRS.RequestTransID = objHotelPaymentRQ.RequestTransID;

            if (objPayRsData.enumStatus == PayRSStatus.Authorized)
            {
                objHotelPaymentRS.PaymentAuthCode = objPayRsData.strAuthCode;
                objHotelPaymentRS.PaymentTransRefID = objHotelPaymentRQ.PaymentTransRefID;
                objHotelPaymentRS.PaymentGatewayCardType = "";
                objHotelPaymentRS.PaymentCard = objHotelPaymentRQ.PaymentCard;

                objHotelPaymentRS.Success = true;

                objHotelPaymentRS.Errors = new Error[0];
                objHotelPaymentRS.Warnings = new Warning[0];
            }

            else
            {
                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.strErrorMessage;

                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"];

            PayRqData objPayRqData = new PayRqData();

            objPayRqData.strMerchantID = objHotelPaymentRQ.PaymentGateway.ConfigurationParameters[WBSPGHelper.DIBS_MERCHANT_ID];
            objPayRqData.strSecureHashSecret1 = objHotelPaymentRQ.PaymentGateway.ConfigurationParameters[WBSPGHelper.DIBS_SECURE_SECRET_1];
            objPayRqData.strSecureHashSecret2 = objHotelPaymentRQ.PaymentGateway.ConfigurationParameters[WBSPGHelper.DIBS_SECURE_SECRET_2];

            objPayRqData.litPayData = litPayData;

            objPayRqData.strTrnRefNumber = objHotelPaymentRQ.PaymentTransRefID;
            objPayRqData.strTrnOrderInfo = objHotelPaymentRQ.PaymentTransInfo;

            objPayRqData.decAmount = WBSPGHelper.GetTotalPaymentCardPayment(objHotelPaymentRQ.PaymentAmounts);
            objPayRqData.strCurrency = objHotelPaymentRQ.PaymentGateway.ConfigurationParameters[WBSPGHelper.DIBS_CURRENCY_CODE_NUMBER];

            if (objHotelPaymentRQ.PaymentGateway.ConfigurationParameters[WBSPGHelper.DIBS_SYSTEM_MODE] == "prod")
                objPayRqData.bTestTransaction = false;
            else
                objPayRqData.bTestTransaction = true;

            objPayRqData.strDisplayLocale = objHotelPaymentRQ.UICultureCode;

            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("PayReceipt.aspx"))).ToString();
            objPayRqData.strCallbackURL = (new Uri(baseURL, Response.ApplyAppPathModifier("Callback.aspx"))).ToString();

            objPayRqData.strEchoData = (string)Session["PendingPrepayBookingID"];

            DIBSDataProcessor objProcessor = new DIBSDataProcessor(objEventLog, objExceptionEventLog, true);

            if (objProcessor.PreparePayRequest(objPayRqData, out strAction))
            {
                Session["PaymentGatewayResponseActive"] = true;
            }

            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;
    }
    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"];

            PayRqData objPayRqData = new PayRqData();

            objPayRqData.strMerchantID = objHotelPaymentRQ.PaymentGateway.ConfigurationParameters[WBSPGHelper.BNZ_MERCHANT_ID];
            objPayRqData.strClientCertificatePath = objHotelPaymentRQ.PaymentGateway.ConfigurationParameters[WBSPGHelper.BNZ_CLIENT_CERT_PATH];
            objPayRqData.strClientCertificatePassword = objHotelPaymentRQ.PaymentGateway.ConfigurationParameters[WBSPGHelper.BNZ_CLIENT_CERT_PASSWORD];

            objPayRqData.strTrnRefNumber = objHotelPaymentRQ.PaymentTransRefID;
            objPayRqData.strTrnOrderInfo = objHotelPaymentRQ.PaymentTransInfo;

            objPayRqData.decAmount = WBSPGHelper.GetTotalPaymentCardPayment(objHotelPaymentRQ.PaymentAmounts);

            DateTime dtPaymentCardExpirationDate = WBSPGHelper.ExpirationDate(objHotelPaymentRQ.PaymentCard.PaymentCardExpireDate);

            objPayRqData.enumCardType = WBSPGHelper.BNZCardType(objHotelPaymentRQ.PaymentCard.PaymentCardType);
            objPayRqData.strCardholderName = objHotelPaymentRQ.PaymentCard.PaymentCardHolder;
            objPayRqData.strCardNumber = objHotelPaymentRQ.PaymentCard.PaymentCardNumber;
            objPayRqData.intCardExpirationMonth = dtPaymentCardExpirationDate.Month;
            objPayRqData.intCardExpirationYear = dtPaymentCardExpirationDate.Year;
            objPayRqData.strCardSecurityCode = objHotelPaymentRQ.PaymentCard.PaymentCardSecurityCode;

            BNZDataProcessor objProcessor = new BNZDataProcessor(objEventLog, objExceptionEventLog);

            PayRsData objPayRsData = objProcessor.SubmitPayRequest(objPayRqData);

            HotelPaymentRS objHotelPaymentRS = new HotelPaymentRS();

            objHotelPaymentRS.RequestTransID = objHotelPaymentRQ.RequestTransID;

            if (objPayRsData.enumStatus == PayRSStatus.Authorized)
            {
                objHotelPaymentRS.PaymentAuthCode = objPayRsData.strAuthCode;
                objHotelPaymentRS.PaymentTransRefID = objHotelPaymentRQ.PaymentTransRefID;
                objHotelPaymentRS.PaymentCard = objHotelPaymentRQ.PaymentCard;

                objHotelPaymentRS.Success = true;

                objHotelPaymentRS.Errors = new Error[0];
                objHotelPaymentRS.Warnings = new Warning[0];
            }

            else
            {
                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.strErrorMessage;

                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;
    }
    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"];
            PayRqData objPayRqData = (PayRqData)Session["XHS.MIGS3VPCHelper.PayRqData"];

            VPCDataProcessor objProcessor = new VPCDataProcessor(objEventLog, objExceptionEventLog, true);

            PayRsData objPayRsData = null;

            if (objHotelPaymentRQ.PaymentGateway.ConfigurationParameters[WBSPGHelper.MIGS3P_AVS_ACTIVE] == "1")
                objPayRsData = objProcessor.ProcessPayResponseAndCapture(Page.Request, objPayRqData, objHotelPaymentRQ.PaymentGateway.ConfigurationParameters[WBSPGHelper.MIGS3P_AVS_RETURN_CODES]);
            else
                objPayRsData = objProcessor.ProcessPayResponse(Page.Request, objHotelPaymentRQ.PaymentGateway.ConfigurationParameters[WBSPGHelper.MIGS3P_SECURE_HASH_SECRET]);

            HotelPaymentRS objHotelPaymentRS = new HotelPaymentRS();

            objHotelPaymentRS.RequestTransID = objHotelPaymentRQ.RequestTransID;

            if (objPayRsData.enumStatus == PayRSStatus.Authorized)
            {
                objHotelPaymentRS.PaymentAuthCode = objPayRsData.strAuthCode;
                objHotelPaymentRS.PaymentTransRefID = objHotelPaymentRQ.PaymentTransRefID;
                objHotelPaymentRS.PaymentGatewayCardType = objPayRsData.strCardType;

                objHotelPaymentRS.PaymentCard = new HotelBookingPaymentCard();
                objHotelPaymentRS.PaymentCard.PaymentCardType = WBSPGHelper.MIGS3PPostingCardType(objPayRsData.strCardType);

                if (objPayRsData.strCarNumMasked != null && objPayRsData.strCarNumMasked != "")
                    objHotelPaymentRS.PaymentCard.PaymentCardNumber = objPayRsData.strCarNumMasked;
                else
                    objHotelPaymentRS.PaymentCard.PaymentCardNumber = "xxxxxxxxxxxxxxxx";

                objHotelPaymentRS.PaymentCard.PaymentCardHolder = objPayRsData.strCardType + ", " + objHotelPaymentRQ.PaymentTransRefID;
                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
            {
                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"];

            PayRqData objPayRqData = new PayRqData();

            objPayRqData.strMerchantID = objHotelPaymentRQ.PaymentGateway.ConfigurationParameters[WBSPGHelper.OGONE_MERCHANT_ID];
            objPayRqData.strUserID = objHotelPaymentRQ.PaymentGateway.ConfigurationParameters[WBSPGHelper.OGONE_USER_ID];
            objPayRqData.strPassword = objHotelPaymentRQ.PaymentGateway.ConfigurationParameters[WBSPGHelper.OGONE_USER_PASSWORD];
            objPayRqData.strSecureSecret = objHotelPaymentRQ.PaymentGateway.ConfigurationParameters[WBSPGHelper.OGONE_SECURE_SECRET];

            objPayRqData.strTrnRefNumber = objHotelPaymentRQ.PaymentTransRefID;
            objPayRqData.strTrnOrderInfo = objHotelPaymentRQ.PaymentTransInfo;

            objPayRqData.decAmount = WBSPGHelper.GetTotalPaymentCardPayment(objHotelPaymentRQ.PaymentAmounts);
            objPayRqData.strCurrency = objHotelPaymentRQ.CurrencyCode;

            DateTime dtPaymentCardExpirationDate = WBSPGHelper.ExpirationDate(objHotelPaymentRQ.PaymentCard.PaymentCardExpireDate);

            objPayRqData.enumCardType = WBSPGHelper.OgoneCardType(objHotelPaymentRQ.PaymentCard.PaymentCardType);
            objPayRqData.strCardHolderName = objHotelPaymentRQ.PaymentCard.PaymentCardHolder;
            objPayRqData.strCardNumber = objHotelPaymentRQ.PaymentCard.PaymentCardNumber;
            objPayRqData.intCardExpirationMonth = dtPaymentCardExpirationDate.Month;
            objPayRqData.intCardExpirationYear = dtPaymentCardExpirationDate.Year;
            objPayRqData.strCardSecurityCode = objHotelPaymentRQ.PaymentCard.PaymentCardSecurityCode;

            objPayRqData.strDisplayLocale = objHotelPaymentRQ.CultureCode.Replace('-', '_');

            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("Pay3DSecReceipt.aspx"))).ToString();

            OgoneDataProcessor objProcessor = new OgoneDataProcessor(objEventLog, objExceptionEventLog);

            PayRsData objPayRsData = objProcessor.SubmitPayRequest(objPayRqData, Request);

            if (objPayRsData.enumStatus == PayRSStatus.ThreeDSecureRequired)
            {
                this.lit3DSecureData.Text = objPayRsData.str3DSecureRequestData;

                Session["PaymentGatewayResponseActive"] = true;
            }

            else
            {
                HotelPaymentRS objHotelPaymentRS = new HotelPaymentRS();

                objHotelPaymentRS.RequestTransID = objHotelPaymentRQ.RequestTransID;

                if (objPayRsData.enumStatus == PayRSStatus.Authorized)
                {
                    objHotelPaymentRS.PaymentAuthCode = objPayRsData.strAuthCode;
                    objHotelPaymentRS.PaymentTransRefID = objHotelPaymentRQ.PaymentTransRefID;
                    objHotelPaymentRS.PaymentGatewayCardType = "";
                    objHotelPaymentRS.PaymentCard = objHotelPaymentRQ.PaymentCard;

                    objHotelPaymentRS.Success = true;

                    objHotelPaymentRS.Errors = new Error[0];
                    objHotelPaymentRS.Warnings = new Warning[0];
                }

                else
                {
                    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.strErrorMessage;

                    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"];

            DIBSDataProcessor objProcessor = new DIBSDataProcessor(objEventLog, objExceptionEventLog, true);
            PayRsData objPayRsData = objProcessor.ProcessPayResponse(Page.Request, objHotelPaymentRQ.PaymentGateway.ConfigurationParameters[WBSPGHelper.DIBS_SECURE_SECRET_1], objHotelPaymentRQ.PaymentGateway.ConfigurationParameters[WBSPGHelper.DIBS_SECURE_SECRET_2]);

            HotelPaymentRS objHotelPaymentRS = new HotelPaymentRS();

            objHotelPaymentRS.RequestTransID = objHotelPaymentRQ.RequestTransID;

            WBSMonitor wbsMonitor = WBSMonitor.GetWbsMonitor(Context.Cache, objEventLog, objExceptionEventLog, XnGR_WBS_Page.IsProductionMode(), (int)Application["WBSMonitor.ExpirationSeconds"]);
            wbsMonitor.UpdateItem(objPayRsData.strEchoData, WBSMonitor.MonitorUpdateType.AcceptReceived);

            if (objPayRsData.enumStatus == PayRSStatus.Authorized)
            {
                objHotelPaymentRS.PaymentAuthCode = objPayRsData.strAuthCode;
                objHotelPaymentRS.PaymentTransRefID = objHotelPaymentRQ.PaymentTransRefID;
                objHotelPaymentRS.PaymentGatewayCardType = objPayRsData.strPaymentType;

                objHotelPaymentRS.PaymentCard = new HotelBookingPaymentCard();
                objHotelPaymentRS.PaymentCard.PaymentCardType = WBSPGHelper.DIBSPostingCardType(objPayRsData.strPaymentType);
                objHotelPaymentRS.PaymentCard.PaymentCardNumber = objPayRsData.strCardNumberMasked;
                objHotelPaymentRS.PaymentCard.PaymentCardHolder = objPayRsData.strPaymentType + ", " + objPayRsData.strTransact;
                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
            {
                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 = "";

                objHotelPaymentRS.Warnings = new Warning[0];
            }

            Session["HotelPaymentRS"] = objHotelPaymentRS;

            Server.Transfer("~/Pages/ProcessPaymentRS.aspx");
        }

        return;
    }