async void GetRates()
        {
            if (String.IsNullOrEmpty(_zip))
            {
                return;
            }
            IsBusy = true;
            try
            {
                Rate = "";
                var taxJarToken = await SecureStorage.GetAsync("taxjar_token");

                var service = new TaxRatesService(new Uri("https://api.taxjar.com/v2"), taxJarToken);
                var result  = await service.GetTaxRates(_zip);

                var formatResult = Double.Parse(result.Rate.CombinedRate);
                Rate = formatResult.ToString("P", CultureInfo.InvariantCulture);
            }
            catch (Exception ex)
            {
                await _dialogService.DisplayAlertAsync("Service Error", ex.Message, "OK");
            }
            finally
            {
                IsBusy = false;
            }
        }
Ejemplo n.º 2
0
        public TaxRatesServiceTests(ShareTestDatabaseFixture fixture)
        {
            var context = fixture.CreateContext();
            var mapper  = new MapperConfiguration(
                c => c.AddProfile <AutomapProfile>())
                          .CreateMapper();

            var repo = new Repository <TaxSchedule>(context);

            this.sService = new TaxRatesService(repo, mapper);
        }