1 | |
2 | type Xero = { |
3 | token: string |
4 | } |
5 | |
6 | * Deletes a salary and wages record for a specific employee |
7 | * |
8 | */ |
9 | export async function main( |
10 | auth: Xero, |
11 | EmployeeID: string, |
12 | SalaryAndWagesID: string, |
13 | Xero_Tenant_Id: string |
14 | ) { |
15 | const url = new URL( |
16 | `https://api.xero.com/payroll.xro/2.0/Employees/${EmployeeID}/SalaryAndWages/${SalaryAndWagesID}` |
17 | ) |
18 |
|
19 | const response = await fetch(url, { |
20 | method: 'DELETE', |
21 | headers: { |
22 | Accept: 'application/json', |
23 | 'Xero-Tenant-Id': Xero_Tenant_Id, |
24 | Authorization: 'Bearer ' + auth.token |
25 | }, |
26 | body: undefined |
27 | }) |
28 | if (!response.ok) { |
29 | const text = await response.text() |
30 | throw new Error(`${response.status} ${text}`) |
31 | } |
32 | return await response.text() |
33 | } |
34 |
|