Esempio n. 1
0
 public void ApplyTaxes(IShoppingCartEntry shoppingCartEntry)
 {
     if (shoppingCartEntry.Product.Origin == Origin.Foreign)
     {
         decimal tax = TaxRounder.Round(shoppingCartEntry.Product.Price * shoppingCartEntry.Quantity * 0.05m);
         shoppingCartEntry.Taxes.Add(TaxType.ImportDuty, tax);
     }
 }
Esempio n. 2
0
 public void ApplyTaxes(IShoppingCartEntry shoppingCartEntry)
 {
     if (!(typeof(IBook).IsAssignableFrom(shoppingCartEntry.Product.GetType()) ||
           typeof(IMedicine).IsAssignableFrom(shoppingCartEntry.Product.GetType()) ||
           typeof(IFood).IsAssignableFrom(shoppingCartEntry.Product.GetType())))  // Exemptions list could be configured
     {
         decimal tax = TaxRounder.Round(shoppingCartEntry.Product.Price * shoppingCartEntry.Quantity * 0.1m);
         shoppingCartEntry.Taxes.Add(TaxType.SalesTax, tax);
     }
 }