public void TestFirstBracketLimitIncome() { decimal totalIncome = 19400m + standardDeductionMarried2019; decimal taxableIncome = Math.Max(0, totalIncome - standardDeductionMarried2019); decimal calculated = TaxUtility.CalculateTaxPayable(taxableIncome, brackets); Assert.Equal(1940m, calculated); }
public void TestFiftyDollars() { decimal totalIncome = 50m + standardDeductionMarried2019; decimal taxableIncome = Math.Max(0, totalIncome - standardDeductionMarried2019); decimal calculated = TaxUtility.CalculateTaxPayable(taxableIncome, brackets); Assert.Equal(5m, calculated); }
public static Money GetSavedAmountIncludingTax(this RewardDescription description, MarketId marketId, Currency currency, IOrderAddress address, TaxUtility taxUtility = null) { var initialAmount = new Money(description.SavedAmount, currency); if (taxUtility == null) { taxUtility = ServiceLocator.Current.GetInstance <TaxUtility>(); } var taxCategoryId = taxUtility.GetDefaultTaxCategoryId(); return(taxUtility.GetPriceWithTax(initialAmount, marketId, address, GetTaxType(description), taxCategoryId)); }
public static Money GetSavedAmountIncludingTax(this RewardDescription description, ICart cart, TaxUtility taxUtility = null) { var initialAmount = new Money(description.SavedAmount, cart.Currency); if (cart.PricesIncludeTax) { return(initialAmount); } var shipment = cart.GetFirstShipment(); var shippingAddress = shipment?.ShippingAddress; return(GetSavedAmountIncludingTax(description, cart.MarketId, cart.Currency, shippingAddress, taxUtility)); }