Functional Weave
Code in Rust

education.student-loan-repayment@1.0.1

README.md

2,870 bytes · view raw

# education.student-loan-repayment

The student loan or postgraduate loan repayment a graduate owes for a whole
tax year, the way HMRC works it out from a Self Assessment return: 9% (plans
1, 2, 4 and 5) or 6% (postgraduate loan) of income over the plan's annual
threshold, less what employers already deducted through PAYE.

## Built on payroll.student-loan

The thresholds and rates are not repeated here. They are the dated rows of
`payroll.student-loan` (tax years 2023/24 to 2026/27), imported from its data
module, so the two capabilities can never disagree about a threshold. That
one answers "what does the employer deduct from this payslip"; this one
answers "what is due for the year". Plan 5 has no threshold before 2026/27,
and a tax year the data does not reach is an error, not a guess.

## Decisions

- **Unearned income is all or nothing.** Up to £2,000 in the year it is left
  out entirely; over £2,000, all of it counts (reg. 29: "excluding unearned
  income unless the amount of such income for that year exceeds £2,000").
  Exactly £2,000 is left out. The £2,000 is a dated row in
  `data/unearned-income-limits.json`.
- **Whole pounds, rounded down**, as HMRC rounds student loan repayments.
- **The tax year is picked by any date in it**, through `dates.uk-tax-year`:
  5 April 2026 is 2025/26 and 6 April 2026 is 2026/27.
- **One plan per call.** A postgraduate loan is repaid alongside a plan 1, 2,
  4 or 5 loan, each against its own threshold: call once for each. With two
  undergraduate plans the lowest threshold applies; choosing it is the
  caller's job.
- `balance` can be negative: PAYE deducted more than the year's income
  justifies (irregular pay, a bonus month), which the Student Loans Company
  refunds.
- Income is what the caller says it is: working out "total income" (pension
  contributions and losses deducted, some benefits excluded) is the tax
  return's job, not this function's.

## Sources

- The Education (Student Loans) (Repayment) Regulations 2009, reg. 29 (9% and
  6%, the threshold, the £2,000 unearned income rule):
  https://www.legislation.gov.uk/uksi/2009/470/regulation/29
- GOV.UK, "Repaying your student loan: what you pay" (thresholds; the worked
  example of a plan 1 borrower on £42,000 repaying £1,359, pinned as a
  vector): https://www.gov.uk/repaying-your-student-loan/what-you-pay
- HMRC, Collection of Student Loans Manual CSLM18025, "rounding down":
  https://www.gov.uk/hmrc-internal-manuals/collection-of-student-loans-manual/cslm18025
- Thresholds: see payroll.student-loan.

## Notices

Contains public sector information licensed under the Open Government
Licence v3.0 (https://www.nationalarchives.gov.uk/doc/open-government-licence/version/3/).

Legislation: Crown copyright and database right.

1.0.1 adds its attribution notices (NOTICE). The code and the tests are unchanged.