# Output Format ## invoices_data.json (written by preprocess.py) ```json { "period": { "start": "2026-06-01", "end": "2026-06-30" }, "summary": { "total_invoices": 12, "new_invoices": 4, "known_contractors": 3, "unknown_contractors": 1, "whitelist_ok": 3, "whitelist_failed": 1, "whitelist_error": 0, "account_mismatch": 0 }, "invoices": [ { "ksef_reference": "1234567890-20260601-ABC123", "invoice_number": "FV/123/06/2026", "issue_date": "2026-06-01", "seller_nip": "1234567890", "seller_name": "Firma ABC Sp. z o.o.", "gross_amount": 1230.00, "currency": "PLN", "bank_account": "PL61109010140000071219812874", "is_new": true, "contractor_known": true, "account_in_contractors": true, "whitelist_status": "ok", "whitelist_account_assigned": true, "whitelist_error": null } ], "known_invoices_count": 8 } ``` ### Field notes - `is_new` — true if the KSeF reference was not in `invoices_cache.json` before this run. The cache is updated at the end of a successful run. - `contractor_known` — true if the seller NIP is in `contractors.md`. - `account_in_contractors` — true if the invoice bank account matches one of the accounts listed in `contractors.md` for this NIP. `null` if the contractor is unknown or has no accounts configured. - `whitelist_status` — `"ok"` (account found on white list), `"failed"` (account NOT on white list), `"no_account"` (invoice has no bank account), `"error"` (API call failed). - `whitelist_account_assigned` — the raw `accountAssigned` value from the MF API (`true`/`false`). `null` if not checked. - `whitelist_error` — error message string if the API call failed, otherwise `null`. ## invoices_report.md (written by postprocess.py) Manager-readable markdown report containing: - Period and run timestamp - Summary block - Table of new invoices with contractor and white list status - Section highlighting white list failures (if any) - Section listing unknown contractors (if any) ### Status icons used in the report | Icon | Meaning | |---|---| | ✓ | White list OK | | ✗ | White list FAILED — do not pay until resolved | | ? | Could not verify (API error) | | — | No bank account on invoice | | ★ | Known contractor | | ✦ | Unknown contractor |