1 | |
2 | type SageIntacct = { |
3 | token: string |
4 | } |
5 | |
6 | * Update a transaction definition entity setting detail object |
7 | * Updates an existing transaction definition entity setting detail object. Any fields not provided remain unchanged. |
8 | */ |
9 | export async function main( |
10 | auth: SageIntacct, |
11 | key: string, |
12 | body: { |
13 | key?: string |
14 | id?: string |
15 | href?: string |
16 | enableNumberingSequence?: false | true |
17 | preserveNumberingSequence?: false | true |
18 | canInheritSourceDocumentNumber?: false | true |
19 | documentTemplate?: { key?: string; id?: string } |
20 | subtotalTemplate?: { href?: string; key?: string; id?: string } |
21 | showExpandedTaxDetail?: false | true |
22 | enableOverrideTax?: false | true |
23 | enableLineLevelSimpleTax?: false | true |
24 | entity?: { href?: string; key?: string; id?: string } |
25 | documentSequence?: { key?: string; href?: string; id?: string } |
26 | audit?: { |
27 | createdDateTime?: string |
28 | modifiedDateTime?: string |
29 | createdBy?: string |
30 | modifiedBy?: string |
31 | } |
32 | purchasingTxnDefinition?: { key?: string; id?: string; href?: string } |
33 | } & { id?: {} } |
34 | ) { |
35 | const url = new URL( |
36 | `https://api.intacct.com/ia/api/v1/objects/purchasing/txn-definition-entity-setting-detail/${key}` |
37 | ) |
38 |
|
39 | const response = await fetch(url, { |
40 | method: 'PATCH', |
41 | headers: { |
42 | 'Content-Type': 'application/json', |
43 | Authorization: 'Bearer ' + auth.token |
44 | }, |
45 | body: JSON.stringify(body) |
46 | }) |
47 | if (!response.ok) { |
48 | const text = await response.text() |
49 | throw new Error(`${response.status} ${text}`) |
50 | } |
51 | return await response.json() |
52 | } |
53 |
|