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

NameTypeRangeNotes
debtmoney[GBPc]1GBPc to 100_000_000GBPc
days_latenumber1 to 1500
reference_raterate0% to 15%

Outputs

NameTypeRoundingNotes
compensationmoney[GBP]down(1GBP) (rounded down to 1GBP)
interestmoney[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.

NameKindExpressionRangeNotes
dailyDefinitionhalf_up(debt × (8% + reference_rate) ÷ 365, 1GBPc) ((debt × (8% + reference_rate)) ÷ 365 rounded half up to 1GBPc)Source: guide
interestDefinitiondaily × days_late

Table fixed_sum (policy unique)

Source: act (sources/late-payment-act-1998.md, sha256:d328938a26fc0ab4)

ColumnSource
debtInput
→ compensationOutput of this rule
#debt→ compensation (money[GBP] / down(1GBP))Notes
1<100_000GBPc (less than 100_000GBPc)40GBPSource: guide table1
2>=100_000GBPc <1_000_000GBPc (100_000GBPc or more and less than 1_000_000GBPc)70GBPSource: guide table1
3>=1_000_000GBPc (1_000_000GBPc or more)100GBPSource: guide table1

What rulec check verified

Examples (verified)

debtdays_latereference_rate→ compensationinterest
100_000GBPc500.5%70GBP1150GBPc
99_999GBPc10%40GBP22GBPc
1_000_000GBPc304%100GBP9870GBPc

rulec check ran these 3 examples through the reference evaluator, and every one produced the declared values (E107). The examples are an executable specification.