validate_cessionario
Validate Italian e-invoice buyer details (FatturaPA): checks company or personal names and tax IDs, returns a CessionarioCommittente block ready for XML, or lists clear errors.
Instructions
Validate and build the CessionarioCommittente (buyer) block for FatturaPA.
Use this as step 5 in the invoice generation workflow, after validate_cedente_prestatore() and before build_dati_generali().
Validates: either denominazione or both nome+cognome must be provided (mutually exclusive); at least one tax identifier (id_codice with id_paese, or codice_fiscale) is required; id_codice requires id_paese to be set.
Italian B2C buyers with only a CodiceFiscale: set codice_fiscale and leave id_paese/id_codice empty. Foreign B2B buyers: set id_paese + id_codice. For B2G invoices (FPA12): routing to the Public Administration is via a 6-char IPA office CodiceDestinatario in build_transmission_header(), not via this tool — look up the code at https://www.indicepa.gov.it.
Gruppo IVA (VAT-group) buyers: when id_paese/id_codice are omitted and codice_fiscale is an 11-digit (company-format) code, this may be a VAT-group's own CF rather than a participating member's. SdI rejects that combination with scarto code 00327 (see mcp_fattura_elettronica_it.sdi.notifications. SCARTO_CODE_REFERENCE) — this tool cannot validate VAT-group membership offline, so it only warns on the detectable structural precondition (IdFiscaleIVA absent
11-digit codice_fiscale); the returned 'warnings' list flags this case. Confirm codice_fiscale identifies the specific member company, not the group itself.
On success returns {'CessionarioCommittente': {...}} ready for generate_fattura_xml(), plus 'warnings' (list[str]) when the 00327 structural precondition is detected. On failure returns {'error': ''} listing all issues joined by '; '.
Input Schema
| Name | Required | Description | Default |
|---|---|---|---|
| cap | No | Postal code of the buyer. | |
| nome | No | First name of the buyer (natural person). | |
| comune | No | City of the buyer. | |
| cognome | No | Last name of the buyer (natural person). | |
| nazione | No | ISO country code of the buyer. | IT |
| id_paese | No | ISO country code for IdFiscaleIVA. Required for VAT-registered buyers. Omit for Italian buyers identified only by CodiceFiscale. | |
| id_codice | No | VAT number of the buyer. Required if id_paese is provided. | |
| indirizzo | No | Street address of the buyer. | |
| denominazione | No | Company name of the buyer. Mutually exclusive with nome+cognome. | |
| codice_fiscale | No | Italian fiscal code (16-char alphanumeric for individuals, 11-digit numeric for companies). Alternative to IdFiscaleIVA. |
Output Schema
| Name | Required | Description | Default |
|---|---|---|---|
No arguments | |||