Hi, I am writing a TaxCloud AddOn to make taxes easier for states like CA and NY. What do I need to call in the code to get the customer billing and shipping addresses?
Thank You,
Devon Quick
public CalculateTaxResult GetTaxRate(CalculateTaxRequest calculateTaxRequest)
{
var result = new CalculateTaxResult();
if (calculateTaxRequest.Address == null)
{
result.Errors.Add("Address is not set");
return result;
}
var taxRates = _taxRateService.GetAllTaxRates(calculateTaxRequest.TaxCategoryId,
calculateTaxRequest.Address.Country != null ? calculateTaxRequest.Address.Country.Id: 0,
calculateTaxRequest.Address.StateProvince != null ? calculateTaxRequest.Address.StateProvince.Id : 0,
calculateTaxRequest.Address.ZipPostalCode);
if (taxRates.Count > 0)
result.TaxRate = taxRates[0].Percentage;
return result;
}