[
{
"name": "600.00 over ten months at a flat 10%: 66.00 a month, and an APR of 23.5%, not 10%",
"args": [
{
"minor": 60000,
"currency": "GBP"
},
{
"minor": 0,
"currency": "GBP"
},
10,
1000,
1
],
"expect": {
"deposit": {
"minor": 0,
"currency": "GBP"
},
"amountFinanced": {
"minor": 60000,
"currency": "GBP"
},
"creditCharge": {
"minor": 6000,
"currency": "GBP"
},
"instalments": [
{
"minor": 6600,
"currency": "GBP"
},
{
"minor": 6600,
"currency": "GBP"
},
{
"minor": 6600,
"currency": "GBP"
},
{
"minor": 6600,
"currency": "GBP"
},
{
"minor": 6600,
"currency": "GBP"
},
{
"minor": 6600,
"currency": "GBP"
},
{
"minor": 6600,
"currency": "GBP"
},
{
"minor": 6600,
"currency": "GBP"
},
{
"minor": 6600,
"currency": "GBP"
},
{
"minor": 6600,
"currency": "GBP"
}
],
"totalPayable": {
"minor": 66000,
"currency": "GBP"
},
"apr": {
"basisPoints": 2350,
"display": "23.5%",
"preciseBasisPoints": 2346
}
}
},
{
"name": "a 20% deposit, 9.9% flat on the rest, eleven instalments: the odd 6p go on the first",
"args": [
{
"minor": 74550,
"currency": "GBP"
},
{
"minor": 14910,
"currency": "GBP"
},
11,
990,
1
],
"expect": {
"deposit": {
"minor": 14910,
"currency": "GBP"
},
"amountFinanced": {
"minor": 59640,
"currency": "GBP"
},
"creditCharge": {
"minor": 5904,
"currency": "GBP"
},
"instalments": [
{
"minor": 5964,
"currency": "GBP"
},
{
"minor": 5958,
"currency": "GBP"
},
{
"minor": 5958,
"currency": "GBP"
},
{
"minor": 5958,
"currency": "GBP"
},
{
"minor": 5958,
"currency": "GBP"
},
{
"minor": 5958,
"currency": "GBP"
},
{
"minor": 5958,
"currency": "GBP"
},
{
"minor": 5958,
"currency": "GBP"
},
{
"minor": 5958,
"currency": "GBP"
},
{
"minor": 5958,
"currency": "GBP"
},
{
"minor": 5958,
"currency": "GBP"
}
],
"totalPayable": {
"minor": 80454,
"currency": "GBP"
},
"apr": {
"basisPoints": 2110,
"display": "21.1%",
"preciseBasisPoints": 2109
}
}
},
{
"name": "interest-free instalments have an APR of 0.0%",
"args": [
{
"minor": 60000,
"currency": "GBP"
},
{
"minor": 0,
"currency": "GBP"
},
12,
0,
1
],
"expect": {
"deposit": {
"minor": 0,
"currency": "GBP"
},
"amountFinanced": {
"minor": 60000,
"currency": "GBP"
},
"creditCharge": {
"minor": 0,
"currency": "GBP"
},
"instalments": [
{
"minor": 5000,
"currency": "GBP"
},
{
"minor": 5000,
"currency": "GBP"
},
{
"minor": 5000,
"currency": "GBP"
},
{
"minor": 5000,
"currency": "GBP"
},
{
"minor": 5000,
"currency": "GBP"
},
{
"minor": 5000,
"currency": "GBP"
},
{
"minor": 5000,
"currency": "GBP"
},
{
"minor": 5000,
"currency": "GBP"
},
{
"minor": 5000,
"currency": "GBP"
},
{
"minor": 5000,
"currency": "GBP"
},
{
"minor": 5000,
"currency": "GBP"
},
{
"minor": 5000,
"currency": "GBP"
}
],
"totalPayable": {
"minor": 60000,
"currency": "GBP"
},
"apr": {
"basisPoints": 0,
"display": "0.0%",
"preciseBasisPoints": 0
}
}
},
{
"name": "the first instalment taken at inception brings the APR up",
"args": [
{
"minor": 48000,
"currency": "GBP"
},
{
"minor": 0,
"currency": "GBP"
},
12,
1500,
0
],
"expect": {
"deposit": {
"minor": 0,
"currency": "GBP"
},
"amountFinanced": {
"minor": 48000,
"currency": "GBP"
},
"creditCharge": {
"minor": 7200,
"currency": "GBP"
},
"instalments": [
{
"minor": 4600,
"currency": "GBP"
},
{
"minor": 4600,
"currency": "GBP"
},
{
"minor": 4600,
"currency": "GBP"
},
{
"minor": 4600,
"currency": "GBP"
},
{
"minor": 4600,
"currency": "GBP"
},
{
"minor": 4600,
"currency": "GBP"
},
{
"minor": 4600,
"currency": "GBP"
},
{
"minor": 4600,
"currency": "GBP"
},
{
"minor": 4600,
"currency": "GBP"
},
{
"minor": 4600,
"currency": "GBP"
},
{
"minor": 4600,
"currency": "GBP"
},
{
"minor": 4600,
"currency": "GBP"
}
],
"totalPayable": {
"minor": 55200,
"currency": "GBP"
},
"apr": {
"basisPoints": 3690,
"display": "36.9%",
"preciseBasisPoints": 3686
}
}
},
{
"name": "one payment a month later at 5% is 1.05^12 - 1 = 79.59% a year",
"args": [
{
"minor": 10000,
"currency": "GBP"
},
{
"minor": 0,
"currency": "GBP"
},
1,
500,
1
],
"expect": {
"deposit": {
"minor": 0,
"currency": "GBP"
},
"amountFinanced": {
"minor": 10000,
"currency": "GBP"
},
"creditCharge": {
"minor": 500,
"currency": "GBP"
},
"instalments": [
{
"minor": 10500,
"currency": "GBP"
}
],
"totalPayable": {
"minor": 10500,
"currency": "GBP"
},
"apr": {
"basisPoints": 7960,
"display": "79.6%",
"preciseBasisPoints": 7959
}
}
},
{
"name": "100.00 over three interest-free instalments: the odd penny goes on the first",
"args": [
{
"minor": 10000,
"currency": "GBP"
},
{
"minor": 0,
"currency": "GBP"
},
3,
0,
1
],
"expect": {
"deposit": {
"minor": 0,
"currency": "GBP"
},
"amountFinanced": {
"minor": 10000,
"currency": "GBP"
},
"creditCharge": {
"minor": 0,
"currency": "GBP"
},
"instalments": [
{
"minor": 3334,
"currency": "GBP"
},
{
"minor": 3333,
"currency": "GBP"
},
{
"minor": 3333,
"currency": "GBP"
}
],
"totalPayable": {
"minor": 10000,
"currency": "GBP"
},
"apr": {
"basisPoints": 0,
"display": "0.0%",
"preciseBasisPoints": 0
}
}
},
{
"name": "a deposit of the whole premium is refused",
"args": [
{
"minor": 60000,
"currency": "GBP"
},
{
"minor": 60000,
"currency": "GBP"
},
10,
1000,
1
],
"expectError": "the deposit leaves nothing to pay by instalments"
},
{
"name": "a negative deposit is refused",
"args": [
{
"minor": 60000,
"currency": "GBP"
},
{
"minor": -1,
"currency": "GBP"
},
10,
1000,
1
],
"expectError": "deposit must not be negative"
},
{
"name": "no instalments is refused",
"args": [
{
"minor": 60000,
"currency": "GBP"
},
{
"minor": 0,
"currency": "GBP"
},
0,
1000,
1
],
"expectError": "instalmentCount must be a whole number of 1 or more"
},
{
"name": "a fractional count is refused",
"args": [
{
"minor": 60000,
"currency": "GBP"
},
{
"minor": 0,
"currency": "GBP"
},
10.5,
1000,
1
],
"expectError": "instalmentCount must be a whole number of 1 or more"
},
{
"name": "a negative charge is refused",
"args": [
{
"minor": 60000,
"currency": "GBP"
},
{
"minor": 0,
"currency": "GBP"
},
10,
-1,
1
],
"expectError": "creditChargeBasisPoints must be a whole number of 0 or more"
},
{
"name": "a negative first month is refused",
"args": [
{
"minor": 60000,
"currency": "GBP"
},
{
"minor": 0,
"currency": "GBP"
},
10,
1000,
-1
],
"expectError": "firstInstalmentMonth must be a whole number of 0 or more"
},
{
"name": "one instalment at inception is not credit",
"args": [
{
"minor": 60000,
"currency": "GBP"
},
{
"minor": 0,
"currency": "GBP"
},
1,
1000,
0
],
"expectError": "a single instalment at inception is payment in full, not credit"
},
{
"name": "instalments smaller than a penny are refused",
"args": [
{
"minor": 5,
"currency": "GBP"
},
{
"minor": 0,
"currency": "GBP"
},
10,
0,
1
],
"expectError": "each instalment must be at least one minor unit"
},
{
"name": "a deposit in another currency is refused",
"args": [
{
"minor": 60000,
"currency": "GBP"
},
{
"minor": 100,
"currency": "EUR"
},
10,
1000,
1
],
"expectError": "currency mismatch"
}
]