Esempio n. 1
0
        public void TestGetLocationTaxRate()
        {
            var client  = new TaxJarClient();
            var taxRate = client.GetLocationTaxRate("33441");

            Assert.IsNotNull(taxRate);
            Assert.AreEqual(0.07f, taxRate);
        }
Esempio n. 2
0
        public async Task VatNumberCanBeValidated()
        {
            var client = new TaxJarClient(token);
            var rates  = await client.ValidateVatNumberAsync("FR40303265045");

            Console.WriteLine(JsonConvert.SerializeObject(rates));
            Assert.NotNull(rates);
        }
Esempio n. 3
0
        public void TestCalculateOrderTaxes()
        {
            var client     = new TaxJarClient();
            var orderTaxes = client.CalculateOrderTaxes("US", "CA", "92093", 100f, 10f);

            Assert.IsNotNull(orderTaxes);
            Assert.AreEqual(0f, orderTaxes);
        }
Esempio n. 4
0
        public async Task SummaryRatesCanBeGot()
        {
            var client = new TaxJarClient(token);
            var rates  = await client.GetSummaryRatesAsync();

            Console.WriteLine(JsonConvert.SerializeObject(rates));
            Assert.NotNull(rates);
        }
Esempio n. 5
0
        public async Task ListOrdersForSingleDate()
        {
            var client = new TaxJarClient(token);
            var range  = new TaxJarDateRange
            {
                from_transaction_date = new DateTime(2016, 6, 1),
                to_transaction_date   = new DateTime(2016, 6, 2)
            };

            Console.WriteLine(JsonConvert.SerializeObject(range));
            var orders = await client.ListOrdersAsync(range);

            Console.WriteLine(JsonConvert.SerializeObject(orders));
            Assert.NotNull(orders);
        }
Esempio n. 6
0
        public void GetLocationTaxRatesTest()
        {
            TaxJarClient TaxClient = new TaxJarClient();

            var rates = TaxClient.GetLocationTaxRates("90404");

            Assert.AreEqual("90404", rates.Zip);
            Assert.AreEqual("CA", rates.State);
            Assert.AreEqual(0.0625m, rates.StateRate);
            Assert.AreEqual("LOS ANGELES", rates.County);
            Assert.AreEqual(0.01m, rates.CountyRate);
            Assert.AreEqual("SANTA MONICA", rates.City);
            Assert.AreEqual(0.0m, rates.CityRate);
            Assert.AreEqual(0.03m, rates.CombinedDistrictRate);
            Assert.AreEqual(0.1025m, rates.CombinedRate);
            Assert.AreEqual(false, rates.FreightTaxable);
        }
Esempio n. 7
0
 public TaxJarCalculaterService(ILogger <TaxJarCalculaterService> logger, TaxJarClient taxJarClient)
 {
     _logger       = logger;
     _taxJarClient = taxJarClient;
 }
Esempio n. 8
0
        public void CalculateOrderTaxesTest()
        {
            TaxJarClient TaxClient = new TaxJarClient();

            var rates = TaxClient.CalculateOrderTaxes(new
            {
                from_country    = "US",
                from_zip        = "92093",
                from_state      = "CA",
                from_city       = "La Jolla",
                from_street     = "9500 Gilman Drive",
                to_country      = "US",
                to_zip          = "90002",
                to_state        = "CA",
                to_city         = "Los Angeles",
                to_street       = "1335 E 103rd St",
                amount          = 15,
                shipping        = 1.5,
                nexus_addresses = new[] {
                    new {
                        id      = "Main Location",
                        country = "US",
                        zip     = "92093",
                        state   = "CA",
                        city    = "La Jolla",
                        street  = "9500 Gilman Drive",
                    }
                },
                line_items = new[] {
                    new {
                        id               = "1",
                        quantity         = 1,
                        product_tax_code = "20010",
                        unit_price       = 15,
                        discount         = 0
                    }
                }
            });

            Assert.AreEqual(16.5, rates.OrderTotalAmount);
            Assert.AreEqual(1.5, rates.Shipping);
            Assert.AreEqual(15, rates.TaxableAmount);
            Assert.AreEqual(1.43, rates.AmountToCollect);
            Assert.AreEqual(0.095, rates.Rate);
            Assert.AreEqual(true, rates.HasNexus);
            Assert.AreEqual(false, rates.FreightTaxable);
            Assert.AreEqual("destination", rates.TaxSource);


            // Jurisdictions
            Assert.AreEqual("US", rates.Jurisdictions.Country);
            Assert.AreEqual("CA", rates.Jurisdictions.State);
            Assert.AreEqual("Los Angeles County", rates.Jurisdictions.County);
            Assert.AreEqual("LOS ANGELES", rates.Jurisdictions.City);

            // Breakdowns
            Assert.AreEqual(15, rates.Breakdown.TaxableAmount);
            Assert.AreEqual(1.43, rates.Breakdown.TaxCollectable);
            Assert.AreEqual(0.095, rates.Breakdown.CombinedTaxRate);
            Assert.AreEqual(15, rates.Breakdown.StateTaxableAmount);
            Assert.AreEqual(0.0625, rates.Breakdown.StateTaxRate);
            Assert.AreEqual(0.94, rates.Breakdown.StateTaxCollectable);
            Assert.AreEqual(15, rates.Breakdown.CountyTaxableAmount);
            Assert.AreEqual(0.01, rates.Breakdown.CountyTaxRate);
            Assert.AreEqual(0.15, rates.Breakdown.CountyTaxCollectable);
            Assert.AreEqual(0, rates.Breakdown.CityTaxableAmount);
            Assert.AreEqual(0, rates.Breakdown.CityTaxRate);
            Assert.AreEqual(0, rates.Breakdown.CityTaxCollectable);
            Assert.AreEqual(15, rates.Breakdown.SpecialDistrictTaxableAmount);
            Assert.AreEqual(0.0225, rates.Breakdown.SpecialTaxRate);
            Assert.AreEqual(0.34, rates.Breakdown.SpecialDistrictTaxCollectable);

            // Line Items
            Assert.AreEqual("1", rates.Breakdown.LineItems[0].Id);
            Assert.AreEqual(15, rates.Breakdown.LineItems[0].TaxableAmount);
            Assert.AreEqual(1.43, rates.Breakdown.LineItems[0].TaxCollectable);
            Assert.AreEqual(0.095, rates.Breakdown.LineItems[0].CombinedTaxRate);
            Assert.AreEqual(15, rates.Breakdown.LineItems[0].StateTaxableAmount);
            Assert.AreEqual(0.0625, rates.Breakdown.LineItems[0].StateSalesTaxRate);
            Assert.AreEqual(0.94, rates.Breakdown.LineItems[0].StateAmount);
            Assert.AreEqual(15, rates.Breakdown.LineItems[0].CountyTaxableAmount);
            Assert.AreEqual(0.01, rates.Breakdown.LineItems[0].CountyTaxRate);
            Assert.AreEqual(0.15, rates.Breakdown.LineItems[0].CountyAmount);
            Assert.AreEqual(0, rates.Breakdown.LineItems[0].CityTaxableAmount);
            Assert.AreEqual(0, rates.Breakdown.LineItems[0].CityTaxRate);
            Assert.AreEqual(0, rates.Breakdown.LineItems[0].CityAmount);
            Assert.AreEqual(15, rates.Breakdown.LineItems[0].SpecialDistrictTaxableAmount);
            Assert.AreEqual(0.0225, rates.Breakdown.LineItems[0].SpecialTaxRate);
            Assert.AreEqual(0.34, rates.Breakdown.LineItems[0].SpecialDistrictAmount);
        }