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