Esempio n. 1
0
        public string GetNewTaxCodeId(string realmId, decimal percent)
        {
            var queryService = GetQueryService <TaxAgency>(realmId);
            var taxAgency    = queryService.Where(x => x != null).FirstOrDefault();

            if (taxAgency == null)
            {
                var dataService = GetDataService(realmId);
                taxAgency = dataService.Add(new TaxAgency {
                    DisplayName = "New Tax Agency"
                });
            }
            var name             = $"{percent} percent tax";
            var taxRateDetailses = new[]
            {
                new TaxRateDetails
                {
                    RateValue          = percent,
                    RateValueSpecified = true,
                    TaxAgencyId        = taxAgency.Id,
                    TaxApplicableOn    = TaxRateApplicableOnEnum.Sales,
                    TaxRateName        = name
                }
            };
            var taxService = new TaxService {
                TaxCode = name, TaxRateDetails = taxRateDetailses
            };
            var globalTaxService = new GlobalTaxService(GetContext(realmId));

            taxService = globalTaxService.AddTaxCode(taxService);
            return(taxService.TaxRateDetails[0].TaxRateId);
        }
        public void TaxCodeAddTestUsingoAuth(ServiceContext qboContextoAuth)
        {
            String           guid             = Helper.GetGuid();
            GlobalTaxService taxSvc           = new GlobalTaxService(qboContextoAuth);
            TaxService       taxCodetobeAdded = new TaxService();

            taxCodetobeAdded.TaxCode = "taxC_" + guid;

            TaxAgency taxagency = Helper.FindOrAdd <TaxAgency>(qboContextoAuth, new TaxAgency());


            List <TaxRateDetails> lstTaxRate = new List <TaxRateDetails>();
            TaxRateDetails        taxdetail1 = new TaxRateDetails();

            taxdetail1.TaxRateName              = "taxR1_" + guid;
            taxdetail1.RateValue                = 3m;
            taxdetail1.RateValueSpecified       = true;
            taxdetail1.TaxAgencyId              = taxagency.Id.ToString();
            taxdetail1.TaxApplicableOn          = TaxRateApplicableOnEnum.Sales;
            taxdetail1.TaxApplicableOnSpecified = true;
            lstTaxRate.Add(taxdetail1);

            TaxRateDetails taxdetail2 = new TaxRateDetails();

            taxdetail2.TaxRateName              = "taxR2_" + guid;
            taxdetail2.RateValue                = 2m;
            taxdetail2.RateValueSpecified       = true;
            taxdetail2.TaxAgencyId              = taxagency.Id.ToString();
            taxdetail2.TaxApplicableOn          = TaxRateApplicableOnEnum.Sales;
            taxdetail2.TaxApplicableOnSpecified = true;
            lstTaxRate.Add(taxdetail2);

            //TaxRateDetails taxdetail3 = new TaxRateDetails();
            //taxdetail3.TaxRateName = "rate298";
            //taxdetail3.TaxRateId = "2";

            //lstTaxRate.Add(taxdetail3);

            taxCodetobeAdded.TaxRateDetails = lstTaxRate.ToArray();

            Intuit.Ipp.Data.TaxService taxCodeAdded = taxSvc.AddTaxCode(taxCodetobeAdded);
        }
