@limetech/n8n-nodes-lime 2.7.0-dev.1 → 3.1.0

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (196) hide show
  1. package/.devcontainer/devcontainer.json +44 -0
  2. package/.devcontainer/docker-compose.yml +27 -0
  3. package/.gitattributes +34 -0
  4. package/.nvmrc +1 -0
  5. package/CHANGELOG.md +17 -5
  6. package/README.md +40 -47
  7. package/credentials/index.ts +0 -1
  8. package/dist/credentials/index.d.ts +0 -1
  9. package/dist/credentials/index.js +0 -1
  10. package/dist/credentials/index.js.map +1 -1
  11. package/dist/nodes/index.d.ts +0 -1
  12. package/dist/nodes/index.js +0 -1
  13. package/dist/nodes/index.js.map +1 -1
  14. package/dist/nodes/lime-crm/LimeCrmNode.node.d.ts +1 -4
  15. package/dist/nodes/lime-crm/LimeCrmNode.node.js +0 -3
  16. package/dist/nodes/lime-crm/LimeCrmNode.node.js.map +1 -1
  17. package/dist/nodes/lime-crm/methods/getLimetypeProperties.d.ts +0 -2
  18. package/dist/nodes/lime-crm/methods/getLimetypeProperties.js +0 -43
  19. package/dist/nodes/lime-crm/methods/getLimetypeProperties.js.map +1 -1
  20. package/dist/nodes/lime-crm/methods/index.d.ts +2 -2
  21. package/dist/nodes/lime-crm/methods/index.js +1 -4
  22. package/dist/nodes/lime-crm/methods/index.js.map +1 -1
  23. package/dist/nodes/lime-crm/methods/resourceMapping.d.ts +0 -1
  24. package/dist/nodes/lime-crm/methods/resourceMapping.js +0 -46
  25. package/dist/nodes/lime-crm/methods/resourceMapping.js.map +1 -1
  26. package/dist/nodes/lime-crm/models/limetype.d.ts +0 -1
  27. package/dist/nodes/lime-crm/resources/data/index.d.ts +1 -1
  28. package/dist/nodes/lime-crm/resources/data/index.js +0 -20
  29. package/dist/nodes/lime-crm/resources/data/index.js.map +1 -1
  30. package/dist/nodes/lime-crm/resources/data/operations/index.d.ts +0 -4
  31. package/dist/nodes/lime-crm/resources/data/operations/index.js +1 -5
  32. package/dist/nodes/lime-crm/resources/data/operations/index.js.map +1 -1
  33. package/dist/nodes/lime-crm/transport/index.d.ts +0 -1
  34. package/dist/nodes/lime-crm/transport/index.js +1 -6
  35. package/dist/nodes/lime-crm/transport/index.js.map +1 -1
  36. package/dist/nodes/lime-crm/transport/limetypes.js +4 -15
  37. package/dist/nodes/lime-crm/transport/limetypes.js.map +1 -1
  38. package/dist/nodes/lime-forms/LimeFormsTrigger.node.js +3 -3
  39. package/dist/nodes/lime-forms/LimeFormsTrigger.node.js.map +1 -1
  40. package/dist/nodes/lime-forms/assets/lime-crm.svg +1 -0
  41. package/dist/package.json +5 -12
  42. package/dist/tsconfig.tsbuildinfo +1 -1
  43. package/nodes/index.ts +0 -1
  44. package/nodes/lime-crm/LimeCrmNode.node.ts +0 -6
  45. package/nodes/lime-crm/methods/getLimetypeProperties.ts +0 -84
  46. package/nodes/lime-crm/methods/index.ts +0 -3
  47. package/nodes/lime-crm/methods/resourceMapping.ts +0 -76
  48. package/nodes/lime-crm/models/limetype.ts +0 -1
  49. package/nodes/lime-crm/resources/data/index.ts +1 -34
  50. package/nodes/lime-crm/resources/data/operations/index.ts +0 -17
  51. package/nodes/lime-crm/transport/index.ts +0 -8
  52. package/nodes/lime-crm/transport/limetypes.ts +8 -26
  53. package/nodes/lime-forms/LimeFormsTrigger.node.ts +3 -3
  54. package/nodes/lime-forms/assets/lime-crm.svg +1 -0
  55. package/package.json +6 -13
  56. package/credentials/FortnoxApi.credentials.ts +0 -61
  57. package/dist/credentials/FortnoxApi.credentials.d.ts +0 -9
  58. package/dist/credentials/FortnoxApi.credentials.js +0 -57
  59. package/dist/credentials/FortnoxApi.credentials.js.map +0 -1
  60. package/dist/nodes/fortnox/Fortnox.node.d.ts +0 -5
  61. package/dist/nodes/fortnox/Fortnox.node.js +0 -95
  62. package/dist/nodes/fortnox/Fortnox.node.js.map +0 -1
  63. package/dist/nodes/fortnox/Fortnox.node.json +0 -18
  64. package/dist/nodes/fortnox/FortnoxTrigger.node.d.ts +0 -5
  65. package/dist/nodes/fortnox/FortnoxTrigger.node.js +0 -155
  66. package/dist/nodes/fortnox/FortnoxTrigger.node.js.map +0 -1
  67. package/dist/nodes/fortnox/FortnoxTrigger.node.json +0 -18
  68. package/dist/nodes/fortnox/commons.d.ts +0 -25
  69. package/dist/nodes/fortnox/commons.js +0 -44
  70. package/dist/nodes/fortnox/commons.js.map +0 -1
  71. package/dist/nodes/fortnox/fortnoxLogo.svg +0 -15
  72. package/dist/nodes/fortnox/index.d.ts +0 -6
  73. package/dist/nodes/fortnox/index.js +0 -23
  74. package/dist/nodes/fortnox/index.js.map +0 -1
  75. package/dist/nodes/fortnox/model.d.ts +0 -20
  76. package/dist/nodes/fortnox/model.js +0 -3
  77. package/dist/nodes/fortnox/model.js.map +0 -1
  78. package/dist/nodes/fortnox/resources/customers/filterParameters.d.ts +0 -2
  79. package/dist/nodes/fortnox/resources/customers/filterParameters.js +0 -31
  80. package/dist/nodes/fortnox/resources/customers/filterParameters.js.map +0 -1
  81. package/dist/nodes/fortnox/resources/customers/index.d.ts +0 -7
  82. package/dist/nodes/fortnox/resources/customers/index.js +0 -85
  83. package/dist/nodes/fortnox/resources/customers/index.js.map +0 -1
  84. package/dist/nodes/fortnox/resources/customers/model.d.ts +0 -99
  85. package/dist/nodes/fortnox/resources/customers/model.js +0 -3
  86. package/dist/nodes/fortnox/resources/customers/model.js.map +0 -1
  87. package/dist/nodes/fortnox/resources/customers/operations/create.operation.d.ts +0 -10
  88. package/dist/nodes/fortnox/resources/customers/operations/create.operation.js +0 -281
  89. package/dist/nodes/fortnox/resources/customers/operations/create.operation.js.map +0 -1
  90. package/dist/nodes/fortnox/resources/customers/operations/delete.operation.d.ts +0 -9
  91. package/dist/nodes/fortnox/resources/customers/operations/delete.operation.js +0 -38
  92. package/dist/nodes/fortnox/resources/customers/operations/delete.operation.js.map +0 -1
  93. package/dist/nodes/fortnox/resources/customers/operations/get.operation.d.ts +0 -10
  94. package/dist/nodes/fortnox/resources/customers/operations/get.operation.js +0 -38
  95. package/dist/nodes/fortnox/resources/customers/operations/get.operation.js.map +0 -1
  96. package/dist/nodes/fortnox/resources/customers/operations/getAll.operation.d.ts +0 -10
  97. package/dist/nodes/fortnox/resources/customers/operations/getAll.operation.js +0 -68
  98. package/dist/nodes/fortnox/resources/customers/operations/getAll.operation.js.map +0 -1
  99. package/dist/nodes/fortnox/resources/customers/operations/index.d.ts +0 -5
  100. package/dist/nodes/fortnox/resources/customers/operations/index.js +0 -42
  101. package/dist/nodes/fortnox/resources/customers/operations/index.js.map +0 -1
  102. package/dist/nodes/fortnox/resources/customers/operations/update.operation.d.ts +0 -10
  103. package/dist/nodes/fortnox/resources/customers/operations/update.operation.js +0 -261
  104. package/dist/nodes/fortnox/resources/customers/operations/update.operation.js.map +0 -1
  105. package/dist/nodes/fortnox/resources/customers/sortParameters.d.ts +0 -2
  106. package/dist/nodes/fortnox/resources/customers/sortParameters.js +0 -30
  107. package/dist/nodes/fortnox/resources/customers/sortParameters.js.map +0 -1
  108. package/dist/nodes/fortnox/resources/invoice/filterParameters.d.ts +0 -2
  109. package/dist/nodes/fortnox/resources/invoice/filterParameters.js +0 -72
  110. package/dist/nodes/fortnox/resources/invoice/filterParameters.js.map +0 -1
  111. package/dist/nodes/fortnox/resources/invoice/index.d.ts +0 -7
  112. package/dist/nodes/fortnox/resources/invoice/index.js +0 -81
  113. package/dist/nodes/fortnox/resources/invoice/index.js.map +0 -1
  114. package/dist/nodes/fortnox/resources/invoice/invoiceParameters.d.ts +0 -2
  115. package/dist/nodes/fortnox/resources/invoice/invoiceParameters.js +0 -193
  116. package/dist/nodes/fortnox/resources/invoice/invoiceParameters.js.map +0 -1
  117. package/dist/nodes/fortnox/resources/invoice/model.d.ts +0 -147
  118. package/dist/nodes/fortnox/resources/invoice/model.js +0 -3
  119. package/dist/nodes/fortnox/resources/invoice/model.js.map +0 -1
  120. package/dist/nodes/fortnox/resources/invoice/operations/create.operation.d.ts +0 -10
  121. package/dist/nodes/fortnox/resources/invoice/operations/create.operation.js +0 -64
  122. package/dist/nodes/fortnox/resources/invoice/operations/create.operation.js.map +0 -1
  123. package/dist/nodes/fortnox/resources/invoice/operations/get.operation.d.ts +0 -10
  124. package/dist/nodes/fortnox/resources/invoice/operations/get.operation.js +0 -37
  125. package/dist/nodes/fortnox/resources/invoice/operations/get.operation.js.map +0 -1
  126. package/dist/nodes/fortnox/resources/invoice/operations/getAll.operation.d.ts +0 -10
  127. package/dist/nodes/fortnox/resources/invoice/operations/getAll.operation.js +0 -92
  128. package/dist/nodes/fortnox/resources/invoice/operations/getAll.operation.js.map +0 -1
  129. package/dist/nodes/fortnox/resources/invoice/operations/index.d.ts +0 -4
  130. package/dist/nodes/fortnox/resources/invoice/operations/index.js +0 -41
  131. package/dist/nodes/fortnox/resources/invoice/operations/index.js.map +0 -1
  132. package/dist/nodes/fortnox/resources/invoice/operations/update.operation.d.ts +0 -10
  133. package/dist/nodes/fortnox/resources/invoice/operations/update.operation.js +0 -64
  134. package/dist/nodes/fortnox/resources/invoice/operations/update.operation.js.map +0 -1
  135. package/dist/nodes/fortnox/transport/errorCodes.d.ts +0 -1
  136. package/dist/nodes/fortnox/transport/errorCodes.js +0 -50
  137. package/dist/nodes/fortnox/transport/errorCodes.js.map +0 -1
  138. package/dist/nodes/fortnox/transport/index.d.ts +0 -3
  139. package/dist/nodes/fortnox/transport/index.js +0 -76
  140. package/dist/nodes/fortnox/transport/index.js.map +0 -1
  141. package/dist/nodes/lime-crm/resources/data/operations/bulkImportCommons.d.ts +0 -5
  142. package/dist/nodes/lime-crm/resources/data/operations/bulkImportCommons.js +0 -230
  143. package/dist/nodes/lime-crm/resources/data/operations/bulkImportCommons.js.map +0 -1
  144. package/dist/nodes/lime-crm/resources/data/operations/createManyObjects.operation.d.ts +0 -9
  145. package/dist/nodes/lime-crm/resources/data/operations/createManyObjects.operation.js +0 -16
  146. package/dist/nodes/lime-crm/resources/data/operations/createManyObjects.operation.js.map +0 -1
  147. package/dist/nodes/lime-crm/resources/data/operations/createOrUpdateManyObjects.operation.d.ts +0 -9
  148. package/dist/nodes/lime-crm/resources/data/operations/createOrUpdateManyObjects.operation.js +0 -16
  149. package/dist/nodes/lime-crm/resources/data/operations/createOrUpdateManyObjects.operation.js.map +0 -1
  150. package/dist/nodes/lime-crm/resources/data/operations/deprecated-startBulkImport.operation.d.ts +0 -9
  151. package/dist/nodes/lime-crm/resources/data/operations/deprecated-startBulkImport.operation.js +0 -241
  152. package/dist/nodes/lime-crm/resources/data/operations/deprecated-startBulkImport.operation.js.map +0 -1
  153. package/dist/nodes/lime-crm/resources/data/operations/updateManyObjects.operation.d.ts +0 -9
  154. package/dist/nodes/lime-crm/resources/data/operations/updateManyObjects.operation.js +0 -16
  155. package/dist/nodes/lime-crm/resources/data/operations/updateManyObjects.operation.js.map +0 -1
  156. package/dist/nodes/lime-crm/transport/bulkimport.d.ts +0 -41
  157. package/dist/nodes/lime-crm/transport/bulkimport.js +0 -86
  158. package/dist/nodes/lime-crm/transport/bulkimport.js.map +0 -1
  159. package/dist/nodes/lime-forms/lime-forms.svg +0 -6
  160. package/docker-compose.yml +0 -0
  161. package/nodes/fortnox/Fortnox.node.json +0 -18
  162. package/nodes/fortnox/Fortnox.node.ts +0 -102
  163. package/nodes/fortnox/FortnoxTrigger.node.json +0 -18
  164. package/nodes/fortnox/FortnoxTrigger.node.ts +0 -196
  165. package/nodes/fortnox/commons.ts +0 -94
  166. package/nodes/fortnox/fortnoxLogo.svg +0 -15
  167. package/nodes/fortnox/index.ts +0 -6
  168. package/nodes/fortnox/model.ts +0 -25
  169. package/nodes/fortnox/resources/customers/filterParameters.ts +0 -47
  170. package/nodes/fortnox/resources/customers/index.ts +0 -53
  171. package/nodes/fortnox/resources/customers/model.ts +0 -107
  172. package/nodes/fortnox/resources/customers/operations/create.operation.ts +0 -307
  173. package/nodes/fortnox/resources/customers/operations/delete.operation.ts +0 -49
  174. package/nodes/fortnox/resources/customers/operations/get.operation.ts +0 -50
  175. package/nodes/fortnox/resources/customers/operations/getAll.operation.ts +0 -79
  176. package/nodes/fortnox/resources/customers/operations/index.ts +0 -5
  177. package/nodes/fortnox/resources/customers/operations/update.operation.ts +0 -288
  178. package/nodes/fortnox/resources/customers/sortParameters.ts +0 -32
  179. package/nodes/fortnox/resources/invoice/filterParameters.ts +0 -88
  180. package/nodes/fortnox/resources/invoice/index.ts +0 -49
  181. package/nodes/fortnox/resources/invoice/invoiceParameters.ts +0 -214
  182. package/nodes/fortnox/resources/invoice/model.ts +0 -156
  183. package/nodes/fortnox/resources/invoice/operations/create.operation.ts +0 -71
  184. package/nodes/fortnox/resources/invoice/operations/get.operation.ts +0 -50
  185. package/nodes/fortnox/resources/invoice/operations/getAll.operation.ts +0 -100
  186. package/nodes/fortnox/resources/invoice/operations/index.ts +0 -4
  187. package/nodes/fortnox/resources/invoice/operations/update.operation.ts +0 -79
  188. package/nodes/fortnox/transport/errorCodes.ts +0 -62
  189. package/nodes/fortnox/transport/index.ts +0 -106
  190. package/nodes/lime-crm/resources/data/operations/bulkImportCommons.ts +0 -323
  191. package/nodes/lime-crm/resources/data/operations/createManyObjects.operation.ts +0 -44
  192. package/nodes/lime-crm/resources/data/operations/createOrUpdateManyObjects.operation.ts +0 -44
  193. package/nodes/lime-crm/resources/data/operations/deprecated-startBulkImport.operation.ts +0 -364
  194. package/nodes/lime-crm/resources/data/operations/updateManyObjects.operation.ts +0 -44
  195. package/nodes/lime-crm/transport/bulkimport.ts +0 -271
  196. package/nodes/lime-forms/lime-forms.svg +0 -6
