Functional Weave
Code in Rust

legal.statutory-interest@1.0.1

vectors.json

7,917 bytes · view raw

[
 {
  "name": "GBP 10,000 High Court judgment, paid 364 days later: 797.81 at 2.19 a day",
  "args": [
   {
    "minor": 1000000,
    "currency": "GBP"
   },
   "2025-01-01",
   "2025-12-31",
   "judgment-high-court"
  ],
  "expect": {
   "days": 364,
   "rateBasisPoints": 800,
   "dailyInterest": {
    "minor": 219,
    "currency": "GBP"
   },
   "interest": {
    "minor": 79781,
    "currency": "GBP"
   },
   "compensation": {
    "minor": 0,
    "currency": "GBP"
   },
   "total": {
    "minor": 79781,
    "currency": "GBP"
   }
  }
 },
 {
  "name": "a whole non-leap year is exactly 8%",
  "args": [
   {
    "minor": 1000000,
    "currency": "GBP"
   },
   "2025-01-01",
   "2026-01-01",
   "judgment-high-court"
  ],
  "expect": {
   "days": 365,
   "rateBasisPoints": 800,
   "dailyInterest": {
    "minor": 219,
    "currency": "GBP"
   },
   "interest": {
    "minor": 80000,
    "currency": "GBP"
   },
   "compensation": {
    "minor": 0,
    "currency": "GBP"
   },
   "total": {
    "minor": 80000,
    "currency": "GBP"
   }
  }
 },
 {
  "name": "a year spanning 29 February is 366 days at 1/365: 802.19, not 800.00",
  "args": [
   {
    "minor": 1000000,
    "currency": "GBP"
   },
   "2024-01-01",
   "2025-01-01",
   "judgment-high-court"
  ],
  "expect": {
   "days": 366,
   "rateBasisPoints": 800,
   "dailyInterest": {
    "minor": 219,
    "currency": "GBP"
   },
   "interest": {
    "minor": 80219,
    "currency": "GBP"
   },
   "compensation": {
    "minor": 0,
    "currency": "GBP"
   },
   "total": {
    "minor": 80219,
    "currency": "GBP"
   }
  }
 },
 {
  "name": "paid on the day of judgment: no interest, but the daily rate is still quoted",
  "args": [
   {
    "minor": 1234567,
    "currency": "GBP"
   },
   "2026-03-01",
   "2026-03-01",
   "judgment-high-court"
  ],
  "expect": {
   "days": 0,
   "rateBasisPoints": 800,
   "dailyInterest": {
    "minor": 271,
    "currency": "GBP"
   },
   "interest": {
    "minor": 0,
    "currency": "GBP"
   },
   "compensation": {
    "minor": 0,
    "currency": "GBP"
   },
   "total": {
    "minor": 0,
    "currency": "GBP"
   }
  }
 },
 {
  "name": "GBP 1 for one day rounds to nothing",
  "args": [
   {
    "minor": 100,
    "currency": "GBP"
   },
   "2026-03-01",
   "2026-03-02",
   "judgment-high-court"
  ],
  "expect": {
   "days": 1,
   "rateBasisPoints": 800,
   "dailyInterest": {
    "minor": 0,
    "currency": "GBP"
   },
   "interest": {
    "minor": 0,
    "currency": "GBP"
   },
   "compensation": {
    "minor": 0,
    "currency": "GBP"
   },
   "total": {
    "minor": 0,
    "currency": "GBP"
   }
  }
 },
 {
  "name": "30 days on GBP 25,000: 164.38",
  "args": [
   {
    "minor": 2500000,
    "currency": "GBP"
   },
   "2026-03-01",
   "2026-03-31",
   "judgment-high-court"
  ],
  "expect": {
   "days": 30,
   "rateBasisPoints": 800,
   "dailyInterest": {
    "minor": 548,
    "currency": "GBP"
   },
   "interest": {
    "minor": 16438,
    "currency": "GBP"
   },
   "compensation": {
    "minor": 0,
    "currency": "GBP"
   },
   "total": {
    "minor": 16438,
    "currency": "GBP"
   }
  }
 },
 {
  "name": "rounded once over the period, not per day: 100 days of 1.10 a day on GBP 5,000.00 is 109.59",
  "args": [
   {
    "minor": 500000,
    "currency": "GBP"
   },
   "2026-01-01",
   "2026-04-11",
   "judgment-county-court"
  ],
  "expect": {
   "days": 100,
   "rateBasisPoints": 800,
   "dailyInterest": {
    "minor": 110,
    "currency": "GBP"
   },
   "interest": {
    "minor": 10959,
    "currency": "GBP"
   },
   "compensation": {
    "minor": 0,
    "currency": "GBP"
   },
   "total": {
    "minor": 10959,
    "currency": "GBP"
   }
  }
 },
 {
  "name": "a County Court judgment of GBP 4,999.99 carries no statutory interest",
  "args": [
   {
    "minor": 499999,
    "currency": "GBP"
   },
   "2026-01-01",
   "2026-12-31",
   "judgment-county-court"
  ],
  "expect": {
   "days": 364,
   "rateBasisPoints": 0,
   "dailyInterest": {
    "minor": 0,
    "currency": "GBP"
   },
   "interest": {
    "minor": 0,
    "currency": "GBP"
   },
   "compensation": {
    "minor": 0,
    "currency": "GBP"
   },
   "total": {
    "minor": 0,
    "currency": "GBP"
   }
  }
 },
 {
  "name": "a County Court judgment of exactly GBP 5,000 does",
  "args": [
   {
    "minor": 500000,
    "currency": "GBP"
   },
   "2026-01-01",
   "2027-01-01",
   "judgment-county-court"
  ],
  "expect": {
   "days": 365,
   "rateBasisPoints": 800,
   "dailyInterest": {
    "minor": 110,
    "currency": "GBP"
   },
   "interest": {
    "minor": 40000,
    "currency": "GBP"
   },
   "compensation": {
    "minor": 0,
    "currency": "GBP"
   },
   "total": {
    "minor": 40000,
    "currency": "GBP"
   }
  }
 },
 {
  "name": "the first day of the 8% rate",
  "args": [
   {
    "minor": 3650000,
    "currency": "GBP"
   },
   "1993-03-31",
   "1993-04-01",
   "judgment-high-court"
  ],
  "expect": {
   "days": 1,
   "rateBasisPoints": 800,
   "dailyInterest": {
    "minor": 800,
    "currency": "GBP"
   },
   "interest": {
    "minor": 800,
    "currency": "GBP"
   },
   "compensation": {
    "minor": 0,
    "currency": "GBP"
   },
   "total": {
    "minor": 800,
    "currency": "GBP"
   }
  }
 },
 {
  "name": "late payment passes through finance.late-payment-interest: 11.75% and the GBP 70 fixed sum",
  "args": [
   {
    "minor": 100000,
    "currency": "GBP"
   },
   "2026-01-31",
   "2026-03-22",
   "late-payment"
  ],
  "expect": {
   "days": 50,
   "rateBasisPoints": 1175,
   "dailyInterest": {
    "minor": 32,
    "currency": "GBP"
   },
   "interest": {
    "minor": 1610,
    "currency": "GBP"
   },
   "compensation": {
    "minor": 7000,
    "currency": "GBP"
   },
   "total": {
    "minor": 8610,
    "currency": "GBP"
   }
  }
 },
 {
  "name": "late payment paid on time: nothing, rate 0",
  "args": [
   {
    "minor": 100000,
    "currency": "GBP"
   },
   "2026-01-31",
   "2026-01-31",
   "late-payment"
  ],
  "expect": {
   "days": 0,
   "rateBasisPoints": 0,
   "dailyInterest": {
    "minor": 0,
    "currency": "GBP"
   },
   "interest": {
    "minor": 0,
    "currency": "GBP"
   },
   "compensation": {
    "minor": 0,
    "currency": "GBP"
   },
   "total": {
    "minor": 0,
    "currency": "GBP"
   }
  }
 },
 {
  "name": "a judgment before the 8% rate began (1 April 1993) is not carried",
  "args": [
   {
    "minor": 100000,
    "currency": "GBP"
   },
   "1993-03-01",
   "1993-06-01",
   "judgment-high-court"
  ],
  "expectError": "judgment interest rate"
 },
 {
  "name": "a County Court judgment before 1 July 1991 is not carried",
  "args": [
   {
    "minor": 1000000,
    "currency": "GBP"
   },
   "1991-06-30",
   "1993-06-01",
   "judgment-county-court"
  ],
  "expectError": "County Court judgment interest rule"
 },
 {
  "name": "paying before judgment is an error",
  "args": [
   {
    "minor": 100000,
    "currency": "GBP"
   },
   "2026-03-02",
   "2026-03-01",
   "judgment-high-court"
  ],
  "expectError": "is before fromDate"
 },
 {
  "name": "a judgment in euros is an error",
  "args": [
   {
    "minor": 100000,
    "currency": "EUR"
   },
   "2026-03-01",
   "2026-03-31",
   "judgment-high-court"
  ],
  "expectError": "statutory interest is defined for GBP debts"
 },
 {
  "name": "a zero judgment is an error",
  "args": [
   {
    "minor": 0,
    "currency": "GBP"
   },
   "2026-03-01",
   "2026-03-31",
   "judgment-high-court"
  ],
  "expectError": "amount must be greater than zero"
 },
 {
  "name": "an unknown basis is an error",
  "args": [
   {
    "minor": 100000,
    "currency": "GBP"
   },
   "2026-03-01",
   "2026-03-31",
   "contract"
  ],
  "expectError": "unknown interest basis"
 },
 {
  "name": "an impossible date is an error",
  "args": [
   {
    "minor": 100000,
    "currency": "GBP"
   },
   "2026-02-30",
   "2026-03-31",
   "judgment-high-court"
  ],
  "expectError": "2026-02-30"
 }
]