[
{
"name": "a leasehold flat: service charge paid by the seller refunded, ground rent unpaid allowed, fees added",
"args": [
{
"minor": 25000000,
"currency": "GBP"
},
{
"minor": 2500000,
"currency": "GBP"
},
"2025-06-30",
[
{
"label": "Service charge",
"amount": {
"minor": 120000,
"currency": "GBP"
},
"periodStart": "2025-04-01",
"periodEnd": "2025-09-30",
"paidBySeller": true
},
{
"label": "Ground rent",
"amount": {
"minor": 25000,
"currency": "GBP"
},
"periodStart": "2025-01-01",
"periodEnd": "2025-12-31",
"paidBySeller": false
}
],
[
{
"label": "Legal fees",
"amount": {
"minor": 120000,
"currency": "GBP"
}
},
{
"label": "SDLT",
"amount": {
"minor": 250000,
"currency": "GBP"
}
}
]
],
"expect": {
"price": {
"minor": 25000000,
"currency": "GBP"
},
"depositPaid": {
"minor": 2500000,
"currency": "GBP"
},
"apportionments": [
{
"label": "Service charge",
"sellerDays": 91,
"buyerDays": 92,
"adjustment": {
"minor": 60328,
"currency": "GBP"
}
},
{
"label": "Ground rent",
"sellerDays": 181,
"buyerDays": 184,
"adjustment": {
"minor": -12397,
"currency": "GBP"
}
}
],
"balanceToSeller": {
"minor": 22547931,
"currency": "GBP"
},
"fees": [
{
"label": "Legal fees",
"amount": {
"minor": 120000,
"currency": "GBP"
}
},
{
"label": "SDLT",
"amount": {
"minor": 250000,
"currency": "GBP"
}
}
],
"feesTotal": {
"minor": 370000,
"currency": "GBP"
},
"totalDue": {
"minor": 22917931,
"currency": "GBP"
}
}
},
{
"name": "a freehold with nothing to apportion and no fees",
"args": [
{
"minor": 30000000,
"currency": "GBP"
},
{
"minor": 3000000,
"currency": "GBP"
},
"2025-06-30",
[],
[]
],
"expect": {
"price": {
"minor": 30000000,
"currency": "GBP"
},
"depositPaid": {
"minor": 3000000,
"currency": "GBP"
},
"apportionments": [],
"balanceToSeller": {
"minor": 27000000,
"currency": "GBP"
},
"fees": [],
"feesTotal": {
"minor": 0,
"currency": "GBP"
},
"totalDue": {
"minor": 27000000,
"currency": "GBP"
}
}
},
{
"name": "no deposit paid",
"args": [
{
"minor": 15000000,
"currency": "GBP"
},
{
"minor": 0,
"currency": "GBP"
},
"2025-06-30",
[],
[
{
"label": "Searches",
"amount": {
"minor": 35000,
"currency": "GBP"
}
}
]
],
"expect": {
"price": {
"minor": 15000000,
"currency": "GBP"
},
"depositPaid": {
"minor": 0,
"currency": "GBP"
},
"apportionments": [],
"balanceToSeller": {
"minor": 15000000,
"currency": "GBP"
},
"fees": [
{
"label": "Searches",
"amount": {
"minor": 35000,
"currency": "GBP"
}
}
],
"feesTotal": {
"minor": 35000,
"currency": "GBP"
},
"totalDue": {
"minor": 15035000,
"currency": "GBP"
}
}
},
{
"name": "completion on the last day of the period: nothing to refund",
"args": [
{
"minor": 20000000,
"currency": "GBP"
},
{
"minor": 2000000,
"currency": "GBP"
},
"2025-09-30",
[
{
"label": "Service charge",
"amount": {
"minor": 120000,
"currency": "GBP"
},
"periodStart": "2025-04-01",
"periodEnd": "2025-09-30",
"paidBySeller": true
}
],
[]
],
"expect": {
"price": {
"minor": 20000000,
"currency": "GBP"
},
"depositPaid": {
"minor": 2000000,
"currency": "GBP"
},
"apportionments": [
{
"label": "Service charge",
"sellerDays": 183,
"buyerDays": 0,
"adjustment": {
"minor": 0,
"currency": "GBP"
}
}
],
"balanceToSeller": {
"minor": 18000000,
"currency": "GBP"
},
"fees": [],
"feesTotal": {
"minor": 0,
"currency": "GBP"
},
"totalDue": {
"minor": 18000000,
"currency": "GBP"
}
}
},
{
"name": "completion on the first day: the seller keeps just that day",
"args": [
{
"minor": 20000000,
"currency": "GBP"
},
{
"minor": 2000000,
"currency": "GBP"
},
"2025-01-01",
[
{
"label": "Ground rent",
"amount": {
"minor": 36500,
"currency": "GBP"
},
"periodStart": "2025-01-01",
"periodEnd": "2025-12-31",
"paidBySeller": true
}
],
[]
],
"expect": {
"price": {
"minor": 20000000,
"currency": "GBP"
},
"depositPaid": {
"minor": 2000000,
"currency": "GBP"
},
"apportionments": [
{
"label": "Ground rent",
"sellerDays": 1,
"buyerDays": 364,
"adjustment": {
"minor": 36400,
"currency": "GBP"
}
}
],
"balanceToSeller": {
"minor": 18036400,
"currency": "GBP"
},
"fees": [],
"feesTotal": {
"minor": 0,
"currency": "GBP"
},
"totalDue": {
"minor": 18036400,
"currency": "GBP"
}
}
},
{
"name": "the next quarter paid in advance by the seller is refunded in full",
"args": [
{
"minor": 20000000,
"currency": "GBP"
},
{
"minor": 2000000,
"currency": "GBP"
},
"2025-06-30",
[
{
"label": "Service charge Q3",
"amount": {
"minor": 92000,
"currency": "GBP"
},
"periodStart": "2025-07-01",
"periodEnd": "2025-09-30",
"paidBySeller": true
}
],
[]
],
"expect": {
"price": {
"minor": 20000000,
"currency": "GBP"
},
"depositPaid": {
"minor": 2000000,
"currency": "GBP"
},
"apportionments": [
{
"label": "Service charge Q3",
"sellerDays": 0,
"buyerDays": 92,
"adjustment": {
"minor": 92000,
"currency": "GBP"
}
}
],
"balanceToSeller": {
"minor": 18092000,
"currency": "GBP"
},
"fees": [],
"feesTotal": {
"minor": 0,
"currency": "GBP"
},
"totalDue": {
"minor": 18092000,
"currency": "GBP"
}
}
},
{
"name": "unpaid arrears for a past quarter are allowed in full",
"args": [
{
"minor": 20000000,
"currency": "GBP"
},
{
"minor": 2000000,
"currency": "GBP"
},
"2025-06-30",
[
{
"label": "Service charge Q1",
"amount": {
"minor": 50000,
"currency": "GBP"
},
"periodStart": "2025-01-01",
"periodEnd": "2025-03-31",
"paidBySeller": false
}
],
[]
],
"expect": {
"price": {
"minor": 20000000,
"currency": "GBP"
},
"depositPaid": {
"minor": 2000000,
"currency": "GBP"
},
"apportionments": [
{
"label": "Service charge Q1",
"sellerDays": 90,
"buyerDays": 0,
"adjustment": {
"minor": -50000,
"currency": "GBP"
}
}
],
"balanceToSeller": {
"minor": 17950000,
"currency": "GBP"
},
"fees": [],
"feesTotal": {
"minor": 0,
"currency": "GBP"
},
"totalDue": {
"minor": 17950000,
"currency": "GBP"
}
}
},
{
"name": "a leap year: completion on 29 February is 60 of 366 days",
"args": [
{
"minor": 20000000,
"currency": "GBP"
},
{
"minor": 2000000,
"currency": "GBP"
},
"2024-02-29",
[
{
"label": "Ground rent",
"amount": {
"minor": 36600,
"currency": "GBP"
},
"periodStart": "2024-01-01",
"periodEnd": "2024-12-31",
"paidBySeller": false
}
],
[]
],
"expect": {
"price": {
"minor": 20000000,
"currency": "GBP"
},
"depositPaid": {
"minor": 2000000,
"currency": "GBP"
},
"apportionments": [
{
"label": "Ground rent",
"sellerDays": 60,
"buyerDays": 306,
"adjustment": {
"minor": -6000,
"currency": "GBP"
}
}
],
"balanceToSeller": {
"minor": 17994000,
"currency": "GBP"
},
"fees": [],
"feesTotal": {
"minor": 0,
"currency": "GBP"
},
"totalDue": {
"minor": 17994000,
"currency": "GBP"
}
}
},
{
"name": "£9.99 over two days splits 500p/499p, never 500p both ways",
"args": [
{
"minor": 20000000,
"currency": "GBP"
},
{
"minor": 2000000,
"currency": "GBP"
},
"2025-06-30",
[
{
"label": "Rent",
"amount": {
"minor": 999,
"currency": "GBP"
},
"periodStart": "2025-06-30",
"periodEnd": "2025-07-01",
"paidBySeller": true
}
],
[]
],
"expect": {
"price": {
"minor": 20000000,
"currency": "GBP"
},
"depositPaid": {
"minor": 2000000,
"currency": "GBP"
},
"apportionments": [
{
"label": "Rent",
"sellerDays": 1,
"buyerDays": 1,
"adjustment": {
"minor": 499,
"currency": "GBP"
}
}
],
"balanceToSeller": {
"minor": 18000499,
"currency": "GBP"
},
"fees": [],
"feesTotal": {
"minor": 0,
"currency": "GBP"
},
"totalDue": {
"minor": 18000499,
"currency": "GBP"
}
}
},
{
"name": "the whole price as deposit leaves only apportionments and fees",
"args": [
{
"minor": 10000000,
"currency": "GBP"
},
{
"minor": 10000000,
"currency": "GBP"
},
"2025-06-30",
[],
[
{
"label": "Land Registry",
"amount": {
"minor": 15000,
"currency": "GBP"
}
}
]
],
"expect": {
"price": {
"minor": 10000000,
"currency": "GBP"
},
"depositPaid": {
"minor": 10000000,
"currency": "GBP"
},
"apportionments": [],
"balanceToSeller": {
"minor": 0,
"currency": "GBP"
},
"fees": [
{
"label": "Land Registry",
"amount": {
"minor": 15000,
"currency": "GBP"
}
}
],
"feesTotal": {
"minor": 15000,
"currency": "GBP"
},
"totalDue": {
"minor": 15000,
"currency": "GBP"
}
}
},
{
"name": "a deposit above the price is refused",
"args": [
{
"minor": 10000000,
"currency": "GBP"
},
{
"minor": 10000001,
"currency": "GBP"
},
"2025-06-30",
[],
[]
],
"expectError": "depositPaid must be between 0 and the price"
},
{
"name": "a fee in another currency is refused",
"args": [
{
"minor": 10000000,
"currency": "GBP"
},
{
"minor": 1000000,
"currency": "GBP"
},
"2025-06-30",
[],
[
{
"label": "Legal fees",
"amount": {
"minor": 120000,
"currency": "EUR"
}
}
]
],
"expectError": "currency mismatch: \"Legal fees\" is EUR"
},
{
"name": "a period that ends before it starts is refused",
"args": [
{
"minor": 10000000,
"currency": "GBP"
},
{
"minor": 1000000,
"currency": "GBP"
},
"2025-06-30",
[
{
"label": "Ground rent",
"amount": {
"minor": 25000,
"currency": "GBP"
},
"periodStart": "2025-12-31",
"periodEnd": "2025-01-01",
"paidBySeller": false
}
],
[]
],
"expectError": "\"Ground rent\": periodEnd 2025-01-01 is before periodStart 2025-12-31"
},
{
"name": "a negative fee is refused",
"args": [
{
"minor": 10000000,
"currency": "GBP"
},
{
"minor": 1000000,
"currency": "GBP"
},
"2025-06-30",
[],
[
{
"label": "Refund",
"amount": {
"minor": -100,
"currency": "GBP"
}
}
]
],
"expectError": "\"Refund\" must not be negative"
},
{
"name": "a malformed completion date is refused",
"args": [
{
"minor": 10000000,
"currency": "GBP"
},
{
"minor": 1000000,
"currency": "GBP"
},
"30/06/2025",
[
{
"label": "Service charge",
"amount": {
"minor": 120000,
"currency": "GBP"
},
"periodStart": "2025-04-01",
"periodEnd": "2025-09-30",
"paidBySeller": true
}
],
[]
],
"expectError": "is not an ISO date"
}
]