1 | |
2 | type SageIntacct = { |
3 | token: string |
4 | } |
5 | |
6 | * Create a price list entry |
7 | * Creates a new price list entry. |
8 | */ |
9 | export async function main( |
10 | auth: SageIntacct, |
11 | body: { |
12 | key?: string |
13 | id?: string |
14 | href?: string |
15 | productLine?: { key?: string; id?: string; href?: string } |
16 | currency?: string |
17 | startDate?: string |
18 | endDate?: string |
19 | minimumQuantity?: string |
20 | maximumQuantity?: string |
21 | value?: string |
22 | valueType?: 'actual' | 'dollarMarkup' | 'dollarDiscount' | 'markupPercent' | 'discountPercent' |
23 | isFixedPrice?: 'true' | 'false' |
24 | employee?: { key?: string; id?: string; href?: string } |
25 | item?: { key?: string; id?: string; name?: string; href?: string } |
26 | priceList?: { key?: string; id?: string; href?: string } |
27 | audit?: { |
28 | createdDateTime?: string |
29 | modifiedDateTime?: string |
30 | createdBy?: string |
31 | modifiedBy?: string |
32 | } & { createdBy?: string; modifiedBy?: string } |
33 | status?: 'active' | 'inactive' |
34 | } & {} |
35 | ) { |
36 | const url = new URL(`https://api.intacct.com/ia/api/v1/objects/purchasing/price-list-entry`) |
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 |
|