1 | |
2 | type SageIntacct = { |
3 | token: string |
4 | } |
5 | |
6 | * Update a credit card transaction template |
7 | * Updates an existing credit card transaction template by setting field values. Any fields not provided remain unchanged. |
8 | */ |
9 | export async function main( |
10 | auth: SageIntacct, |
11 | key: string, |
12 | body: { |
13 | key?: string |
14 | id?: string |
15 | href?: string |
16 | name?: string |
17 | description?: string |
18 | payee?: string |
19 | numberOfRulesUsingTemplate?: number |
20 | taxImplication?: 'none' | 'inbound' |
21 | isInclusiveTax?: false | true |
22 | taxSchedule?: { key?: string; id?: string; name?: string; href?: string } |
23 | taxSolution?: { key?: string; id?: string; href?: string } |
24 | lines?: { |
25 | key?: string |
26 | id?: string |
27 | href?: string |
28 | memo?: string |
29 | lineNumber?: number |
30 | isBillable?: false | true |
31 | exchangeRate?: { date?: string; rate?: number; typeId?: string } |
32 | accountLabel?: { key?: string; id?: string; href?: string } |
33 | glAccount?: { key?: string; id?: string; name?: string; href?: string } |
34 | dimensions?: { |
35 | location?: { key?: string; id?: string; name?: string; href?: string } |
36 | department?: { |
37 | key?: string |
38 | id?: string |
39 | name?: string |
40 | href?: string |
41 | } |
42 | employee?: { key?: string; id?: string; name?: string; href?: string } |
43 | project?: { key?: string; id?: string; name?: string; href?: string } |
44 | customer?: { key?: string; id?: string; name?: string; href?: string } |
45 | vendor?: { key?: string; id?: string; name?: string; href?: string } |
46 | item?: { key?: string; id?: string; name?: string; href?: string } |
47 | warehouse?: { key?: string; id?: string; name?: string; href?: string } |
48 | class?: { key?: string; id?: string; name?: string; href?: string } |
49 | task?: { id?: string; key?: string; name?: string; href?: string } |
50 | costType?: { id?: string; key?: string; name?: string; href?: string } |
51 | asset?: { id?: string; key?: string; name?: string; href?: string } |
52 | contract?: { id?: string; key?: string; name?: string; href?: string } |
53 | affiliateEntity?: { |
54 | key?: string |
55 | id?: string |
56 | href?: string |
57 | name?: string |
58 | } |
59 | } |
60 | creditCardTxnTemplate?: { id?: string; key?: string; href?: string } |
61 | status?: 'active' | 'inactive' |
62 | audit?: { |
63 | createdDateTime?: string |
64 | modifiedDateTime?: string |
65 | createdBy?: string |
66 | modifiedBy?: string |
67 | } |
68 | }[] |
69 | audit?: { |
70 | createdDateTime?: string |
71 | modifiedDateTime?: string |
72 | createdBy?: string |
73 | modifiedBy?: string |
74 | } & { createdDateTime?: string } |
75 | status?: 'active' | 'inactive' |
76 | entity?: { key?: string; id?: string; name?: string; href?: string } |
77 | } & { id?: {} } |
78 | ) { |
79 | const url = new URL( |
80 | `https://api.intacct.com/ia/api/v1/objects/cash-management/credit-card-txn-template/${key}` |
81 | ) |
82 |
|
83 | const response = await fetch(url, { |
84 | method: 'PATCH', |
85 | headers: { |
86 | 'Content-Type': 'application/json', |
87 | Authorization: 'Bearer ' + auth.token |
88 | }, |
89 | body: JSON.stringify(body) |
90 | }) |
91 | if (!response.ok) { |
92 | const text = await response.text() |
93 | throw new Error(`${response.status} ${text}`) |
94 | } |
95 | return await response.json() |
96 | } |
97 |
|