2026-01-14 11:43:46 -03:00
|
|
|
PARAM product_id AS STRING
|
|
|
|
|
|
|
|
|
|
product = PRODUCT product_id
|
|
|
|
|
IF NOT product THEN
|
2026-01-14 12:23:03 -03:00
|
|
|
RETURN WITH error AS "Product not found"
|
2026-01-14 11:43:46 -03:00
|
|
|
END IF
|
|
|
|
|
|
|
|
|
|
IF product.tax_code THEN
|
2026-01-14 12:23:03 -03:00
|
|
|
RETURN WITH tax_code AS product.tax_code, tax_class AS product.tax_class
|
2026-01-14 11:43:46 -03:00
|
|
|
END IF
|
|
|
|
|
|
2026-01-14 12:23:03 -03:00
|
|
|
info = LLM "Get NCM/tax classification for: " + product.name + " " + product.category + ". Return JSON with tax_code, tax_class, description"
|
|
|
|
|
UPDATE "products" WITH tax_code AS info.tax_code, tax_class AS info.tax_class WHERE id = product_id
|
|
|
|
|
|
|
|
|
|
RETURN WITH tax_code AS info.tax_code, tax_class AS info.tax_class, description AS info.description
|