Automated INVOIC plausibility and tariff validation for the LF (Lieferant) role.
A German LF receives INVOIC messages (PIDs 31001–31011) from NB/GNB/MSB/BIKO
counterparties for grid fees (NNE), meter charges, and Mehr-/Mindermengen (MMM)
settlement. This library runs automated business-rule checks over BO4E
[Rechnung][rubo4e::v202501::Rechnung] objects — the industry-standard German
energy domain model — and produces a [CheckReport] that drives the REMADV /
dispute workflow in invoicd.
EDIFACT INVOIC segments
→ [makod adapter: anti-corruption layer]
→ BO4E Rechnung — industry-standard domain model, stored in events
→ InvoicCheckEngine::check — pure business rules, no EDIFACT dependency
→ CheckReport { Ok | Warn | Dispute }
→ REMADV auto-dispatch or dispute workflow
Design principles
- Format-agnostic: zero dependency on
edifact-rs. Operates solely on the BO4E domain model. EDIFACT → BO4E translation belongs in themakodtransport adapter (anti-corruption layer). - Pure library — no I/O, no async, no Tokio dependency.
- Trait-injected stores — [
PreisblattStore] is injected by the caller (e.g.invoicdinjects an in-memory store seeded frommarktd's price-sheet API). - No floating-point money — all amounts are [
EuroAmount] (i64×10⁻⁵ EUR).
Monetary precision
[EuroAmount] stores values as i64 in units of 10⁻⁵ EUR (1/100 000 EUR):
EuroAmount(100_000)= 1.00000 EUREuroAmount(3_456)= 0.03456 EUR (typical NNE unit price per kWh)
This gives five decimal places — sufficient for all BDEW INVOIC precision requirements (NNE unit prices: typically 4 decimal places).
Example
use ;
use ;
let preisblatt_store = default;
let rechnung = default;
let report = check;
assert_eq!;