예제 #1
0
        public async Task <Tax> CalculateTax(TaxJar taxJar, Tax taxInfo)
        {
            //setting the api auth values

            TaxResponse taxResponse = new TaxResponse();

            if (taxInfo.ToCountry.Equals(""))
            {
                taxResponse.Tax = null;
            }
            else
            {
                try
                {
                    await Task.Run(async() =>
                    {
                        taxResponse = await taxJar.CalculateTax(taxInfo);
                    });
                }
                catch (Exception ex)
                {
                    System.Diagnostics.Debug.Write("Error {0}", ex.Message);
                }
            }

            return(taxResponse.Tax);
        }
예제 #2
0
        public async Task <Rate> GetRate(TaxJar taxJar, string zip)
        {
            //setting the api auth values

            RateResponse rateResponse = new RateResponse();

            if (string.IsNullOrEmpty(zip))
            {
                rateResponse.Rate = null;
            }
            else
            {
                try
                {
                    await Task.Run(async() =>
                    {
                        rateResponse = await taxJar.GetRate(zip);
                    });
                }
                catch (Exception ex)
                {
                    System.Diagnostics.Debug.Write("Error {0}", ex.Message);
                }
            }
            return(rateResponse.Rate);
        }