//native
type SageIntacct = {
token: string
}
/**
* Create a WIP setup
* Creates a new WIP setup.
Permissions and other requirements
SubscriptionConstruction
User typeBusiness user with admin privileges
PermissionsAdd WIP Setups
*/
export async function main(
auth: SageIntacct,
body: {
key?: string
id?: string
postingJournal?: string
reconcileMethod?: 'autoReverse' | 'autoReverseBegin' | 'autoReverseEnd' | 'netChange'
autoCreateNextPeriod?: false | true
wipCostBreakdownLevel?: 'wipScheduleProject' | 'project' | 'costCode' | 'costCodeAndCostType'
allowGroupCostCodes?: false | true
wipSetupAccounts?: {
key?: string
id?: string
wipAccountType?:
| 'cost'
| 'revenue'
| 'overbilling'
| 'underbilling'
| 'offset'
| 'underbillingOffset'
| 'overbillingOffset'
accountNumber?: string
accountTitle?: string
href?: string
wipSetup?: { key?: string; id?: string; href?: string }
audit?: {
createdDateTime?: string
modifiedDateTime?: string
createdBy?: string
modifiedBy?: string
}
}[]
href?: string
audit?: {
createdDateTime?: string
modifiedDateTime?: string
createdBy?: string
modifiedBy?: string
}
} & {}
) {
const url = new URL(
`https://api.intacct.com/ia/api/v1/objects/construction-forecasting/wip-setup`
)
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