1 | |
2 | type SageIntacct = { |
3 | token: string |
4 | } |
5 | |
6 | * Create a/an inventory transaction definition subtotal detail |
7 | * Creates a new inventory transaction definition subtotal detail. |
8 | */ |
9 | export async function main( |
10 | auth: SageIntacct, |
11 | body: { |
12 | key?: string |
13 | id?: string |
14 | href?: string |
15 | inventoryTxnDefinition?: { key?: string; id?: string; href?: string } |
16 | lineNumber?: number |
17 | description?: string |
18 | subtotalType?: 'discount' | 'charge' |
19 | appliedToLineNumber?: number |
20 | valueType?: 'amount' | 'percent' |
21 | subtotalValue?: string |
22 | txnType?: '' | 'debit' | 'credit' |
23 | glAccount?: { href?: string; id?: string; key?: string } |
24 | offsetGlAccount?: { href?: string; id?: string; key?: string } |
25 | isTax?: false | true |
26 | enableAvaTax?: false | true |
27 | dimensions?: { |
28 | location?: { key?: string; id?: string; name?: string; href?: string } |
29 | department?: { key?: string; id?: string; name?: string; href?: string } |
30 | employee?: { key?: string; id?: string; name?: string; href?: string } |
31 | project?: { key?: string; id?: string; name?: string; href?: string } |
32 | customer?: { key?: string; id?: string; name?: string; href?: string } |
33 | vendor?: { key?: string; id?: string; name?: string; href?: string } |
34 | item?: { key?: string; id?: string; name?: string; href?: string } |
35 | warehouse?: { key?: string; id?: string; name?: string; href?: string } |
36 | class?: { key?: string; id?: string; name?: string; href?: string } |
37 | task?: { id?: string; key?: string; name?: string; href?: string } |
38 | costType?: { id?: string; key?: string; name?: string; href?: string } |
39 | asset?: { id?: string; key?: string; name?: string; href?: string } |
40 | contract?: { id?: string; key?: string; name?: string; href?: string } |
41 | affiliateEntity?: { |
42 | key?: string |
43 | id?: string |
44 | href?: string |
45 | name?: string |
46 | } |
47 | } & { |
48 | department?: { href?: string; id?: string; key?: string; name?: string } |
49 | location?: { href?: string; id?: string; key?: string; name?: string } |
50 | } |
51 | } & {} |
52 | ) { |
53 | const url = new URL( |
54 | `https://api.intacct.com/ia/api/v1/objects/inventory-control/txn-definition-subtotal-detail` |
55 | ) |
56 |
|
57 | const response = await fetch(url, { |
58 | method: 'POST', |
59 | headers: { |
60 | 'Content-Type': 'application/json', |
61 | Authorization: 'Bearer ' + auth.token |
62 | }, |
63 | body: JSON.stringify(body) |
64 | }) |
65 | if (!response.ok) { |
66 | const text = await response.text() |
67 | throw new Error(`${response.status} ${text}`) |
68 | } |
69 | return await response.json() |
70 | } |
71 |
|