public override IEnumerable <TaxRate> CalculateRates(Domain.Common.IEvaluationContext context) { var taxEvalContext = context as TaxEvaluationContext; if (taxEvalContext == null) { throw new NullReferenceException("taxEvalContext"); } var retVal = new List <TaxRate>(); foreach (var line in taxEvalContext.Lines) { var rate = AbstractTypeFactory <TaxRate> .TryCreateInstance(); rate.Rate = line.Amount * Rate * 0.01m; rate.Currency = taxEvalContext.Currency; rate.TaxProvider = this; rate.TaxProviderCode = Code; rate.Line = line; retVal.Add(rate); } return(retVal); }
public override IEnumerable <TaxRate> CalculateRates(Domain.Common.IEvaluationContext context) { var taxEvalContext = context as TaxEvaluationContext; if (taxEvalContext == null) { throw new NullReferenceException("taxEvalContext"); } var retVal = new List <TaxRate>(); foreach (var line in taxEvalContext.Lines) { var rate = new TaxRate { Rate = line.Amount * Rate * 0.01m, Currency = taxEvalContext.Currency, TaxProvider = this, Line = line }; retVal.Add(rate); } return(retVal); }
public override IEnumerable <ShippingRate> CalculateRates(Domain.Common.IEvaluationContext context) { var shippingEvalContext = context as ShippingEvaluationContext; if (shippingEvalContext == null) { throw new NullReferenceException("shippingEvalContext"); } return(new ShippingRate[] { new ShippingRate { Rate = Rate, Currency = shippingEvalContext.ShoppingCart.Currency, ShippingMethod = this } }); }
public override IEnumerable <ShippingRate> CalculateRates(Domain.Common.IEvaluationContext context) { var shippingEvalContext = context as ShippingEvaluationContext; if (shippingEvalContext == null) { throw new NullReferenceException("shippingEvalContext"); } return(new ShippingRate[] { new ShippingRate { Rate = GroundOptionRate, Currency = shippingEvalContext.ShoppingCart.Currency, ShippingMethod = this, OptionName = "Ground", OptionDescription = "Ground shipping" }, new ShippingRate { Rate = AirOptionRate, Currency = shippingEvalContext.ShoppingCart.Currency, ShippingMethod = this, OptionName = "Air", OptionDescription = "Air shipping" } }); }