public RedisCartRepositoryOld(IOptionsSnapshot <CartSettings> options, ILoggerFactory loggerFactory /*, ConnectionMultiplexer multiplexer*/)
 {
     _settings = options.Value;
     _logger   = loggerFactory.CreateLogger <RedisCartRepositoryOld>();
     //_redis = multiplexer;
     _logger.LogInformation("Redis instance :" + _redis);
 }
        public ShoppingCartMiddleware(RequestDelegate next, IShoppingCartService shoppingCartService,
                                      ISettingsProvider settingsProvider, ILogger logger, IPluginHelperService pluginHelperService)
        {
            if (logger == null)
            {
                throw new ArgumentNullException(nameof(logger));
            }

            if (settingsProvider == null)
            {
                throw new ArgumentNullException(nameof(settingsProvider));
            }

            _next = next;
            _shoppingCartService = shoppingCartService ?? throw new ArgumentNullException(nameof(shoppingCartService));

            if (pluginHelperService == null || !pluginHelperService.PluginLoaded(Constants.PluginNameUserSession, out int version))
            {
                logger.AddToLog(LogLevel.Error,
                                new Exception(Constants.UserSessionServiceNotFound),
                                nameof(ShoppingCartMiddleware));
            }

            _cartSettings = settingsProvider.GetSettings <CartSettings>(Constants.ShoppingCart);
        }
예제 #3
0
 public SetQtyOrdered(
     IRoundingRulesProvider roundingRulesProvider,
     IOrderLineUtilities orderLineUtilities,
     CartSettings cartSettings)
 {
     this.roundingRulesProvider = roundingRulesProvider;
     this.orderLineUtilities    = orderLineUtilities;
     this.cartSettings          = cartSettings;
 }
예제 #4
0
        public ActionResult Index()
        {
            var           activeSendMethods    = SendMethods.GetActiveMethods();
            var           activePaymentMethods = PaymentMethods.GetActiveMethods();
            ViewBuyerInfo buyer = new ViewBuyerInfo();

            if (User.Identity.IsAuthenticated)
            {
                var user = OSUsers.GetByID(UserID);

                #region Mapp To Buyer

                buyer.Firstname = user.Firstname;
                buyer.Lastname  = user.Lastname;
                buyer.Email     = user.Email;

                // TODO: UserAddresses
                buyer.Phone       = user.Phone;
                buyer.Mobile      = user.Mobile;
                buyer.HomeAddress = user.HomeAddress;
                buyer.PostalCode  = user.PostalCode;
                if (user.StateID.HasValue)
                {
                    buyer.StateName = Cities.GetCityName(user.StateID.Value);
                }
                if (user.CityID.HasValue)
                {
                    buyer.CityName = Cities.GetCityName(user.CityID.Value);
                }

                #endregion Mapp To Buyer
            }

            var send    = Mapper.Map <List <ViewSendMethod> >(activeSendMethods);
            var payment = Mapper.Map <List <ViewPaymentMethod> >(activePaymentMethods);

            CartSettings cart = new CartSettings
            {
                PaymentMethods   = payment,
                SendMethods      = send,
                IsAuthentication = User.Identity.IsAuthenticated,
                BuyerInfo        = buyer
            };

            return(View(cart));
        }
예제 #5
0
 public RecalculateCart_Override(IPricingPipeline pricingPipeline, CartSettings cartSettings)
 {
     this.pricingPipeline = pricingPipeline;
     this.cartSettings    = cartSettings;
 }