validate_cessionario
Validate and build the buyer block for Italian e-invoices. Ensures correct tax identifiers and IPA office code for public administration invoices.
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): codice_ufficio is required — the 6-char IPA office code from https://www.indicepa.gov.it. Absence causes SdI routing rejection.
On success returns {'CessionarioCommittente': {...}} ready for generate_fattura_xml(). On failure returns {'error': ''} listing all issues joined by '; '.
Input Schema
| Name | Required | Description | Default |
|---|---|---|---|
| denominazione | No | Company name of the buyer. Mutually exclusive with nome+cognome. | |
| nome | No | First name of the buyer (natural person). | |
| cognome | No | Last name of the buyer (natural person). | |
| 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. | |
| codice_fiscale | No | Italian fiscal code (16-char alphanumeric for individuals, 11-digit numeric for companies). Alternative to IdFiscaleIVA. | |
| indirizzo | No | Street address of the buyer. | |
| cap | No | Postal code of the buyer. | |
| comune | No | City of the buyer. | |
| nazione | No | ISO country code of the buyer. | IT |
| codice_ufficio | No | IPA office code (CodiceUfficio) for B2G invoices (FPA12 format). Required for all invoices addressed to a Public Administration (PA). 6-character code from the IPA registry (https://www.indicepa.gov.it). Absence causes SdI routing rejection for FPA12 invoices. |
Output Schema
| Name | Required | Description | Default |
|---|---|---|---|
No arguments | |||