//native
type SageIntacct = {
token: string
}
/**
* Post a contract
* Posting a draft contract sets the contract and all existing draft contract lines and expense lines to "In progress".
*/
export async function main(
auth: SageIntacct,
body: { key: string; glPostingDate?: string; postMemo?: string }
) {
const url = new URL(`https://api.intacct.com/ia/api/v1/workflows/contracts/contract/post`)
const response = await fetch(url, {
method: 'POST',
headers: {
'Content-Type': 'application/json',
Authorization: 'Bearer ' + auth.token
},
body: JSON.stringify(body)
})
if (!response.ok) {
const text = await response.text()
throw new Error(`${response.status} ${text}`)
}
return await response.json()
}
Submitted by hugo697 235 days ago