Esempio n. 1
0
        internal static List <CountryStandardVat> GetCountryAndVatInfo(RootObject vatRates)
        {
            List <CountryStandardVat> countryStandardVats = new List <CountryStandardVat>();

            foreach (Rate rate in vatRates.rates)
            {
                CountryStandardVat countryStandardVat = VatRatesUtils.GetCountryStandardVatByValidDate(rate);
                countryStandardVats.Add(countryStandardVat);
            }

            return(countryStandardVats);
        }
Esempio n. 2
0
        internal void PrintRates()
        {
            RootObject vatRates = VatRatesReader.ReadRatesfromURL(_vatURL);

            List <CountryStandardVat> countryStandardVats = VatRatesUtils.GetCountryAndVatInfo(vatRates);

            var cheapestVats = VatRatesUtils.GetTopThreeCheapestVats(countryStandardVats);

            Console.WriteLine($"Top {cheapestVats.Count} cheapest VATs:");
            foreach (var vat in cheapestVats)
            {
                Console.WriteLine($"Country: {vat.Name} - Standard VAT: {vat.StandardVat}");
            }

            var expensveVats = VatRatesUtils.GetTopThreeMostExpensiveVats(countryStandardVats);

            Console.WriteLine($"Top {expensveVats.Count()} most expensive VATs:");
            foreach (var vat in expensveVats)
            {
                Console.WriteLine($"Country: {vat.Name} - Standard VAT: {vat.StandardVat}");
            }

            Console.ReadLine();
        }