declaration_build
Build ANAF declarations from plain JSON: generates XML, applies required-field and tax rules, computes amounts, and validates with DUKIntegrator/ANAF online, returning issues for fixes.
Instructions
Build an ANAF declaration from plain JSON (schema from declaration_form_spec): Storno writes the XML, applies its own rules (required fields, address codes, quotas, postal code, tenant CNP …), does the arithmetic (D212: 20 % forfait, 10 % tax, CASS tiers on the minimum wage), validates it with ANAF's DUKIntegrator and, for C168, with ANAF's online validator behind the web form (the authoritative BR-C168 rules). Returns valid, xml, issues[{level: error|warning|info, code, field, message}] (info = computed amounts to explain to the user) and validation{duk, anafOnline}. Loop: fix issues → build again until valid=true, then declaration_pdf. Public, nothing stored, 60 requests/hour per IP.
Input Schema
| Name | Required | Description | Default |
|---|---|---|---|
| type | Yes | Form code, e.g. C168 | |
| input | Yes | The form input (see declaration_form_spec → input / example) | |
| online | No | Also run ANAF's online validator when available (default true) | |
| validate | No | Run the DUK validator (default true) |