//native
type SageIntacct = {
token: string
}
/**
* Update an Order Entry tax detail
* Updates an existing Order Entry tax detail by setting field values. Any fields not provided remain unchanged.
*/
export async function main(
auth: SageIntacct,
key: string,
body: {
key?: string
id?: string
href?: string
status?: 'active' | 'inactive'
taxUniqueId?: string
taxRate?: 'standard' | 'reduced' | 'exempt' | 'zero' | 'federal' | 'provincial'
amountToTax?: 'fullAmount' | 'amountWithinRange'
description?: string
taxPercent?: number
taxLimit?: {
minTaxable?: number
maxTaxable?: number
minTax?: number
maxTax?: number
}
reverseCharge?: false | true
useExpenseAccount?: false | true
isSystemGenerated?: false | true
accountLabel?: { id?: string; key?: string; href?: string }
taxAuthority?: { id?: string; key?: string; href?: string }
salesGLAccount?: { id?: string; key?: string; href?: string }
taxSolution?: { key?: string; id?: string; href?: string }
} & { id?: {} }
) {
const url = new URL(`https://api.intacct.com/ia/api/v1/objects/tax/order-entry-tax-detail/${key}`)
const response = await fetch(url, {
method: 'PATCH',
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