# Validate sample invoices

> Check sample invoices with veraPDF, KoSIT and Mustang, and reproduce the document hashes.


Use these checks to reproduce the results for the sample documents, Desk and rating engine.

| Claim | Checked by | Run it |
|---|---|---|
| The PDF is accessible: PDF/UA-1 | [veraPDF](https://verapdf.org) 1.30.4 (image by digest) | `just proof` |
| The PDF is archivable: PDF/A-3b, also with the e-invoice embedded | veraPDF 1.30.4 | `just proof` |
| The XRechnung (UBL) and the ZUGFeRD XML (CII) are valid | [KoSIT validator](https://github.com/itplr-kosit/validator) 1.6.3 with the XRechnung 3.0.2 configuration of 31.08.2026 | `just proof` |
| The ZUGFeRD PDF is valid as a whole | [Mustang](https://www.mustangproject.org) 2.26.0 | `just proof` |
| The bill page and Desk views pass automated accessibility checks | [axe-core](https://github.com/dequelabs/axe-core) 4.14.1, zero violations | `just desk-check` |
| The same bill, byte for byte, on Linux, macOS (arm64 and x86_64), Windows and in WebAssembly | `samples/SHA256SUMS`, compared on each OS | `just samples --check` |
| The core in your browser is the core the services bill with | the same requests through the native build and the WebAssembly module, compared byte for byte | `just wasm` |
| Every cent of a year adds up | `telco demo`: lines sum, numbers rise, a Stornorechnung negates its bill, the ledger equals the bills | `just seed` |

## The sample bills

`just samples` renders three bills from fixed inputs — no clock, no environment — and
writes them with their SHA-256 to `samples/`:

| File | What |
|---|---|
| `consumer.html`, `consumer.pdf` | A first fibre bill: a partial month, a set-up fee, a welcome discount, a call |
| `zugferd.pdf`, `zugferd.cii.xml` | A business bill with its ZUGFeRD e-invoice embedded |
| `xrechnung.pdf`, `xrechnung.ubl.xml` | A bill to a public buyer with a Leitweg-ID, as XRechnung |

The sums in `samples/SHA256SUMS` are the published ones: every release carries them, and
CI renders the bills on Linux, macOS and Windows and fails on any difference. A rendering
change is deliberate: `just samples` rewrites them and the diff shows which bills changed.

## The validators

`just proof` (Java 17+ and Docker) runs what CI runs. It downloads each tool once, checks
its SHA-256 **before** anything runs, and stops naming the file and the rule when a sample
does not conform. veraPDF runs from its official image, pinned by digest.

## The playground

Choose Fibre, Mobile or Business, then pick a scenario. Open a charge in the invoice to read the rating engine’s explanation. **Adjust billing inputs** changes the plan, dates and usage. **Tariff source & tests** lets you edit the TOML and see which golden tests pass.

**Copy scenario link** includes the current book and billing inputs in the URL fragment. Editing a billing input or the tariff clears the old link from the address bar. Copy again to share the revision. If the selected plan is missing, choose another plan or restore its TOML to see an invoice. The calculation runs locally with the same Rust core as the services. [Open the tariff playground](../playground/)

## Releases

The release workflow uses crates.io Trusted Publishing and creates provenance attestations for binaries and images. To verify a released artifact, substitute its tag and filename below.

```sh
gh attestation verify telco-v0.1.0-aarch64-apple-darwin --repo hupe1980/telco
gh attestation verify oci://ghcr.io/hupe1980/telco:v0.1.0 --repo hupe1980/telco
```

## Verify a customer invoice

The customer can create a verification link from a sealed invoice in the customer portal. The script-free page compares each line and the VAT breakdown against a fresh rating with the pinned price books. The result distinguishes a calculation difference from missing or changed pricing. The QR code on the original points to the private invoice in the customer account. Only the customer-issued sharing link opens the masked calculation publicly.

Anyone with the link can see service dates, tariff items, quantities and amounts. The link expires after seven calendar days on the service clock. Each successful lookup of the page, QR or evidence counts against its 60 reads. Revoking or replacing the link closes all three paths. billd admits at most four concurrent public proof requests and 240 requests per minute per process.

For local verification, explicitly publish each required complete price book. The browser downloads the masked rating inputs and approved pricing from the customer origin, checks the pinned hashes and runs the same Rust calculation in WebAssembly. The local verifier accepts up to 512 KiB of input. The server result is available for larger bills and for tariffs retained by the operator. [Customer portal setup](../docs/selfcare/)
