@limetech/n8n-nodes-lime 2.6.0 → 3.0.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.
- package/CHANGELOG.md +17 -0
- package/credentials/index.ts +0 -1
- package/dist/credentials/index.d.ts +0 -1
- package/dist/credentials/index.js +0 -1
- package/dist/credentials/index.js.map +1 -1
- package/dist/nodes/index.d.ts +0 -1
- package/dist/nodes/index.js +0 -1
- package/dist/nodes/index.js.map +1 -1
- package/dist/nodes/lime-forms/LimeFormsTrigger.node.js +3 -3
- package/dist/nodes/lime-forms/LimeFormsTrigger.node.js.map +1 -1
- package/dist/nodes/lime-forms/assets/lime-crm.svg +1 -0
- package/dist/package.json +0 -8
- package/dist/tsconfig.tsbuildinfo +1 -1
- package/nodes/index.ts +0 -1
- package/nodes/lime-forms/LimeFormsTrigger.node.ts +3 -3
- package/nodes/lime-forms/assets/lime-crm.svg +1 -0
- package/package.json +1 -9
- package/credentials/FortnoxApi.credentials.ts +0 -61
- package/dist/credentials/FortnoxApi.credentials.d.ts +0 -9
- package/dist/credentials/FortnoxApi.credentials.js +0 -57
- package/dist/credentials/FortnoxApi.credentials.js.map +0 -1
- package/dist/nodes/fortnox/Fortnox.node.d.ts +0 -5
- package/dist/nodes/fortnox/Fortnox.node.js +0 -95
- package/dist/nodes/fortnox/Fortnox.node.js.map +0 -1
- package/dist/nodes/fortnox/Fortnox.node.json +0 -18
- package/dist/nodes/fortnox/FortnoxTrigger.node.d.ts +0 -5
- package/dist/nodes/fortnox/FortnoxTrigger.node.js +0 -155
- package/dist/nodes/fortnox/FortnoxTrigger.node.js.map +0 -1
- package/dist/nodes/fortnox/FortnoxTrigger.node.json +0 -18
- package/dist/nodes/fortnox/commons.d.ts +0 -25
- package/dist/nodes/fortnox/commons.js +0 -44
- package/dist/nodes/fortnox/commons.js.map +0 -1
- package/dist/nodes/fortnox/fortnoxLogo.svg +0 -15
- package/dist/nodes/fortnox/index.d.ts +0 -6
- package/dist/nodes/fortnox/index.js +0 -23
- package/dist/nodes/fortnox/index.js.map +0 -1
- package/dist/nodes/fortnox/model.d.ts +0 -20
- package/dist/nodes/fortnox/model.js +0 -3
- package/dist/nodes/fortnox/model.js.map +0 -1
- package/dist/nodes/fortnox/resources/customers/filterParameters.d.ts +0 -2
- package/dist/nodes/fortnox/resources/customers/filterParameters.js +0 -31
- package/dist/nodes/fortnox/resources/customers/filterParameters.js.map +0 -1
- package/dist/nodes/fortnox/resources/customers/index.d.ts +0 -7
- package/dist/nodes/fortnox/resources/customers/index.js +0 -85
- package/dist/nodes/fortnox/resources/customers/index.js.map +0 -1
- package/dist/nodes/fortnox/resources/customers/model.d.ts +0 -99
- package/dist/nodes/fortnox/resources/customers/model.js +0 -3
- package/dist/nodes/fortnox/resources/customers/model.js.map +0 -1
- package/dist/nodes/fortnox/resources/customers/operations/create.operation.d.ts +0 -10
- package/dist/nodes/fortnox/resources/customers/operations/create.operation.js +0 -281
- package/dist/nodes/fortnox/resources/customers/operations/create.operation.js.map +0 -1
- package/dist/nodes/fortnox/resources/customers/operations/delete.operation.d.ts +0 -9
- package/dist/nodes/fortnox/resources/customers/operations/delete.operation.js +0 -38
- package/dist/nodes/fortnox/resources/customers/operations/delete.operation.js.map +0 -1
- package/dist/nodes/fortnox/resources/customers/operations/get.operation.d.ts +0 -10
- package/dist/nodes/fortnox/resources/customers/operations/get.operation.js +0 -38
- package/dist/nodes/fortnox/resources/customers/operations/get.operation.js.map +0 -1
- package/dist/nodes/fortnox/resources/customers/operations/getAll.operation.d.ts +0 -10
- package/dist/nodes/fortnox/resources/customers/operations/getAll.operation.js +0 -68
- package/dist/nodes/fortnox/resources/customers/operations/getAll.operation.js.map +0 -1
- package/dist/nodes/fortnox/resources/customers/operations/index.d.ts +0 -5
- package/dist/nodes/fortnox/resources/customers/operations/index.js +0 -42
- package/dist/nodes/fortnox/resources/customers/operations/index.js.map +0 -1
- package/dist/nodes/fortnox/resources/customers/operations/update.operation.d.ts +0 -10
- package/dist/nodes/fortnox/resources/customers/operations/update.operation.js +0 -261
- package/dist/nodes/fortnox/resources/customers/operations/update.operation.js.map +0 -1
- package/dist/nodes/fortnox/resources/customers/sortParameters.d.ts +0 -2
- package/dist/nodes/fortnox/resources/customers/sortParameters.js +0 -30
- package/dist/nodes/fortnox/resources/customers/sortParameters.js.map +0 -1
- package/dist/nodes/fortnox/resources/invoice/filterParameters.d.ts +0 -2
- package/dist/nodes/fortnox/resources/invoice/filterParameters.js +0 -72
- package/dist/nodes/fortnox/resources/invoice/filterParameters.js.map +0 -1
- package/dist/nodes/fortnox/resources/invoice/index.d.ts +0 -7
- package/dist/nodes/fortnox/resources/invoice/index.js +0 -81
- package/dist/nodes/fortnox/resources/invoice/index.js.map +0 -1
- package/dist/nodes/fortnox/resources/invoice/invoiceParameters.d.ts +0 -2
- package/dist/nodes/fortnox/resources/invoice/invoiceParameters.js +0 -193
- package/dist/nodes/fortnox/resources/invoice/invoiceParameters.js.map +0 -1
- package/dist/nodes/fortnox/resources/invoice/model.d.ts +0 -147
- package/dist/nodes/fortnox/resources/invoice/model.js +0 -3
- package/dist/nodes/fortnox/resources/invoice/model.js.map +0 -1
- package/dist/nodes/fortnox/resources/invoice/operations/create.operation.d.ts +0 -10
- package/dist/nodes/fortnox/resources/invoice/operations/create.operation.js +0 -64
- package/dist/nodes/fortnox/resources/invoice/operations/create.operation.js.map +0 -1
- package/dist/nodes/fortnox/resources/invoice/operations/get.operation.d.ts +0 -10
- package/dist/nodes/fortnox/resources/invoice/operations/get.operation.js +0 -37
- package/dist/nodes/fortnox/resources/invoice/operations/get.operation.js.map +0 -1
- package/dist/nodes/fortnox/resources/invoice/operations/getAll.operation.d.ts +0 -10
- package/dist/nodes/fortnox/resources/invoice/operations/getAll.operation.js +0 -92
- package/dist/nodes/fortnox/resources/invoice/operations/getAll.operation.js.map +0 -1
- package/dist/nodes/fortnox/resources/invoice/operations/index.d.ts +0 -4
- package/dist/nodes/fortnox/resources/invoice/operations/index.js +0 -41
- package/dist/nodes/fortnox/resources/invoice/operations/index.js.map +0 -1
- package/dist/nodes/fortnox/resources/invoice/operations/update.operation.d.ts +0 -10
- package/dist/nodes/fortnox/resources/invoice/operations/update.operation.js +0 -64
- package/dist/nodes/fortnox/resources/invoice/operations/update.operation.js.map +0 -1
- package/dist/nodes/fortnox/transport/errorCodes.d.ts +0 -1
- package/dist/nodes/fortnox/transport/errorCodes.js +0 -50
- package/dist/nodes/fortnox/transport/errorCodes.js.map +0 -1
- package/dist/nodes/fortnox/transport/index.d.ts +0 -3
- package/dist/nodes/fortnox/transport/index.js +0 -76
- package/dist/nodes/fortnox/transport/index.js.map +0 -1
- package/dist/nodes/lime-forms/lime-forms.svg +0 -6
- package/nodes/fortnox/Fortnox.node.json +0 -18
- package/nodes/fortnox/Fortnox.node.ts +0 -102
- package/nodes/fortnox/FortnoxTrigger.node.json +0 -18
- package/nodes/fortnox/FortnoxTrigger.node.ts +0 -196
- package/nodes/fortnox/commons.ts +0 -94
- package/nodes/fortnox/fortnoxLogo.svg +0 -15
- package/nodes/fortnox/index.ts +0 -6
- package/nodes/fortnox/model.ts +0 -25
- package/nodes/fortnox/resources/customers/filterParameters.ts +0 -47
- package/nodes/fortnox/resources/customers/index.ts +0 -53
- package/nodes/fortnox/resources/customers/model.ts +0 -107
- package/nodes/fortnox/resources/customers/operations/create.operation.ts +0 -307
- package/nodes/fortnox/resources/customers/operations/delete.operation.ts +0 -49
- package/nodes/fortnox/resources/customers/operations/get.operation.ts +0 -50
- package/nodes/fortnox/resources/customers/operations/getAll.operation.ts +0 -79
- package/nodes/fortnox/resources/customers/operations/index.ts +0 -5
- package/nodes/fortnox/resources/customers/operations/update.operation.ts +0 -288
- package/nodes/fortnox/resources/customers/sortParameters.ts +0 -32
- package/nodes/fortnox/resources/invoice/filterParameters.ts +0 -88
- package/nodes/fortnox/resources/invoice/index.ts +0 -49
- package/nodes/fortnox/resources/invoice/invoiceParameters.ts +0 -214
- package/nodes/fortnox/resources/invoice/model.ts +0 -156
- package/nodes/fortnox/resources/invoice/operations/create.operation.ts +0 -71
- package/nodes/fortnox/resources/invoice/operations/get.operation.ts +0 -50
- package/nodes/fortnox/resources/invoice/operations/getAll.operation.ts +0 -100
- package/nodes/fortnox/resources/invoice/operations/index.ts +0 -4
- package/nodes/fortnox/resources/invoice/operations/update.operation.ts +0 -79
- package/nodes/fortnox/transport/errorCodes.ts +0 -62
- package/nodes/fortnox/transport/index.ts +0 -106
- 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,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
|
-
}
|
|
@@ -1,6 +0,0 @@
|
|
|
1
|
-
<svg viewBox="0 0 1025 1025" xmlns="http://www.w3.org/2000/svg" xml:space="preserve"><clipPath id="a"><path d="M.067.03h1024v1024H.067z"/></clipPath>
|
|
2
|
-
<g clip-path="url(#a)"><path d="M92.466 480.888c0-257.059 208.718-465.779 465.78-465.779 257.101 0 465.821 208.72 465.821 465.779 0 133.713-55.806 271.139-193.404 385.355-166.779 138.45-390.389 157.35-736.149 134.525-102.653-6.785-117.502-24.319-64.469-63.444C196.74 814.277 92.466 720.157 92.466 480.888Z" style="fill:#a6efff"/>
|
|
3
|
-
<clipPath id="b"><path d="M92.466 480.888c0-257.059 208.718-465.779 465.78-465.779 257.101 0 465.821 208.72 465.821 465.779 0 133.713-55.806 271.139-193.404 385.355-166.779 138.45-390.389 157.35-736.149 134.525-102.653-6.785-117.502-24.319-64.469-63.444C196.74 814.277 92.466 720.157 92.466 480.888Z"/></clipPath>
|
|
4
|
-
<g clip-path="url(#b)"><path d="M-810.991 1517.47c-520.197-174.655 602.109-1999.19 1122.31-1824.54 520.198 174.652 347.26 364.038 243.982 791.188-103.277 427.149-846.091 1208-1366.29 1033.35Z" style="fill:#ffa6ea;filter:blur(200px)"/></g>
|
|
5
|
-
<path d="M415.273 301.267c-40.49 0-73.342 32.894-73.342 73.385 0 40.489 32.852 73.342 73.342 73.342 40.489 0 73.384-32.853 73.384-73.342 0-40.491-32.895-73.385-73.384-73.385Zm168.017 96.552h175.653c12.8 0 23.168-10.368 23.168-23.167 0-12.801-10.368-23.168-23.168-23.168H583.29c-12.8 0-23.168 10.367-23.168 23.168 0 12.799 10.368 23.167 23.168 23.167Zm0 212.345h175.653c12.8 0 23.168-10.367 23.168-23.167 0-12.756-10.368-23.166-23.168-23.166H583.29c-12.8 0-23.168 10.41-23.168 23.166 0 12.8 10.368 23.167 23.168 23.167Zm-168.017-96.509c-40.49 0-73.342 32.853-73.342 73.342 0 40.49 32.852 73.385 73.342 73.385 40.489 0 73.384-32.895 73.384-73.385 0-40.489-32.895-73.342-73.384-73.342Z"
|
|
6
|
-
style="fill:#fff"/></g></svg>
|