Exemplo n.º 1
0
        public void GetCartTotals()
        {
            var cartTotal      = 0.0;
            var taxTotal       = 0.0;
            var totalItemPrice = 0.0;

            foreach (var product in Products)
            {
                _taxCalculator.SetProductTax(product);
                _salesPriceCalculator.CalculateItemTotalWithTax(product);

                taxTotal       += (double)product.ItemTaxAmount;
                totalItemPrice += (double)product.BasePrice;
                cartTotal      += (double)product.TotalWithTax;
            }

            TotalItemPrice = (decimal)totalItemPrice;
            TotalTax       = (decimal)Math.Ceiling(taxTotal * 20) / 20;
            CartTotal      = (decimal)cartTotal;
        }