Esempio n. 3
0
        public void AddTaxCodeSyncTest()
        {
            try
            {
                //GlobalTaxService taxSvc = new GlobalTaxService(context);
                //Intuit.Ipp.Data.TaxService  taxCodetobeAdded =  new Data.TaxService();
                //taxCodetobeAdded.TaxCode = "taxservic294";

                //List<TaxRateDetails> lstTaxRate = new List<TaxRateDetails>();
                //TaxRateDetails taxdetail1 = new TaxRateDetails();
                //taxdetail1.TaxRateName = "rat296";
                //taxdetail1.RateValue = 3m;
                //taxdetail1.RateValueSpecified = true;
                //taxdetail1.TaxAgencyId = "1";
                //taxdetail1.TaxApplicableOn = TaxRateApplicableOnEnum.Sales;
                //taxdetail1.TaxApplicableOnSpecified = true;
                //lstTaxRate.Add(taxdetail1);

                //TaxRateDetails taxdetail2 = new TaxRateDetails();
                //taxdetail2.TaxRateName = "rate297";
                //taxdetail2.RateValue = 2m;
                //taxdetail2.RateValueSpecified = true;
                //taxdetail2.TaxAgencyId = "1";
                //taxdetail2.TaxApplicableOn = TaxRateApplicableOnEnum.Sales;
                //taxdetail2.TaxApplicableOnSpecified = true;
                //lstTaxRate.Add(taxdetail2);

                //TaxRateDetails taxdetail3 = new TaxRateDetails();
                //taxdetail3.TaxRateName = "rate298";
                //taxdetail3.TaxRateId = "2";

                //lstTaxRate.Add(taxdetail3);

                //taxCodetobeAdded.TaxRateDetails = lstTaxRate.ToArray();

                //Intuit.Ipp.Data.TaxService taxCodeAdded = taxSvc.AddTaxCode(taxCodetobeAdded);
                //Assert.IsNotNull(taxCodeAdded.TaxCodeId);


                //GlobalTaxService taxSvc = new GlobalTaxService(context);
                //Intuit.Ipp.Data.TaxService taxCodetobeAdded = new Data.TaxService();
                //taxCodetobeAdded.TaxCode = "taxservic296";//change name everytime

                //List<TaxRateDetails> lstTaxRate = new List<TaxRateDetails>();
                //TaxRateDetails taxdetail1 = new TaxRateDetails();

                //taxdetail1.TaxRateId = "30";

                //lstTaxRate.Add(taxdetail1);



                //taxCodetobeAdded.TaxRateDetails = lstTaxRate.ToArray();

                //Intuit.Ipp.Data.TaxService taxCodeAdded = taxSvc.AddTaxCode(taxCodetobeAdded);



                GlobalTaxService           taxSvc           = new GlobalTaxService(context);
                Intuit.Ipp.Data.TaxService taxCodetobeAdded = new Data.TaxService();
                taxCodetobeAdded.TaxCode = "taxC_" + Guid.NewGuid().ToString("N");

                QueryService <TaxAgency> taxagency = new QueryService <TaxAgency>(context);
                TaxAgency taxagencyResult          = taxagency.ExecuteIdsQuery("select * from TaxAgency").FirstOrDefault <TaxAgency>();



                List <TaxRateDetails> lstTaxRate = new List <TaxRateDetails>();
                TaxRateDetails        taxdetail1 = new TaxRateDetails();
                taxdetail1.TaxRateName              = "taxR1_" + Guid.NewGuid().ToString("N");
                taxdetail1.RateValue                = 3m;
                taxdetail1.RateValueSpecified       = true;
                taxdetail1.TaxAgencyId              = taxagencyResult.Id.ToString();
                taxdetail1.TaxApplicableOn          = TaxRateApplicableOnEnum.Sales;
                taxdetail1.TaxApplicableOnSpecified = true;
                lstTaxRate.Add(taxdetail1);

                TaxRateDetails taxdetail2 = new TaxRateDetails();
                taxdetail2.TaxRateName              = "taxR2_" + Guid.NewGuid().ToString("N");
                taxdetail2.RateValue                = 2m;
                taxdetail2.RateValueSpecified       = true;
                taxdetail2.TaxAgencyId              = taxagencyResult.Id.ToString();
                taxdetail2.TaxApplicableOn          = TaxRateApplicableOnEnum.Sales;
                taxdetail2.TaxApplicableOnSpecified = true;
                lstTaxRate.Add(taxdetail2);

                //TaxRateDetails taxdetail3 = new TaxRateDetails();
                //taxdetail3.TaxRateName = "rate298";
                //taxdetail3.TaxRateId = "2";

                //lstTaxRate.Add(taxdetail3);

                taxCodetobeAdded.TaxRateDetails = lstTaxRate.ToArray();

                Intuit.Ipp.Data.TaxService taxCodeAdded = taxSvc.AddTaxCode(taxCodetobeAdded);
                Assert.IsNotNull(taxCodeAdded.TaxCodeId);
            }
            catch (System.Exception ex)
            {
                Assert.Fail(ex.ToString());
            }
        }