Ejemplo n.º 1
0
        public static AdjustTaxResult Execute(CustomerOrder refundOrder, out string summary)
        {
            summary = "";
            TaxServiceWrapper taxSvcWrapper = new TaxServiceWrapper();
            TaxSvc            taxSvc        = taxSvcWrapper.GetTaxSvcInstance(refundOrder.InProduction);

            AdjustTaxRequest adjustTaxRequest = new AdjustTaxRequest();

            GetTaxRequest getTaxRequest = GetTax.BuildGetTaxRequest(refundOrder);

            getTaxRequest.TaxOverride.TaxOverrideType = TaxOverrideType.TaxAmount;
            getTaxRequest.TaxOverride.Reason          = "Adjustment for router return";
            //getTaxRequest.TaxOverride.TaxDate = DateTime.Parse("2013-07-01");
            getTaxRequest.TaxOverride.TaxAmount = refundOrder.TotalTax;
            getTaxRequest.ServiceMode           = ServiceMode.Automatic;

            adjustTaxRequest.GetTaxRequest         = getTaxRequest;
            adjustTaxRequest.AdjustmentReason      = 5;
            adjustTaxRequest.AdjustmentDescription = "Tax adjusted based on router refund";

            AdjustTaxResult adjustTaxResult = taxSvc.AdjustTax(adjustTaxRequest);

            if (!adjustTaxResult.ResultCode.Equals(SeverityLevel.Success))
            {
                foreach (Message message in adjustTaxResult.Messages)
                {
                    summary = message.Summary;
                }
            }

            return(adjustTaxResult);
        }
Ejemplo n.º 2
0
        public static CommitTaxResult Execute(bool inProduction, string strOCN, out string summary)
        {
            summary = "";
            TaxServiceWrapper taxSvcWrapper = new TaxServiceWrapper();
            TaxSvc            taxSvc        = taxSvcWrapper.GetTaxSvcInstance(inProduction);

            CommitTaxRequest commitTaxRequest = new CommitTaxRequest();

            // Required Parameters
            commitTaxRequest.DocCode     = strOCN;
            commitTaxRequest.DocType     = DocumentType.SalesInvoice;
            commitTaxRequest.CompanyCode = Properties.Settings.Default.CompanyCode;

            // Optional Parameters
            //commitTaxRequest.NewDocCode = "INV001";

            CommitTaxResult commitTaxResult = taxSvc.CommitTax(commitTaxRequest);

            if (!commitTaxResult.ResultCode.Equals(SeverityLevel.Success))
            {
                foreach (Message message in commitTaxResult.Messages)
                {
                    summary = message.Summary;
                }
            }

            return(commitTaxResult);
        }
Ejemplo n.º 3
0
        public static PostTaxResult Execute(CustomerOrder order, Avalara.AvaTax.Adapter.TaxService.GetTaxResult getTaxResult, out string summary)
        {
            summary = "";
            TaxServiceWrapper taxSvcWrapper = new TaxServiceWrapper();
            TaxSvc            taxSvc        = taxSvcWrapper.GetTaxSvcInstance(order.InProduction);

            PostTaxRequest postTaxRequest = new PostTaxRequest();

            // Required Request Parameters
            postTaxRequest.CompanyCode = Properties.Settings.Default.CompanyCode;
            postTaxRequest.DocType     = DocumentType.SalesInvoice;
            postTaxRequest.DocCode     = getTaxResult.DocCode;
            postTaxRequest.Commit      = order.IsCommit;
            postTaxRequest.DocDate     = getTaxResult.DocDate;
            postTaxRequest.TotalTax    = order.TotalTax;
            postTaxRequest.TotalAmount = order.TotalAmount;

            // Optional Request Parameters
            postTaxRequest.NewDocCode = order.OCN;

            PostTaxResult postTaxResult = taxSvc.PostTax(postTaxRequest);

            if (!postTaxResult.ResultCode.Equals(SeverityLevel.Success))
            {
                foreach (Message message in postTaxResult.Messages)
                {
                    summary = message.Summary;
                }
            }

            return(postTaxResult);
        }
Ejemplo n.º 4
0
        public static GetTaxResult Execute(CustomerOrder order, out string summary)
        {
            summary = "";
            TaxServiceWrapper taxSvcWrapper = new TaxServiceWrapper();
            TaxSvc            taxSvc        = taxSvcWrapper.GetTaxSvcInstance(order.InProduction);

            PostTaxRequest postTaxRequest = new PostTaxRequest();

            GetTaxRequest getTaxRequest = BuildGetTaxRequest(order);

            GetTaxResult getTaxResult = taxSvc.GetTax(getTaxRequest);

            if (!getTaxResult.ResultCode.Equals(SeverityLevel.Success))
            {
                foreach (Message message in getTaxResult.Messages)
                {
                    summary = message.Summary;
                }
            }

            return(getTaxResult);
        }