//native
type Xero = {
token: string;
};
/**
* Retrieves for a payslip by a unique payslip id
*
*/
export async function main(
auth: Xero,
PayslipID: string,
Xero_Tenant_Id: string,
) {
const url = new URL(
`https://api.xero.com/payroll.xro/1.0/Payslip/${PayslipID}`,
);
const response = await fetch(url, {
method: "GET",
headers: {
Accept: 'application/json',
"Xero-Tenant-Id": Xero_Tenant_Id,
Authorization: "Bearer " + auth.token,
},
body: undefined,
});
if (!response.ok) {
const text = await response.text();
throw new Error(`${response.status} ${text}`);
}
return await response.json();
}
Submitted by hugo697 515 days ago