@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.
Files changed (126) hide show
  1. package/CHANGELOG.md +10 -0
  2. package/credentials/index.ts +0 -1
  3. package/dist/credentials/index.d.ts +0 -1
  4. package/dist/credentials/index.js +0 -1
  5. package/dist/credentials/index.js.map +1 -1
  6. package/dist/nodes/index.d.ts +0 -1
  7. package/dist/nodes/index.js +0 -1
  8. package/dist/nodes/index.js.map +1 -1
  9. package/dist/package.json +0 -8
  10. package/dist/tsconfig.tsbuildinfo +1 -1
  11. package/nodes/index.ts +0 -1
  12. package/package.json +1 -9
  13. package/credentials/FortnoxApi.credentials.ts +0 -61
  14. package/dist/credentials/FortnoxApi.credentials.d.ts +0 -9
  15. package/dist/credentials/FortnoxApi.credentials.js +0 -57
  16. package/dist/credentials/FortnoxApi.credentials.js.map +0 -1
  17. package/dist/nodes/fortnox/Fortnox.node.d.ts +0 -5
  18. package/dist/nodes/fortnox/Fortnox.node.js +0 -95
  19. package/dist/nodes/fortnox/Fortnox.node.js.map +0 -1
  20. package/dist/nodes/fortnox/Fortnox.node.json +0 -18
  21. package/dist/nodes/fortnox/FortnoxTrigger.node.d.ts +0 -5
  22. package/dist/nodes/fortnox/FortnoxTrigger.node.js +0 -155
  23. package/dist/nodes/fortnox/FortnoxTrigger.node.js.map +0 -1
  24. package/dist/nodes/fortnox/FortnoxTrigger.node.json +0 -18
  25. package/dist/nodes/fortnox/commons.d.ts +0 -25
  26. package/dist/nodes/fortnox/commons.js +0 -44
  27. package/dist/nodes/fortnox/commons.js.map +0 -1
  28. package/dist/nodes/fortnox/fortnoxLogo.svg +0 -15
  29. package/dist/nodes/fortnox/index.d.ts +0 -6
  30. package/dist/nodes/fortnox/index.js +0 -23
  31. package/dist/nodes/fortnox/index.js.map +0 -1
  32. package/dist/nodes/fortnox/model.d.ts +0 -20
  33. package/dist/nodes/fortnox/model.js +0 -3
  34. package/dist/nodes/fortnox/model.js.map +0 -1
  35. package/dist/nodes/fortnox/resources/customers/filterParameters.d.ts +0 -2
  36. package/dist/nodes/fortnox/resources/customers/filterParameters.js +0 -31
  37. package/dist/nodes/fortnox/resources/customers/filterParameters.js.map +0 -1
  38. package/dist/nodes/fortnox/resources/customers/index.d.ts +0 -7
  39. package/dist/nodes/fortnox/resources/customers/index.js +0 -85
  40. package/dist/nodes/fortnox/resources/customers/index.js.map +0 -1
  41. package/dist/nodes/fortnox/resources/customers/model.d.ts +0 -99
  42. package/dist/nodes/fortnox/resources/customers/model.js +0 -3
  43. package/dist/nodes/fortnox/resources/customers/model.js.map +0 -1
  44. package/dist/nodes/fortnox/resources/customers/operations/create.operation.d.ts +0 -10
  45. package/dist/nodes/fortnox/resources/customers/operations/create.operation.js +0 -281
  46. package/dist/nodes/fortnox/resources/customers/operations/create.operation.js.map +0 -1
  47. package/dist/nodes/fortnox/resources/customers/operations/delete.operation.d.ts +0 -9
  48. package/dist/nodes/fortnox/resources/customers/operations/delete.operation.js +0 -38
  49. package/dist/nodes/fortnox/resources/customers/operations/delete.operation.js.map +0 -1
  50. package/dist/nodes/fortnox/resources/customers/operations/get.operation.d.ts +0 -10
  51. package/dist/nodes/fortnox/resources/customers/operations/get.operation.js +0 -38
  52. package/dist/nodes/fortnox/resources/customers/operations/get.operation.js.map +0 -1
  53. package/dist/nodes/fortnox/resources/customers/operations/getAll.operation.d.ts +0 -10
  54. package/dist/nodes/fortnox/resources/customers/operations/getAll.operation.js +0 -68
  55. package/dist/nodes/fortnox/resources/customers/operations/getAll.operation.js.map +0 -1
  56. package/dist/nodes/fortnox/resources/customers/operations/index.d.ts +0 -5
  57. package/dist/nodes/fortnox/resources/customers/operations/index.js +0 -42
  58. package/dist/nodes/fortnox/resources/customers/operations/index.js.map +0 -1
  59. package/dist/nodes/fortnox/resources/customers/operations/update.operation.d.ts +0 -10
  60. package/dist/nodes/fortnox/resources/customers/operations/update.operation.js +0 -261
  61. package/dist/nodes/fortnox/resources/customers/operations/update.operation.js.map +0 -1
  62. package/dist/nodes/fortnox/resources/customers/sortParameters.d.ts +0 -2
  63. package/dist/nodes/fortnox/resources/customers/sortParameters.js +0 -30
  64. package/dist/nodes/fortnox/resources/customers/sortParameters.js.map +0 -1
  65. package/dist/nodes/fortnox/resources/invoice/filterParameters.d.ts +0 -2
  66. package/dist/nodes/fortnox/resources/invoice/filterParameters.js +0 -72
  67. package/dist/nodes/fortnox/resources/invoice/filterParameters.js.map +0 -1
  68. package/dist/nodes/fortnox/resources/invoice/index.d.ts +0 -7
  69. package/dist/nodes/fortnox/resources/invoice/index.js +0 -81
  70. package/dist/nodes/fortnox/resources/invoice/index.js.map +0 -1
  71. package/dist/nodes/fortnox/resources/invoice/invoiceParameters.d.ts +0 -2
  72. package/dist/nodes/fortnox/resources/invoice/invoiceParameters.js +0 -193
  73. package/dist/nodes/fortnox/resources/invoice/invoiceParameters.js.map +0 -1
  74. package/dist/nodes/fortnox/resources/invoice/model.d.ts +0 -147
  75. package/dist/nodes/fortnox/resources/invoice/model.js +0 -3
  76. package/dist/nodes/fortnox/resources/invoice/model.js.map +0 -1
  77. package/dist/nodes/fortnox/resources/invoice/operations/create.operation.d.ts +0 -10
  78. package/dist/nodes/fortnox/resources/invoice/operations/create.operation.js +0 -64
  79. package/dist/nodes/fortnox/resources/invoice/operations/create.operation.js.map +0 -1
  80. package/dist/nodes/fortnox/resources/invoice/operations/get.operation.d.ts +0 -10
  81. package/dist/nodes/fortnox/resources/invoice/operations/get.operation.js +0 -37
  82. package/dist/nodes/fortnox/resources/invoice/operations/get.operation.js.map +0 -1
  83. package/dist/nodes/fortnox/resources/invoice/operations/getAll.operation.d.ts +0 -10
  84. package/dist/nodes/fortnox/resources/invoice/operations/getAll.operation.js +0 -92
  85. package/dist/nodes/fortnox/resources/invoice/operations/getAll.operation.js.map +0 -1
  86. package/dist/nodes/fortnox/resources/invoice/operations/index.d.ts +0 -4
  87. package/dist/nodes/fortnox/resources/invoice/operations/index.js +0 -41
  88. package/dist/nodes/fortnox/resources/invoice/operations/index.js.map +0 -1
  89. package/dist/nodes/fortnox/resources/invoice/operations/update.operation.d.ts +0 -10
  90. package/dist/nodes/fortnox/resources/invoice/operations/update.operation.js +0 -64
  91. package/dist/nodes/fortnox/resources/invoice/operations/update.operation.js.map +0 -1
  92. package/dist/nodes/fortnox/transport/errorCodes.d.ts +0 -1
  93. package/dist/nodes/fortnox/transport/errorCodes.js +0 -50
  94. package/dist/nodes/fortnox/transport/errorCodes.js.map +0 -1
  95. package/dist/nodes/fortnox/transport/index.d.ts +0 -3
  96. package/dist/nodes/fortnox/transport/index.js +0 -76
  97. package/dist/nodes/fortnox/transport/index.js.map +0 -1
  98. package/nodes/fortnox/Fortnox.node.json +0 -18
  99. package/nodes/fortnox/Fortnox.node.ts +0 -102
  100. package/nodes/fortnox/FortnoxTrigger.node.json +0 -18
  101. package/nodes/fortnox/FortnoxTrigger.node.ts +0 -196
  102. package/nodes/fortnox/commons.ts +0 -94
  103. package/nodes/fortnox/fortnoxLogo.svg +0 -15
  104. package/nodes/fortnox/index.ts +0 -6
  105. package/nodes/fortnox/model.ts +0 -25
  106. package/nodes/fortnox/resources/customers/filterParameters.ts +0 -47
  107. package/nodes/fortnox/resources/customers/index.ts +0 -53
  108. package/nodes/fortnox/resources/customers/model.ts +0 -107
  109. package/nodes/fortnox/resources/customers/operations/create.operation.ts +0 -307
  110. package/nodes/fortnox/resources/customers/operations/delete.operation.ts +0 -49
  111. package/nodes/fortnox/resources/customers/operations/get.operation.ts +0 -50
  112. package/nodes/fortnox/resources/customers/operations/getAll.operation.ts +0 -79
  113. package/nodes/fortnox/resources/customers/operations/index.ts +0 -5
  114. package/nodes/fortnox/resources/customers/operations/update.operation.ts +0 -288
  115. package/nodes/fortnox/resources/customers/sortParameters.ts +0 -32
  116. package/nodes/fortnox/resources/invoice/filterParameters.ts +0 -88
  117. package/nodes/fortnox/resources/invoice/index.ts +0 -49
  118. package/nodes/fortnox/resources/invoice/invoiceParameters.ts +0 -214
  119. package/nodes/fortnox/resources/invoice/model.ts +0 -156
  120. package/nodes/fortnox/resources/invoice/operations/create.operation.ts +0 -71
  121. package/nodes/fortnox/resources/invoice/operations/get.operation.ts +0 -50
  122. package/nodes/fortnox/resources/invoice/operations/getAll.operation.ts +0 -100
  123. package/nodes/fortnox/resources/invoice/operations/index.ts +0 -4
  124. package/nodes/fortnox/resources/invoice/operations/update.operation.ts +0 -79
  125. package/nodes/fortnox/transport/errorCodes.ts +0 -62
  126. package/nodes/fortnox/transport/index.ts +0 -106
