1 | |
2 | |
3 | * Request EOR Contract Resignation |
4 | * Enable clients with group admin and people manager permissions to initiate a resignation request for an Employee of Record (EOR) contract within their team. |
5 | **Token scopes**: `contracts:read`, `contracts:write` |
6 | */ |
7 | export async function main(auth: RT.Deel, oid: string, body: Body) { |
8 | const url = new URL(`https://api.letsdeel.com/rest/v2/eor/${oid}/terminations/resignation`) |
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 | export interface Body { |
33 | data: { |
34 | data: { |
35 | |
36 | * Reason why the contract is being terminated |
37 | */ |
38 | reason: |
39 | | 'EMPLOYEE_IS_MOVING_TO_ANOTHER_COUNTRY' |
40 | | 'MOVING_EMPLOYEE_TO_INTERNAL_ENTITY' |
41 | | 'MOVING_EMPLOYEE_TO_DEEL_PEO' |
42 | | 'EMPLOYEE_FOUND_ANOTHER_JOB' |
43 | | 'EMPLOYEE_NOT_HAPPY_WITH_BENEFITS' |
44 | | 'EMPLOYEE_NOT_HAPPY_WITH_SALARY' |
45 | | 'EMPLOYEE_NOT_HAPPY_WITH_THE_ROLE' |
46 | | 'EMPLOYEE_NOT_HAPPY_WITH_COMPANY_CULTURE' |
47 | | 'EMPLOYEE_NOT_HAPPY_WITH_DEEL' |
48 | | 'EMPLOYEE_PROJECT_ENDED' |
49 | | 'EMPLOYEE_SWITCHING_TO_OTHER_EOR_PROVIDER' |
50 | | 'EMPLOYEE_LEFT_ROLE_FOR_PERSONAL_MATTERS' |
51 | | 'EMPLOYEE_MOVING_FROM_EOR_TO_CONTRACTOR_OR_FREELANCE' |
52 | | 'WORKER_TYPE_CHANGE' |
53 | | 'DEEL_COLLECTIONS' |
54 | | 'EMPLOYEE_DID_NOT_TAKE_THE_OFFER' |
55 | | 'EMPLOYEE_PROVIDED_NO_REASON' |
56 | | 'OTHER_BUSINESS_REASONS' |
57 | |
58 | * Any document that is important for the request to terminate the contract |
59 | */ |
60 | attachments?: { |
61 | key: string |
62 | file_name?: string |
63 | [k: string]: unknown |
64 | }[] |
65 | |
66 | * Defines whether the termination is sensitive. In this case, only the person requesting the termination will be able to view the termination, receive emails or notifications. |
67 | */ |
68 | is_sensitive?: boolean |
69 | |
70 | * Optional field to describe the reason behind the resignation request |
71 | */ |
72 | reason_detail?: string |
73 | used_time_off: { |
74 | |
75 | * All time-off used by the employee during contract period |
76 | */ |
77 | time_offs?: { |
78 | |
79 | * Time off unit |
80 | */ |
81 | unit: 'BUSINESS_DAY' | 'CALENDAR_DAY' | 'HOUR' | 'WEEK' | 'MONTH' | 'YEAR' |
82 | |
83 | * Time off policy type |
84 | */ |
85 | policy_type?: |
86 | | 'Vacation' |
87 | | 'Sick leave' |
88 | | 'Maternity leave' |
89 | | 'Paternity leave' |
90 | | 'Parental leave' |
91 | | 'Bereavement leave' |
92 | | 'Childcare leave' |
93 | | 'Civic/public duty leave' |
94 | | 'Personal leave' |
95 | | 'Adoption leave' |
96 | | 'Blood donation leave' |
97 | | 'Childbirth leave' |
98 | | 'Disability leave' |
99 | | "Doctor's appointment leave" |
100 | | 'Family & domestic violence leave' |
101 | | 'Hajj leave' |
102 | | 'Marriage/wedding leave' |
103 | | 'Military leave' |
104 | | 'Moving leave' |
105 | | 'Pregnancy leave' |
106 | | 'Study leave' |
107 | | 'Volunteer leave' |
108 | | 'Unpaid leave' |
109 | | 'Paid leave' |
110 | | 'Other leave' |
111 | | 'RTT' |
112 | | 'Regional holiday' |
113 | | 'Breastfeeding leave' |
114 | | 'Advanced vacation' |
115 | | 'Supplementary Leave' |
116 | | 'Floating Holiday Allowance' |
117 | tracking_periods?: { |
118 | |
119 | * Time off used in the period |
120 | */ |
121 | used: number |
122 | |
123 | * Time off start period |
124 | */ |
125 | end_date?: string |
126 | |
127 | * Time off end period |
128 | */ |
129 | start_date?: string |
130 | [k: string]: unknown |
131 | }[] |
132 | |
133 | * Time off escheduled until contract end date |
134 | */ |
135 | scheduled_until_end_date?: number |
136 | [k: string]: unknown |
137 | }[] |
138 | |
139 | * Any additional details regarding time off that HRX should know |
140 | */ |
141 | additional_details?: string |
142 | |
143 | * Defines whether the client agrees with the time off values that are registered in Deel. If false, it means that the client changed the values. |
144 | */ |
145 | is_deel_pto_confirmed?: boolean |
146 | [k: string]: unknown |
147 | } |
148 | |
149 | * The type of severance selected by the client. It's an optional field |
150 | */ |
151 | severance_type?: 'DAYS' | 'WEEKS' | 'MONTHS' | 'CASH' |
152 | |
153 | * The desired end date. If the date is not provided, it will be selected by HRX the closest date possible |
154 | */ |
155 | desired_end_date?: string |
156 | |
157 | * The amount of severance needed |
158 | */ |
159 | severance_amount?: number |
160 | |
161 | * An additional reason can be provided in case the reason selected is MOVING_EMPLOYEE_TO_INTERNAL_ENTITY |
162 | */ |
163 | additional_reason?: |
164 | | 'MOVING_TO_INTERNAL_ENTITY_WITH_DEEL_GLOBAL_PAYROLL' |
165 | | 'MOVING_TO_INTERNAL_ENTITY_WITH_OTHER_PROVIDER' |
166 | |
167 | * Additional notes can be provided regarding the termination for Deel, like questions and doubts |
168 | */ |
169 | termination_notes?: string[] |
170 | |
171 | * Parameter to inform whether it would be possible for the client to hire the employee again |
172 | */ |
173 | eligible_for_rehire?: 'YES' | 'NO' | 'DONT_KNOW' |
174 | |
175 | * Termination impact data if there is some configured on HR module |
176 | */ |
177 | termination_impact_id?: string |
178 | |
179 | * Describe if the option DONT_KNOW was selected on eligibleForRehire |
180 | */ |
181 | eligible_for_rehire_reason?: string |
182 | |
183 | * Custom termination reason ID. A custom termination reason can be added on Client HR module |
184 | */ |
185 | custom_termination_reason_id?: string |
186 | |
187 | * Defines if employee will keep using Deel as provider |
188 | */ |
189 | is_employee_staying_with_deel: boolean |
190 | [k: string]: unknown |
191 | } |
192 | [k: string]: unknown |
193 | } |
194 | [k: string]: unknown |
195 | } |
196 |
|