-
Notifications
You must be signed in to change notification settings - Fork 5.5k
Enhance Fortnox component with new actions and properties #19208
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
base: master
Are you sure you want to change the base?
Changes from all commits
603ba20
cc19f4f
9dfa75d
ac32c62
3c0c68d
105a3e4
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -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, | ||
|
Comment on lines
+108
to
120
Contributor
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Fix mismatch between You renamed the prop to Update the payload to use the actual prop name: termsOfDeliveries: {
propDefinition: [
fortnox,
"termsOfDeliveries",
],
optional: true,
},
@@
- TermsOfDelivery: this.termsOfDelivery,
+ TermsOfDelivery: this.termsOfDeliveries,
TermsOfPayment: this.termsOfPayment,This wires the selected term of delivery into the created invoice correctly. Also applies to: 148-150 🤖 Prompt for AI Agents |
||
| }, | ||
| }, | ||
|
|
||
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -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; | ||
| }, | ||
| }; |
| Original file line number | Diff line number | Diff line change | ||||||||||||||||||||||||||||||||||||
|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|
| @@ -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; | ||||||||||||||||||||||||||||||||||||||
|
Comment on lines
+17
to
+25
Contributor
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. 🧹 Nitpick | 🔵 Trivial Default If the API ever omits or nulls the - const { Accounts: accounts } = await this.app.listAccounts({
+ const { Accounts: accounts = [] } = await this.app.listAccounts({
$,
});This also guarantees the action always returns an array. 📝 Committable suggestion
Suggested change
🤖 Prompt for AI Agents |
||||||||||||||||||||||||||||||||||||||
| }, | ||||||||||||||||||||||||||||||||||||||
| }; | ||||||||||||||||||||||||||||||||||||||
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -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; | ||
| }, | ||
| }; |
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -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, | ||
luancazarine marked this conversation as resolved.
Show resolved
Hide resolved
|
||
| }, | ||
| lastmodified: { | ||
| type: "string", | ||
| label: "Last Modified", | ||
| description: "Filter by last modified date", | ||
| optional: true, | ||
luancazarine marked this conversation as resolved.
Show resolved
Hide resolved
|
||
| }, | ||
| sortby: { | ||
| type: "string", | ||
| label: "Sort By", | ||
| description: "Sort the customers by the specified field", | ||
| optional: true, | ||
| options: [ | ||
| "customernumber", | ||
| "name", | ||
| ], | ||
| }, | ||
luancazarine marked this conversation as resolved.
Show resolved
Hide resolved
|
||
| }, | ||
| 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; | ||
| }, | ||
| }; | ||
Uh oh!
There was an error while loading. Please reload this page.