Rule late_payment_charges v1
What a supplier may claim on a commercial debt paid late: the fixed sum for the cost of recovering it, and statutory interest at 8% over the reference rate, worked out a day at a time. As this example reads the Late Payment of Commercial Debts (Interest) Act 1998, section 5A(2), and GOV.UK's guide to charging interest on a commercial debt; it says nothing of how the law is read
Try a case
Enter the inputs: the rows that match light up and the outputs appear. What runs is the generated code itself, and the line it would write to a log is shown as it is.
Inputs
| Name | Type | Range | Notes |
|---|---|---|---|
| debt | money[GBPc] | 1GBPc to 100_000_000GBPc | |
| days_late | number | 1 to 1500 | |
| reference_rate | rate | 0% to 15% |
Outputs
| Name | Type | Rounding | Notes |
|---|---|---|---|
| compensation | money[GBP] | down(1GBP) (rounded down to 1GBP) | |
| interest | money[GBPc] | down(1GBPc) (rounded down to 1GBPc) |
Derived Values and Definitions
Intermediate values that can be placed in a table column. The expressions are as written in the source file, and the ranges are the declared ones.
| Name | Kind | Expression | Range | Notes |
|---|---|---|---|---|
| daily | Definition | half_up(debt × (8% + reference_rate) ÷ 365, 1GBPc) ((debt × (8% + reference_rate)) ÷ 365 rounded half up to 1GBPc) | Source: guide | |
| interest | Definition | daily × days_late |
Table fixed_sum (policy unique)
Source: act (sources/late-payment-act-1998.md, sha256:d328938a26fc0ab4)
| Column | Source |
|---|---|
| debt | Input |
| → compensation | Output of this rule |
| # | debt | → compensation (money[GBP] / down(1GBP)) | Notes |
|---|---|---|---|
| 1 | <100_000GBPc (less than 100_000GBPc) | 40GBP | Source: guide table1 |
| 2 | >=100_000GBPc <1_000_000GBPc (100_000GBPc or more and less than 1_000_000GBPc) | 70GBP | Source: guide table1 |
| 3 | >=1_000_000GBPc (1_000_000GBPc or more) | 100GBP | Source: guide table1 |
What rulec check verified
- Every combination of inputs matches some row (E101 completeness)
- There is no row that can never match (E102 unreachable row)
- No input matches two or more rows at once (E105 overlap). Reordering the rows does not change the meaning
Examples (verified)
| debt | days_late | reference_rate | → compensation | interest |
|---|---|---|---|---|
| 100_000GBPc | 50 | 0.5% | 70GBP | 1150GBPc |
| 99_999GBPc | 1 | 0% | 40GBP | 22GBPc |
| 1_000_000GBPc | 30 | 4% | 100GBP | 9870GBPc |
rulec check ran these 3 examples through the reference evaluator, and every one produced the declared values (E107). The examples are an executable specification.