| name | pdf_supplier_invoice |
| tier | 3 |
| task | T20 |
| description | This skill handles supplier invoices that come with a PDF attachment. The PDF contains the invoice details (supplier, amount, account, invoice number). Keywords include "leverandørfaktura" with a PDF file, supplier invoice with attachment, incoming invoice PDF, "facture fournisseur" with PDF, "Lieferantenrechnung" with PDF. |
PDF Supplier Invoice
Extract from the PDF: supplier name, org number, address (street, postal code, city), bank account ("Bankkonto"), invoice number, dates (DD.MM.YYYY→YYYY-MM-DD), net amount ("Beløp"), VAT amount ("MVA 25%"), total ("Totalt"), expense account ("Konto"), description.
Turn 1: GET /supplier + GET /ledger/account (parallel)
GET /supplier?organizationNumber=<org_nr>&fields=id,name&count=10
GET /ledger/account?number=<expense_acct>,2400,2710&fields=id,number,name
If supplier not found → create in Turn 2. If found → skip to Turn 3.
Turn 2: POST /supplier (only if not found)
POST /supplier
{
"name": "<name>", "organizationNumber": "<org>",
"bankAccountPresentation": [{"bban": "<bankkonto>"}],
"postalAddress": {"addressLine1": "<street>", "postalCode": "<code>", "city": "<city>"}
}
Turn 3: POST /supplierInvoice?sendToLedger=true
3-line EXPLICIT postings. Use the EXACT net/VAT/total amounts from the PDF. No vatType on any posting.
POST /supplierInvoice?sendToLedger=true
{
"invoiceNumber": "<invoice_number>",
"invoiceDate": "<YYYY-MM-DD>",
"invoiceDueDate": "<YYYY-MM-DD>",
"supplier": {"id": <supplier_id>},
"amountCurrency": -<total>,
"currency": {"id": 1},
"kidOrReceiverReference": "<bankkonto>",
"voucher": {
"date": "<invoice_date>",
"description": "<description>",
"postings": [
{"date": "<date>", "account": {"id": <expense_id>}, "amountGross": <net_from_pdf>, "amountGrossCurrency": <net_from_pdf>, "description": "<desc>", "row": 1, "supplier": {"id": <sid>}},
{"date": "<date>", "account": {"id": <acct_2710_id>}, "amountGross": <vat_from_pdf>, "amountGrossCurrency": <vat_from_pdf>, "description": "Inngående MVA 25%", "row": 2},
{"date": "<date>", "account": {"id": <acct_2400_id>}, "amountGross": -<total>, "amountGrossCurrency": -<total>, "description": "<desc>", "row": 3, "supplier": {"id": <sid>}}
]
}
}
Save response.value.voucher.id for Turns 4 and 5.
Turn 4: POST /ledger/voucher/{voucherId}/attachment + PUT :sendToLedger (parallel)
Both calls in the SAME turn:
POST /ledger/voucher/<voucher_id>/attachment
file_index: 0
PUT /ledger/voucher/<voucher_id>/:sendToLedger
3-4 writes total. 0 errors.