build_dati_pagamento
Construct the DatiPagamento (payment details) block for Italian electronic invoices. Validates payment terms, method, IBAN, and returns structured data for XML generation.
Instructions
Build the DatiPagamento block for the FatturaElettronicaBody.
Use this as step 9 in the invoice generation workflow, after compute_totali() and before generate_fattura_xml(). The block is optional in the XML but strongly recommended for B2B invoices.
condizioni_pagamento: TP01 = instalments, TP02 = single full payment, TP03 = advance. modalita_pagamento: MP05 (bank transfer) is most common for B2B; include iban when using MP05. importo_pagamento: for TP02 this should equal totale_fattura from compute_totali(); for TP01 (instalments) call this tool once per instalment tranche.
Validates: condizioni_pagamento in {TP01, TP02, TP03}; modalita_pagamento in MP01–MP23; IBAN format (letters + digits, max 34 chars); data_scadenza_pagamento is YYYY-MM-DD.
On success returns {'DatiPagamento': {...}} ready for generate_fattura_xml(). On failure returns {'error': ''}.
Input Schema
| Name | Required | Description | Default |
|---|---|---|---|
| condizioni_pagamento | Yes | Payment terms code: 'TP01' = full payment in instalments, 'TP02' = full single payment, 'TP03' = advance payment. | |
| modalita_pagamento | Yes | Payment method code MP01–MP23. Common values: MP05 (bonifico/bank transfer), MP01 (cash), MP08 (card), MP19/MP20/MP21 (SEPA direct debit), MP23 (PagoPA). Use a valid MP code from the FatturaPA reference. | |
| importo_pagamento | Yes | Payment amount (may equal or differ from invoice total for instalments). | |
| data_scadenza_pagamento | No | Payment due date (YYYY-MM-DD). Omit for immediate payment. | |
| iban | No | IBAN for bank transfer (MP05). Validated for format (letters+digits, max 34 chars). | |
| istituto_finanziario | No | Name of the financial institution (bank name). Optional. |
Output Schema
| Name | Required | Description | Default |
|---|---|---|---|
No arguments | |||