diff --git a/components/fortnox/actions/create-article/create-article.mjs b/components/fortnox/actions/create-article/create-article.mjs index f9c9c80eaeebe..5bc7dcd7719b4 100644 --- a/components/fortnox/actions/create-article/create-article.mjs +++ b/components/fortnox/actions/create-article/create-article.mjs @@ -4,7 +4,7 @@ export default { key: "fortnox-create-article", name: "Create Article", description: "Creates a new article in the Fortnox API. [See the documentation](https://api.fortnox.se/apidocs#tag/fortnox_Articles/operation/1_create_3).", - version: "0.0.1", + version: "0.0.2", type: "action", annotations: { destructiveHint: false, diff --git a/components/fortnox/actions/create-customer/create-customer.mjs b/components/fortnox/actions/create-customer/create-customer.mjs index 34010db7bc2d3..cf174ffb23f5f 100644 --- a/components/fortnox/actions/create-customer/create-customer.mjs +++ b/components/fortnox/actions/create-customer/create-customer.mjs @@ -4,7 +4,7 @@ export default { key: "fortnox-create-customer", name: "Create Customer", description: "Creates a new customer in the Fortnox API. [See the documentation](https://api.fortnox.se/apidocs#tag/fortnox_Customers/operation/create_16).", - version: "0.0.1", + version: "0.0.2", type: "action", annotations: { destructiveHint: false, diff --git a/components/fortnox/actions/create-invoice-payment/create-invoice-payment.mjs b/components/fortnox/actions/create-invoice-payment/create-invoice-payment.mjs index e8a8181ef9fb6..6f96092eb456f 100644 --- a/components/fortnox/actions/create-invoice-payment/create-invoice-payment.mjs +++ b/components/fortnox/actions/create-invoice-payment/create-invoice-payment.mjs @@ -4,7 +4,7 @@ export default { key: "fortnox-create-invoice-payment", name: "Create Invoice Payment", description: "Creates a new invoice payment in the Fortnox API. [See the documentation](https://api.fortnox.se/apidocs#tag/fortnox_InvoicePayments/operation/create_22).", - version: "0.0.1", + version: "0.0.2", type: "action", annotations: { destructiveHint: false, @@ -25,12 +25,6 @@ export default { description: "The amount of the payment", optional: true, }, - booked: { - type: "boolean", - label: "Booked", - description: "Whether the payment is booked", - optional: true, - }, customerNumber: { propDefinition: [ fortnox, @@ -41,13 +35,13 @@ export default { dueDate: { type: "string", label: "Due Date", - description: "The due date of the invoice", + description: "The due date of the invoice. Format DD/MM/YYYY", optional: true, }, paymentDate: { type: "string", label: "Payment Date", - description: "The date of the payment", + description: "The date of the payment. Format DD/MM/YYYY", optional: true, }, invoiceTotal: { @@ -78,7 +72,6 @@ export default { Amount: this.amount ? +this.amount : undefined, - Booked: this.booked, InvoiceCustomerNumber: this.customerNumber, InvoiceDueDate: this.dueDate, InvoiceTotal: this.invoiceTotal diff --git a/components/fortnox/actions/create-invoice/create-invoice.mjs b/components/fortnox/actions/create-invoice/create-invoice.mjs index df0142bdfa426..e136bd2ea3eea 100644 --- a/components/fortnox/actions/create-invoice/create-invoice.mjs +++ b/components/fortnox/actions/create-invoice/create-invoice.mjs @@ -1,11 +1,11 @@ -import fortnox from "../../fortnox.app.mjs"; import { parseObject } from "../../common/utils.mjs"; +import fortnox from "../../fortnox.app.mjs"; export default { key: "fortnox-create-invoice", name: "Create Invoice", description: "Creates a new invoice in the Fortnox API. [See the documentation](https://api.fortnox.se/apidocs#tag/fortnox_Invoices/operation/create_23).", - version: "0.0.1", + version: "0.0.2", type: "action", annotations: { destructiveHint: false, @@ -105,16 +105,18 @@ export default { description: "The freight of the invoice", optional: true, }, - termsOfDelivery: { - type: "string", - label: "Terms of Delivery", - description: "The terms of delivery of the invoice", + termsOfDeliveries: { + propDefinition: [ + fortnox, + "termsOfDeliveries", + ], optional: true, }, termsOfPayment: { - type: "string", - label: "Terms of Payment", - description: "The terms of payment of the invoice", + propDefinition: [ + fortnox, + "termsOfPayments", + ], optional: true, }, }, diff --git a/components/fortnox/actions/get-supplier-invoice/get-supplier-invoice.mjs b/components/fortnox/actions/get-supplier-invoice/get-supplier-invoice.mjs new file mode 100644 index 0000000000000..4c3689f714f43 --- /dev/null +++ b/components/fortnox/actions/get-supplier-invoice/get-supplier-invoice.mjs @@ -0,0 +1,32 @@ +import app from "../../fortnox.app.mjs"; + +export default { + key: "fortnox-get-supplier-invoice", + name: "Get Supplier Invoice", + description: "Retrieve a supplier invoice. [See the documentation](https://api.fortnox.se/apidocs#tag/fortnox_SupplierInvoices/operation/get_39)", + version: "0.0.1", + type: "action", + annotations: { + destructiveHint: false, + openWorldHint: true, + readOnlyHint: true, + }, + props: { + app, + supplierInvoiceNumber: { + propDefinition: [ + app, + "supplierInvoiceNumber", + ], + }, + }, + async run({ $ }) { + const { SupplierInvoice } = await this.app.getSupplierInvoice({ + $, + supplierInvoiceNumber: this.supplierInvoiceNumber, + }); + + $.export("$summary", `Successfully retrieved supplier invoice with number ${this.supplierInvoiceNumber}`); + return SupplierInvoice; + }, +}; diff --git a/components/fortnox/actions/list-accounts/list-accounts.mjs b/components/fortnox/actions/list-accounts/list-accounts.mjs new file mode 100644 index 0000000000000..59858fbf8d105 --- /dev/null +++ b/components/fortnox/actions/list-accounts/list-accounts.mjs @@ -0,0 +1,27 @@ +import app from "../../fortnox.app.mjs"; + +export default { + key: "fortnox-list-accounts", + name: "List Accounts", + description: "List all accounts in Fortnox. [See the documentation](https://api.fortnox.se/apidocs#tag/fortnox_Accounts/operation/list_2)", + version: "0.0.1", + type: "action", + annotations: { + destructiveHint: false, + openWorldHint: true, + readOnlyHint: true, + }, + props: { + app, + }, + async run({ $ }) { + const { Accounts: accounts } = await this.app.listAccounts({ + $, + }); + + $.export("$summary", `Successfully retrieved ${accounts.length} account${accounts.length === 1 + ? "" + : "s"}`); + return accounts; + }, +}; diff --git a/components/fortnox/actions/list-articles/list-articles.mjs b/components/fortnox/actions/list-articles/list-articles.mjs new file mode 100644 index 0000000000000..8b45defeeb262 --- /dev/null +++ b/components/fortnox/actions/list-articles/list-articles.mjs @@ -0,0 +1,109 @@ +import app from "../../fortnox.app.mjs"; + +export default { + key: "fortnox-list-articles", + name: "List Articles", + description: "List all articles in Fortnox. [See the documentation](https://api.fortnox.se/apidocs#tag/fortnox_Articles/operation/list_4)", + version: "0.0.1", + type: "action", + annotations: { + destructiveHint: false, + openWorldHint: true, + readOnlyHint: true, + }, + props: { + app, + filter: { + type: "string", + label: "Filter", + description: "Filter the articles by Active or Inactive", + options: [ + "active", + "inactive", + ], + optional: true, + }, + articlenumber: { + type: "string", + label: "Article Number", + description: "Filter by article number", + optional: true, + }, + description: { + type: "string", + label: "Description", + description: "Filter by description", + optional: true, + }, + ean: { + type: "string", + label: "EAN", + description: "Filter by EAN", + optional: true, + }, + suppliernumber: { + type: "string", + label: "Supplier Number", + description: "Filter by supplier number", + optional: true, + }, + manufacturer: { + type: "string", + label: "Manufacturer", + description: "Filter by manufacturer", + optional: true, + }, + manufacturerarticlenumber: { + type: "string", + label: "Manufacturer Article Number", + description: "Filter by manufacturer article number", + optional: true, + }, + webshop: { + type: "string", + label: "Webshop", + description: "Filter by web shop", + optional: true, + }, + lastmodified: { + type: "string", + label: "Last Modified", + description: "Filter by last modified date", + optional: true, + }, + sortby: { + type: "string", + label: "Sort By", + description: "Sort the articles by the specified field", + optional: true, + options: [ + "articlenumber", + "quantityinstock", + "reservedquantity", + "stockvalue", + ], + }, + }, + async run({ $ }) { + const { Articles } = await this.app.listArticles({ + $, + params: { + filter: this.filter, + articlenumber: this.articlenumber, + description: this.description, + ean: this.ean, + suppliernumber: this.suppliernumber, + manufacturer: this.manufacturer, + manufacturerarticlenumber: this.manufacturerarticlenumber, + webshop: this.webshop, + lastmodified: this.lastmodified, + sortby: this.sortby, + }, + }); + + $.export("$summary", `Successfully retrieved ${Articles.length} article${Articles.length === 1 + ? "" + : "s"}`); + return Articles; + }, +}; diff --git a/components/fortnox/actions/list-customers/list-customers.mjs b/components/fortnox/actions/list-customers/list-customers.mjs new file mode 100644 index 0000000000000..20a88154826e3 --- /dev/null +++ b/components/fortnox/actions/list-customers/list-customers.mjs @@ -0,0 +1,121 @@ +import app from "../../fortnox.app.mjs"; + +export default { + key: "fortnox-list-customers", + name: "List Customers", + description: "List all customers in Fortnox. [See the documentation](https://api.fortnox.se/apidocs#tag/fortnox_Customers/operation/list_15)", + version: "0.0.1", + type: "action", + annotations: { + destructiveHint: false, + openWorldHint: true, + readOnlyHint: true, + }, + props: { + app, + filter: { + type: "string", + label: "Filter", + description: "Filter the customers by Active or Inactive", + options: [ + "active", + "inactive", + ], + optional: true, + }, + customernumber: { + type: "string", + label: "Customer Number", + description: "Filter by customer number", + optional: true, + }, + name: { + type: "string", + label: "Name", + description: "Filter by name", + optional: true, + }, + zipcode: { + type: "string", + label: "Zip Code", + description: "Filter by zip code", + optional: true, + }, + city: { + type: "string", + label: "City", + description: "Filter by city", + optional: true, + }, + email: { + type: "string", + label: "Email", + description: "Filter by email", + optional: true, + }, + phone: { + type: "string", + label: "Phone", + description: "Filter by phone", + optional: true, + }, + organisationnumber: { + type: "string", + label: "Organisation Number", + description: "Filter by organisation number", + optional: true, + }, + gln: { + type: "string", + label: "GLN", + description: "Filter by GLN", + optional: true, + }, + glndelivery: { + type: "string", + label: "GLN Delivery", + description: "Filter by GLN Delivery", + optional: true, + }, + lastmodified: { + type: "string", + label: "Last Modified", + description: "Filter by last modified date", + optional: true, + }, + sortby: { + type: "string", + label: "Sort By", + description: "Sort the customers by the specified field", + optional: true, + options: [ + "customernumber", + "name", + ], + }, + }, + async run({ $ }) { + const { Customers } = await this.app.listCustomers({ + $, + params: { + filter: this.filter, + customernumber: this.customernumber, + name: this.name, + zipcode: this.zipcode, + city: this.city, + email: this.email, + phone: this.phone, + organisationnumber: this.organisationnumber, + gln: this.gln, + glndelivery: this.glndelivery, + lastmodified: this.lastmodified, + sortby: this.sortby, + }, + }); + + $.export("$summary", `Successfully retrieved ${Customers.length} customer${Customers.length === 1 + ? "" + : "s"}`); + return Customers; + }, +}; diff --git a/components/fortnox/actions/list-financial-years/list-financial-years.mjs b/components/fortnox/actions/list-financial-years/list-financial-years.mjs new file mode 100644 index 0000000000000..ac832adf7dabe --- /dev/null +++ b/components/fortnox/actions/list-financial-years/list-financial-years.mjs @@ -0,0 +1,36 @@ +import app from "../../fortnox.app.mjs"; + +export default { + key: "fortnox-list-financial-years", + name: "List Financial Years", + description: "Retrieve a list of financial years. [See the documentation](https://api.fortnox.se/apidocs#tag/fortnox_FinancialYears/operation/getByDate)", + version: "0.0.1", + type: "action", + annotations: { + destructiveHint: false, + openWorldHint: true, + readOnlyHint: true, + }, + props: { + app, + date: { + type: "string", + label: "Date", + description: "The date to retrieve the financial years for in **YYYY-MM-DD** format", + optional: true, + }, + }, + async run({ $ }) { + const { FinancialYears } = await this.app.listFinancialYears({ + $, + params: { + Date: this.date, + }, + }); + + $.export("$summary", `Successfully retrieved ${FinancialYears.length} financial year${FinancialYears.length === 1 + ? "" + : "s"}`); + return FinancialYears; + }, +}; diff --git a/components/fortnox/actions/list-invoices/list-invoices.mjs b/components/fortnox/actions/list-invoices/list-invoices.mjs new file mode 100644 index 0000000000000..14aa93e49c465 --- /dev/null +++ b/components/fortnox/actions/list-invoices/list-invoices.mjs @@ -0,0 +1,240 @@ +import app from "../../fortnox.app.mjs"; + +export default { + key: "fortnox-list-invoices", + name: "List Invoices", + description: "Retrieve a list of invoices in Fortnox. [See the documentation](https://api.fortnox.se/apidocs#tag/fortnox_Invoices/operation/list_20)", + version: "0.0.1", + type: "action", + annotations: { + destructiveHint: false, + openWorldHint: true, + readOnlyHint: true, + }, + props: { + app, + filter: { + type: "string", + label: "Filter", + description: "Filter the invoices", + options: [ + "cancelled", + "fullpaid", + "unpaid", + "unpaidoverdue", + "unbooked", + ], + optional: true, + }, + costcenter: { + type: "string", + label: "Cost Center", + description: "Filter the invoices by cost center", + optional: true, + }, + customername: { + type: "string", + label: "Customer Name", + description: "Filter the invoices by customer name", + optional: true, + }, + customernumber: { + type: "string", + label: "Customer Number", + description: "Filter the invoices by customer number", + optional: true, + }, + label: { + type: "string", + label: "Label", + description: "Filter the invoices by label", + optional: true, + }, + documentnumber: { + type: "string", + label: "Document Number", + description: "Filter the invoices by document number", + optional: true, + }, + fromdate: { + type: "string", + label: "From Date", + description: "Filter the invoices by from date", + optional: true, + }, + todate: { + type: "string", + label: "To Date", + description: "Filter the invoices by to date", + optional: true, + }, + fromfinalpaydate: { + type: "string", + label: "From Final Pay Date", + description: "Filter the invoices by from final pay date", + optional: true, + }, + tofinalpaydate: { + type: "string", + label: "To Final Pay Date", + description: "Filter the invoices by to final pay date", + optional: true, + }, + lastmodified: { + type: "string", + label: "Last Modified", + description: "Filter the invoices by last modified", + optional: true, + }, + notcompleted: { + type: "string", + label: "Not Completed", + description: "Filter the invoices by not completed", + optional: true, + }, + ocr: { + type: "string", + label: "OCR", + description: "Filter the invoices by OCR", + optional: true, + }, + ourreference: { + type: "string", + label: "Our Reference", + description: "Filter the invoices by our reference", + optional: true, + }, + project: { + type: "string", + label: "Project", + description: "Filter the invoices by project", + optional: true, + }, + sent: { + type: "string", + label: "Sent", + description: "Filter the invoices by sent", + optional: true, + }, + externalinvoicereference1: { + type: "string", + label: "External Invoice Reference 1", + description: "Filter the invoices by external invoice reference 1", + optional: true, + }, + externalinvoicereference2: { + type: "string", + label: "External Invoice Reference 2", + description: "Filter the invoices by external invoice reference 2", + optional: true, + }, + yourreference: { + type: "string", + label: "Your Reference", + description: "Filter the invoices by your reference", + optional: true, + }, + invoicetype: { + type: "string", + label: "Invoice Type", + description: "Filter the invoices by invoice type", + optional: true, + }, + articlenumber: { + type: "string", + label: "Article Number", + description: "Filter the invoices by article number", + optional: true, + }, + articledescription: { + type: "string", + label: "Article Description", + description: "Filter the invoices by article description", + optional: true, + }, + currency: { + type: "string", + label: "Currency", + description: "Filter the invoices by currency", + optional: true, + }, + accountnumberfrom: { + type: "string", + label: "Account Number From", + description: "Filter the invoices by account number from", + optional: true, + }, + accountnumberto: { + type: "string", + label: "Account Number To", + description: "Filter the invoices by account number to", + optional: true, + }, + credit: { + type: "string", + label: "Credit", + description: "Filter the invoices by credit", + optional: true, + }, + sortby: { + type: "string", + label: "Sort By", + description: "Filter the invoices by sort by", + optional: true, + }, + sortorder: { + type: "string", + label: "Sort Order", + description: "Filter the invoices by sort order", + options: [ + "customername", + "customernumber", + "documentnumber", + "invoicedate", + "ocr", + "total", + ], + optional: true, + }, + }, + async run({ $ }) { + const { Invoices } = await this.app.listInvoices({ + $, + params: { + filter: this.filter, + costcenter: this.costcenter, + customername: this.customername, + customernumber: this.customernumber, + label: this.label, + documentnumber: this.documentnumber, + fromdate: this.fromdate, + todate: this.todate, + fromfinalpaydate: this.fromfinalpaydate, + tofinalpaydate: this.tofinalpaydate, + lastmodified: this.lastmodified, + notcompleted: this.notcompleted, + ocr: this.ocr, + ourreference: this.ourreference, + project: this.project, + sent: this.sent, + externalinvoicereference1: this.externalinvoicereference1, + externalinvoicereference2: this.externalinvoicereference2, + yourreference: this.yourreference, + invoicetype: this.invoicetype, + articlenumber: this.articlenumber, + articledescription: this.articledescription, + currency: this.currency, + accountnumberfrom: this.accountnumberfrom, + accountnumberto: this.accountnumberto, + credit: this.credit, + sortby: this.sortby, + sortorder: this.sortorder, + }, + }); + + $.export("$summary", `Successfully retrieved ${Invoices.length} invoice${Invoices.length === 1 + ? "" + : "s"}`); + return Invoices; + }, +}; diff --git a/components/fortnox/actions/list-supplier-invoices/list-supplier-invoices.mjs b/components/fortnox/actions/list-supplier-invoices/list-supplier-invoices.mjs new file mode 100644 index 0000000000000..64c895bf3a290 --- /dev/null +++ b/components/fortnox/actions/list-supplier-invoices/list-supplier-invoices.mjs @@ -0,0 +1,63 @@ +import app from "../../fortnox.app.mjs"; + +export default { + key: "fortnox-list-supplier-invoices", + name: "List Supplier Invoices", + description: "List all invoices for a supplier. [See the documentation](https://api.fortnox.se/apidocs#tag/fortnox_SupplierInvoices/operation/list_39)", + version: "0.0.1", + type: "action", + annotations: { + destructiveHint: false, + openWorldHint: true, + readOnlyHint: true, + }, + props: { + app, + filter: { + type: "string", + label: "Filter", + description: "Filter the invoices by supplier status", + options: [ + { + label: "Retrieves all invoices with the status `cancelled`", + value: "cancelled", + }, + { + label: "Retrieves all invoices that have been fully paid", + value: "fullypaid", + }, + { + label: "Retrieves all invoices that are unpaid", + value: "unpaid", + }, + { + label: "Retrieves all invoices that are unpaid and overdue", + value: "unpaidoverdue", + }, + { + label: "Retrieves all invoices that are unbooked", + value: "unbooked", + }, + { + label: "Retrieves all invoices that have PaymentPending=true and are booked", + value: "pendingpayment", + }, + { + label: "Retrieves all invoices that have a waiting authorization pending", + value: "authorizepending", + }, + ], + optional: true, + }, + }, + async run({ $ }) { + const { SupplierInvoices } = await this.app.listSupplierInvoices({ + $, + }); + + $.export("$summary", `Successfully retrieved ${SupplierInvoices.length} supplier invoice${SupplierInvoices.length === 1 + ? "" + : "s"}`); + return SupplierInvoices; + }, +}; diff --git a/components/fortnox/actions/list-suppliers/list-suppliers.mjs b/components/fortnox/actions/list-suppliers/list-suppliers.mjs new file mode 100644 index 0000000000000..8a6376e91f1c8 --- /dev/null +++ b/components/fortnox/actions/list-suppliers/list-suppliers.mjs @@ -0,0 +1,27 @@ +import app from "../../fortnox.app.mjs"; + +export default { + key: "fortnox-list-suppliers", + name: "List Suppliers", + description: "List all suppliers in Fortnox. [See the documentation](https://api.fortnox.se/apidocs#tag/fortnox_Suppliers/operation/list_40)", + version: "0.0.1", + type: "action", + annotations: { + destructiveHint: false, + openWorldHint: true, + readOnlyHint: true, + }, + props: { + app, + }, + async run({ $ }) { + const { Suppliers } = await this.app.listSuppliers({ + $, + }); + + $.export("$summary", `Successfully retrieved ${Suppliers.length} supplier${Suppliers.length === 1 + ? "" + : "s"}`); + return Suppliers; + }, +}; diff --git a/components/fortnox/actions/send-invoice/send-invoice.mjs b/components/fortnox/actions/send-invoice/send-invoice.mjs index a781fe4948f60..cc257895ffaee 100644 --- a/components/fortnox/actions/send-invoice/send-invoice.mjs +++ b/components/fortnox/actions/send-invoice/send-invoice.mjs @@ -4,7 +4,7 @@ export default { key: "fortnox-send-invoice", name: "Send Invoice", description: "Sends an invoice in the Fortnox API. [See the documentation](https://api.fortnox.se/apidocs#tag/fortnox_Invoices/operation/eInvoice).", - version: "0.0.1", + version: "0.0.2", type: "action", annotations: { destructiveHint: false, diff --git a/components/fortnox/actions/update-article/update-article.mjs b/components/fortnox/actions/update-article/update-article.mjs index cf8cbec3b8608..7a6acee8ef17f 100644 --- a/components/fortnox/actions/update-article/update-article.mjs +++ b/components/fortnox/actions/update-article/update-article.mjs @@ -4,7 +4,7 @@ export default { key: "fortnox-update-article", name: "Update Article", description: "Updates an existing article in the Fortnox API. [See the documentation](https://api.fortnox.se/apidocs#tag/fortnox_Articles/operation/1_update_2).", - version: "0.0.1", + version: "0.0.2", type: "action", annotations: { destructiveHint: true, diff --git a/components/fortnox/actions/update-customer/update-customer.mjs b/components/fortnox/actions/update-customer/update-customer.mjs index be1515bd04055..00dbdb699c585 100644 --- a/components/fortnox/actions/update-customer/update-customer.mjs +++ b/components/fortnox/actions/update-customer/update-customer.mjs @@ -4,7 +4,7 @@ export default { key: "fortnox-update-customer", name: "Update Customer", description: "Updates an existing customer in the Fortnox API. [See the documentation](https://api.fortnox.se/apidocs#tag/fortnox_Customers/operation/update_14).", - version: "0.0.1", + version: "0.0.2", type: "action", annotations: { destructiveHint: true, diff --git a/components/fortnox/fortnox.app.mjs b/components/fortnox/fortnox.app.mjs index 0a9278a21c501..46d50cb4103f9 100644 --- a/components/fortnox/fortnox.app.mjs +++ b/components/fortnox/fortnox.app.mjs @@ -106,6 +106,42 @@ export default { })) || []; }, }, + supplierInvoiceNumber: { + type: "string", + label: "Supplier Invoice Number", + description: "The number of the supplier invoice", + async options() { + const { SupplierInvoices: supplierInvoices } = await this.listSupplierInvoices(); + return supplierInvoices?.map((invoice) => ({ + label: `${invoice.InvoiceNumber} - ${invoice.Total}`, + value: invoice.GivenNumber, + })) || []; + }, + }, + termsOfDeliveries: { + type: "string", + label: "Terms of Delivery", + description: "The terms of delivery of the invoice", + async options() { + const { TermsOfDeliveries: termsOfDeliveries } = await this.listTermsOfDeliveries(); + return termsOfDeliveries?.map((term) => ({ + label: term.Description, + value: term.Code, + })) || []; + }, + }, + termsOfPayments: { + type: "string", + label: "Terms of Payment", + description: "The terms of payment of the invoice", + async options() { + const { TermsOfPayments: termsOfPayments } = await this.listTermsOfPayments(); + return termsOfPayments?.map((term) => ({ + label: term.Description, + value: term.Code, + })) || []; + }, + }, articleDescription: { type: "string", label: "Description", @@ -274,7 +310,9 @@ export default { return axios($, { url: `${this._baseUrl()}${path}`, headers: { - Authorization: `Bearer ${this.$auth.oauth_access_token}`, + "Authorization": `Bearer ${this.$auth.oauth_access_token}`, + "Content-Type": "application/json", + "Accept": "application/json", }, ...opts, }); @@ -379,5 +417,43 @@ export default { ...opts, }); }, + listAccounts(opts = {}) { + return this._makeRequest({ + path: "/accounts", + ...opts, + }); + }, + listFinancialYears(opts = {}) { + return this._makeRequest({ + path: "/financialyears", + ...opts, + }); + }, + listSupplierInvoices(opts = {}) { + return this._makeRequest({ + path: "/supplierinvoices", + ...opts, + }); + }, + getSupplierInvoice({ + supplierInvoiceNumber, ...opts + }) { + return this._makeRequest({ + path: `/supplierinvoices/${supplierInvoiceNumber}`, + ...opts, + }); + }, + listTermsOfPayments(opts = {}) { + return this._makeRequest({ + path: "/termsofpayments", + ...opts, + }); + }, + listTermsOfDeliveries(opts = {}) { + return this._makeRequest({ + path: "/termsofdeliveries", + ...opts, + }); + }, }, }; diff --git a/components/fortnox/package.json b/components/fortnox/package.json index 4ddb48c8058a6..3fdef1b0f271c 100644 --- a/components/fortnox/package.json +++ b/components/fortnox/package.json @@ -1,6 +1,6 @@ { "name": "@pipedream/fortnox", - "version": "0.1.0", + "version": "0.2.0", "description": "Pipedream Fortnox Components", "main": "fortnox.app.mjs", "keywords": [