//native
type SageIntacct = {
token: string
}
/**
* Decline a vendor
* When vendor approval is enabled, new and recently edited vendors are automatically submitted to an approval queue. Designated approvers review those vendors and either approve or decline them. For more information, see [About vendor approvals](https://www.intacct.com/ia/docs/en_US/help_action/Accounts_Payable/Approvals/Vendor_approvals/about-vendor-approvals.htm?TocPath=Applications%7CAccounts%20Payable%7CSetup%7CApprovals%7CVendor%20approval%7C_____1) in the Sage Intacct Help Center.
*/
export async function main(auth: SageIntacct, body: { key?: string; notes?: string }) {
const url = new URL(`https://api.intacct.com/ia/api/v1/workflows/accounts-payable/vendor/decline`)
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