1 | |
2 | |
3 | * Create 401k plan for legal entity |
4 | * Create a new 401k plan for existing provider to legal entity |
5 | **Token scopes**: `benefits:write` |
6 | */ |
7 | export async function main(auth: RT.Deel, id: string, body: Body) { |
8 | const url = new URL(`https://api.letsdeel.com/rest/v2/benefits/legal-entities/${id}/401k/plans`) |
9 |
|
10 | const response = await fetch(url, { |
11 | method: 'POST', |
12 | headers: { |
13 | 'Content-Type': 'application/json', |
14 | Authorization: 'Bearer ' + auth.apiKey |
15 | }, |
16 | body: JSON.stringify(body) |
17 | }) |
18 | if (!response.ok) { |
19 | const text = await response.text() |
20 | throw new Error(`${response.status} ${text}`) |
21 | } |
22 | return await response.json() |
23 | } |
24 |
|
25 | |
26 | |
27 | * This file was automatically generated by json-schema-to-typescript. |
28 | * DO NOT MODIFY IT BY HAND. Instead, modify the source JSONSchema file, |
29 | * and run json-schema-to-typescript to regenerate this file. |
30 | */ |
31 |
|
32 | |
33 | * Schema for the 401K Guideline Plan request body. |
34 | */ |
35 | export interface Body { |
36 | |
37 | * Name of the 401K plan. |
38 | */ |
39 | name: string |
40 | |
41 | * Object containing additional information about the 401K plan. |
42 | */ |
43 | details?: { |
44 | |
45 | * A key-value pair providing additional details about the plan. |
46 | */ |
47 | key?: string |
48 | [k: string]: unknown |
49 | } |
50 | |
51 | * Start date of the plan. |
52 | */ |
53 | start_date: string |
54 | |
55 | * Type of contribution for the 401K plan. |
56 | */ |
57 | contribution_type: 'PERCENTAGE' | 'NEC_PERCENTAGE' | 'NEC_FIXED_AMOUNT' | 'FIXED_AMOUNT' | 'MATCH' |
58 | |
59 | * Value of the contribution if type is percent or amount. |
60 | */ |
61 | contribution_value?: number |
62 | |
63 | * Array of objects containing limits and rates for match rate contribution type. |
64 | */ |
65 | contribution_value_for_match_rate?: { |
66 | |
67 | * Rate of matching contribution. |
68 | */ |
69 | rate: number |
70 | |
71 | * Limit up to which the match rate is applicable. |
72 | */ |
73 | limit: number |
74 | [k: string]: unknown |
75 | }[] |
76 | [k: string]: unknown |
77 | } |
78 |
|