/// <summary> /// Clears the target customer's session data /// </summary> protected void btnClearSession_OnClick(object sender, EventArgs e) { if (CustomerId == null) { return; } CustomerSession.StaticClear(CustomerId.Value); AlertMessageDisplay.PushAlertMessage("admin.customer.CustomerSessionCleared".StringResource(), AlertMessage.AlertType.Success); }
protected void Page_Load(object sender, EventArgs e) { if (CommonLogic.QueryStringCanBeDangerousContent("flushcache").Length != 0 || CommonLogic.QueryStringCanBeDangerousContent("resetcache").Length != 0 || CommonLogic.QueryStringCanBeDangerousContent("clearcache").Length != 0) { foreach (DictionaryEntry dEntry in HttpContext.Current.Cache) { HttpContext.Current.Cache.Remove(dEntry.Key.ToString()); } AppLogic.m_RestartApp(); Response.Redirect(AppLogic.AdminLinkUrl("default.aspx")); } divLowStock.Visible = ShowLowStockAudit(); CustomerSession.StaticClear(); CheckForMaintenanceAlert(); CheckForSecurityAlerts(); if (!IsPostBack) { SetCacheSwitch(AppLogic.AppConfigBool("CacheMenus")); loadGrids(); currencySymbol.Value = Currency.GetDefaultCurrencySymbol(); LoadQuickLook(); } var newsFeedTopic = AppLogic.AppConfig("NewsFeedTopic"); if (string.IsNullOrEmpty(newsFeedTopic)) { newsFeedTopic = "news"; } XmlPackage1.RuntimeParams = string.Format("channel={0}&height=330", newsFeedTopic); XmlPackage3.RuntimeParams = "channel=sponsors&height=330"; }
private void Page_Load(object sender, System.EventArgs e) { Response.CacheControl = "private"; Response.Expires = 0; Response.AddHeader("pragma", "no-cache"); Response.Cache.SetAllowResponseInBrowserHistory(false); Customer ThisCustomer = ((AspDotNetStorefrontPrincipal)Context.User).ThisCustomer; ThisCustomer.RequireCustomerRecord(); int CustomerID = ThisCustomer.CustomerID; String CcpaResultsCode = CommonLogic.FormCanBeDangerousContent("CcpaResultsCode"); String XID = CommonLogic.FormCanBeDangerousContent("XID"); String CAVV = CommonLogic.FormCanBeDangerousContent("CAVV"); String ECI = CommonLogic.FormCanBeDangerousContent("ECI"); String MerchantData = CommonLogic.FormCanBeDangerousContent("MD"); String TransactionStatus = CommonLogic.FormCanBeDangerousContent("TransactionStatus"); int OrderNumber = ThisCustomer.ThisCustomerSession.SessionUSInt("3Dsecure.OrderNumber"); String ReturnURL = String.Empty; ErrorMessage err; if (ReturnURL.Length == 0 && MerchantData != ThisCustomer.ThisCustomerSession["3Dsecure.MD"]) { err = new ErrorMessage(Server.HtmlEncode(AppLogic.GetString("secureprocess.aspx.1", 1, Localization.GetDefaultLocale()))); ReturnURL = "checkoutpayment.aspx?error=1&errormsg=" + err.MessageId; } if (ReturnURL.Length == 0 && ShoppingCart.CartIsEmpty(CustomerID, CartTypeEnum.ShoppingCart)) { ReturnURL = "ShoppingCart.aspx"; } if (ReturnURL.Length == 0 && OrderNumber == 0) { err = new ErrorMessage(Server.HtmlEncode(AppLogic.GetString("secureprocess.aspx.1", 1, Localization.GetDefaultLocale()))); ReturnURL = "checkoutpayment.aspx?error=1&errormsg=" + err.MessageId; } if (ReturnURL.Length == 0) { err = new ErrorMessage(Server.HtmlEncode(AppLogic.GetString("secureprocess.aspx.3", 1, Localization.GetDefaultLocale()))); switch (CcpaResultsCode) { case "5": /* * The cardholder has failed payer authentication. Do not submit the transaction - it will * Prompt the cardholder for an alternate card. be rejected. Prompt for a new card. */ ReturnURL = "checkoutpayment.aspx?error=1&errormsg=" + err.MessageId; break; case "6": /* * Signature validation of the results from the ACS Do not submit the transaction - it will * failed. Prompt the cardholder for an alternate card. be rejected. Prompt for a new card. */ ReturnURL = "checkoutpayment.aspx?error=1&errormsg=" + err.MessageId; break; } } if (ReturnURL.Length == 0) { // We need CcpaResultsCode in ProcessCard ThisCustomer.ThisCustomerSession.SetVal("3DSecure.HSBCPASResult", CcpaResultsCode); ShoppingCart cart = new ShoppingCart(1, ThisCustomer, CartTypeEnum.ShoppingCart, 0, false); String status = Gateway.MakeOrder(String.Empty, AppLogic.TransactionMode(), cart, OrderNumber, CAVV, ECI, XID, String.Empty); // The session may have changed in MakeOrder, so get the latest values from the DB CustomerSession cSession = new CustomerSession(ThisCustomer.CustomerID); if (status == AppLogic.ro_OK) { if (cSession["3DSecure.LookupResult"].Length > 0) { // the data in this session variable will be encoded, so decode it before saving to the database byte[] decodedBytes = Convert.FromBase64String(cSession["3DSecure.LookupResult"]); String LookupResult = Encoding.UTF8.GetString(decodedBytes); if (TransactionStatus.Length != 0) { LookupResult = "TransactionStatus=" + TransactionStatus + "\r\n" + LookupResult; } DB.ExecuteSQL("update orders set CardinalLookupResult=" + DB.SQuote(LookupResult) + " where OrderNumber=" + OrderNumber.ToString()); cSession["3DSecure.LookupResult"] = String.Empty; // at this point we are done with the session altogether CustomerSession.StaticClear(ThisCustomer.CustomerID); } ReturnURL = "orderconfirmation.aspx?ordernumber=" + OrderNumber.ToString() + "&paymentmethod=Credit+Card"; } else { err = new ErrorMessage(Server.HtmlEncode(status)); ReturnURL = "checkoutpayment.aspx?error=1&errormsg=" + err.MessageId; } } if (ReturnURL.Length == 0) { err = new ErrorMessage(Server.HtmlEncode(AppLogic.GetString("secureprocess.aspx.2", 1, Localization.GetDefaultLocale()))); ReturnURL = "checkoutpayment.aspx?error=1&errormsg=" + err.MessageId; } ThisCustomer.ThisCustomerSession["3DSecure.CustomerID"] = String.Empty; ThisCustomer.ThisCustomerSession["3DSecure.OrderNumber"] = String.Empty; ThisCustomer.ThisCustomerSession["3DSecure.XID"] = String.Empty; ThisCustomer.ThisCustomerSession["3DSecure.MD"] = String.Empty; ThisCustomer.ThisCustomerSession["3DSecure.HSBCPASResult"] = String.Empty; ThisCustomer.ThisCustomerSession["3DSecure.HSBCAmountRaw"] = String.Empty; ThisCustomer.ThisCustomerSession["3DSecure.HSBCAmount"] = String.Empty; Response.CacheControl = "private"; Response.Expires = 0; Response.AddHeader("pragma", "no-cache"); Response.Write("<html><head><title>3-D Secure Process</title></head><body>"); Response.Write("<script type=\"text/javascript\">\n"); Response.Write("top.location='" + ReturnURL + "';\n"); Response.Write("</SCRIPT>\n"); Response.Write("<div align=\"center\">" + String.Format(AppLogic.GetString("secureprocess.aspx.6", 1, Localization.GetDefaultLocale()), ReturnURL) + "</div>"); Response.Write("</body></html>"); }
public ExternalPaymentMethodContext Process3DSecureResponse(Dictionary <string, string> responseData) { try { if (responseData == null || responseData["response"] == null) { var errorMessage = new ErrorMessage(System.Web.HttpUtility.HtmlEncode(AppLogic.GetString("secureprocess.aspx.1", Customer.Current.SkinID, Customer.Current.LocaleSetting))); string redirectUrl = "checkoutpayment.aspx?error=1&errormsg=" + errorMessage.MessageId; return(new ExternalPaymentMethodContext("No response data", redirectUrl, new Dictionary <string, string>())); } GatewayMoneybookers.PaymentXmlTransformer <GatewayMoneybookers.CreditCardPaymentMethod> paymentTransformer = new GatewayMoneybookers.PaymentXmlTransformer <GatewayMoneybookers.CreditCardPaymentMethod>(); GatewayMoneybookers.PaymentResponse paymentResponse = paymentTransformer.TransformResponse(responseData["response"]); string result = String.Format("{0} - {1} - {2} - {3}", paymentResponse.Result, paymentResponse.Status, paymentResponse.Reason, paymentResponse.Return); int customerId = Int32.Parse(paymentResponse.SessionId); Customer customer = new Customer(customerId, true); customer.RequireCustomerRecord(); ShoppingCart cart = new ShoppingCart(customer.SkinID, customer, CartTypeEnum.ShoppingCart, 0, false); if (cart.IsEmpty()) { string redirectUrl = "shoppingcart.aspx"; return(new ExternalPaymentMethodContext("Shopping cart empty", redirectUrl, new Dictionary <string, string>())); } int orderNumber = customer.ThisCustomerSession.SessionUSInt("Moneybookers_3DSecure_OrderNumber"); if (orderNumber == 0) { var errorMessage = new ErrorMessage(System.Web.HttpUtility.HtmlEncode(AppLogic.GetString("secureprocess.aspx.1", Customer.Current.SkinID, Customer.Current.LocaleSetting))); string redirectUrl = "checkoutpayment.aspx?error=1&errormsg=" + errorMessage.MessageId; return(new ExternalPaymentMethodContext(result, redirectUrl, new Dictionary <string, string>())); } if (paymentResponse.Result.ToUpperInvariant() != "ACK") { var errorMessage = new ErrorMessage(System.Web.HttpUtility.HtmlEncode(AppLogic.GetString("secureprocess.aspx.3", Customer.Current.SkinID, Customer.Current.LocaleSetting))); string redirectUrl = "checkoutpayment.aspx?error=1&errormsg=" + errorMessage.MessageId; return(new ExternalPaymentMethodContext(result, redirectUrl, new Dictionary <string, string>())); } CustomerSession customerSession = new CustomerSession(customerId); customerSession["Moneybookers_3DSecure_Approved"] = Boolean.TrueString; customerSession["Moneybookers_3DSecure_Response"] = responseData["response"]; customerSession["Moneybookers_3DSecure_VerificationPath"] = responseData["threedsecure_verificationpath"]; string status = Gateway.MakeOrder(String.Empty, AppLogic.TransactionMode(), cart, orderNumber, String.Empty, String.Empty, String.Empty, String.Empty); if (status != AppLogic.ro_OK) { var errorMessage = new ErrorMessage(System.Web.HttpUtility.HtmlEncode(status)); string redirectUrl = "checkoutpayment.aspx?error=1&errormsg=" + errorMessage.MessageId; return(new ExternalPaymentMethodContext(result, redirectUrl, new Dictionary <string, string>())); } CustomerSession.StaticClear(customer.CustomerID); return(new ExternalPaymentMethodContext(result, AppLogic.GetStoreHTTPLocation(false) + "orderconfirmation.aspx?paymentmethod=Credit+Card&ordernumber=" + orderNumber, new Dictionary <string, string>())); } catch (Exception exception) { string result = "Error processing order: " + exception.ToString(); ErrorMessage errorMessage = new ErrorMessage(AspDotNetStorefrontCore.AppLogic.GetString("checkoutpayment.aspx.35", Customer.Current.SkinID, Customer.Current.LocaleSetting)); string redirectUrl = String.Format("{0}shoppingcart.aspx?error=1&ErrorMsg={1}", AppLogic.GetStoreHTTPLocation(false), errorMessage.MessageId); return(new ExternalPaymentMethodContext(result, redirectUrl, new Dictionary <string, string>())); } }
private void Page_Load(object sender, System.EventArgs e) { Response.CacheControl = "private"; Response.Expires = 0; Response.AddHeader("pragma", "no-cache"); Response.Cache.SetAllowResponseInBrowserHistory(false); Customer ThisCustomer = ((AspDotNetStorefrontPrincipal)Context.User).ThisCustomer; ThisCustomer.RequireCustomerRecord(); int CustomerID = ThisCustomer.CustomerID; String paReq = ThisCustomer.ThisCustomerSession["3Dsecure.paReq"]; String PaRes = CommonLogic.FormCanBeDangerousContent("PaRes"); String MerchantData = CommonLogic.FormCanBeDangerousContent("MD"); String TransactionID = ThisCustomer.ThisCustomerSession["3Dsecure.XID"]; int OrderNumber = ThisCustomer.ThisCustomerSession.SessionUSInt("3Dsecure.OrderNumber"); String ErrorDesc = String.Empty; String ReturnURL = String.Empty; // The PaRes should have no whitespace in it, we need to strip it out. PaRes = PaRes.Replace(" ", ""); PaRes = PaRes.Replace("\r", ""); PaRes = PaRes.Replace("\n", ""); ErrorMessage err; if (PaRes.Length != 0) { ThisCustomer.ThisCustomerSession["3Dsecure.PaRes"] = PaRes; } if (ReturnURL.Length == 0 && MerchantData != ThisCustomer.ThisCustomerSession["3Dsecure.MD"]) { err = new ErrorMessage(Server.HtmlEncode(AppLogic.GetString("secureprocess.aspx.1", 1, Localization.GetDefaultLocale()))); ReturnURL = "checkoutpayment.aspx?error=1&errormsg=" + err.MessageId; } if (ReturnURL.Length == 0 && ShoppingCart.CartIsEmpty(CustomerID, CartTypeEnum.ShoppingCart)) { ReturnURL = "ShoppingCart.aspx"; } if (ReturnURL.Length == 0 && OrderNumber == 0) { err = new ErrorMessage(Server.HtmlEncode(AppLogic.GetString("secureprocess.aspx.1", 1, Localization.GetDefaultLocale()))); ReturnURL = "checkoutpayment.aspx?error=1&errormsg=" + err.MessageId; } if (ReturnURL.Length == 0) { if (paReq.Length == 0 || TransactionID.Length == 0) { err = new ErrorMessage(Server.HtmlEncode(AppLogic.GetString("secureprocess.aspx.1", 1, Localization.GetDefaultLocale()))); ReturnURL = "checkoutpayment.aspx?error=1&errormsg=" + err.MessageId; } } if (ReturnURL.Length == 0) { ShoppingCart cart = new ShoppingCart(1, ThisCustomer, CartTypeEnum.ShoppingCart, 0, false); String status = Gateway.MakeOrder(String.Empty, AppLogic.TransactionMode(), cart, OrderNumber, String.Empty, String.Empty, String.Empty, String.Empty); // The session may have changed in MakeOrder, so get the latest values from the DB CustomerSession cSession = new CustomerSession(ThisCustomer.CustomerID); if (status == AppLogic.ro_OK) { if (cSession["3DSecure.LookupResult"].Length > 0) { // the data in this session variable will be encoded, so decode it before saving to the database byte[] decodedBytes = Convert.FromBase64String(cSession["3DSecure.LookupResult"]); String LookupResult = Encoding.UTF8.GetString(decodedBytes); DB.ExecuteSQL("update orders set CardinalLookupResult=" + DB.SQuote(LookupResult) + " where OrderNumber=" + OrderNumber.ToString()); cSession["3DSecure.LookupResult"] = String.Empty; // at this point we are done with the session altogether CustomerSession.StaticClear(ThisCustomer.CustomerID); } ReturnURL = "orderconfirmation.aspx?ordernumber=" + OrderNumber.ToString() + "&paymentmethod=Credit+Card"; } else { ErrorDesc = status; } } if (ReturnURL.Length == 0) { err = new ErrorMessage(Server.HtmlEncode(String.Format(AppLogic.GetString("secureprocess.aspx.5", 1, Localization.GetDefaultLocale()), ErrorDesc))); ReturnURL = "checkoutpayment.aspx?error=1&errormsg=" + err.MessageId; } ThisCustomer.ThisCustomerSession["3DSecure.CustomerID"] = String.Empty; ThisCustomer.ThisCustomerSession["3DSecure.OrderNumber"] = String.Empty; ThisCustomer.ThisCustomerSession["3DSecure.ACSUrl"] = String.Empty; ThisCustomer.ThisCustomerSession["3DSecure.paReq"] = String.Empty; ThisCustomer.ThisCustomerSession["3DSecure.XID"] = String.Empty; ThisCustomer.ThisCustomerSession["3DSecure.MD"] = String.Empty; ThisCustomer.ThisCustomerSession["3Dsecure.PaRes"] = String.Empty; Response.CacheControl = "private"; Response.Expires = 0; Response.AddHeader("pragma", "no-cache"); Response.Write("<html><head><title>3-D Secure Process</title></head><body>"); Response.Write("<script type=\"text/javascript\">\n"); Response.Write("top.location='" + ReturnURL + "';\n"); Response.Write("</SCRIPT>\n"); Response.Write("<div align=\"center\">" + String.Format(AppLogic.GetString("secureprocess.aspx.6", 1, Localization.GetDefaultLocale()), ReturnURL) + "</div>"); Response.Write("</body></html>"); }