@@ -1,6 +0,0 @@
1
- export * from './commons';
2
- export * from './Fortnox.node';
3
- export * from './FortnoxTrigger.node';
4
- export * from './model';
5
- export * from './resources/invoice';
6
- export * from './resources/customers';
@@ -1,25 +0,0 @@
1
- import { IDataObject } from 'n8n-workflow';
2
-
3
- export interface ErrorInformationModel {
4
- // fields in ErrorInformationModel can start with lowercase or uppercase,
5
- code?: number;
6
- Code?: number;
7
- error?: number;
8
- Error?: number;
9
- message?: string;
10
- Message?: string;
11
- }
12
-
13
- export interface ErrorResponseModel extends IDataObject {
14
- ErrorInformation: ErrorInformationModel;
15
- }
16
-
17
- export interface MetaInformationModel {
18
- '@TotalResources': number;
19
- '@TotalPages': number;
20
- '@CurrentPage': number;
21
- }
22
-
23
- export interface ResponseModel extends IDataObject {
24
- MetaInformation: MetaInformationModel;
25
- }
@@ -1,47 +0,0 @@
1
- import { INodeProperties } from 'n8n-workflow';
2
- import {
3
- createOptionParameter,
4
- createParameter,
5
- OptionParameterDefinition,
6
- ParameterDefinition,
7
- } from '../../commons';
8
-
9
- const optionParametersDefinitions: OptionParameterDefinition[] = [
10
- {
11
- displayName: 'Activity',
12
- name: 'filter',
13
- parameters: [
14
- ['Active', 'active'],
15
- ['Inactive', 'inactive'],
16
- ],
17
- },
18
- ];
19
-
20
- const parametersDefinitions: ParameterDefinition[] = [
21
- ['Customer Number', 'customernumber', 'string', '', {}],
22
- ['Name', 'name', 'string', '', {}],
23
- ['ZIP Code', 'zipcode', 'string', '', {}],
24
- ['City', 'city', 'string', '', {}],
25
- ['Email', 'email', 'string', '', {}],
26
- ['Phone', 'phone', 'string', '', {}],
27
- ['Organisation Number', 'organisationnumber', 'string', '', {}],
28
- ['GLN', 'gln', 'string', '', {}],
29
- ['GLN Delivery', 'glndelivery', 'string', '', {}],
30
- ['Last Modified', 'lastmodified', 'string', '', {}],
31
- ];
32
-
33
- export const filterParameters: INodeProperties[] = [
34
- ...optionParametersDefinitions.map((option) =>
35
- createOptionParameter(option)
36
- ),
37
- ...parametersDefinitions.map(
38
- ([displayName, name, filterType, defaultValue, typeOptions]) =>
39
- createParameter(
40
- displayName,
41
- name,
42
- filterType,
43
- defaultValue,
44
- typeOptions
45
- )
46
- ),
47
- ];
@@ -1,53 +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.getManyCustomers,
12
- operations.getSingleCustomer,
13
- operations.createSingleCustomer,
14
- operations.updateSingleCustomer,
15
- operations.deleteSingleCustomer,
16
- ]);
17
-
18
- export const customerProperties: INodeProperties[] = [
19
- {
20
- displayName: 'Operation',
21
- name: 'operation',
22
- type: 'options' as NodePropertyTypes,
23
- noDataExpression: true,
24
- displayOptions: {
25
- show: {
26
- resource: ['customer'],
27
- },
28
- },
29
- options: moduleHandler.getDescriptions(),
30
- default: 'getAll',
31
- },
32
- ...moduleHandler.getProperties(),
33
- ];
34
-
35
- export async function customerOperations(
36
- this: IExecuteFunctions,
37
- { operation, i }: { operation: string; i: number }
38
- ) {
39
- if (operation === 'get') {
40
- return await operations.getSingleCustomer.execute.call(this, i);
41
- } else if (operation === 'getAll') {
42
- return await operations.getManyCustomers.execute.call(this, i);
43
- } else if (operation === 'create') {
44
- return await operations.createSingleCustomer.execute.call(this, i);
45
- } else if (operation === 'update') {
46
- return await operations.updateSingleCustomer.execute.call(this, i);
47
- } else if (operation === 'delete') {
48
- return await operations.deleteSingleCustomer.execute.call(this, i);
49
- }
50
-
51
- return null;
52
- }
53
- export * from './operations';
@@ -1,107 +0,0 @@
1
- import { ResponseModel } from '../../model';
2
-
3
- export interface CustomerBase {
4
- '@url': string;
5
- Address1: string | null;
6
- Address2: string | null;
7
- City: string | null;
8
- CustomerNumber: number;
9
- Email: string | null;
10
- Name: string;
11
- OrganisationNumber: string;
12
- Phone: string | null;
13
- ZipCode: number | string | null;
14
- }
15
-
16
- export type DeliveryType = 'PRINT' | 'EMAIL' | 'PRINTSERVICE';
17
-
18
- export interface DefaultDeliveryTypes {
19
- Invoice: DeliveryType;
20
- Order: DeliveryType;
21
- Offer: DeliveryType;
22
- }
23
-
24
- export interface DefaultTemplates {
25
- Order: string | null;
26
- Offer: string | null;
27
- Invoice: string | null;
28
- CashInvoice: string | null;
29
- }
30
-
31
- export interface CustomerDetails {
32
- Address1: string | null;
33
- Address2: string | null;
34
- City: string | null;
35
- Country: string | null;
36
- Comments: string | null;
37
- Currency: string;
38
- CostCenter: string | null;
39
- CountryCode: string | null;
40
- Active: boolean;
41
- CustomerNumber: string;
42
- DefaultDeliveryTypes: DefaultDeliveryTypes;
43
- DefaultTemplates: DefaultTemplates;
44
- DeliveryAddress1: string | null;
45
- DeliveryAddress2: string | null;
46
- DeliveryCity: string | null;
47
- DeliveryCountry: string | null;
48
- DeliveryCountryCode: string | null;
49
- DeliveryFax: string | null;
50
- DeliveryName: string | null;
51
- DeliveryPhone1: string | null;
52
- DeliveryPhone2: string | null;
53
- DeliveryZipCode: string | null;
54
- Email: string | null;
55
- EmailInvoice: string | null;
56
- EmailInvoiceBCC: string | null;
57
- EmailInvoiceCC: string | null;
58
- EmailOffer: string | null;
59
- EmailOfferBCC: string | null;
60
- EmailOfferCC: string | null;
61
- EmailOrder: string | null;
62
- EmailOrderBCC: string | null;
63
- EmailOrderCC: string | null;
64
- ExternalReference: string | null;
65
- Fax: string | null;
66
- GLN: string | null;
67
- GLNDelivery: string | null;
68
- InvoiceAdministrationFee: number | null;
69
- InvoiceDiscount: number | null;
70
- InvoiceFreight: number | null;
71
- InvoiceRemark: string | null;
72
- Name: string;
73
- OrganisationNumber: string;
74
- OurReference: string | null;
75
- Phone1: string | null;
76
- Phone2: string | null;
77
- PriceList: string | null;
78
- Project: string | null;
79
- SalesAccount: string | null;
80
- ShowPriceVATIncluded: boolean;
81
- TermsOfDelivery: string | null;
82
- TermsOfPayment: string | null;
83
- Type: 'PRIVATE' | 'COMPANY';
84
- VATNumber: string | null;
85
- VATType: 'SEVAT' | 'SEREVERSEDVAT' | 'EUREVERSEDVAT' | 'EUVAT' | 'EXPORT';
86
- VisitingAddress: string | null;
87
- VisitingCity: string | null;
88
- VisitingCountry: string | null;
89
- VisitingCountryCode: string | null;
90
- VisitingZipCode: string | null;
91
- WayOfDelivery: string | null;
92
- WWW: string | null;
93
- YourReference: string | null;
94
- ZipCode: string | null;
95
- }
96
-
97
- export interface Customer extends CustomerDetails {
98
- '@url': string;
99
- }
100
-
101
- export interface CustomersResponse extends ResponseModel {
102
- Customers: CustomerBase[];
103
- }
104
-
105
- export interface CustomerResponse {
106
- Customer: Customer;
107
- }
@@ -1,307 +0,0 @@
1
- import {
2
- IExecuteFunctions,
3
- INodeProperties,
4
- IDataObject,
5
- NodeOperationError,
6
- } from 'n8n-workflow';
7
- import { apiRequest } from '../../../transport';
8
- import { code as currencyCode } from 'currency-codes';
9
- import { CustomerResponse } from '../model';
10
-
11
- export const description = {
12
- name: 'Create Customer',
13
- value: 'create',
14
- description: 'Create a new customer',
15
- action: 'Create a customer',
16
- };
17
-
18
- const createProperties: INodeProperties[] = [
19
- {
20
- displayName: 'Address 1',
21
- name: 'Address1',
22
- type: 'string',
23
- default: '',
24
- description: "Customer's primary address",
25
- },
26
- {
27
- displayName: 'Address 2',
28
- name: 'Address2',
29
- type: 'string',
30
- default: '',
31
- description: "Customer's secondary address",
32
- },
33
- {
34
- displayName: 'City',
35
- name: 'City',
36
- type: 'string',
37
- default: '',
38
- description: "Customer's city",
39
- },
40
- {
41
- displayName: 'Comments',
42
- name: 'Comments',
43
- type: 'string',
44
- default: '',
45
- description: 'Comments about the customer',
46
- },
47
- {
48
- displayName: 'Cost Center',
49
- name: 'CostCenter',
50
- type: 'string',
51
- default: '',
52
- description: "Customer's cost center",
53
- },
54
- {
55
- displayName: 'Country',
56
- name: 'Country',
57
- type: 'string',
58
- default: '',
59
- description: "Customer's country",
60
- },
61
- {
62
- displayName: 'Country Code',
63
- name: 'CountryCode',
64
- type: 'string',
65
- default: '',
66
- description: "Customer's country code",
67
- },
68
- {
69
- displayName: 'Email',
70
- name: 'Email',
71
- type: 'string',
72
- default: '',
73
- description: "Customer's email address",
74
- },
75
- {
76
- displayName: 'External Reference',
77
- name: 'ExternalReference',
78
- type: 'string',
79
- default: '',
80
- description: 'External reference for the customer',
81
- },
82
- {
83
- displayName: 'Fax',
84
- name: 'Fax',
85
- type: 'string',
86
- default: '',
87
- description: "Customer's fax number",
88
- },
89
- {
90
- displayName: 'GLN',
91
- name: 'GLN',
92
- type: 'string',
93
- default: '',
94
- description: 'Global Location Number',
95
- },
96
- {
97
- displayName: 'Organisation Number',
98
- name: 'OrganisationNumber',
99
- type: 'string',
100
- default: '',
101
- description: "Customer's organisation number",
102
- },
103
- {
104
- displayName: 'Phone 1',
105
- name: 'Phone1',
106
- type: 'string',
107
- default: '',
108
- description: "Customer's primary phone number",
109
- },
110
- {
111
- displayName: 'Phone 2',
112
- name: 'Phone2',
113
- type: 'string',
114
- default: '',
115
- description: "Customer's secondary phone number",
116
- },
117
- {
118
- displayName: 'VAT Number',
119
- name: 'VATNumber',
120
- type: 'string',
121
- default: '',
122
- description: "Customer's VAT number",
123
- },
124
- {
125
- displayName: 'Website',
126
- name: 'WWW',
127
- type: 'string',
128
- default: '',
129
- description: "Customer's website URL",
130
- },
131
- {
132
- displayName: 'ZIP Code',
133
- name: 'ZipCode',
134
- type: 'string',
135
- default: '',
136
- description: "Customer's ZIP/postal code",
137
- },
138
- ];
139
-
140
- export const properties: INodeProperties[] = [
141
- {
142
- displayName: 'Name',
143
- name: 'Name',
144
- type: 'string',
145
- required: true,
146
- default: '',
147
- description: 'Customer name',
148
- displayOptions: {
149
- show: {
150
- resource: ['customer'],
151
- operation: ['create'],
152
- },
153
- },
154
- },
155
- {
156
- displayName: 'Active',
157
- name: 'Active',
158
- type: 'boolean',
159
- required: true,
160
- default: true,
161
- description: 'Whether the customer is active',
162
- displayOptions: {
163
- show: {
164
- resource: ['customer'],
165
- operation: ['create'],
166
- },
167
- },
168
- },
169
- {
170
- displayName: 'Currency',
171
- name: 'Currency',
172
- type: 'string',
173
- required: true,
174
- default: 'SEK',
175
- description: 'Currency',
176
- displayOptions: {
177
- show: {
178
- resource: ['customer'],
179
- operation: ['create'],
180
- },
181
- },
182
- },
183
- {
184
- displayName: 'Type',
185
- name: 'Type',
186
- type: 'options',
187
- required: true,
188
- options: [
189
- {
190
- name: 'Private',
191
- value: 'PRIVATE',
192
- },
193
- {
194
- name: 'Company',
195
- value: 'COMPANY',
196
- },
197
- ],
198
- default: 'COMPANY',
199
- description: 'Type of customer',
200
- displayOptions: {
201
- show: {
202
- resource: ['customer'],
203
- operation: ['create'],
204
- },
205
- },
206
- },
207
- {
208
- displayName: 'VAT Type',
209
- name: 'VATType',
210
- type: 'options',
211
- required: true,
212
-
213
- options: [
214
- {
215
- name: 'SE VAT',
216
- value: 'SEVAT',
217
- },
218
- {
219
- name: 'SE Reversed VAT',
220
- value: 'SEREVERSEDVAT',
221
- },
222
- {
223
- name: 'EU Reversed VAT',
224
- value: 'EUREVERSEDVAT',
225
- },
226
- {
227
- name: 'EU VAT',
228
- value: 'EUVAT',
229
- },
230
- {
231
- name: 'Export',
232
- value: 'EXPORT',
233
- },
234
- ],
235
- default: 'SEVAT',
236
- description: 'Type of VAT applied',
237
- displayOptions: {
238
- show: {
239
- resource: ['customer'],
240
- operation: ['create'],
241
- },
242
- },
243
- },
244
- // Additional Fields
245
- {
246
- displayName: 'Additional Fields',
247
- name: 'additionalFields',
248
- type: 'collection',
249
- placeholder: 'Add Field',
250
- default: {},
251
- displayOptions: {
252
- show: {
253
- resource: ['customer'],
254
- operation: ['create'],
255
- },
256
- },
257
- options: [...createProperties],
258
- },
259
- ];
260
-
261
- export async function execute(
262
- this: IExecuteFunctions,
263
- i: number
264
- ): Promise<CustomerResponse> {
265
- const name = this.getNodeParameter('Name', i) as string;
266
- let currency = this.getNodeParameter('Currency', i) as string;
267
- currency = currency.toUpperCase();
268
- const active = this.getNodeParameter('Active', i) as boolean;
269
- const type = this.getNodeParameter('Type', i) as 'COMPANY' | 'PRIVATE';
270
- const vatType = this.getNodeParameter('VATType', i) as
271
- | 'SEVAT'
272
- | 'SEREVERSEDVAT'
273
- | 'EUREVERSEDVAT'
274
- | 'EUVAT'
275
- | 'EXPORT';
276
- const additionalFields = this.getNodeParameter(
277
- 'additionalFields',
278
- i,
279
- {}
280
- ) as IDataObject;
281
-
282
- if (currencyCode(currency) === undefined) {
283
- throw new NodeOperationError(
284
- this.getNode(),
285
- `Invalid currency code: ${currency}. Use ISO 4217 currency code.`
286
- );
287
- }
288
-
289
- const body = {
290
- Customer: {
291
- Name: name,
292
- Currency: currency,
293
- Active: active,
294
- Type: type,
295
- VATType: vatType,
296
- ...additionalFields,
297
- },
298
- };
299
-
300
- const endpoint = `/customers`;
301
-
302
- return await apiRequest<CustomerResponse>(this, {
303
- method: 'POST',
304
- endpoint: endpoint,
305
- body: body,
306
- });
307
- }
@@ -1,49 +0,0 @@
1
- import { IExecuteFunctions, INodeProperties } from 'n8n-workflow';
2
- import { apiRequest } from '../../../transport';
3
-
4
- export const description = {
5
- name: 'Delete Customer',
6
- value: 'delete',
7
- description: 'Delete a single company by customer number',
8
- action: 'Delete a customer',
9
- };
10
-
11
- export const properties: INodeProperties[] = [
12
- {
13
- displayName: 'Customer Number',
14
- name: 'customerNumber',
15
- type: 'string',
16
- required: true,
17
- default: '',
18
- description: 'Unique identifier for customer',
19
- displayOptions: {
20
- show: {
21
- resource: ['customer'],
22
- operation: ['delete'],
23
- },
24
- },
25
- },
26
- ];
27
-
28
- export async function execute(
29
- this: IExecuteFunctions,
30
- i: number
31
- ): Promise<null> {
32
- const customerNumber = this.getNodeParameter(
33
- 'customerNumber',
34
- i,
35
- ''
36
- ) as string;
37
-
38
- const endpoint = `/customers/${encodeURIComponent(customerNumber)}`;
39
- return await apiRequest<null>(
40
- this,
41
- {
42
- method: 'DELETE',
43
- endpoint,
44
- },
45
- {
46
- id: customerNumber,
47
- }
48
- );
49
- }
@@ -1,50 +0,0 @@
1
- import { IExecuteFunctions, INodeProperties } from 'n8n-workflow';
2
- import { apiRequest } from '../../../transport';
3
- import { CustomerResponse } from '../model';
4
-
5
- export const description = {
6
- name: 'Get Customer',
7
- value: 'get',
8
- description: 'Get a single company by customer number',
9
- action: 'Get a customer',
10
- };
11
-
12
- export const properties: INodeProperties[] = [
13
- {
14
- displayName: 'Customer Number',
15
- name: 'customerNumber',
16
- type: 'string',
17
- required: true,
18
- default: '',
19
- description: 'Unique identifier for customer',
20
- displayOptions: {
21
- show: {
22
- resource: ['customer'],
23
- operation: ['get'],
24
- },
25
- },
26
- },
27
- ];
28
-
29
- export async function execute(
30
- this: IExecuteFunctions,
31
- i: number
32
- ): Promise<CustomerResponse> {
33
- const customerNumber = this.getNodeParameter(
34
- 'customerNumber',
35
- i,
36
- ''
37
- ) as string;
38
-
39
- const endpoint = `/customers/${encodeURIComponent(customerNumber)}`;
40
- return await apiRequest<CustomerResponse>(
41
- this,
42
- {
43
- method: 'GET',
44
- endpoint,
45
- },
46
- {
47
- id: customerNumber,
48
- }
49
- );
50
- }