Belgian consumer debt reminder (Book XIX CEL)
BodyA payment reminder that follows Book XIX of the Belgian Code of Economic Law. A consumer's first reminder is free and carries the four statutory mentions; if one is missing it prints an 'incomplete' warning instead, because without them the 14-day period never starts. That period runs from the third working day after a paper reminder is sent, or the day after an electronic one, and the exact last day is printed. Only a later reminder, sent after the period has lapsed unpaid, adds anything, and only what the contract expressly provides: a lump sum capped by bands on the outstanding amount (EUR 20, then EUR 30 plus 10%, then EUR 65 plus 5% up to EUR 2,000), and late interest capped at the reference rate plus 8 points. Nothing else is ever charged. A business debtor gets the fixed EUR 40 per invoice of the Act of 2 August 2002. All dates and amounts come from one deriver.
npx dxcl add be-consumer-debt-reminder debt.debtorType Vorschaudaten
das JSON, mit dem diese Vorschau gebaut wurde{
"debt": {
"debtorType": "consumer",
"stage": "subsequent",
"asOf": "2026-11-30",
"amountDue": 48730.6,
"dueDate": "2026-09-15",
"creditorName": "Vandenbroucke-Delacroix Ameublement, Literie et Décoration SRL",
"creditorEnterpriseNumber": "0712.345.678",
"description": "the corner sofa 'Ardennes XL' in cognac leather with two electric recliners, delivery and assembly included (order 2026-118734-B, invoice F-2026-0045817)",
"firstReminder": {
"sentDate": "2026-10-14",
"channel": "paper"
},
"contractProvidesDamages": true,
"contractProvidesInterest": true,
"agreedRate": 14,
"referenceRate": 4.25,
"creditorIsSme": false,
"holidays": [
"2026-09-27"
]
}
} {
"debt": {
"debtorType": "business",
"stage": "subsequent",
"asOf": "2026-11-30",
"amountDue": 48730.6,
"dueDate": "2026-09-15",
"creditorName": "Vandenbroucke-Delacroix Ameublement, Literie et Décoration SRL",
"creditorEnterpriseNumber": "0712.345.678",
"description": "the corner sofa 'Ardennes XL' in cognac leather with two electric recliners, delivery and assembly included (order 2026-118734-B, invoice F-2026-0045817)",
"firstReminder": {
"sentDate": "2026-10-14",
"channel": "paper"
},
"contractProvidesDamages": true,
"contractProvidesInterest": true,
"agreedRate": 14,
"referenceRate": 4.25,
"creditorIsSme": false,
"holidays": [
"2026-09-27"
]
}
} Aufgelöste Nodes
was ein Renderer erhält — 1 Nodesbe-debt-lapsed section be-debt-business section Die Dateien
was die Installation schreibt; die gewählte Datei ist die Komponentenodes/be-consumer-debt-reminder.node.tsx import { Cell, type Nodes, Paragraph, Row, Section, Table, useDeriver, useState } from "docxcelerate/template";
import beConsumerDebtReminder from "../derivers/be-consumer-debt-reminder.deriver.ts";
/**
* A Belgian payment reminder under Book XIX of the Code of Economic Law (CEL),
* already split into the stage the law allows.
*
* Decisions already made for you:
*
* - A consumer's first reminder is free. No cost, interest or indemnity is
* added to it, and it carries the four statutory mentions of art. XIX.2 §3:
* the amount, the creditor's name and enterprise number, what the debt is
* for and when it fell due, and the period to pay. If one is missing it
* prints an "incomplete" warning instead, because without them the 14-day
* period never starts and nothing can ever be charged.
* - The exact last day of the period is printed. It is 14 calendar days from
* the third working day after a paper reminder was sent, or from the day
* after an electronic one, never from the send date. Saturdays are not
* working days, which gives the later date and so can never make the period
* too short. The last day is not moved off a weekend or holiday.
* - Costs only after the period has lapsed unpaid, and only what the contract
* expressly provides: a lump sum capped by bands on the outstanding amount,
* and late interest capped at the reference rate plus 8 points. Nothing else
* is passed on (art. XIX.4). With no first reminder on record, a period that
* has not lapsed or no clause, the section adds nothing and says so.
* - A business debtor falls under the Act of 2 August 2002 instead: a fixed
* EUR 40 per unpaid invoice, owed without notice.
*
* All of the dates and money are worked out in one deriver, because every step
* is date or money arithmetic on request data and publishing refuses all of it.
* The node computes nothing: it branches on the deriver's result, with every
* test written inline so a publish build keeps each arm.
*
* The node publishes 16 branches against the default `branchLimit` of 32.
*
* Not covered: regular-supply contracts, whether the contract clauses are
* valid, interest on a business debt, part payments, collection agencies,
* languages other than English and delivery of the reminder.
*
* Installed by `dxcl add be-consumer-debt-reminder`.
*/
/** What this component reads. Add these fields to your document data type. */
export interface BeConsumerDebtReminderData {
debt: {
/**
* Who owes the debt. `"consumer"` applies Book XIX CEL; `"business"` applies the
* Act of 2 August 2002 instead and ignores `stage`, `firstReminder` and the
* contract fields. Required: throws when missing or outside the union.
*/
debtorType: "consumer" | "business";
/**
* Which reminder this document is. `"first"`: the free first reminder, being
* sent now. `"subsequent"`: any later one, which may carry costs if the first
* reminder's period has lapsed. Read for consumers only. Required for a consumer:
* throws when missing or outside the union.
*/
stage: "first" | "subsequent";
/**
* The date this document is issued, ISO 8601. Interest runs to this day, and it is
* what decides whether the period has lapsed. Required: throws when missing.
*/
asOf: string;
/**
* What is still owed, in euros, before any cost: the principal left after part
* payments. The lump-sum bands and the interest are both worked out on it. Zero or
* negative prints "nothing outstanding". Required: throws when missing or not finite.
*/
amountDue: number;
/**
* When the debt fell due, ISO 8601. Printed on the first reminder (a statutory
* mention). On or after `asOf` prints "not yet due". Required: throws when missing.
*/
dueDate: string;
/**
* The creditor's name, as the consumer knows it. A statutory mention of the first
* reminder: missing there prints the "incomplete" warning. Not read otherwise.
*/
creditorName?: string;
/**
* The creditor's enterprise number (KBO/BCE), printed as given: "0712.345.678".
* A statutory mention of the first reminder: missing there prints the "incomplete"
* warning. Not read otherwise. Not checked for well-formedness.
*/
creditorEnterpriseNumber?: string;
/**
* What the debt is for: the product or service that gave rise to it, with any
* order or invoice reference. A statutory mention of the first reminder: missing
* there prints the "incomplete" warning. Not read otherwise.
*/
description?: string;
/**
* When and how the free first reminder was (or, at stage "first", is being) sent.
* The 14-day period is counted from it. Missing at stage "first" prints the
* "incomplete" warning. Missing at "subsequent" means no first reminder is on
* record: nothing may be charged, and a warning says so.
*/
firstReminder?: {
/** The day it was handed to the post or sent, ISO 8601. */
sentDate: string;
/**
* `"paper"`: the period starts on the third working day after `sentDate`.
* `"electronic"`: it starts the calendar day after.
*/
channel: "paper" | "electronic";
};
/**
* True when the consumer accepted a contract clause that expressly provides a
* lump-sum indemnity for late payment. False or missing: no lump sum is ever
* announced or charged.
*/
contractProvidesDamages?: boolean;
/**
* The lump sum the clause states, in euros, when it states a figure. The amount
* charged is the lower of this and the statutory cap. Missing means the clause
* adopts the statutory scale, so the cap is charged. 0 means none. Ignored unless
* `contractProvidesDamages`.
*/
agreedLumpSum?: number;
/**
* True when the consumer accepted a clause providing late interest. False or
* missing: no interest is ever announced or charged.
*/
contractProvidesInterest?: boolean;
/**
* The annual rate the clause states, as a percentage: 10 means 10% a year. The rate
* applied is the lower of this and `referenceRate + 8`. Missing means the clause
* adopts the statutory cap. Ignored unless `contractProvidesInterest`.
*/
agreedRate?: number;
/**
* The reference interest rate under art. 5 of the Act of 2 August 2002 for the
* current half-year, as a percentage (published by the FPS Finance). Needed
* whenever interest is provided for, because the cap is this plus 8 points.
* Missing then: at stage "first" this is an "incomplete" warning; at "subsequent"
* the interest is not charged and a warning says why.
*/
referenceRate?: number;
/**
* True when the creditor is an SME under art. 1:24 §1 of the Code of Companies and
* Associations. If the period lapses unpaid, it may let interest run from the
* calendar day after the first reminder was sent (art. XIX.2 §4), instead of from
* the day after the period ends. Missing means false: the later start, which can
* never overcharge.
*/
creditorIsSme?: boolean;
/**
* Extra non-working days, ISO 8601, added to the ten Belgian legal holidays the
* deriver already knows (for example 11 July or 27 September for a community, or a
* company closure). Read only when counting the three working days after a paper
* reminder.
*/
holidays?: string[];
/**
* Business debtors only: how many unpaid invoices `amountDue` covers. Each one owes
* the fixed EUR 40. Missing means 1.
*/
invoiceCount?: number;
};
}
/** Prints the reminder the law allows for this debt's stage, or says why nothing can be added. */
export const BeConsumerDebtReminder: Nodes = async () => {
const [debt] = useState((data: BeConsumerDebtReminderData) => data.debt);
const r = await useDeriver(beConsumerDebtReminder, [debt]);
return (
<>
{r.outcome === "nothing-due" && (
<Section id="be-debt-nothing-due" title="Your account">
<Paragraph id="be-debt-nothing-due-text">
There is nothing outstanding on this account, so there is nothing to pay.
</Paragraph>
</Section>
)}
{r.outcome === "not-yet-due" && (
<Section id="be-debt-not-yet-due" title="Your account">
<Paragraph id="be-debt-not-yet-due-text">
The amount of {r.amountDue} falls due on {r.dueDate}. It is not overdue.
</Paragraph>
</Section>
)}
{r.outcome === "first" && (
<Section id="be-debt-first" title="Payment reminder">
<Paragraph id="be-debt-first-creditor">
This reminder is sent by {debt.creditorName}, enterprise number {debt.creditorEnterpriseNumber}.
</Paragraph>
<Paragraph id="be-debt-first-debt">
Our records show that {r.amountDue} is still outstanding for {debt.description}, which fell due on{" "}
{r.dueDate}.
</Paragraph>
<Paragraph id="be-debt-first-free">
This first reminder is free of charge: no costs, interest or damages have been added to it.
</Paragraph>
<Paragraph id="be-debt-first-deadline">
Please pay {r.amountDue} by {r.lastDay}. You have 14 calendar days, from {r.periodStart} to {r.lastDay}{" "}
inclusive, to pay without any costs.
</Paragraph>
{r.lumpSum && (
<Paragraph id="be-debt-first-lump-sum">
If it is not paid by then, a lump-sum indemnity of {r.lumpSum} will be claimed, as your contract provides.
</Paragraph>
)}
{r.rate && (
<Paragraph id="be-debt-first-interest">
Late interest at {r.rate} a year will then also be charged on the outstanding amount, from{" "}
{r.interestFrom}.
</Paragraph>
)}
{r.addsNothing && (
<Paragraph id="be-debt-first-adds-nothing">
If it is not paid by then, no costs, interest or damages will be added.
</Paragraph>
)}
</Section>
)}
{r.outcome === "first-incomplete" && (
<Section id="be-debt-first-incomplete" title="Payment reminder">
<Paragraph id="be-debt-first-incomplete-text">
Reminder incomplete: a first reminder under Book XIX of the Code of Economic Law must state {r.missing}, and
this one does not. Without it the 14-day period does not start. Add it before this reminder is sent.
</Paragraph>
</Section>
)}
{r.outcome === "waiting" && (
<Section id="be-debt-waiting" title="Payment reminder">
<Paragraph id="be-debt-waiting-text">
The amount of {r.amountDue}, due on {r.dueDate}, is still outstanding. You can pay it without any costs,
interest or damages until {r.lastDay} inclusive, and none have been added.
</Paragraph>
</Section>
)}
{r.outcome === "no-first-reminder" && (
<Section id="be-debt-no-first-reminder" title="Payment reminder">
<Paragraph id="be-debt-no-first-reminder-amount">
The amount of {r.amountDue}, due on {r.dueDate}, is still outstanding.
</Paragraph>
<Paragraph id="be-debt-no-first-reminder-warning">
Reminder incomplete: no first reminder is on record for this debt, so no costs, interest or damages can be
claimed, and none have been added. A free first reminder has to be sent, and its 14-day period has to
lapse, first.
</Paragraph>
</Section>
)}
{r.outcome === "lapsed" && (
<Section id="be-debt-lapsed" title="Reminder: payment overdue">
<Paragraph id="be-debt-lapsed-text">
The period to pay without costs ended on {r.lastDay}, and {r.amountDue} is still outstanding.
</Paragraph>
{r.charged && (
<Table id="be-debt-lapsed-charges" columns={[{ width: "auto" }, { width: 35, align: "right" }]}>
<Row id="be-debt-lapsed-outstanding">
<Cell>Outstanding amount</Cell>
<Cell>{r.amountDue}</Cell>
</Row>
{r.lumpSum && (
<Row id="be-debt-lapsed-lump-sum">
<Cell>Lump-sum indemnity under your contract</Cell>
<Cell>{r.lumpSum}</Cell>
</Row>
)}
{r.interest && (
<Row id="be-debt-lapsed-interest">
<Cell>Late interest at {r.rate} a year from {r.interestFrom} ({r.interestDays} days)</Cell>
<Cell>{r.interest}</Cell>
</Row>
)}
<Row id="be-debt-lapsed-total">
<Cell>Total now due</Cell>
<Cell>{r.total}</Cell>
</Row>
</Table>
)}
{!r.charged && !r.interestIncomplete && (
<Paragraph id="be-debt-lapsed-no-charges">
Your contract provides for no indemnity or late interest, so nothing has been added to this amount.
</Paragraph>
)}
{r.interestIncomplete && (
<Paragraph id="be-debt-lapsed-interest-incomplete">
Late interest not charged: your contract provides for it, but no reference rate was given, so the
statutory cap could not be applied.
</Paragraph>
)}
</Section>
)}
{r.outcome === "business" && (
<Section id="be-debt-business" title="Overdue payment">
<Paragraph id="be-debt-business-amount">
The amount of {r.amountDue}, due on {r.dueDate}, has not been paid.
</Paragraph>
<Paragraph id="be-debt-business-compensation">
Under the Act of 2 August 2002 on combating late payment in commercial transactions, a fixed compensation
of €40.00 per unpaid invoice is owed without notice: {r.compensation} for {r.invoicesLabel}. The total now
due is {r.total}.
</Paragraph>
</Section>
)}
</>
);
}; derivers/be-consumer-debt-reminder.deriver.ts // deno-lint-ignore-file no-explicit-any
import { deriver } from "docxcelerate/template";
/**
* Works out every date and amount of a Belgian debt reminder: which stage the
* law allows, the exact last day of the free period, and what may be added
* after it. Installed by `dxcl add be-consumer-debt-reminder`.
*
* It is self-contained on purpose: it travels to the engine as source text, so
* a module-level constant or helper would be a ReferenceError there. Every
* helper is declared inside `run`.
*/
export default deriver({
name: "beConsumerDebtReminder",
run: (debt: unknown) => {
const d = debt as any;
// UTC day indexes, so a day does not shift with the engine's time zone.
const isoDay = (value: unknown, field: string): string => {
if (typeof value !== "string" || !/^\d{4}-\d{2}-\d{2}/.test(value)) {
throw new Error(field + " must be an ISO 8601 date");
}
return value.slice(0, 10);
};
const dayIndex = (iso: string) => {
const [y, m, day] = iso.split("-").map(Number);
return Date.UTC(y, m - 1, day) / 86_400_000;
};
const dates = new Intl.DateTimeFormat("en-GB", { dateStyle: "long", timeZone: "UTC" });
const fmtDay = (index: number) => dates.format(new Date(index * 86_400_000));
const money = new Intl.NumberFormat("en-IE", { style: "currency", currency: "EUR" });
const fmtMoney = (cents: number) => money.format(cents / 100);
const number = (value: unknown, field: string): number => {
if (typeof value !== "number" || !Number.isFinite(value)) throw new Error(field + " must be a finite number");
return value;
};
const optional = (value: unknown, field: string): number | undefined =>
value === undefined || value === null ? undefined : number(value, field);
const nonNegative = (value: unknown, field: string): number | undefined => {
const n = optional(value, field);
if (n !== undefined && n < 0) throw new Error(field + " must not be negative");
return n;
};
const present = (value: unknown) => typeof value === "string" && value !== "";
// 1. Validate.
const debtorType = d?.debtorType;
if (debtorType !== "consumer" && debtorType !== "business") {
throw new Error('debt.debtorType must be "consumer" or "business"');
}
const consumer = debtorType === "consumer";
if (consumer && d.stage !== "first" && d.stage !== "subsequent") {
throw new Error('debt.stage must be "first" or "subsequent"');
}
const asOf = dayIndex(isoDay(d.asOf, "debt.asOf"));
const dueDate = dayIndex(isoDay(d.dueDate, "debt.dueDate"));
const amountCents = Math.round(number(d.amountDue, "debt.amountDue") * 100);
const agreedLumpSum = nonNegative(d.agreedLumpSum, "debt.agreedLumpSum");
const agreedRate = nonNegative(d.agreedRate, "debt.agreedRate");
const referenceRate = optional(d.referenceRate, "debt.referenceRate");
const extraHolidays: number[] = [];
if (d.holidays !== undefined && d.holidays !== null) {
if (!Array.isArray(d.holidays)) throw new Error("debt.holidays must be a list of ISO 8601 dates");
d.holidays.forEach((h: unknown, i: number) => extraHolidays.push(dayIndex(isoDay(h, "debt.holidays[" + i + "]"))));
}
let invoiceCount = 1;
if (d.invoiceCount !== undefined && d.invoiceCount !== null) {
if (!Number.isInteger(d.invoiceCount) || d.invoiceCount < 1) {
throw new Error("debt.invoiceCount must be an integer of 1 or more");
}
invoiceCount = d.invoiceCount;
}
const fr = d.firstReminder;
let sent = 0;
let channel = "";
if (fr !== undefined && fr !== null) {
sent = dayIndex(isoDay(fr.sentDate, "debt.firstReminder.sentDate"));
channel = fr.channel;
if (channel !== "paper" && channel !== "electronic") {
throw new Error('debt.firstReminder.channel must be "paper" or "electronic"');
}
}
const hasFirst = channel !== "";
const out = {
outcome: "nothing-due" as string,
amountDue: "",
dueDate: "",
periodStart: "",
lastDay: "",
lumpSum: "",
rate: "",
interestFrom: "",
interest: "",
interestDays: 0,
interestIncomplete: false,
charged: false,
addsNothing: false,
missing: "",
compensation: "",
invoicesLabel: "",
total: "",
};
// 3. Nothing due.
if (amountCents <= 0) return out;
out.amountDue = fmtMoney(amountCents);
out.dueDate = fmtDay(dueDate);
// 4. Not yet due.
if (asOf <= dueDate) {
out.outcome = "not-yet-due";
return out;
}
// 5. A business debtor: the fixed compensation of the Act of 2 August 2002.
if (!consumer) {
const compensation = 4000 * invoiceCount;
out.outcome = "business";
out.compensation = fmtMoney(compensation);
out.invoicesLabel = invoiceCount === 1 ? "1 invoice" : invoiceCount + " invoices";
out.total = fmtMoney(amountCents + compensation);
return out;
}
// 6. The 14-day period. Easter by the anonymous Gregorian algorithm.
const legalHolidays = (year: number): number[] => {
const a = year % 19;
const b = Math.floor(year / 100);
const c = year % 100;
const g = Math.floor((b - Math.floor((b + 8) / 25) + 1) / 3);
const h = (19 * a + b - Math.floor(b / 4) - g + 15) % 30;
const l = (32 + 2 * (b % 4) + 2 * Math.floor(c / 4) - h - (c % 4)) % 7;
const m = Math.floor((a + 11 * h + 22 * l) / 451);
const month = Math.floor((h + l - 7 * m + 114) / 31);
const dayOfMonth = ((h + l - 7 * m + 114) % 31) + 1;
const easter = Date.UTC(year, month - 1, dayOfMonth) / 86_400_000;
return [
Date.UTC(year, 0, 1), Date.UTC(year, 4, 1), Date.UTC(year, 6, 21), Date.UTC(year, 7, 15),
Date.UTC(year, 10, 1), Date.UTC(year, 10, 11), Date.UTC(year, 11, 25),
].map((t) => t / 86_400_000).concat([easter + 1, easter + 39, easter + 50]);
};
let periodStart = 0;
let lastDay = 0;
if (hasFirst) {
if (channel === "electronic") periodStart = sent + 1;
else {
// Saturdays do not count: of the two readings of "jour ouvrable" this gives the later date.
let day = sent;
let counted = 0;
while (counted < 3) {
day++;
const weekday = new Date(day * 86_400_000).getUTCDay();
const year = new Date(day * 86_400_000).getUTCFullYear();
if (weekday !== 0 && weekday !== 6 && !legalHolidays(year).includes(day) && !extraHolidays.includes(day)) {
counted++;
}
}
periodStart = day;
}
lastDay = periodStart + 13;
out.periodStart = fmtDay(periodStart);
out.lastDay = fmtDay(lastDay);
}
// 7. The lump sum, floored to the cent: each amount is a maximum.
const lumpCents = (): number => {
if (d.contractProvidesDamages !== true) return 0;
const c = amountCents;
const cap = c <= 15000
? 2000
: c <= 50000
? 3000 + Math.floor((c - 15000) / 10)
: Math.min(200000, 6500 + Math.floor((c - 50000) / 20));
return agreedLumpSum === undefined ? cap : Math.min(cap, Math.round(agreedLumpSum * 100));
};
// 8. The rate, capped at the reference rate plus 8 points.
let rate = 0;
if (d.contractProvidesInterest === true && referenceRate !== undefined) {
const cap = referenceRate + 8;
rate = Math.round((agreedRate === undefined ? cap : Math.min(agreedRate, cap)) * 100) / 100;
if (rate < 0) rate = 0;
}
const interestFromDay = hasFirst && rate > 0 ? (d.creditorIsSme === true ? sent + 1 : lastDay + 1) : 0;
if (d.stage === "first") {
// 9. The four statutory mentions.
const missing: string[] = [];
if (!present(d.creditorName)) missing.push("the creditor's name");
if (!present(d.creditorEnterpriseNumber)) missing.push("the creditor's enterprise number");
if (!present(d.description)) missing.push("a description of what the debt is for");
if (!hasFirst) missing.push("the date and channel the reminder is sent by");
if (d.contractProvidesInterest === true && referenceRate === undefined) {
missing.push("the reference rate that caps the late interest");
}
if (missing.length > 0) {
out.outcome = "first-incomplete";
out.missing = new Intl.ListFormat("en-GB", { type: "conjunction" }).format(missing);
return out;
}
const lump = lumpCents();
out.outcome = "first";
out.lumpSum = lump > 0 ? fmtMoney(lump) : "";
out.rate = rate > 0 ? rate + "%" : "";
out.interestFrom = rate > 0 ? fmtDay(interestFromDay) : "";
out.addsNothing = !out.lumpSum && !out.rate;
return out;
}
// 10. A later reminder.
if (!hasFirst) {
out.outcome = "no-first-reminder";
return out;
}
if (asOf <= lastDay) {
out.outcome = "waiting";
return out;
}
out.outcome = "lapsed";
const lump = lumpCents();
out.lumpSum = lump > 0 ? fmtMoney(lump) : "";
let interestCents = 0;
if (rate > 0) {
const days = asOf - (interestFromDay - 1);
// The epsilon stops a float such as 9000.999999 losing a cent.
interestCents = Math.floor((amountCents * rate * days) / 36500 + 1e-9);
out.rate = rate + "%";
out.interestFrom = fmtDay(interestFromDay);
out.interestDays = days;
out.interest = interestCents > 0 ? fmtMoney(interestCents) : "";
}
out.interestIncomplete = d.contractProvidesInterest === true && referenceRate === undefined;
out.charged = Boolean(out.lumpSum || out.interest);
out.total = fmtMoney(amountCents + lump + interestCents);
return out;
},
});