private bool IsProductIsValid(Product product, OrderItem orderItem, out ArrayList optionItemNameArray) { //check product enabled optionItemNameArray = null; if (!product.IsEnabled) { StoreContext.ClearCheckoutSession(); string message = "<p class=\"ErrorHeader\">[$Product is inactive]</p>"; ErrorMessage(message); return(false); } //check is product option valid if (!IsProductOptionValid(product, orderItem, out optionItemNameArray)) { StoreContext.ClearCheckoutSession(); string message = "<p class=\"ErrorHeader\">[$Product changed]</p>"; ErrorMessage(message); return(false); } //check is category enabled if (!product.IsProductAvailable(StoreContext.CurrentStore.StoreID)) { StoreContext.ClearCheckoutSession(); string message = "<p class=\"ErrorHeader\">[$Product is inactive]</p>"; ErrorMessage(message); return(false); } return(true); }
private void AddItemToGiftRegistryAndRedirect(string giftRegistryID) { GiftRegistryItem.ConvertToGiftRegistryItem(StoreContext.ShoppingCart, StoreContext.Culture, StoreContext.Currency, giftRegistryID); StoreContext.ClearCheckoutSession(); Session["GiftRegistryID"] = null; Response.Redirect("GiftRegistryItemList.aspx?GiftRegistryID=" + giftRegistryID); }
private void ProcessZeroPricePayment(CheckoutDetails checkout) { OrderNotifyService order = CreateOrder(checkout); Exception emailEx = order.SendOrderEmailNoThrow(); StoreError.Instance.Exception = emailEx; order.ProcessPaymentComplete(); StoreContext.ClearCheckoutSession(); MainContext.RedirectMainControl("OrdersEdit.ascx", String.Format("OrderID={0}", order.OrderID)); }
private void ProcessZeroPricePayment(CheckoutDetails checkout) { OrderNotifyService order = CreateOrder(checkout); Exception emailEx = order.SendOrderEmailNoThrow(); StoreError.Instance.Exception = emailEx; order.ProcessPaymentComplete(); StoreContext.ClearCheckoutSession(); Response.Redirect("CheckoutComplete.aspx?OrderID=" + order.OrderID + "&IsTransaction=True" + GenerateIsEmailOKString(emailEx)); }
protected void Page_PreRender(object sender, EventArgs e) { if (!MainContext.IsPostBack) { uxCurrencyControl.StoreID = SelectedStoreID; uxCategoryFilterDrop.CultureID = CurrentCulture.CultureID; uxCategoryFilterDrop.RefreshCategoryDropList( "0"); StoreContext.ClearCheckoutSession(); } uxCurrencyControl.StoreID = SelectedStoreID; PopulateControls(); }
protected void PostCartToGoogle(object sender, System.Web.UI.ImageClickEventArgs e) { uxGCheckoutButton.Currency = DataAccessContext.Configurations.GetValue("PaymentCurrency"); CheckoutShoppingCartRequest request = uxGCheckoutButton.CreateRequest(); GoogleCheckoutRequestHelper helper = new GoogleCheckoutRequestHelper(); helper.PopulateRequest( UrlPath.StorefrontUrl, request, StoreContext.ShoppingCart, StoreContext.Culture, StoreContext.Currency, StoreContext.WholesaleStatus, StoreContext.CheckoutDetails); StoreContext.ClearCheckoutSession(); Log.Debug("----------------------------------------"); Log.Debug("Request XML: " + EncodeHelper.Utf8BytesToString(request.GetXml())); GCheckoutResponse response = request.Send(); if (response.IsGood) { if (UrlManager.IsFacebook()) { string script = "window.parent.location.href='" + response.RedirectUrl + "'"; ScriptManager.RegisterStartupScript(this, typeof(Page), "startScript", script, true); } else { Response.Redirect(response.RedirectUrl, true); } } else { StringBuilder sb = new StringBuilder(); sb.AppendLine("Google Checkout Request Error: "); sb.AppendLine("ResponseXml = " + response.ResponseXml); sb.AppendLine("RedirectUrl = " + response.RedirectUrl); sb.AppendLine("IsGood = " + response.IsGood); sb.AppendLine("ErrorMessage = " + response.ErrorMessage); throw new VevoException(sb.ToString()); } }
private void ProcessOfflinePaymentSuccess(CheckoutDetails checkout) { OrderNotifyService order = CreateOrder(checkout); // Do not send electronic goods for offline payment. Merchants should send them manually. //********************* For Testing ***************************** //order.SendDownloadEmailByOrderID(); Exception emailEx = order.SendOrderEmailNoThrow(); StoreError.Instance.Exception = emailEx; StoreContext.ClearCheckoutSession(); MainContext.RedirectMainControl("OrdersEdit.ascx", String.Format("OrderID={0}", order.OrderID)); }
private void ProcessOfflinePaymentSuccess(CheckoutDetails checkout) { OrderNotifyService order = CreateOrder(checkout); // Do not send electronic goods for offline payment. Merchants should send them manually. //********************* For Testing ***************************** //order.SendDownloadEmailByOrderID(); Exception emailEx = order.SendOrderEmailNoThrow(); StoreError.Instance.Exception = emailEx; StoreContext.ClearCheckoutSession(); Response.Redirect("CheckoutComplete.aspx?OrderID=" + order.OrderID + "&IsTransaction=True" + GenerateIsEmailOKString(emailEx)); }
private void ProcessCreditCardPaymentSuccess( OrderNotifyService order, string gatewayOrderID, string log, string cvvStatus, string AvsAddrStatus, string AvsZipStatus ) { if (!String.IsNullOrEmpty(log)) { PaymentLog paymentLog = new PaymentLog(); paymentLog.OrderID = order.OrderID; paymentLog.PaymentResponse = log; paymentLog.PaymentGateway = order.PaymentMethod; paymentLog.PaymentType = "ProcessCreditCard"; DataAccessContext.PaymentLogRepository.Save(paymentLog); } if (!String.IsNullOrEmpty(gatewayOrderID) || !String.IsNullOrEmpty(cvvStatus) || !String.IsNullOrEmpty(AvsAddrStatus) || !String.IsNullOrEmpty(AvsZipStatus)) { Order orderDetails = DataAccessContext.OrderRepository.GetOne(order.OrderID); orderDetails.GatewayOrderID = gatewayOrderID; orderDetails.CvvStatus = cvvStatus; orderDetails.AvsAddrStatus = AvsAddrStatus; orderDetails.AvsZipStatus = AvsZipStatus; DataAccessContext.OrderRepository.Save(orderDetails); } Exception emailEx = order.SendOrderEmailNoThrow(); StoreError.Instance.Exception = emailEx; order.ProcessPaymentComplete(); StoreContext.ClearCheckoutSession(); Response.Redirect("CheckoutComplete.aspx?OrderID=" + order.OrderID + "&IsTransaction=True" + GenerateIsEmailOKString(emailEx)); }
protected void Page_PreRender(object sender, EventArgs e) { if (!MainContext.IsPostBack) { uxCurrencyControl.StoreID = SelectedStoreID; uxCategoryFilterDrop.RefreshCategoryDropList( DataAccessContext.Configurations.GetValue("RootCategory", DataAccessContext.StoreRepository.GetOne(SelectedStoreID))); StoreContext.ClearCheckoutSession(); } uxTaxIncludeMsgPanel.Visible = TaxIncludeVisibility(); uxTaxIncludeMsgLabel.ToolTip = GetTaxTooltipText(); StoreContext.Customer = DataAccessContext.CustomerRepository.GetOne(SelectedCustomerID); uxCurrencyControl.StoreID = SelectedStoreID; PopulateControls(); PopulateShoppingCartControls(); }
private bool IsProductIsValid(Product product, OrderItem orderItem, out ArrayList optionItemNameArray, out ProductKitItemValueCollection itemCollection) { //check product enabled optionItemNameArray = null; itemCollection = ProductKitItemValueCollection.Null; if (!product.IsEnabled) { StoreContext.ClearCheckoutSession(); string message = "<p class=\"ErrorHeader\">[$Product is inactive]</p>"; ErrorMessage(message); return(false); } //check is product option valid if (!IsProductOptionValid(product, orderItem, out optionItemNameArray)) { StoreContext.ClearCheckoutSession(); string message = "<p class=\"ErrorHeader\">[$Product changed]</p>"; ErrorMessage(message); return(false); } //check is category enabled if (!product.IsProductAvailable(StoreContext.CurrentStore.StoreID)) { StoreContext.ClearCheckoutSession(); string message = "<p class=\"ErrorHeader\">[$Product is inactive]</p>"; ErrorMessage(message); return(false); } ArrayList productKitArray = new ArrayList(); ArrayList productKitCountArray = new ArrayList(); ArrayList productKitGroupIDArray = new ArrayList(); if (product.IsProductKit) { if (!IsProductKitValid(product, orderItem, StoreContext.Culture, new StoreRetriever().GetCurrentStoreID(), out productKitArray, out productKitCountArray, out productKitGroupIDArray)) { StoreContext.ClearCheckoutSession(); string message = "<p class=\"ErrorHeader\">[$ProductKit is inactive]</p>"; ErrorMessage(message); return(false); } itemCollection = GenerateProductKitItemValueCollection(product, orderItem, productKitArray, productKitCountArray, productKitGroupIDArray); } ProductSubscription subscriptionItem = new ProductSubscription(product.ProductID); //check customer can subscription this product if (subscriptionItem.IsSubscriptionProduct()) { if (CustomerSubscription.IsContainsProductSubscriptionHigherLevel( subscriptionItem.ProductSubscriptions[0].SubscriptionLevelID, DataAccessContextDeluxe.CustomerSubscriptionRepository.GetCustomerSubscriptionsByCustomerID(StoreContext.Customer.CustomerID))) { StoreContext.ClearCheckoutSession(); string message = "<p class=\"ErrorHeader\">[$Cannot subscription]</p>"; ErrorMessage(message); return(false); } } return(true); }
private bool ReOrderToCart(Product product, OrderItem orderItem, string optionItemIDs, ProductKitItemValueCollection itemCollection) { string errorCurrentStock = string.Empty; int currentStock = 0; bool isAddToCartSuccess = false; OptionItemValueCollection optionCollection = new OptionItemValueCollection(StoreContext.Culture, optionItemIDs, product.ProductID); CartItemGiftDetails giftDetails = new CartItemGiftDetails(); if (product.IsGiftCertificate) { GiftCertificateProduct giftProduct = (GiftCertificateProduct)product; IList <GiftCertificate> giftCertificateList = DataAccessContext.GiftCertificateRepository.GetAllByOrderID(orderItem.OrderID); foreach (GiftCertificate giftCertificate in giftCertificateList) { if (orderItem.OrderItemID == giftCertificate.OrderItemID) { giftDetails = new CartItemGiftDetails( giftCertificate.Recipient, giftCertificate.PersonalNote, giftCertificate.NeedPhysical, giftCertificate.GiftValue); } } if (giftProduct.GiftAmount == 0) { giftProduct.GiftAmount = orderItem.UnitPrice; } product = (Product)giftProduct; CartAddItemService addToCartService = new CartAddItemService( StoreContext.Culture, StoreContext.ShoppingCart); isAddToCartSuccess = addToCartService.AddToCart( product, optionCollection, itemCollection, orderItem.Quantity, giftDetails, 0, out errorCurrentStock, out currentStock); } else if (product.IsCustomPrice) { CartAddItemService addToCartService = new CartAddItemService( StoreContext.Culture, StoreContext.ShoppingCart); isAddToCartSuccess = addToCartService.AddToCart( product, optionCollection, itemCollection, GetProductQuantity(product, orderItem), giftDetails, orderItem.UnitPrice, out errorCurrentStock, out currentStock); } else { CartAddItemService addToCartService = new CartAddItemService( StoreContext.Culture, StoreContext.ShoppingCart); isAddToCartSuccess = addToCartService.AddToCart( product, optionCollection, itemCollection, GetProductQuantity(product, orderItem), giftDetails, 0, out errorCurrentStock, out currentStock); } if (!isAddToCartSuccess) { StoreContext.ClearCheckoutSession(); string message = "<p class=\"ErrorHeader\">[$StockError]</p>"; ErrorMessage(message); return(false); } return(true); }
protected void Page_PreRender(object sender, EventArgs e) { if (!IsPostBack) { DisplayOrderSummary(); } DisplayEmailErrorMessage(); DisplayCreditCardMultiChargeErrorMessage(); Order order = DataAccessContext.OrderRepository.GetOne(CurrentOrderID); if (StoreContext.CheckoutDetails.IsCreatedByAdmin) { StoreContext.ClearCheckoutSession(); Response.Redirect(String.Format("admin/Default.aspx#OrdersEdit,OrderID={0}", order.OrderID)); return; } StoreContext.ClearCheckoutSession(); uxGiftCertificateTR.Visible = DataAccessContext.Configurations.GetBoolValue("GiftCertificateEnabled"); if ((Membership.GetUser() != null && String.Compare(order.UserName, Membership.GetUser().UserName, true) == 0) || order.UserName == SystemConst.AnonymousUser) { uxProductCostLabel.Text = StoreContext.Currency.FormatPrice(Convert.ToDecimal(order.Subtotal)); uxDiscountLabel.Text = StoreContext.Currency.FormatPrice( Convert.ToDecimal(order.CouponDiscount * -1)); uxPointDiscountLabel.Text = StoreContext.Currency.FormatPrice(Convert.ToDecimal(order.RedeemPrice * -1)); uxGiftCertificateLabel.Text = StoreContext.Currency.FormatPrice( Convert.ToDecimal(order.GiftCertificate * -1)); uxTaxLabel.Text = StoreContext.Currency.FormatPrice(Convert.ToDecimal(order.Tax)); uxShippingCostLabel.Text = StoreContext.Currency.FormatPrice( Convert.ToDecimal(order.ShippingCost)); uxHandlingFeeLabel.Text = StoreContext.Currency.FormatPrice(Convert.ToDecimal(order.HandlingFee)); uxTotalLabel.Text = StoreContext.Currency.FormatPrice(Convert.ToDecimal(order.Total)); uxOrderIDLabel.Text = "[$intro] : " + CurrentOrderID; uxHandlingFeeTR.Visible = DataAccessContext.Configurations.GetBoolValue("HandlingFeeEnabled"); uxOrderItemsGrid.DataBind(); uxClientForm.Visible = false; if (order.UserName == SystemConst.AnonymousUser) { uxOrderIDLink.Visible = false; uxOrderIDLinkLabel.Visible = true; uxPrintLink.Visible = false; } } else { uxHeadPanel.Visible = false; uxSummaryPlaceHolder.Visible = false; uxPrintLink.Visible = false; uxErrorLiteral.Visible = true; } HtmlTableRow infoShippTR = (HtmlTableRow)uxOrderView.FindControl("InfoShippTR"); HtmlTableRow shippDetailsTR = (HtmlTableRow)uxOrderView.FindControl("ShippDetailsTR"); infoShippTR.Visible = order.ShowShippingAddress; shippDetailsTR.Visible = order.ShowShippingAddress; AlternatePaymentRow(); }
protected void uxClearCartButton_Click(object sender, EventArgs e) { StoreContext.ClearCheckoutSession(); }