Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
152 changes: 152 additions & 0 deletions components/sage_intacct/actions/create-bill/create-bill.mjs
Original file line number Diff line number Diff line change
@@ -0,0 +1,152 @@
import app from "../../sage_intacct.app.mjs";
import utils from "../../common/utils.mjs";

export default {
key: "sage_intacct-create-bill",
name: "Create Bill",
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)",
version: "0.0.1",
annotations: {
readOnlyHint: false,
openWorldHint: true,
destructiveHint: false,
},
type: "action",
props: {
app,
billNumber: {
propDefinition: [
app,
"billNumber",
],
},
vendorId: {
propDefinition: [
app,
"vendorId",
],
},
referenceNumber: {
propDefinition: [
app,
"referenceNumber",
],
},
description: {
propDefinition: [
app,
"description",
],
},
createdDate: {
propDefinition: [
app,
"createdDate",
],
},
postingDate: {
propDefinition: [
app,
"postingDate",
],
},
dueDate: {
propDefinition: [
app,
"dueDate",
],
},
discountCutOffDate: {
propDefinition: [
app,
"discountCutOffDate",
],
},
recommendedPaymentDate: {
propDefinition: [
app,
"recommendedPaymentDate",
],
},
paymentPriority: {
propDefinition: [
app,
"paymentPriority",
],
},
isOnHold: {
propDefinition: [
app,
"isOnHold",
],
},
isTaxInclusive: {
propDefinition: [
app,
"isTaxInclusive",
],
},
txnCurrency: {
propDefinition: [
app,
"txnCurrency",
],
},
lines: {
propDefinition: [
app,
"lines",
],
},
},
async run({ $ }) {
const {
app,
billNumber,
vendorId,
referenceNumber,
description,
createdDate,
postingDate,
dueDate,
discountCutOffDate,
recommendedPaymentDate,
paymentPriority,
isOnHold,
isTaxInclusive,
txnCurrency,
lines,
} = this;

const response = await app.createBill({
$,
data: {
billNumber,
referenceNumber,
description,
postingDate,
discountCutOffDate,
recommendedPaymentDate,
paymentPriority,
isOnHold,
isTaxInclusive,
createdDate,
dueDate,
...(vendorId && {
vendor: {
id: vendorId,
},
}),
...(txnCurrency && {
currency: {
txnCurrency,
},
}),
lines: utils.parseJson(lines),
},
});

$.export("$summary", "Successfully created bill");
return response;
},
};
127 changes: 127 additions & 0 deletions components/sage_intacct/actions/create-vendor/create-vendor.mjs
Original file line number Diff line number Diff line change
@@ -0,0 +1,127 @@
import app from "../../sage_intacct.app.mjs";

export default {
key: "sage_intacct-create-vendor",
name: "Create Vendor",
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)",
version: "0.0.1",
type: "action",
annotations: {
readOnlyHint: false,
openWorldHint: true,
destructiveHint: false,
},
props: {
app,
vendorId: {
propDefinition: [
app,
"vendorId",
],
},
name: {
propDefinition: [
app,
"vendorName",
],
},
taxId: {
propDefinition: [
app,
"vendorTaxId",
],
},
creditLimit: {
propDefinition: [
app,
"vendorCreditLimit",
],
},
billingType: {
propDefinition: [
app,
"vendorBillingType",
],
},
paymentPriority: {
propDefinition: [
app,
"vendorPaymentPriority",
],
},
status: {
propDefinition: [
app,
"vendorStatus",
],
},
isOnHold: {
propDefinition: [
app,
"vendorIsOnHold",
],
},
doNotPay: {
propDefinition: [
app,
"vendorDoNotPay",
],
},
notes: {
propDefinition: [
app,
"vendorNotes",
],
},
vendorAccountNumber: {
propDefinition: [
app,
"vendorAccountNumber",
],
},
preferredPaymentMethod: {
propDefinition: [
app,
"vendorPreferredPaymentMethod",
],
},
},
async run({ $ }) {
const {
app,
vendorId,
name,
taxId,
creditLimit,
billingType,
paymentPriority,
status,
isOnHold,
doNotPay,
notes,
vendorAccountNumber,
preferredPaymentMethod,
} = this;

const response = await app.createVendor({
$,
data: {
id: vendorId,
name,
taxId,
creditLimit,
billingType,
paymentPriority,
status,
isOnHold,
doNotPay,
notes,
vendorAccountNumber,
preferredPaymentMethod,
},
});

$.export("$summary", "Successfully created vendor");
return response;
},
};
39 changes: 39 additions & 0 deletions components/sage_intacct/actions/delete-bill/delete-bill.mjs
Original file line number Diff line number Diff line change
@@ -0,0 +1,39 @@
import app from "../../sage_intacct.app.mjs";

export default {
key: "sage_intacct-delete-bill",
name: "Delete Bill",
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)",
version: "0.0.1",
annotations: {
readOnlyHint: false,
openWorldHint: true,
destructiveHint: true,
},
type: "action",
props: {
app,
billKey: {
propDefinition: [
app,
"billKey",
],
},
},
async run({ $ }) {
const {
app,
billKey,
} = this;

await app.deleteBill({
$,
billKey,
});

$.export("$summary", "Successfully deleted bill");
return {
success: true,
};
},
};
39 changes: 39 additions & 0 deletions components/sage_intacct/actions/delete-vendor/delete-vendor.mjs
Original file line number Diff line number Diff line change
@@ -0,0 +1,39 @@
import app from "../../sage_intacct.app.mjs";

export default {
key: "sage_intacct-delete-vendor",
name: "Delete Vendor",
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)",
version: "0.0.1",
type: "action",
annotations: {
readOnlyHint: false,
openWorldHint: true,
destructiveHint: true,
},
props: {
app,
vendorKey: {
propDefinition: [
app,
"vendorKey",
],
},
},
async run({ $ }) {
const {
app,
vendorKey,
} = this;

await app.deleteVendor({
$,
vendorKey,
});

$.export("$summary", "Successfully deleted vendor");
return {
success: true,
};
},
};
27 changes: 27 additions & 0 deletions components/sage_intacct/actions/list-bills/list-bills.mjs
Original file line number Diff line number Diff line change
@@ -0,0 +1,27 @@
import app from "../../sage_intacct.app.mjs";

export default {
key: "sage_intacct-list-bills",
name: "List Bills",
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)",
version: "0.0.1",
type: "action",
annotations: {
readOnlyHint: true,
openWorldHint: true,
destructiveHint: false,
},
props: {
app,
},
async run({ $ }) {
const { app } = this;

const response = await app.listBills({
$,
});

$.export("$summary", "Successfully listed bills");
return response;
},
};
Loading
Loading