@limetech/n8n-nodes-lime 2.6.1 → 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 +10 -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/package.json +0 -8
- package/dist/tsconfig.tsbuildinfo +1 -1
- package/nodes/index.ts +0 -1
- 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/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
|
@@ -1,79 +0,0 @@
|
|
|
1
|
-
import { IExecuteFunctions, INodeProperties, IDataObject } from 'n8n-workflow';
|
|
2
|
-
import { apiRequest } from '../../../transport';
|
|
3
|
-
import { filterParameters } from '../filterParameters';
|
|
4
|
-
import { sortParameters } from '../sortParameters';
|
|
5
|
-
import { CustomersResponse } from '../model';
|
|
6
|
-
|
|
7
|
-
export const description = {
|
|
8
|
-
name: 'Get All Customers',
|
|
9
|
-
value: 'getAll',
|
|
10
|
-
description: 'Get all customers',
|
|
11
|
-
action: 'Get all customers',
|
|
12
|
-
};
|
|
13
|
-
|
|
14
|
-
export const properties: INodeProperties[] = [
|
|
15
|
-
{
|
|
16
|
-
displayName: 'Filter by',
|
|
17
|
-
name: 'filterParameters',
|
|
18
|
-
type: 'collection',
|
|
19
|
-
placeholder: 'Add Parameter',
|
|
20
|
-
default: {},
|
|
21
|
-
displayOptions: {
|
|
22
|
-
show: {
|
|
23
|
-
resource: ['customer'],
|
|
24
|
-
operation: ['getAll'],
|
|
25
|
-
},
|
|
26
|
-
},
|
|
27
|
-
options: filterParameters,
|
|
28
|
-
},
|
|
29
|
-
{
|
|
30
|
-
displayName: 'Sort by',
|
|
31
|
-
name: 'sortParameters',
|
|
32
|
-
type: 'collection',
|
|
33
|
-
placeholder: 'Add Parameter',
|
|
34
|
-
default: {},
|
|
35
|
-
displayOptions: {
|
|
36
|
-
show: {
|
|
37
|
-
resource: ['customer'],
|
|
38
|
-
operation: ['getAll'],
|
|
39
|
-
},
|
|
40
|
-
},
|
|
41
|
-
options: sortParameters,
|
|
42
|
-
},
|
|
43
|
-
];
|
|
44
|
-
|
|
45
|
-
export async function execute(
|
|
46
|
-
this: IExecuteFunctions,
|
|
47
|
-
i: number
|
|
48
|
-
): Promise<CustomersResponse> {
|
|
49
|
-
const filterParameters = this.getNodeParameter('filterParameters', i, {});
|
|
50
|
-
const sortParameters = this.getNodeParameter(
|
|
51
|
-
'sortParameters',
|
|
52
|
-
i,
|
|
53
|
-
{}
|
|
54
|
-
) as IDataObject;
|
|
55
|
-
|
|
56
|
-
const qs: IDataObject = {};
|
|
57
|
-
if (filterParameters) {
|
|
58
|
-
for (const [key, value] of Object.entries(filterParameters)) {
|
|
59
|
-
if (value !== '' && value !== undefined && value !== null) {
|
|
60
|
-
qs[key] = value;
|
|
61
|
-
}
|
|
62
|
-
}
|
|
63
|
-
}
|
|
64
|
-
|
|
65
|
-
if (sortParameters && Object.keys(sortParameters).length > 0) {
|
|
66
|
-
qs['sortby'] = Object.entries(sortParameters)
|
|
67
|
-
.filter(([, value]) => value)
|
|
68
|
-
.map(([, value]) => `${value}`)
|
|
69
|
-
.join('');
|
|
70
|
-
}
|
|
71
|
-
|
|
72
|
-
const endpoint = `/customers`;
|
|
73
|
-
|
|
74
|
-
return await apiRequest<CustomersResponse>(this, {
|
|
75
|
-
method: 'GET',
|
|
76
|
-
endpoint: endpoint,
|
|
77
|
-
qs: qs,
|
|
78
|
-
});
|
|
79
|
-
}
|
|
@@ -1,5 +0,0 @@
|
|
|
1
|
-
export * as createSingleCustomer from './create.operation';
|
|
2
|
-
export * as deleteSingleCustomer from './delete.operation';
|
|
3
|
-
export * as getSingleCustomer from './get.operation';
|
|
4
|
-
export * as getManyCustomers from './getAll.operation';
|
|
5
|
-
export * as updateSingleCustomer from './update.operation';
|
|
@@ -1,288 +0,0 @@
|
|
|
1
|
-
import {
|
|
2
|
-
IExecuteFunctions,
|
|
3
|
-
INodeProperties,
|
|
4
|
-
IDataObject,
|
|
5
|
-
NodeOperationError,
|
|
6
|
-
} from 'n8n-workflow';
|
|
7
|
-
import { apiRequest } from '../../../transport';
|
|
8
|
-
import { CustomerResponse } from '../model';
|
|
9
|
-
import { code as currencyCode } from 'currency-codes';
|
|
10
|
-
|
|
11
|
-
export const description = {
|
|
12
|
-
name: 'Update Customer',
|
|
13
|
-
value: 'update',
|
|
14
|
-
description: 'Update an existing customer',
|
|
15
|
-
action: 'Update a customer',
|
|
16
|
-
};
|
|
17
|
-
|
|
18
|
-
const updateProperties: INodeProperties[] = [
|
|
19
|
-
{
|
|
20
|
-
displayName: 'Name',
|
|
21
|
-
name: 'Name',
|
|
22
|
-
type: 'string',
|
|
23
|
-
default: '',
|
|
24
|
-
description: 'Customer name',
|
|
25
|
-
},
|
|
26
|
-
{
|
|
27
|
-
displayName: 'Active',
|
|
28
|
-
name: 'Active',
|
|
29
|
-
type: 'boolean',
|
|
30
|
-
default: true,
|
|
31
|
-
description: 'Whether the customer is active',
|
|
32
|
-
},
|
|
33
|
-
{
|
|
34
|
-
displayName: 'Address 1',
|
|
35
|
-
name: 'Address1',
|
|
36
|
-
type: 'string',
|
|
37
|
-
default: '',
|
|
38
|
-
description: "Customer's primary address",
|
|
39
|
-
},
|
|
40
|
-
{
|
|
41
|
-
displayName: 'Address 2',
|
|
42
|
-
name: 'Address2',
|
|
43
|
-
type: 'string',
|
|
44
|
-
default: '',
|
|
45
|
-
description: "Customer's secondary address",
|
|
46
|
-
},
|
|
47
|
-
{
|
|
48
|
-
displayName: 'City',
|
|
49
|
-
name: 'City',
|
|
50
|
-
type: 'string',
|
|
51
|
-
default: '',
|
|
52
|
-
description: "Customer's city",
|
|
53
|
-
},
|
|
54
|
-
{
|
|
55
|
-
displayName: 'Comments',
|
|
56
|
-
name: 'Comments',
|
|
57
|
-
type: 'string',
|
|
58
|
-
default: '',
|
|
59
|
-
description: 'Comments about the customer',
|
|
60
|
-
},
|
|
61
|
-
{
|
|
62
|
-
displayName: 'Currency',
|
|
63
|
-
name: 'Currency',
|
|
64
|
-
type: 'string',
|
|
65
|
-
default: '',
|
|
66
|
-
description: "Customer's currency code, e.g., SEK, EUR",
|
|
67
|
-
},
|
|
68
|
-
{
|
|
69
|
-
displayName: 'Cost Center',
|
|
70
|
-
name: 'CostCenter',
|
|
71
|
-
type: 'string',
|
|
72
|
-
default: '',
|
|
73
|
-
description: "Customer's cost center",
|
|
74
|
-
},
|
|
75
|
-
{
|
|
76
|
-
displayName: 'Country',
|
|
77
|
-
name: 'Country',
|
|
78
|
-
type: 'string',
|
|
79
|
-
default: '',
|
|
80
|
-
description: "Customer's country",
|
|
81
|
-
},
|
|
82
|
-
{
|
|
83
|
-
displayName: 'Country Code',
|
|
84
|
-
name: 'CountryCode',
|
|
85
|
-
type: 'string',
|
|
86
|
-
default: '',
|
|
87
|
-
description: "Customer's country code",
|
|
88
|
-
},
|
|
89
|
-
{
|
|
90
|
-
displayName: 'Email',
|
|
91
|
-
name: 'Email',
|
|
92
|
-
type: 'string',
|
|
93
|
-
default: '',
|
|
94
|
-
description: "Customer's email address",
|
|
95
|
-
},
|
|
96
|
-
{
|
|
97
|
-
displayName: 'External Reference',
|
|
98
|
-
name: 'ExternalReference',
|
|
99
|
-
type: 'string',
|
|
100
|
-
default: '',
|
|
101
|
-
description: 'External reference for the customer',
|
|
102
|
-
},
|
|
103
|
-
{
|
|
104
|
-
displayName: 'Fax',
|
|
105
|
-
name: 'Fax',
|
|
106
|
-
type: 'string',
|
|
107
|
-
default: '',
|
|
108
|
-
description: "Customer's fax number",
|
|
109
|
-
},
|
|
110
|
-
{
|
|
111
|
-
displayName: 'GLN',
|
|
112
|
-
name: 'GLN',
|
|
113
|
-
type: 'string',
|
|
114
|
-
default: '',
|
|
115
|
-
description: 'Global Location Number',
|
|
116
|
-
},
|
|
117
|
-
{
|
|
118
|
-
displayName: 'Organisation Number',
|
|
119
|
-
name: 'OrganisationNumber',
|
|
120
|
-
type: 'string',
|
|
121
|
-
default: '',
|
|
122
|
-
description: "Customer's organisation number",
|
|
123
|
-
},
|
|
124
|
-
{
|
|
125
|
-
displayName: 'Phone 1',
|
|
126
|
-
name: 'Phone1',
|
|
127
|
-
type: 'string',
|
|
128
|
-
default: '',
|
|
129
|
-
description: "Customer's primary phone number",
|
|
130
|
-
},
|
|
131
|
-
{
|
|
132
|
-
displayName: 'Phone 2',
|
|
133
|
-
name: 'Phone2',
|
|
134
|
-
type: 'string',
|
|
135
|
-
default: '',
|
|
136
|
-
description: "Customer's secondary phone number",
|
|
137
|
-
},
|
|
138
|
-
{
|
|
139
|
-
displayName: 'Type',
|
|
140
|
-
name: 'Type',
|
|
141
|
-
type: 'options',
|
|
142
|
-
options: [
|
|
143
|
-
{
|
|
144
|
-
name: 'Private',
|
|
145
|
-
value: 'PRIVATE',
|
|
146
|
-
},
|
|
147
|
-
{
|
|
148
|
-
name: 'Company',
|
|
149
|
-
value: 'COMPANY',
|
|
150
|
-
},
|
|
151
|
-
],
|
|
152
|
-
default: 'COMPANY',
|
|
153
|
-
description: 'Type of customer',
|
|
154
|
-
},
|
|
155
|
-
{
|
|
156
|
-
displayName: 'VAT Number',
|
|
157
|
-
name: 'VATNumber',
|
|
158
|
-
type: 'string',
|
|
159
|
-
default: '',
|
|
160
|
-
description: "Customer's VAT number",
|
|
161
|
-
},
|
|
162
|
-
{
|
|
163
|
-
displayName: 'VAT Type',
|
|
164
|
-
name: 'VATType',
|
|
165
|
-
type: 'options',
|
|
166
|
-
options: [
|
|
167
|
-
{
|
|
168
|
-
name: 'SE VAT',
|
|
169
|
-
value: 'SEVAT',
|
|
170
|
-
},
|
|
171
|
-
{
|
|
172
|
-
name: 'SE Reversed VAT',
|
|
173
|
-
value: 'SEREVERSEDVAT',
|
|
174
|
-
},
|
|
175
|
-
{
|
|
176
|
-
name: 'EU Reversed VAT',
|
|
177
|
-
value: 'EUREVERSEDVAT',
|
|
178
|
-
},
|
|
179
|
-
{
|
|
180
|
-
name: 'EU VAT',
|
|
181
|
-
value: 'EUVAT',
|
|
182
|
-
},
|
|
183
|
-
{
|
|
184
|
-
name: 'Export',
|
|
185
|
-
value: 'EXPORT',
|
|
186
|
-
},
|
|
187
|
-
],
|
|
188
|
-
default: 'SEVAT',
|
|
189
|
-
description: 'Type of VAT applied',
|
|
190
|
-
},
|
|
191
|
-
{
|
|
192
|
-
displayName: 'Website',
|
|
193
|
-
name: 'WWW',
|
|
194
|
-
type: 'string',
|
|
195
|
-
default: '',
|
|
196
|
-
description: "Customer's website URL",
|
|
197
|
-
},
|
|
198
|
-
{
|
|
199
|
-
displayName: 'ZIP Code',
|
|
200
|
-
name: 'ZipCode',
|
|
201
|
-
type: 'string',
|
|
202
|
-
default: '',
|
|
203
|
-
description: "Customer's ZIP/postal code",
|
|
204
|
-
},
|
|
205
|
-
];
|
|
206
|
-
|
|
207
|
-
export const properties: INodeProperties[] = [
|
|
208
|
-
{
|
|
209
|
-
displayName: 'Customer Number',
|
|
210
|
-
name: 'customerNumber',
|
|
211
|
-
type: 'string',
|
|
212
|
-
required: true,
|
|
213
|
-
default: '',
|
|
214
|
-
description: 'Unique identifier for customer',
|
|
215
|
-
displayOptions: {
|
|
216
|
-
show: {
|
|
217
|
-
resource: ['customer'],
|
|
218
|
-
operation: ['update'],
|
|
219
|
-
},
|
|
220
|
-
},
|
|
221
|
-
},
|
|
222
|
-
{
|
|
223
|
-
displayName: 'Fields',
|
|
224
|
-
name: 'fields',
|
|
225
|
-
type: 'collection',
|
|
226
|
-
placeholder: 'Add Field',
|
|
227
|
-
default: {},
|
|
228
|
-
displayOptions: {
|
|
229
|
-
show: {
|
|
230
|
-
resource: ['customer'],
|
|
231
|
-
operation: ['update'],
|
|
232
|
-
},
|
|
233
|
-
},
|
|
234
|
-
options: [...updateProperties],
|
|
235
|
-
},
|
|
236
|
-
];
|
|
237
|
-
|
|
238
|
-
export async function execute(
|
|
239
|
-
this: IExecuteFunctions,
|
|
240
|
-
i: number
|
|
241
|
-
): Promise<CustomerResponse> {
|
|
242
|
-
const customerNumber = this.getNodeParameter('customerNumber', i) as string;
|
|
243
|
-
const fields = this.getNodeParameter('fields', i, {}) as IDataObject;
|
|
244
|
-
|
|
245
|
-
if (Object.keys(fields).length === 0) {
|
|
246
|
-
throw new NodeOperationError(
|
|
247
|
-
this.getNode(),
|
|
248
|
-
'At least one field must be provided for update'
|
|
249
|
-
);
|
|
250
|
-
}
|
|
251
|
-
|
|
252
|
-
if (fields.name && fields.name === '') {
|
|
253
|
-
throw new NodeOperationError(
|
|
254
|
-
this.getNode(),
|
|
255
|
-
'Customer name cannot be empty'
|
|
256
|
-
);
|
|
257
|
-
}
|
|
258
|
-
|
|
259
|
-
if (fields.Currency) {
|
|
260
|
-
fields.Currency = String(fields.Currency).toUpperCase();
|
|
261
|
-
if (currencyCode(fields.Currency) === undefined) {
|
|
262
|
-
throw new NodeOperationError(
|
|
263
|
-
this.getNode(),
|
|
264
|
-
`Invalid currency code: ${fields.Currency}. Use ISO 4217 currency code.`
|
|
265
|
-
);
|
|
266
|
-
}
|
|
267
|
-
}
|
|
268
|
-
|
|
269
|
-
const body = {
|
|
270
|
-
Customer: {
|
|
271
|
-
...fields,
|
|
272
|
-
},
|
|
273
|
-
};
|
|
274
|
-
|
|
275
|
-
const endpoint = `/customers/${encodeURIComponent(customerNumber)}`;
|
|
276
|
-
|
|
277
|
-
return await apiRequest<CustomerResponse>(
|
|
278
|
-
this,
|
|
279
|
-
{
|
|
280
|
-
method: 'PUT',
|
|
281
|
-
endpoint: endpoint,
|
|
282
|
-
body: body,
|
|
283
|
-
},
|
|
284
|
-
{
|
|
285
|
-
id: customerNumber,
|
|
286
|
-
}
|
|
287
|
-
);
|
|
288
|
-
}
|
|
@@ -1,32 +0,0 @@
|
|
|
1
|
-
import { INodeProperties, NodePropertyTypes } from 'n8n-workflow';
|
|
2
|
-
|
|
3
|
-
const sortByDefinitions = [
|
|
4
|
-
['Customer Number', 'customernumber'],
|
|
5
|
-
['Name', 'name'],
|
|
6
|
-
];
|
|
7
|
-
|
|
8
|
-
function createSortProperties(parameters: string[][]): INodeProperties[] {
|
|
9
|
-
const options = parameters.map(([displayName, fieldName]) => {
|
|
10
|
-
return {
|
|
11
|
-
name: displayName,
|
|
12
|
-
value: fieldName,
|
|
13
|
-
description: `Sort by ${displayName.toLowerCase()}`,
|
|
14
|
-
};
|
|
15
|
-
});
|
|
16
|
-
|
|
17
|
-
return [
|
|
18
|
-
{
|
|
19
|
-
displayName: 'Sort by',
|
|
20
|
-
name: 'sortby',
|
|
21
|
-
type: 'options' as NodePropertyTypes,
|
|
22
|
-
noDataExpression: true,
|
|
23
|
-
options: options,
|
|
24
|
-
default: options[0].value,
|
|
25
|
-
placeholder: 'Select a field to sort by',
|
|
26
|
-
description: 'Select a field to sort by',
|
|
27
|
-
},
|
|
28
|
-
];
|
|
29
|
-
}
|
|
30
|
-
|
|
31
|
-
export const sortParameters: INodeProperties[] =
|
|
32
|
-
createSortProperties(sortByDefinitions);
|
|
@@ -1,88 +0,0 @@
|
|
|
1
|
-
import { INodeProperties } from 'n8n-workflow';
|
|
2
|
-
import {
|
|
3
|
-
createOptionParameter,
|
|
4
|
-
createParameter,
|
|
5
|
-
ParameterDefinition,
|
|
6
|
-
OptionParameterDefinition,
|
|
7
|
-
} from '../../commons';
|
|
8
|
-
|
|
9
|
-
const optionParametersDefinitions: OptionParameterDefinition[] = [
|
|
10
|
-
{
|
|
11
|
-
displayName: 'Invoice Status',
|
|
12
|
-
name: 'filter',
|
|
13
|
-
parameters: [
|
|
14
|
-
['Cancelled', 'cancelled'],
|
|
15
|
-
['Fully Paid', 'fullypaid'],
|
|
16
|
-
['Unbooked', 'unbooked'],
|
|
17
|
-
['Unpaid', 'unpaid'],
|
|
18
|
-
['Unpaid And Overdue', 'unpaidoverdue'],
|
|
19
|
-
],
|
|
20
|
-
},
|
|
21
|
-
{
|
|
22
|
-
displayName: 'Invoice Type',
|
|
23
|
-
name: 'InvoiceType',
|
|
24
|
-
parameters: [
|
|
25
|
-
['Invoice', 'invoice'],
|
|
26
|
-
['Agreement Invoice', 'agreementinvoice'],
|
|
27
|
-
['Intrest Invoice', 'intrestinvoice'],
|
|
28
|
-
['Summery Invoice', 'summaryinvoice'],
|
|
29
|
-
['Cash Invoice', 'cashinvoice'],
|
|
30
|
-
],
|
|
31
|
-
},
|
|
32
|
-
];
|
|
33
|
-
|
|
34
|
-
const parametersDefinitions: ParameterDefinition[] = [
|
|
35
|
-
['Account Number From', 'accountnumberfrom', 'string', '', {}],
|
|
36
|
-
['Account Number To', 'accountnumberto', 'string', '', {}],
|
|
37
|
-
['Article Description', 'articledescription', 'string', '', {}],
|
|
38
|
-
['Article Number', 'articlenumber', 'string', '', {}],
|
|
39
|
-
['Cost Center', 'costcenter', 'string', '', {}],
|
|
40
|
-
['Credit', 'credit', 'string', '', {}],
|
|
41
|
-
['Currency', 'currency', 'string', '', {}],
|
|
42
|
-
['Customer Name', 'customername', 'string', '', {}],
|
|
43
|
-
['Customer Number', 'customernumber', 'string', '', {}],
|
|
44
|
-
['Document Number', 'documentnumber', 'string', '', {}],
|
|
45
|
-
[
|
|
46
|
-
'External Invoice Reference 1',
|
|
47
|
-
'externalinvoicereference1',
|
|
48
|
-
'string',
|
|
49
|
-
'',
|
|
50
|
-
{},
|
|
51
|
-
],
|
|
52
|
-
[
|
|
53
|
-
'External Invoice Reference 2',
|
|
54
|
-
'externalinvoicereference2',
|
|
55
|
-
'string',
|
|
56
|
-
'',
|
|
57
|
-
{},
|
|
58
|
-
],
|
|
59
|
-
['From Date', 'fromdate', 'string', '', {}],
|
|
60
|
-
['From Final Pay Date', 'fromfinalpaydate', 'string', '', {}],
|
|
61
|
-
['Label', 'label', 'string', '', {}],
|
|
62
|
-
['Last Modified', 'lastmodified', 'string', '', {}],
|
|
63
|
-
['Not Completed', 'notcomplete', 'string', '', {}],
|
|
64
|
-
['OCR', 'ocr', 'string', '', {}],
|
|
65
|
-
['Our Reference', 'ourreference', 'string', '', {}],
|
|
66
|
-
['Project', 'project', 'string', '', {}],
|
|
67
|
-
['Sent', 'sent', 'boolean', false, {}],
|
|
68
|
-
['To Date', 'todate', 'string', '', {}],
|
|
69
|
-
['To Final Pay Date', 'tofinalpaydate', 'string', '', {}],
|
|
70
|
-
['Your Order Number', 'yourordernumber', 'string', '', {}],
|
|
71
|
-
['Your Reference', 'yourreference', 'string', '', {}],
|
|
72
|
-
];
|
|
73
|
-
|
|
74
|
-
export const filterParameters: INodeProperties[] = [
|
|
75
|
-
...optionParametersDefinitions.map((option) =>
|
|
76
|
-
createOptionParameter(option)
|
|
77
|
-
),
|
|
78
|
-
...parametersDefinitions.map(
|
|
79
|
-
([displayName, name, filterType, defaultValue, typeOptions]) =>
|
|
80
|
-
createParameter(
|
|
81
|
-
displayName,
|
|
82
|
-
name,
|
|
83
|
-
filterType,
|
|
84
|
-
defaultValue,
|
|
85
|
-
typeOptions
|
|
86
|
-
)
|
|
87
|
-
),
|
|
88
|
-
];
|
|
@@ -1,49 +0,0 @@
|
|
|
1
|
-
import {
|
|
2
|
-
IExecuteFunctions,
|
|
3
|
-
INodeProperties,
|
|
4
|
-
NodePropertyTypes,
|
|
5
|
-
} from 'n8n-workflow';
|
|
6
|
-
|
|
7
|
-
import * as operations from './operations';
|
|
8
|
-
import { N8NOperationModuleHandler } from '../../../modules';
|
|
9
|
-
|
|
10
|
-
const moduleHandler = new N8NOperationModuleHandler([
|
|
11
|
-
operations.createSingleInvoice,
|
|
12
|
-
operations.getManyInvoices,
|
|
13
|
-
operations.getSingleInvoice,
|
|
14
|
-
operations.updateSingleInvoice,
|
|
15
|
-
]);
|
|
16
|
-
|
|
17
|
-
export const invoiceProperties: INodeProperties[] = [
|
|
18
|
-
{
|
|
19
|
-
displayName: 'Operation',
|
|
20
|
-
name: 'operation',
|
|
21
|
-
type: 'options' as NodePropertyTypes,
|
|
22
|
-
noDataExpression: true,
|
|
23
|
-
displayOptions: {
|
|
24
|
-
show: {
|
|
25
|
-
resource: ['invoice'],
|
|
26
|
-
},
|
|
27
|
-
},
|
|
28
|
-
options: moduleHandler.getDescriptions(),
|
|
29
|
-
default: 'getAll',
|
|
30
|
-
},
|
|
31
|
-
...moduleHandler.getProperties(),
|
|
32
|
-
];
|
|
33
|
-
|
|
34
|
-
export async function invoiceOperations(
|
|
35
|
-
this: IExecuteFunctions,
|
|
36
|
-
{ operation, i }: { operation: string; i: number }
|
|
37
|
-
) {
|
|
38
|
-
if (operation === 'create') {
|
|
39
|
-
return await operations.createSingleInvoice.execute.call(this, i);
|
|
40
|
-
} else if (operation === 'get') {
|
|
41
|
-
return await operations.getSingleInvoice.execute.call(this, i);
|
|
42
|
-
} else if (operation === 'getAll') {
|
|
43
|
-
return await operations.getManyInvoices.execute.call(this, i);
|
|
44
|
-
} else if (operation === 'update') {
|
|
45
|
-
return await operations.updateSingleInvoice.execute.call(this, i);
|
|
46
|
-
}
|
|
47
|
-
return null;
|
|
48
|
-
}
|
|
49
|
-
export * from './operations';
|