//native
/**
* Add off-cycle payment
* Add a new invoice line-item for the purpose of an off-cycle payment associated with a specific contract. This is typically used for exceptional payments outside the regular payment schedule.
**Token scopes**: `off-cycle-payments:write`
*/
export async function main(auth: RT.Deel, contract_id: string, body: Body) {
const url = new URL(
`https://api.letsdeel.com/rest/v2/contracts/${contract_id}/off-cycle-payments`
)
const response = await fetch(url, {
method: 'POST',
headers: {
'Content-Type': 'application/json',
Authorization: 'Bearer ' + auth.apiKey
},
body: JSON.stringify(body)
})
if (!response.ok) {
const text = await response.text()
throw new Error(`${response.status} ${text}`)
}
return await response.json()
}
/* eslint-disable */
/**
* This file was automatically generated by json-schema-to-typescript.
* DO NOT MODIFY IT BY HAND. Instead, modify the source JSONSchema file,
* and run json-schema-to-typescript to regenerate this file.
*/
export interface Body {
data?: {
/**
* The amount of the off-cycle payment.
*/
amount: number
/**
* A description or reason for the off-cycle payment.
*/
description: string
/**
* The date the off-cycle payment is submitted, in ISO-8601 format (YYYY-MM-DD).
*/
date_submitted: string
/**
* If true, the off-cycle payment will be automatically approved as part of the request.
*/
is_auto_approved?: boolean
/**
* Id of an existing preset.
*/
hourly_report_preset_id?: string
[k: string]: unknown
}
[k: string]: unknown
}
Submitted by hugo697 235 days ago