-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathFHBG.ts
110 lines (97 loc) · 2.78 KB
/
FHBG.ts
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
import { calcLVR, type EligibilityResult } from "../calculators/loan";
import type { FormResponse, State } from "../defaults";
export const FHBGconfig: {
location: Record<State, { city: number; regional: number } | { default: number }>;
income: Record<FormResponse["participants"], number>;
lvr: { max: number; min: number };
} = {
location: {
NSW: {
city: 900_000,
regional: 750_000,
},
VIC: {
city: 800_000,
regional: 650_000,
},
QLD: {
city: 700_000,
regional: 550_000,
},
WA: {
city: 600_000,
regional: 450_000,
},
SA: {
city: 600_000,
regional: 450_000,
},
ACT: { default: 750_000 },
NT: { default: 600_000 },
},
income: {
couple: 200_000,
single: 125_000,
},
lvr: {
max: 95,
min: 80,
},
};
// https://www.nhfic.gov.au/support-buy-home/property-price-caps
// https://www.nhfic.gov.au/support-buy-home/first-home-guarantee#eligibility-and-how-to-apply
export function qualifiesForFHBG(
purchasePrice: number,
{ participants, income, purpose, deposit, location, state }: FormResponse
): EligibilityResult {
const result: EligibilityResult = {
scheme: "FHBG",
reason: "",
eligible: false,
};
const locationThresholds = FHBGconfig.location[state as State];
if (purpose === "investor") {
return {
...result,
reason: "You must be intending to be an owner-occupier of the purchased property",
};
}
if ("default" in locationThresholds) {
const threshold = locationThresholds.default;
if (purchasePrice > threshold) {
return {
...result,
reason: `Purchase price must not exceed $${threshold.toLocaleString()} for ${state} properties.`,
};
}
} else {
const threshold = locationThresholds[location];
if (purchasePrice > threshold) {
const regionDescription = location === "city" ? `properties in ${state}` : `properties outside ${state}`;
return {
...result,
reason: `Purchase price must not exceed $${threshold.toLocaleString()} for ${regionDescription}`,
};
}
}
const lvr = calcLVR(purchasePrice, deposit);
if (lvr > FHBGconfig.lvr.max) {
return {
...result,
reason: `The minimum deposit required is ${100 - FHBGconfig.lvr.max}% of purchase price`,
};
}
if (lvr < FHBGconfig.lvr.min) {
return { ...result, reason: `Your LVR is less than ${FHBGconfig.lvr.min}%`, scheme: "FHBG" };
}
const incomeThreshold = FHBGconfig.income[participants];
if (income > incomeThreshold) {
return {
...result,
reason: `Your income is over the $${incomeThreshold.toLocaleString()} threshold for ${
participants === "couple" ? "couples" : "individuals"
}`,
};
}
return { eligible: true, scheme: "FHBG" };
}