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