Migration package v1
Map legacy account, tariff, invoice and finance records into a versioned EUR billing rehearsal.
A package contains the records for one source estate and one cutover date. Supply a UTF-8 JSON object with format set to telco.migration.v1. All record collections below are arrays, including empty collections. The worked package contains two monthly invoices, a grandfathered tariff, usage, earlier charges, a mandate and the opening receivable. Worked JSON package · Run and review a shadow comparison
Snapshot and accounts
| Field | Contents |
|---|---|
source, snapshot | Opaque identifiers for the estate and this extract. |
cutover_on | Business date in YYYY-MM-DD format. |
periods | One or two consecutive, ascending YYYY-MM billing periods that have ended before cutover. |
customers | One id per customer. Use pseudonyms consistently across extracts. |
accounts | id and owning customer. Every account in the package is compared for each period. |
contracts | id, account, original starts_on and optional inclusive ends_on. |
subscriptions | contract and an input object with id, optional active_from, optional inclusive ends_on, and slices. Each assignment has plan, book_version, inclusive from and optional exclusive to. Assignments must cover active service days through cutover without overlap. |
Use stable identifiers of 1–128 ASCII letters, digits or the characters ._:/-. IDs are unique within their record group. Diagnostics identify records by these IDs, and the comparison includes account and invoice IDs. Keep personal details out of IDs and tariff text. The optional live fields below carry personal and payment data. Keep the entire package in the operator’s restricted environment.
Tariffs and previous billing facts
| Field | Contents |
|---|---|
tariffs | id (the assignment’s book_version), sha256 (compiled book hash including the sha256: prefix) and files (relative TOML filenames mapped to their text). A tariff ID may use book@version. Compile the original grandfathered prices, effective tax dates, rounding and allowances. |
usage | subscription and record with id, kind, business date and integer quantity in the tariff’s base unit. For a November invoice, include the October usage. |
prior_charges | Charges already billed for the month before each requested cycle. Supply the original line’s opaque id, subscription, service month, plan, book_version, charge kind (recurring, one-off or discount), tariff item, VAT rate, EUR amount in the original book’s gross or net basis (up to ten decimal places), and inclusive from and to dates. The comparator derives the correction key from kind, item and rate. If the original charge alone explains a credit, the evidence points back to that legacy record. Use the actual prior billed charges for each comparison so mid-cycle changes produce the proper corrections. An empty array asserts that nothing was billed. |
Read the original book’s compiled hash with telco price check BOOK. Embedded tariff files are compiled in memory. Every assignment must resolve to an imported tariff and plan. Price-book format
Legacy invoices and matching
Each invoices entry contains id, account, period, net, vat, gross and lines. Supply at most one invoice per account and period. An omitted invoice is reported as missing. A real zero bill has an invoice record with zero totals. Monetary controls are EUR decimal strings with at most two fractional digits. Negative amounts represent credits. Invoice lines must sum to the header gross and net plus VAT must equal gross.
Each line has its source id, a gross amount gross and VAT percentage rate, both as decimal strings. Set item to the mapped tariff item, for example base, or omit it if the mapping is unknown. Supply the optional charge_id for an exact calculated charge within that item and rate. Without an explicit charge ID, automatic matching requires a unique remaining line on each side for that item and VAT rate. An ambiguous group requires review. Matching never uses labels or amounts.
For net tariffs, the comparison apportions the engine’s rounded VAT per rate over its lines in canonical order. Each gross contribution can therefore be reconciled with the document gross, including when VAT rounding leaves a one-cent difference between lines.
Independent invoice register
Use telco.invoice-register.v1 for the finance export. Copy the agreed source, snapshot and ordered periods labels into its header. Extract invoices directly from the legacy issued-invoice register. Each row has account, period, invoice, net, vat and gross. The account and document identifiers must be opaque. Amounts are signed decimal strings in EUR with at most two fractional digits. Net plus VAT must equal gross.
Supply one row per issued invoice, with unique invoice identifiers and unique account-period pairs. An empty array declares no issued invoices for the selected cohort. The register accepts up to 50,000 rows in a regular file of up to 16 MiB. Register diagnostics give JSON line and column for parsing errors, or a one-based invoice row for rejected headers. Keep the original bytes for approval and retries. Worked register
Finance controls
| Field | Contents |
|---|---|
open_items | Stable id, owning account, signed EUR amount and integer dunning_level (0–255). A positive level requires a positive outstanding receivable. |
opening_balances | Exactly one row per account with the signed control amount and explicit signed residual. Outstanding items plus this residual must equal the control amount. For €80 in unpaid invoices and a €10 credit outside the item list, use amount: "70.00" and residual: "-10.00". |
mandates | Stable id, account, unique original reference (up to 35 characters), business date signed_on and original sequence (FRST, RCUR, FNAL or OOFF). The signature date must be on or before cutover. |
number_series | series (RE-YYYY for invoices or ST-YYYY for credit notes) and positive integer next. Include the invoice series for the cutover year. The next number must exceed numbers already present for the same series in this package. A live target’s current counter is a separate cutover control. |
Additional data for live cutover
A live cutover starts on the first day of the month after the last rehearsed cycle. Every affected customer, account, contract and subscription needs a live object. Rehearsals can omit these objects. An account’s mandate is selected by source ID, linking the actual debit instructions to the original reference, signature date and sequence.
| Record | Fields inside live |
|---|---|
| Customer | name, street, postcode, city, two-letter country, Boolean consumer, and salutation (sie or du). |
| Account | Integer payment_terms_days (0–90), payment_method (transfer or direct-debit). Direct debit requires the account’s own mandate ID and valid iban. Optional fields are vat_id, buyer_reference, peppol_id and invoice_email. |
| Contract | initial_months, notice_months, renews, state (effective, awaiting_approval, ended or voided) and summary_before_conclusion. Include approved_on for a subsequent approval, and bundle_code where applicable. For a termination supply termination_received_on, termination_basis and the applicable termination_rule if one decided the date. The inclusive effective date belongs in the contract’s ends_on. A voided contract requires the original voided_on. |
| Subscription | product, state (ordered, active, restricted, terminating, ended or voided), and optional term_months. Supply the original state_on for a restriction or void. The dated service facts must support the stated status on cutover day. |
Also supply a top-level cutover_history object with prior_charges and usage arrays, using the same record shapes as the rehearsal. These are the source facts for the month immediately before cutover, including unbilled usage due on the first live bill. Empty arrays assert that no such charges or records exist. Keep service dates, monetary precision and record IDs intact.
Limits and diagnostics
A package fits in a regular file of up to 16 MiB with at most 50,000 records, counting invoice lines and assignment slices. It may contain up to 64 tariffs, each with up to 256 relative TOML files of up to 1 MiB each. Keep account ownership, finance controls and all billing facts together when splitting an estate into packages.
Malformed JSON or a field of the wrong type yields a format error with a line and column. For well-formed inputs, validation collects independent errors under issues, each with record, source_id, field and code. An invalid record identifier can be blanked. The validator returns up to 256 detailed issues and an additional-errors marker when more exist.