//native
type SageIntacct = {
token: string
}
/**
* Delete a transaction definition
* Deletes a purchasing transaction definition. You can delete a transaction definition when it is no longer needed or relevant. Deleting a transaction definition is irreversible.
Permissions and other requirements
SubscriptionPurchasing
User typeBusiness, Employee, Project Manager, Warehouse
PermissionsList, View, Delete Purchasing transactions
*/
export async function main(auth: SageIntacct, key: string) {
const url = new URL(`https://api.intacct.com/ia/api/v1/objects/purchasing/txn-definition/${key}`)
const response = await fetch(url, {
method: 'DELETE',
headers: {
Authorization: 'Bearer ' + auth.token
},
body: undefined
})
if (!response.ok) {
const text = await response.text()
throw new Error(`${response.status} ${text}`)
}
return await response.text()
}
Submitted by hugo697 235 days ago