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"]; VPCDataProcessor objProcessor = new VPCDataProcessor(objEventLog, objExceptionEventLog, true); PayRsData objPayRsData = objProcessor.ProcessPayResponse(Page.Request, objHotelPaymentRQ.PaymentGateway.ConfigurationParameters[WBSPGHelper.CBA_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 = ""; 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.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"]; 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; }