1 | |
2 | type SageIntacct = { |
3 | token: string |
4 | } |
5 | |
6 | * Create an adjustment line |
7 | * Creates a new adjustment line. |
8 |
|
9 |
|
10 | Permissions and other requirements |
11 |
|
12 | SubscriptionAccounts Payable |
13 | User typeBusiness |
14 | PermissionsList, View, Add Adjustment lines |
15 |
|
16 |
|
17 |
|
18 |
|
19 | */ |
20 | export async function main( |
21 | auth: SageIntacct, |
22 | body: { |
23 | id?: string |
24 | key?: string |
25 | href?: string |
26 | baseAmount?: string |
27 | txnAmount?: string |
28 | totalTxnAmount?: string |
29 | memo?: string |
30 | lineNumber?: string |
31 | hasForm1099?: string |
32 | form1099?: { type?: string; box?: string } |
33 | adjustmentType?: string |
34 | glAccount?: { key?: string; id?: string; name?: string; href?: string } |
35 | overrideOffsetGLAccount?: { |
36 | key?: string |
37 | id?: string |
38 | name?: string |
39 | href?: string |
40 | } |
41 | accountLabel?: { key?: string; id?: string; href?: string } |
42 | dimensions?: { |
43 | location?: { key?: string; id?: string; name?: string; href?: string } |
44 | department?: { key?: string; id?: string; name?: string; href?: string } |
45 | employee?: { key?: string; id?: string; name?: string; href?: string } |
46 | project?: { key?: string; id?: string; name?: string; href?: string } |
47 | customer?: { key?: string; id?: string; name?: string; href?: string } |
48 | vendor?: { key?: string; id?: string; name?: string; href?: string } |
49 | item?: { key?: string; id?: string; name?: string; href?: string } |
50 | warehouse?: { key?: string; id?: string; name?: string; href?: string } |
51 | class?: { key?: string; id?: string; name?: string; href?: string } |
52 | task?: { id?: string; key?: string; name?: string; href?: string } |
53 | costType?: { id?: string; key?: string; name?: string; href?: string } |
54 | asset?: { id?: string; key?: string; name?: string; href?: string } |
55 | contract?: { id?: string; key?: string; name?: string; href?: string } |
56 | affiliateEntity?: { |
57 | key?: string |
58 | id?: string |
59 | href?: string |
60 | name?: string |
61 | } |
62 | } & { |
63 | department?: { key?: string; id?: string; name?: string; href?: string } |
64 | location?: { key?: string; id?: string; name?: string; href?: string } |
65 | } |
66 | currency?: { |
67 | baseCurrency?: string |
68 | txnCurrency?: string |
69 | exchangeRate?: { date?: string; rate?: string; typeId?: string } |
70 | } |
71 | paymentInformation?: { |
72 | totalBaseAmountPaid?: string |
73 | txnTotalPaid?: string |
74 | totalBaseAmountSelected?: string |
75 | txnTotalSelected?: string |
76 | } |
77 | taxEntries?: { |
78 | key?: string |
79 | id?: string |
80 | baseTaxAmount?: string |
81 | txnTaxAmount?: string |
82 | taxRate?: number |
83 | } & { |
84 | purchasingTaxDetail?: { key?: string; id?: string; href?: string } |
85 | adjustmentLine?: { id?: string; key?: string; href?: string } |
86 | }[] |
87 | apAdjustment?: { id?: string; key?: string; href?: string } |
88 | audit?: { |
89 | createdDateTime?: string |
90 | modifiedDateTime?: string |
91 | createdBy?: string |
92 | modifiedBy?: string |
93 | } |
94 | } & { dimensions?: {} } |
95 | ) { |
96 | const url = new URL(`https://api.intacct.com/ia/api/v1/objects/accounts-payable/adjustment-line`) |
97 |
|
98 | const response = await fetch(url, { |
99 | method: 'POST', |
100 | headers: { |
101 | 'Content-Type': 'application/json', |
102 | Authorization: 'Bearer ' + auth.token |
103 | }, |
104 | body: JSON.stringify(body) |
105 | }) |
106 | if (!response.ok) { |
107 | const text = await response.text() |
108 | throw new Error(`${response.status} ${text}`) |
109 | } |
110 | return await response.json() |
111 | } |
112 |
|