Skip to content

Commit 9b60c85

Browse files
committed
[Components] Sage Intacct new components
1 parent 29b168a commit 9b60c85

File tree

11 files changed

+1102
-6
lines changed

11 files changed

+1102
-6
lines changed
Lines changed: 152 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,152 @@
1+
import app from "../../sage_intacct.app.mjs";
2+
import utils from "../../common/utils.mjs";
3+
4+
export default {
5+
key: "sage_intacct-create-bill",
6+
name: "Create Bill",
7+
description: "Creates a new bill. After you create a bill, it can be moved through the normal Accounts Payable workflow. [See the documentation](https://developer.sage.com/intacct/apis/intacct/1/intacct-openapi/groups/accounts-payable/groups/bills/tags/accounts_payable_bills/paths/create-accounts-payable-bill)",
8+
version: "0.0.1",
9+
annotations: {
10+
readOnlyHint: false,
11+
openWorldHint: true,
12+
destructiveHint: false,
13+
},
14+
type: "action",
15+
props: {
16+
app,
17+
billNumber: {
18+
propDefinition: [
19+
app,
20+
"billNumber",
21+
],
22+
},
23+
vendorId: {
24+
propDefinition: [
25+
app,
26+
"vendorId",
27+
],
28+
},
29+
referenceNumber: {
30+
propDefinition: [
31+
app,
32+
"referenceNumber",
33+
],
34+
},
35+
description: {
36+
propDefinition: [
37+
app,
38+
"description",
39+
],
40+
},
41+
createdDate: {
42+
propDefinition: [
43+
app,
44+
"createdDate",
45+
],
46+
},
47+
postingDate: {
48+
propDefinition: [
49+
app,
50+
"postingDate",
51+
],
52+
},
53+
dueDate: {
54+
propDefinition: [
55+
app,
56+
"dueDate",
57+
],
58+
},
59+
discountCutOffDate: {
60+
propDefinition: [
61+
app,
62+
"discountCutOffDate",
63+
],
64+
},
65+
recommendedPaymentDate: {
66+
propDefinition: [
67+
app,
68+
"recommendedPaymentDate",
69+
],
70+
},
71+
paymentPriority: {
72+
propDefinition: [
73+
app,
74+
"paymentPriority",
75+
],
76+
},
77+
isOnHold: {
78+
propDefinition: [
79+
app,
80+
"isOnHold",
81+
],
82+
},
83+
isTaxInclusive: {
84+
propDefinition: [
85+
app,
86+
"isTaxInclusive",
87+
],
88+
},
89+
txnCurrency: {
90+
propDefinition: [
91+
app,
92+
"txnCurrency",
93+
],
94+
},
95+
lines: {
96+
propDefinition: [
97+
app,
98+
"lines",
99+
],
100+
},
101+
},
102+
async run({ $ }) {
103+
const {
104+
app,
105+
billNumber,
106+
vendorId,
107+
referenceNumber,
108+
description,
109+
createdDate,
110+
postingDate,
111+
dueDate,
112+
discountCutOffDate,
113+
recommendedPaymentDate,
114+
paymentPriority,
115+
isOnHold,
116+
isTaxInclusive,
117+
txnCurrency,
118+
lines,
119+
} = this;
120+
121+
const response = await app.createBill({
122+
$,
123+
data: {
124+
billNumber,
125+
referenceNumber,
126+
description,
127+
postingDate,
128+
discountCutOffDate,
129+
recommendedPaymentDate,
130+
paymentPriority,
131+
isOnHold,
132+
isTaxInclusive,
133+
createdDate,
134+
dueDate,
135+
...(vendorId && {
136+
vendor: {
137+
id: vendorId,
138+
},
139+
}),
140+
...(txnCurrency && {
141+
currency: {
142+
txnCurrency,
143+
},
144+
}),
145+
lines: utils.parseJson(lines),
146+
},
147+
});
148+
149+
$.export("$summary", "Successfully created bill");
150+
return response;
151+
},
152+
};
Lines changed: 127 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,127 @@
1+
import app from "../../sage_intacct.app.mjs";
2+
3+
export default {
4+
key: "sage_intacct-create-vendor",
5+
name: "Create Vendor",
6+
description: "Creates a new vendor. When you add a new vendor, you can provide key descriptive information about that vendor and establish how you want to pay them. [See the documentation](https://developer.sage.com/intacct/apis/intacct/1/intacct-openapi/groups/accounts-payable/groups/vendors/tags/accounts_payable_vendors/paths/create-accounts-payable-vendor)",
7+
version: "0.0.1",
8+
type: "action",
9+
annotations: {
10+
readOnlyHint: false,
11+
openWorldHint: true,
12+
destructiveHint: false,
13+
},
14+
props: {
15+
app,
16+
vendorId: {
17+
propDefinition: [
18+
app,
19+
"vendorId",
20+
],
21+
},
22+
name: {
23+
propDefinition: [
24+
app,
25+
"vendorName",
26+
],
27+
},
28+
taxId: {
29+
propDefinition: [
30+
app,
31+
"vendorTaxId",
32+
],
33+
},
34+
creditLimit: {
35+
propDefinition: [
36+
app,
37+
"vendorCreditLimit",
38+
],
39+
},
40+
billingType: {
41+
propDefinition: [
42+
app,
43+
"vendorBillingType",
44+
],
45+
},
46+
paymentPriority: {
47+
propDefinition: [
48+
app,
49+
"vendorPaymentPriority",
50+
],
51+
},
52+
status: {
53+
propDefinition: [
54+
app,
55+
"vendorStatus",
56+
],
57+
},
58+
isOnHold: {
59+
propDefinition: [
60+
app,
61+
"vendorIsOnHold",
62+
],
63+
},
64+
doNotPay: {
65+
propDefinition: [
66+
app,
67+
"vendorDoNotPay",
68+
],
69+
},
70+
notes: {
71+
propDefinition: [
72+
app,
73+
"vendorNotes",
74+
],
75+
},
76+
vendorAccountNumber: {
77+
propDefinition: [
78+
app,
79+
"vendorAccountNumber",
80+
],
81+
},
82+
preferredPaymentMethod: {
83+
propDefinition: [
84+
app,
85+
"vendorPreferredPaymentMethod",
86+
],
87+
},
88+
},
89+
async run({ $ }) {
90+
const {
91+
app,
92+
vendorId,
93+
name,
94+
taxId,
95+
creditLimit,
96+
billingType,
97+
paymentPriority,
98+
status,
99+
isOnHold,
100+
doNotPay,
101+
notes,
102+
vendorAccountNumber,
103+
preferredPaymentMethod,
104+
} = this;
105+
106+
const response = await app.createVendor({
107+
$,
108+
data: {
109+
id: vendorId,
110+
name,
111+
taxId,
112+
creditLimit,
113+
billingType,
114+
paymentPriority,
115+
status,
116+
isOnHold,
117+
doNotPay,
118+
notes,
119+
vendorAccountNumber,
120+
preferredPaymentMethod,
121+
},
122+
});
123+
124+
$.export("$summary", "Successfully created vendor");
125+
return response;
126+
},
127+
};
Lines changed: 39 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,39 @@
1+
import app from "../../sage_intacct.app.mjs";
2+
3+
export default {
4+
key: "sage_intacct-delete-bill",
5+
name: "Delete Bill",
6+
description: "Deletes a bill. You can only delete unpaid bills that are in a Posted, Draft, or Declined state. [See the documentation](https://developer.sage.com/intacct/apis/intacct/1/intacct-openapi/groups/accounts-payable/groups/bills/tags/accounts_payable_bills/paths/delete-accounts-payable-bill-key)",
7+
version: "0.0.1",
8+
annotations: {
9+
readOnlyHint: false,
10+
openWorldHint: true,
11+
destructiveHint: true,
12+
},
13+
type: "action",
14+
props: {
15+
app,
16+
billKey: {
17+
propDefinition: [
18+
app,
19+
"billKey",
20+
],
21+
},
22+
},
23+
async run({ $ }) {
24+
const {
25+
app,
26+
billKey,
27+
} = this;
28+
29+
await app.deleteBill({
30+
$,
31+
billKey,
32+
});
33+
34+
$.export("$summary", "Successfully deleted bill");
35+
return {
36+
success: true,
37+
};
38+
},
39+
};
Lines changed: 39 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,39 @@
1+
import app from "../../sage_intacct.app.mjs";
2+
3+
export default {
4+
key: "sage_intacct-delete-vendor",
5+
name: "Delete Vendor",
6+
description: "Deletes a vendor. You can only delete vendors that aren't tied to any transactions or payments. [See the documentation](https://developer.sage.com/intacct/apis/intacct/1/intacct-openapi/groups/accounts-payable/groups/vendors/tags/accounts_payable_vendors/paths/delete-accounts-payable-vendor-key)",
7+
version: "0.0.1",
8+
type: "action",
9+
annotations: {
10+
readOnlyHint: false,
11+
openWorldHint: true,
12+
destructiveHint: true,
13+
},
14+
props: {
15+
app,
16+
vendorKey: {
17+
propDefinition: [
18+
app,
19+
"vendorKey",
20+
],
21+
},
22+
},
23+
async run({ $ }) {
24+
const {
25+
app,
26+
vendorKey,
27+
} = this;
28+
29+
await app.deleteVendor({
30+
$,
31+
vendorKey,
32+
});
33+
34+
$.export("$summary", "Successfully deleted vendor");
35+
return {
36+
success: true,
37+
};
38+
},
39+
};
Lines changed: 27 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,27 @@
1+
import app from "../../sage_intacct.app.mjs";
2+
3+
export default {
4+
key: "sage_intacct-list-bills",
5+
name: "List Bills",
6+
description: "Returns up to 100 object references from the collection with a key, ID, and link for each bill. [See the documentation](https://developer.sage.com/intacct/apis/intacct/1/intacct-openapi/groups/accounts-payable/groups/bills/tags/accounts_payable_bills/paths/list-accounts-payable-bill)",
7+
version: "0.0.1",
8+
type: "action",
9+
annotations: {
10+
readOnlyHint: true,
11+
openWorldHint: true,
12+
destructiveHint: false,
13+
},
14+
props: {
15+
app,
16+
},
17+
async run({ $ }) {
18+
const { app } = this;
19+
20+
const response = await app.listBills({
21+
$,
22+
});
23+
24+
$.export("$summary", "Successfully listed bills");
25+
return response;
26+
},
27+
};

0 commit comments

Comments
 (0)