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