forked from jasonburt/AvaTaxCalcSOAP-csharp
-
Notifications
You must be signed in to change notification settings - Fork 0
/
CancelTaxTest.cs
49 lines (41 loc) · 1.79 KB
/
CancelTaxTest.cs
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
namespace AvaTaxCalcSOAP
{
using System;
using System.Configuration;
using Avalara.AvaTax.Adapter;
using Avalara.AvaTax.Adapter.TaxService;
public class CancelTaxTest
{
public static void Test()
{
string accountNumber = ConfigurationManager.AppSettings["AvaTax:AccountNumber"];
string licenseKey = ConfigurationManager.AppSettings["AvaTax:LicenseKey"];
string serviceURL = ConfigurationManager.AppSettings["AvaTax:ServiceUrl"];
TaxSvc taxSvc = new TaxSvc();
// Header Level Parameters
// Required Header Parameters
taxSvc.Configuration.Security.Account = accountNumber;
taxSvc.Configuration.Security.License = licenseKey;
taxSvc.Configuration.Url = serviceURL;
taxSvc.Configuration.ViaUrl = serviceURL;
taxSvc.Profile.Client = "AvaTaxSample";
// Optional Header Parameters
taxSvc.Profile.Name = "Development";
CancelTaxRequest cancelTaxRequest = new CancelTaxRequest();
// Required Request Parameters
cancelTaxRequest.CompanyCode = "APITrialCompany";
cancelTaxRequest.DocType = DocumentType.SalesInvoice;
cancelTaxRequest.DocCode = "INV001";
cancelTaxRequest.CancelCode = CancelCode.DocVoided;
CancelTaxResult cancelTaxResult = taxSvc.CancelTax(cancelTaxRequest);
Console.WriteLine("CancelTaxTest Result: " + cancelTaxResult.ResultCode.ToString());
if (!cancelTaxResult.ResultCode.Equals(SeverityLevel.Success))
{
foreach (Message message in cancelTaxResult.Messages)
{
Console.WriteLine(message.Summary);
}
}
}
}
}