forked from ustaxes/UsTaxes
-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathdata.ts
344 lines (303 loc) · 6.77 KB
/
data.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
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
275
276
277
278
279
280
281
282
283
284
285
286
287
288
289
290
291
292
293
294
295
296
297
298
299
300
301
302
303
304
305
306
307
308
309
310
311
312
313
314
315
316
317
318
319
320
321
322
323
324
325
326
327
328
329
330
331
332
333
334
335
336
337
338
339
340
341
342
343
344
import { Responses } from 'ustaxes/data/questions'
export enum PersonRole {
PRIMARY = 'PRIMARY',
SPOUSE = 'SPOUSE',
DEPENDENT = 'DEPENDENT',
EMPLOYER = 'EMPLOYER'
}
export interface Person {
firstName: string
lastName: string
ssid: string
role: PersonRole
}
export interface QualifyingInformation {
birthYear: number
numberOfMonths: number
isStudent: boolean
}
export interface Dependent extends Person {
relationship: string
qualifyingInfo?: QualifyingInformation
}
export interface Address {
address: string
aptNo?: string
city: string
state?: State
zip?: string
foreignCountry?: string
province?: string
postalCode?: string
}
export interface PrimaryPerson extends Person {
address: Address
isTaxpayerDependent: boolean
}
export interface Spouse extends Person {
isTaxpayerDependent: boolean
}
export interface Employer {
EIN?: string
employerName?: string
address?: Address
}
export enum AccountType {
checking = 'checking',
savings = 'savings'
}
export interface Refund {
routingNumber: string
accountNumber: string
accountType: AccountType
}
export interface IncomeW2 {
occupation: string
income: number
medicareIncome: number
fedWithholding: number
ssWithholding: number
medicareWithholding: number
employer?: Employer
personRole: PersonRole.PRIMARY | PersonRole.SPOUSE
state?: State
stateWages?: number
stateWithholding?: number
}
export interface EstimatedTaxPayments {
label: string
payment: number
}
export enum Income1099Type {
B = 'B',
INT = 'INT',
DIV = 'DIV',
R = 'R',
SSA = 'SSA'
}
export interface F1099BData {
shortTermProceeds: number
shortTermCostBasis: number
longTermProceeds: number
longTermCostBasis: number
}
export interface F1099IntData {
income: number
}
export interface F1099DivData {
dividends: number
qualifiedDividends: number
}
/*
TODO: Add in logic for various different distributions
that should go in box 4a and 5a. Will need to implement
form 8606 and Schedule 1 line 19.
*/
export enum PlanType1099 {
/* IRA includes a traditional IRA, Roth IRA,
* simplified employee pension (SEP) IRA,
* and a savings incentive match plan for employees (SIMPLE) IRA
*/
IRA = 'IRA',
/* Pension and annuity payments include distributions from 401(k), 403(b), and governmental 457(b) plans.
*/
Pension = 'Pension'
}
export const PlanType1099Texts = {
[PlanType1099.IRA]:
'traditional IRA, Roth IRA, simplified employee pension (SEP) IRA, or savings incentive match plan for employees (SIMPLE) IRA',
[PlanType1099.Pension]: '401(k), 403(b), or 457(b) plan'
}
export interface F1099RData {
grossDistribution: number
taxableAmount: number
federalIncomeTaxWithheld: number
planType: PlanType1099
}
export interface F1099SSAData {
// benefitsPaid: number
// benefitsRepaid: number
netBenefits: number
federalIncomeTaxWithheld: number
}
export interface Income1099<T, D> {
payer: string
type: T
form: D
personRole: PersonRole.PRIMARY | PersonRole.SPOUSE
}
export enum FilingStatus {
S = 'S',
MFJ = 'MFJ',
MFS = 'MFS',
HOH = 'HOH',
W = 'W'
}
export type FilingStatusName = keyof typeof FilingStatus
export const FilingStatusTexts = {
[FilingStatus.S]: 'Single',
[FilingStatus.MFJ]: 'Married Filing Jointly',
[FilingStatus.MFS]: 'Married Filing Separately',
[FilingStatus.HOH]: 'Head of Household',
[FilingStatus.W]: 'Widow(er)'
}
export const filingStatuses = (p: TaxPayer | undefined): FilingStatus[] => {
let withDependents: FilingStatus[] = []
let spouseStatuses: FilingStatus[] = []
if ((p?.dependents ?? []).length > 0) {
withDependents = [FilingStatus.HOH]
}
if (p?.spouse !== undefined) {
spouseStatuses = [FilingStatus.MFJ, FilingStatus.MFS]
// HoH not available if married
withDependents = []
} else {
spouseStatuses = [FilingStatus.S]
}
return [...spouseStatuses, ...withDependents, FilingStatus.W]
}
export interface ContactInfo {
contactPhoneNumber?: string
contactEmail?: string
}
export interface TaxPayer extends ContactInfo {
filingStatus?: FilingStatus
primaryPerson?: PrimaryPerson
spouse?: Spouse
dependents: Dependent[]
}
export type Income1099Int = Income1099<Income1099Type.INT, F1099IntData>
export type Income1099B = Income1099<Income1099Type.B, F1099BData>
export type Income1099Div = Income1099<Income1099Type.DIV, F1099DivData>
export type Income1099R = Income1099<Income1099Type.R, F1099RData>
export type Income1099SSA = Income1099<Income1099Type.SSA, F1099SSAData>
export type Supported1099 =
| Income1099Int
| Income1099B
| Income1099Div
| Income1099R
| Income1099SSA
export enum PropertyType {
singleFamily,
multiFamily,
vacation,
commercial,
land,
selfRental,
other
}
export type PropertyTypeName = keyof typeof PropertyType
export enum PropertyExpenseType {
advertising,
auto,
cleaning,
commissions,
insurance,
legal,
management,
mortgage,
otherInterest,
repairs,
supplies,
taxes,
utilities,
depreciation,
other
}
export type PropertyExpenseTypeName = keyof typeof PropertyExpenseType
export interface Property {
address: Address
rentalDays: number
personalUseDays: number
rentReceived: number
propertyType: PropertyTypeName
otherPropertyType?: string
qualifiedJointVenture: boolean
expenses: Partial<{ [K in PropertyExpenseTypeName]: number }>
otherExpenseType?: string
}
export interface F1098e {
lender: string
interest: number
}
export type State =
| 'AL'
| 'AK'
| 'AZ'
| 'CO'
| 'DC'
| 'FL'
| 'HI'
| 'ID'
| 'IN'
| 'KY'
| 'MA'
| 'ME'
| 'MN'
| 'MS'
| 'NC'
| 'NE'
| 'NJ'
| 'NV'
| 'OH'
| 'OR'
| 'RI'
| 'SD'
| 'TX'
| 'VA'
| 'WA'
| 'WV'
| 'AR'
| 'CA'
| 'CT'
| 'DE'
| 'GA'
| 'IA'
| 'IL'
| 'KS'
| 'LA'
| 'MD'
| 'MI'
| 'MO'
| 'MT'
| 'ND'
| 'NH'
| 'NM'
| 'NY'
| 'OK'
| 'PA'
| 'SC'
| 'TN'
| 'UT'
| 'VT'
| 'WI'
| 'WY'
// Hold information about state residency
// TODO: Support part-year state residency
export interface StateResidency {
state: State
}
export interface Information {
f1099s: Supported1099[]
w2s: IncomeW2[]
realEstate: Property[]
estimatedTaxes: EstimatedTaxPayments[]
f1098es: F1098e[]
refund?: Refund
taxPayer: TaxPayer
questions: Responses
stateResidencies: StateResidency[]
}
export interface TaxesState {
information: Information
}
export interface ArrayItemEditAction<A> {
index: number
value: A
}
export type EditDependentAction = ArrayItemEditAction<Dependent>
export type EditW2Action = ArrayItemEditAction<IncomeW2>
export type EditEstimatedTaxesAction = ArrayItemEditAction<EstimatedTaxPayments>
export type Edit1099Action = ArrayItemEditAction<Supported1099>
export type EditPropertyAction = ArrayItemEditAction<Property>
export type Edit1098eAction = ArrayItemEditAction<F1098e>