protected void Page_PreRender(object sender, EventArgs e) { bool hasSubscriptions = BasketHelper.HasRecurringSubscriptions(AbleContext.Current.User.Basket); bool newSubFeatureEnabled = AbleContext.Current.Store.Settings.ROCreateNewOrdersEnabled; AmazonCheckoutWidget.Visible = AbleContext.Current.User.Basket.Items.Count > 0 && (!hasSubscriptions || !newSubFeatureEnabled) && HasAmazonGateway(); }
protected bool AllowPartialPayments() { bool allow = this.AllowAmountEntry || AbleContext.Current.Store.Settings.EnablePartialPaymentCheckouts; // check if this order contain subscriptions if (allow) { allow = !BasketHelper.HasRecurringSubscriptions(AbleContext.Current.User.Basket); } return(allow); }
protected void Page_PreRender(object sender, System.EventArgs e) { // EXPRESS CHECKOUT BUTTON IS NOT VISIBLE BY DEFAULT // DETERMINE WHETHER THE PAYPAL GATEWAY IS DEFINED, AND WHETHER IT HAS API SERVICES ENABLED // BUTTON ONLY SHOWS IF PRODUCTS ARE IN THE BASKET AND MIN/MAX ORER LIMITS ARE MET if (BasketHasProducts()) { bool hasSubscriptions = BasketHelper.HasRecurringSubscriptions(AbleContext.Current.User.Basket); bool newSubFeatureEnabled = AbleContext.Current.Store.Settings.ROCreateNewOrdersEnabled; if (!hasSubscriptions || !newSubFeatureEnabled) { Basket basket = AbleContext.Current.User.Basket; foreach (BasketItem item in basket.Items) { if (item.OrderItemType == OrderItemType.Product) { if (item.Product.IsProhibited) { this.Visible = false; return; } } } // FIND THE PAYPAL GATEWAY PayPalProvider provider = AbleCommerce.Code.StoreDataHelper.GetPayPalProvider(); if (provider != null && provider.ApiEnabled && ValidateOrderMinMaxAmounts()) { //SHOW PANEL IF API ENABLED ExpressCheckoutPanel.Visible = !AbleContext.Current.Store.Settings.ProductPurchasingDisabled; if (ShowHeader) { phHeader.Visible = true; } else { phHeader.Visible = false; } if (ShowDescription) { phDescription.Visible = true; } else { phDescription.Visible = false; } phBillMeLaterBtn.Visible = provider.IsPayPalCreditEnabled; } } } }
protected void Page_PreRender(object sender, EventArgs e) { bool hasSubscriptions = BasketHelper.HasRecurringSubscriptions(AbleContext.Current.User.Basket); bool newSubFeatureEnabled = AbleContext.Current.Store.Settings.ROCreateNewOrdersEnabled; if (!hasSubscriptions || !newSubFeatureEnabled) { IPaymentProvider amazonProvider = GetAmazonProvider(); if (amazonProvider != null) { MethodInfo buttonMethod = amazonProvider.GetType().GetMethod("GetCheckoutButton"); object[] parameters = new object[] { AbleContext.Current.User.Basket }; PlaceHolder checkoutButton = (PlaceHolder)buttonMethod.Invoke(amazonProvider, parameters); this.ButtonPanel.Controls.Add(checkoutButton); } } }
private bool HasRecurringSubscriptions() { bool hasBasket = this.Basket != null; bool hasOrder = this.Order != null; if (hasBasket) { return(BasketHelper.HasRecurringSubscriptions(this.Basket)); } else if (hasOrder) { return(OrderHelper.HasRecurringSubscriptions(this.Order)); } else { return(false); } }
protected void Page_Load(object sender, EventArgs e) { bool hasSubscriptions = BasketHelper.HasRecurringSubscriptions(AbleContext.Current.User.Basket); bool newSubFeatureEnabled = AbleContext.Current.Store.Settings.ROCreateNewOrdersEnabled; if (!hasSubscriptions || !newSubFeatureEnabled) { ExpressCheckoutSession paypalSession = ExpressCheckoutSession.Current; if (paypalSession != null) { PayPalAccount.Text = paypalSession.Payer; PayPalButton.ImageUrl = string.Format(PayPalButton.ImageUrl, Request.Url.Scheme); } else { this.Controls.Clear(); } } else { this.Controls.Clear(); } }