1 | |
2 | type SageIntacct = { |
3 | token: string |
4 | } |
5 | |
6 | * Create an Order Entry tax detail |
7 | * Creates a new Order Entry tax detail. |
8 | */ |
9 | export async function main( |
10 | auth: SageIntacct, |
11 | body: { |
12 | key?: string |
13 | id?: string |
14 | href?: string |
15 | status?: 'active' | 'inactive' |
16 | taxUniqueId?: string |
17 | taxRate?: 'standard' | 'reduced' | 'exempt' | 'zero' | 'federal' | 'provincial' |
18 | amountToTax?: 'fullAmount' | 'amountWithinRange' |
19 | description?: string |
20 | taxPercent?: number |
21 | taxLimit?: { |
22 | minTaxable?: number |
23 | maxTaxable?: number |
24 | minTax?: number |
25 | maxTax?: number |
26 | } |
27 | reverseCharge?: false | true |
28 | useExpenseAccount?: false | true |
29 | isSystemGenerated?: false | true |
30 | accountLabel?: { id?: string; key?: string; href?: string } |
31 | taxAuthority?: { id?: string; key?: string; href?: string } |
32 | salesGLAccount?: { id?: string; key?: string; href?: string } |
33 | taxSolution?: { key?: string; id?: string; href?: string } |
34 | } & {} |
35 | ) { |
36 | const url = new URL(`https://api.intacct.com/ia/api/v1/objects/tax/order-entry-tax-detail`) |
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 |
|