@@ -1,156 +0,0 @@
1
- import { ResponseModel } from '../../model';
2
-
3
- export interface InvoiceBase {
4
- '@url': string;
5
- Balance: number;
6
- Booked: boolean;
7
- Cancelled: boolean;
8
- CostCenter: string;
9
- Currency: string;
10
- CurrencyRate: string;
11
- CurrencyUnit: number;
12
- CustomerName: string;
13
- CustomerNumber: string;
14
- DocumentNumber: string;
15
- DueDate: string;
16
- ExternalInvoiceReference1: string;
17
- ExternalInvoiceReference2: string;
18
- InvoiceDate: string;
19
- InvoiceType: string;
20
- NoxFinans: boolean;
21
- OCR: string;
22
- VoucherNumber: number | string | null;
23
- VoucherSeries: string | null;
24
- VoucherYear: number | string | null;
25
- WayOfDelivery: string;
26
- TermsOfPayment: string;
27
- Project: string;
28
- Sent: boolean;
29
- Total: number;
30
- FinalPayDate: string | null;
31
- }
32
-
33
- export interface EDIInformation {
34
- EDIGlobalLocationNumber: string | null;
35
- EDIGlobalLocationNumberDelivery: string | null;
36
- EDIInvoiceExtra1: string | null;
37
- EDIInvoiceExtra2: string | null;
38
- EDIOurElectronicReference: string | null;
39
- EDIYourElectronicReference: string | null;
40
- EDIStatus: string;
41
- }
42
-
43
- export interface EmailInformation {
44
- EmailAddressFrom: string | null;
45
- EmailAddressTo: string | null;
46
- EmailAddressCC: string | null;
47
- EmailAddressBCC: string | null;
48
- EmailSubject: string;
49
- EmailBody: string;
50
- }
51
-
52
- export interface InvoiceRow {
53
- AccountNumber: number;
54
- ArticleNumber: string;
55
- ContributionPercent: string;
56
- ContributionValue: string;
57
- Cost: number;
58
- CostCenter: string;
59
- DeliveredQuantity: string;
60
- Description: string;
61
- Discount: number;
62
- DiscountType: string;
63
- HouseWork: boolean;
64
- HouseWorkHoursToReport: number | null;
65
- HouseWorkType: string | null;
66
- Price: number;
67
- PriceExcludingVAT: number;
68
- Project: string;
69
- RowId: number;
70
- StockPointCode: string | null;
71
- Total: number;
72
- TotalExcludingVAT: number;
73
- Unit: string;
74
- VAT: number;
75
- }
76
-
77
- export interface Label {
78
- Id: string;
79
- }
80
-
81
- export interface Invoice extends InvoiceBase {
82
- '@urlTaxReductionList': string;
83
- AccountingMethod: string;
84
- Address1: string;
85
- Address2: string;
86
- AdministrationFee: number;
87
- AdministrationFeeVAT: number;
88
- BasisTaxReduction: number;
89
- City: string;
90
- Comments: string;
91
- ContractReference: string;
92
- ContributionPercent: number;
93
- ContributionValue: string;
94
- Country: string;
95
- Credit: string;
96
- CreditInvoiceReference: string;
97
- DeliveryAddress1: string;
98
- DeliveryAddress2: string;
99
- DeliveryCity: string;
100
- DeliveryCountry: string;
101
- DeliveryDate: string | null;
102
- DeliveryName: string;
103
- DeliveryZipCode: string;
104
- EDIInformation: EDIInformation;
105
- EUQuarterlyReport: boolean;
106
- EmailInformation: EmailInformation;
107
- Freight: number;
108
- FreightVAT: number;
109
- Gross: number;
110
- HouseWork: boolean;
111
- InvoicePeriodEnd: string;
112
- InvoicePeriodStart: string;
113
- InvoiceReference: string;
114
- InvoiceRows: InvoiceRow[];
115
- Labels: Label[];
116
- Language: string;
117
- LastRemindDate: string | null;
118
- Net: number;
119
- NotCompleted: boolean;
120
- OfferReference: string;
121
- OrderReference: string;
122
- OrganisationNumber: string;
123
- OurReference: string;
124
- OutboundDate: string;
125
- PaymentWay: string;
126
- Phone1: string;
127
- Phone2: string;
128
- PriceList: string;
129
- PrintTemplate: string;
130
- Remarks: string;
131
- Reminders: number;
132
- RoundOff: number;
133
- TaxReduction: string | null;
134
- TaxReductionType: string;
135
- TermsOfDelivery: string;
136
- TimeBasisReference: string | null;
137
- TotalToPay: number;
138
- TotalVAT: number;
139
- VATIncluded: boolean;
140
- WarehouseReady: boolean;
141
- YourOrderNumber: string;
142
- YourReference: string;
143
- ZipCode: string;
144
- }
145
-
146
- export interface CreateInvoiceResponse {
147
- Invoice: Invoice;
148
- }
149
-
150
- export interface GetInvoiceResponse extends ResponseModel {
151
- Invoice: InvoiceBase;
152
- }
153
-
154
- export interface GetAllInvoicesResponse extends ResponseModel {
155
- Invoices: InvoiceBase[];
156
- }
@@ -1,71 +0,0 @@
1
- import { IExecuteFunctions, INodeProperties, IDataObject } from 'n8n-workflow';
2
- import { apiRequest } from '../../../transport';
3
- import { CreateInvoiceResponse } from '../model';
4
- import { invoiceParameters } from '../invoiceParameters';
5
-
6
- export const description = {
7
- name: 'Create',
8
- value: 'create',
9
- description: 'Create an invoice',
10
- action: 'Create a document',
11
- };
12
-
13
- export const properties: INodeProperties[] = [
14
- {
15
- displayName: 'Customer Number',
16
- name: 'customerNumber',
17
- type: 'string',
18
- required: true,
19
- default: '',
20
- displayOptions: {
21
- show: {
22
- resource: ['invoice'],
23
- operation: ['create'],
24
- },
25
- },
26
- },
27
- {
28
- displayName: 'Add Parameters',
29
- name: 'createParameters',
30
- type: 'collection',
31
- placeholder: 'Add Parameter',
32
- default: {},
33
- displayOptions: {
34
- show: {
35
- resource: ['invoice'],
36
- operation: ['create'],
37
- },
38
- },
39
- options: invoiceParameters,
40
- },
41
- ];
42
-
43
- export async function execute(
44
- this: IExecuteFunctions,
45
- i: number
46
- ): Promise<CreateInvoiceResponse> {
47
- const customerNumber = this.getNodeParameter('customerNumber', i, {});
48
- const createParameters = this.getNodeParameter('createParameters', i, {});
49
-
50
- const body: IDataObject = {
51
- Invoice: {
52
- CustomerNumber: customerNumber,
53
- },
54
- };
55
-
56
- if (createParameters) {
57
- for (const [key, value] of Object.entries(createParameters)) {
58
- if (value !== '' && value !== undefined && value !== null) {
59
- (body['Invoice'] as IDataObject)[key] = value;
60
- }
61
- }
62
- }
63
-
64
- const endpoint = 'invoices';
65
-
66
- return await apiRequest<CreateInvoiceResponse>(this, {
67
- method: 'POST',
68
- endpoint: endpoint,
69
- body: body,
70
- });
71
- }
@@ -1,50 +0,0 @@
1
- import { IExecuteFunctions, INodeProperties } from 'n8n-workflow';
2
- import { apiRequest } from '../../../transport';
3
- import { GetInvoiceResponse } from '../model';
4
-
5
- export const description = {
6
- name: 'Get',
7
- value: 'get',
8
- description: 'Retrieve the invoice',
9
- action: 'Get single document',
10
- };
11
-
12
- export const properties: INodeProperties[] = [
13
- {
14
- displayName: 'Document Number',
15
- name: 'documentNumber',
16
- type: 'string',
17
- required: true,
18
- default: '',
19
- displayOptions: {
20
- show: {
21
- resource: ['invoice'],
22
- operation: ['get'],
23
- },
24
- },
25
- },
26
- ];
27
-
28
- export async function execute(
29
- this: IExecuteFunctions,
30
- i: number
31
- ): Promise<GetInvoiceResponse> {
32
- const documentNumber = this.getNodeParameter(
33
- 'documentNumber',
34
- i,
35
- ''
36
- ) as string;
37
-
38
- const endpoint = `invoices/${encodeURIComponent(documentNumber)}`;
39
-
40
- return await apiRequest<GetInvoiceResponse>(
41
- this,
42
- {
43
- method: 'GET',
44
- endpoint: endpoint,
45
- },
46
- {
47
- id: documentNumber,
48
- }
49
- );
50
- }
@@ -1,100 +0,0 @@
1
- import { IExecuteFunctions, INodeProperties, IDataObject } from 'n8n-workflow';
2
- import { apiRequest } from '../../../transport';
3
- import { filterParameters } from '../filterParameters';
4
- import { GetAllInvoicesResponse } from '../model';
5
-
6
- export const description = {
7
- name: 'Get Many',
8
- value: 'getAll',
9
- description: 'Retrieve a list of invoices',
10
- action: 'Get list of documents',
11
- };
12
-
13
- export const properties: INodeProperties[] = [
14
- {
15
- displayName: 'Filter By',
16
- name: 'filterParameters',
17
- type: 'collection',
18
- placeholder: 'Add Parameter',
19
- default: {},
20
- displayOptions: {
21
- show: {
22
- resource: ['invoice'],
23
- operation: ['getAll'],
24
- },
25
- },
26
- options: filterParameters,
27
- },
28
- {
29
- displayName: 'Sort By',
30
- name: 'sortParameters',
31
- type: 'options',
32
- default: '',
33
- displayOptions: {
34
- show: {
35
- resource: ['invoice'],
36
- operation: ['getAll'],
37
- },
38
- },
39
- options: [
40
- {
41
- name: '',
42
- value: '',
43
- },
44
- {
45
- name: 'Customer Name',
46
- value: 'customername',
47
- },
48
- {
49
- name: 'Customer Number',
50
- value: 'customernumber',
51
- },
52
- {
53
- name: 'Document Number',
54
- value: 'documentnumber',
55
- },
56
- {
57
- name: 'Invoice Date',
58
- value: 'invoicedate',
59
- },
60
- {
61
- name: 'OCR',
62
- value: 'ocr',
63
- },
64
- {
65
- name: 'Total',
66
- value: 'total',
67
- },
68
- ],
69
- },
70
- ];
71
-
72
- export async function execute(
73
- this: IExecuteFunctions,
74
- i: number
75
- ): Promise<GetAllInvoicesResponse> {
76
- const filterParameters = this.getNodeParameter('filterParameters', i, {});
77
- const sortParameters = this.getNodeParameter('sortParameters', i, '');
78
-
79
- const qs: IDataObject = {};
80
-
81
- if (filterParameters) {
82
- for (const [key, value] of Object.entries(filterParameters)) {
83
- if (value !== '' && value !== undefined && value !== null) {
84
- qs[key] = value;
85
- }
86
- }
87
- }
88
-
89
- if (sortParameters) {
90
- qs['sortby'] = sortParameters;
91
- }
92
-
93
- const endpoint = 'invoices';
94
-
95
- return await apiRequest<GetAllInvoicesResponse>(this, {
96
- method: 'GET',
97
- endpoint: endpoint,
98
- qs: qs,
99
- });
100
- }
@@ -1,4 +0,0 @@
1
- export * as createSingleInvoice from './create.operation';
2
- export * as getSingleInvoice from './get.operation';
3
- export * as getManyInvoices from './getAll.operation';
4
- export * as updateSingleInvoice from './update.operation';
@@ -1,79 +0,0 @@
1
- import { IExecuteFunctions, INodeProperties, IDataObject } from 'n8n-workflow';
2
- import { apiRequest } from '../../../transport';
3
- import { CreateInvoiceResponse } from '../model';
4
- import { invoiceParameters } from '../invoiceParameters';
5
-
6
- export const description = {
7
- name: 'Update',
8
- value: 'update',
9
- description: 'Update the invoice',
10
- action: 'Update the document',
11
- };
12
-
13
- export const properties: INodeProperties[] = [
14
- {
15
- displayName: 'Document Number',
16
- name: 'documentNumber',
17
- type: 'string',
18
- required: true,
19
- default: '',
20
- displayOptions: {
21
- show: {
22
- resource: ['invoice'],
23
- operation: ['update'],
24
- },
25
- },
26
- },
27
- {
28
- displayName: 'Add Parameters',
29
- name: 'createParameters',
30
- type: 'collection',
31
- placeholder: 'Add Parameter',
32
- default: {},
33
- displayOptions: {
34
- show: {
35
- resource: ['invoice'],
36
- operation: ['update'],
37
- },
38
- },
39
- options: invoiceParameters,
40
- },
41
- ];
42
-
43
- export async function execute(
44
- this: IExecuteFunctions,
45
- i: number
46
- ): Promise<CreateInvoiceResponse> {
47
- const documentNumber = this.getNodeParameter(
48
- 'documentNumber',
49
- i,
50
- {}
51
- ) as string;
52
- const updateParameters = this.getNodeParameter('invoiceParameters', i, {});
53
-
54
- const body: IDataObject = {
55
- Invoice: {},
56
- };
57
-
58
- if (updateParameters) {
59
- for (const [key, value] of Object.entries(updateParameters)) {
60
- if (value !== '' && value !== undefined && value !== null) {
61
- (body['Invoice'] as IDataObject)[key] = value;
62
- }
63
- }
64
- }
65
-
66
- const endpoint = `invoices/${encodeURIComponent(documentNumber)}`;
67
-
68
- return await apiRequest<CreateInvoiceResponse>(
69
- this,
70
- {
71
- method: 'PUT',
72
- endpoint: endpoint,
73
- body: body,
74
- },
75
- {
76
- id: documentNumber,
77
- }
78
- );
79
- }
@@ -1,62 +0,0 @@
1
- /* eslint-disable unicorn/numeric-separators-style */
2
-
3
- const errorMessages: { [key: number]: string } = {
4
- 1000003:
5
- 'System exception: Something went wrong on our end, please contact our support',
6
- 1000030:
7
- 'Invalid response type: The provided response type(Accept) was invalid.',
8
- 1000031: 'Invalid content type: The provided content type was invalid.',
9
- 2000106: 'The value needs to be alphanumeric.',
10
- 2000108: 'The value needs to be numeric.',
11
- 2000134: 'The value needs to be boolean',
12
- 2000310:
13
- 'The Client-Secret or the Access-Token is either missing or is incorrect.',
14
- 2000311:
15
- 'The Client-Secret or the Access-Token is either missing or is incorrect.',
16
- 2000359: 'The value contains invalid characters.',
17
- 2000588:
18
- 'A parameter is invalid. Read more about parameters in the Parameters page.',
19
- 2000637:
20
- 'Customer number 1 is/has already been used and is reserved even if it has been deleted.',
21
- 2000729: 'A valid identifier was not provided.',
22
- 2001103:
23
- 'The requested Fortnox account does not have a license to use the API.',
24
- 2001392: 'The request body was empty or contained incorrect data.',
25
- 2001740: 'The XML object contained an error.',
26
- 2002115: 'The JSON object contained an error.',
27
- 2001304:
28
- 'Could not find Account used in the request/attached to an element.',
29
- 2001399: 'Invalid Field name',
30
- 2001101: 'There is no active licens for the desired scope.',
31
- 2000663: 'No access to the current scope.',
32
- 2003095:
33
- 'Account is missing for Purchase SE reversed tax liability, in predefined accounts.',
34
- 2000755: 'Supplier invoice debit and credit does not balance',
35
- 2003115: 'Tax Rows for VAT type REVERSE must be marked with CODE',
36
- 2003124:
37
- 'Only order that has been delivered can be marked as warehouseready',
38
- 2003125:
39
- 'A document that has been set to warehouseready can not be modified.',
40
- 2003126: 'Delviered date can not be later than todays date.',
41
- 2003241: 'Migration has allready been started or finished.',
42
- 2003275: 'Not authorized',
43
- 2003277: 'Was not found in the warehouse module.',
44
- 2003399: 'The document is voided in the warehouse module',
45
- 2003127: 'An error has occured in the warehouse module',
46
- 2000204:
47
- 'The customer in the request is not available in the customer resource.',
48
- 2000433:
49
- 'The customer in the request is not available in the customer resource.',
50
- 2001302: 'Could not find article used in request',
51
- 2000428: 'Could not find article used in request',
52
- 2000865: 'An incorrect sort field has been used.',
53
- 2000587: 'An invalid filter has been used.',
54
- 2001422: 'Invalid currency.',
55
- 2004195: 'VAT number must be entered for selected VAT type.',
56
- 2004194: 'Invalid VAT number.',
57
- 2001314: 'Invalid cost center.',
58
- };
59
-
60
- export function translateErrorCode(errorCode: number): string {
61
- return errorMessages[errorCode] || 'Unknown error code';
62
- }
@@ -1,106 +0,0 @@
1
- import {
2
- IExecuteFunctions,
3
- ILoadOptionsFunctions,
4
- IDataObject,
5
- IRequestOptions,
6
- LoggerProxy as Logger,
7
- IHttpRequestMethods,
8
- NodeOperationError,
9
- } from 'n8n-workflow';
10
- import { translateErrorCode } from './errorCodes';
11
- import { ErrorResponseModel } from '../model';
12
- import { FORTNOX_API_CREDENTIAL_KEY } from '../commons';
13
-
14
- export const FORTNOX_BASE_URL = 'https://api.fortnox.se/3/';
15
-
16
- export async function apiRequest<T>(
17
- nodeContext: IExecuteFunctions | ILoadOptionsFunctions,
18
- options: IDataObject,
19
- errorMetadata?: Record<string, unknown>
20
- ): Promise<T> {
21
- const endpoint = options.endpoint;
22
- const method = options.method as IHttpRequestMethods;
23
- const credentials = await nodeContext.getCredentials(
24
- FORTNOX_API_CREDENTIAL_KEY
25
- );
26
-
27
- const requestOptions: IRequestOptions = {
28
- method: method,
29
- uri: `${FORTNOX_BASE_URL}${endpoint}`,
30
- json: true,
31
- headers: {
32
- Authorization: `Bearer ${credentials.token}`,
33
- Accept: 'application/json',
34
- 'Content-Type': 'application/json',
35
- },
36
- };
37
-
38
- if (options.qs && Object.keys(options.qs).length > 0) {
39
- requestOptions.qs = options.qs as IDataObject;
40
- }
41
-
42
- if (options.body) {
43
- requestOptions.body = options.body;
44
- }
45
-
46
- if (options.timeout) {
47
- requestOptions.timeout = options.timeout as number;
48
- }
49
- const fullUrl = `${requestOptions.uri}${requestOptions.qs ? '?' + new URLSearchParams(requestOptions.qs as Record<string, string>).toString() : ''}`;
50
- Logger.info(`URL: ${fullUrl}`);
51
-
52
- try {
53
- // use request instead of requestWithAuthentication cause in the requestWithAuthentication
54
- // error.error is not set, so we cannot access error.error.ErrorInformation
55
- // and we cannot translate the error code
56
- return await nodeContext.helpers.request.call(
57
- nodeContext,
58
- FORTNOX_API_CREDENTIAL_KEY,
59
- requestOptions
60
- );
61
- } catch (error) {
62
- const errorResponse: ErrorResponseModel = error.error || {
63
- ErrorInformation: {},
64
- };
65
- // fields in ErrorInformationModel can start with lowercase or uppercase,
66
- // so we normalize them to lowercase for consistency
67
- const errorInformation = errorResponse?.ErrorInformation && {
68
- error:
69
- errorResponse.ErrorInformation.error ||
70
- errorResponse.ErrorInformation.Error,
71
- message:
72
- errorResponse.ErrorInformation.message ||
73
- errorResponse.ErrorInformation.Message,
74
- code:
75
- errorResponse.ErrorInformation.code ||
76
- errorResponse.ErrorInformation.Code,
77
- };
78
-
79
- let message: string;
80
- if (errorInformation) {
81
- message = `API request failed [URL: ${fullUrl}][Method: ${method}]\n
82
- [Error Information:\n
83
- - Error: ${errorInformation.error || 'Unknown error'}\n
84
- - Message: ${errorInformation.message || 'No message provided'}\n
85
- - Code: ${errorInformation.code || 'No code provided'}\n
86
- - Code Translation: ${translateErrorCode(errorInformation.code as number) || 'No translation available'}\n
87
- ]`;
88
- } else {
89
- message = `API request failed [URL: ${fullUrl}][Method: ${method}]: ${error.message}`;
90
- }
91
- const errorContext = {
92
- error: message,
93
- status: error?.cause?.status,
94
- metadata: {
95
- qs: options?.qs,
96
- body: options?.body,
97
- timeout: options?.timeout,
98
- ...errorMetadata,
99
- },
100
- };
101
- throw new NodeOperationError(
102
- nodeContext.getNode(),
103
- JSON.stringify(errorContext)
104
- );
105
- }
106
- }