Tax Category Service - Nioron07/Easy-Acumatica GitHub Wiki
This guide covers the TaxCategoryService
, which is your primary tool for creating or updating tax category records through the contract-based API.
1. Importing Helpers
Before you start, import the necessary builders and query helpers. The TaxCategoryService
methods rely on these to construct payloads and define query parameters.
from easy_acumatica.models.tax_category_builder import TaxCategoryBuilder
from easy_acumatica.models.query_builder import QueryOptions
2. Understanding the Service's Purpose
The TaxCategoryService
provides a method for creating and updating tax categories in Acumatica. It acts as the main interface for sending PUT
requests to the TaxCategory
endpoint.
3. TaxCategoryService Methods
The following table summarizes the primary method available in the TaxCategoryService
.
Method | Description | Key Parameters |
---|---|---|
.update_tax_category() |
Creates a new tax category or updates an existing one. | api_version , builder , options |
4. Creating or Updating a Tax Category
The primary function of this service is to create or update tax categories. The API uses a PUT
request, which will create a new record if the TaxCategoryID
doesn't exist, or update it if it does.
update_tax_category(api_version, builder, options)
This method creates or updates a tax category. You must provide a TaxCategoryBuilder
instance containing the category's details.
Example: Create a new tax category for services
from easy_acumatica.models.tax_category_builder import TaxCategoryBuilder
# 1. Build the tax category payload
tax_category_payload = (
TaxCategoryBuilder()
.tax_category_id("SERVICES")
.description("Taxable Professional Services")
.active(True)
.exclude_listed_taxes(False)
)
# 2. Use the payload to create the record
try:
new_category = client.tax_categories.update_tax_category(
"24.200.001",
builder=tax_category_payload
)
print(f"Successfully created or updated tax category: {new_category['TaxCategoryID']['value']}")
except Exception as e:
print(f"Failed to process tax category: {e}")