private double GetPrice(SkuCart cart)
        {
            // Getting popilated prices for each product (master data)
            IDictionary <char, double> priceOfEachItem = cart.GetAvailableProductsWithPrice();

            double totalPrice  = 0;
            bool   IsComboRule = checkForComboRule();

            foreach (var Product in _purchasedProductCount)
            {
                //Getting Rule defined for each product (sku id's)
                Tuple <int, double> Rule = PromotionRules.GetRule(Product.Key);
                if (Rule != null)
                {
                    //applying rule and calculating total price
                    totalPrice += (Product.Value / Rule.Item1) * Rule.Item2 + (Product.Value % Rule.Item1) * priceOfEachItem[Product.Key];
                }
                else
                //if there is no rule and it is not combo product(sku id) then calculating it's price
                if (!IsComboRule)
                {
                    totalPrice += priceOfEachItem[Product.Key] * Product.Value;
                }
            }

            if (!IsComboRule)
            {
                return(totalPrice);
            }
            else
            {
                return(caluculateComboRule(totalPrice, priceOfEachItem));
            }
        }
        private void populateProductWithCount(SkuCart SkuCart)
        {
            // Here we are populating products and its repeated times

            foreach (var product in SkuCart.GetPurchasedProductList())
            {
                if (_purchasedProductCount.ContainsKey(product))
                {
                    _purchasedProductCount[product]++;
                }
                else
                {
                    _purchasedProductCount.Add(product, 1);
                }
            }
        }
 /// <summary>
 /// Pass Purchased cart
 /// </summary>
 /// <param name="cart">Cart having master and purchased data</param>
 /// <returns></returns>
 public double CalculatePrice(SkuCart cart)
 {
     return(_promotionEngine.GetOrderPrice(cart));
 }
        public double GetOrderPrice(SkuCart cart)
        {
            populateProductWithCount(cart);

            return(GetPrice(cart));
        }