public ShoppingCartModel()
        {
            Items = new List<ShoppingCartItemModel>();
            Warnings = new List<string>();
            EstimateShipping = new EstimateShippingModel();
            DiscountBox = new DiscountBoxModel();
            GiftCardBox = new GiftCardBoxModel();
            CheckoutAttributes = new List<CheckoutAttributeModel>();
            OrderReviewData = new OrderReviewDataModel();

            ButtonPaymentMethods = new ButtonPaymentMethodModel();
        }
Example #2
0
        public ShoppingCartModel()
        {
            Items              = new List <ShoppingCartItemModel>();
            Warnings           = new List <string>();
            EstimateShipping   = new EstimateShippingModel();
            DiscountBox        = new DiscountBoxModel();
            GiftCardBox        = new GiftCardBoxModel();
            CheckoutAttributes = new List <CheckoutAttributeModel>();
            OrderReviewData    = new OrderReviewDataModel();

            ButtonPaymentMethods = new ButtonPaymentMethodModel();
        }
        private void PrepareButtonPaymentMethodModel(ButtonPaymentMethodModel model, IList<OrganizedShoppingCartItem> cart)
        {
            model.Items.Clear();

            var paymentTypes = new PaymentMethodType[] { PaymentMethodType.Button, PaymentMethodType.StandardAndButton };

            var boundPaymentMethods = _paymentService
                .LoadActivePaymentMethods(_workContext.CurrentCustomer, cart, _storeContext.CurrentStore.Id, paymentTypes, false)
                .ToList();

            foreach (var pm in boundPaymentMethods)
            {
                if (cart.IsRecurring() && pm.Value.RecurringPaymentType == RecurringPaymentType.NotSupported)
                    continue;

                string actionName;
                string controllerName;
                RouteValueDictionary routeValues;
                pm.Value.GetPaymentInfoRoute(out actionName, out controllerName, out routeValues);

                model.Items.Add(new ButtonPaymentMethodModel.ButtonPaymentMethodItem
                {
                    ActionName = actionName,
                    ControllerName = controllerName,
                    RouteValues = routeValues
                });
            }
        }