validate_cessionario
Validate and prepare buyer data for Italian e-invoicing: ensure correct tax IDs and name fields. Returns CessionarioCommittente block or 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.
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 |
Output Schema
| Name | Required | Description | Default |
|---|---|---|---|
No arguments | |||