@pokash/n8n-nodes-optima-rest-api 1.1.20 → 1.1.21
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.
|
@@ -289,10 +289,16 @@ class OptimaRestApi {
|
|
|
289
289
|
description: 'Create a sales or purchase invoice',
|
|
290
290
|
action: 'Create an invoice',
|
|
291
291
|
},
|
|
292
|
+
{
|
|
293
|
+
name: 'Create Additional Record',
|
|
294
|
+
value: 'createAdditionalRecord',
|
|
295
|
+
description: 'Create additional purchase/sale record (expense/income)',
|
|
296
|
+
action: 'Create an additional record',
|
|
297
|
+
},
|
|
292
298
|
],
|
|
293
299
|
default: 'createInvoice',
|
|
294
300
|
},
|
|
295
|
-
// Document Type
|
|
301
|
+
// Document Type for Invoice
|
|
296
302
|
{
|
|
297
303
|
displayName: 'Document Type',
|
|
298
304
|
name: 'documentType',
|
|
@@ -315,7 +321,30 @@ class OptimaRestApi {
|
|
|
315
321
|
],
|
|
316
322
|
default: 'Sale',
|
|
317
323
|
},
|
|
318
|
-
//
|
|
324
|
+
// Record Type for Additional Record
|
|
325
|
+
{
|
|
326
|
+
displayName: 'Record Type',
|
|
327
|
+
name: 'recordType',
|
|
328
|
+
type: 'options',
|
|
329
|
+
displayOptions: {
|
|
330
|
+
show: {
|
|
331
|
+
resource: ['document'],
|
|
332
|
+
operation: ['createAdditionalRecord'],
|
|
333
|
+
},
|
|
334
|
+
},
|
|
335
|
+
options: [
|
|
336
|
+
{
|
|
337
|
+
name: 'Purchase (Expense)',
|
|
338
|
+
value: 'Purchase',
|
|
339
|
+
},
|
|
340
|
+
{
|
|
341
|
+
name: 'Sale (Income)',
|
|
342
|
+
value: 'Sale',
|
|
343
|
+
},
|
|
344
|
+
],
|
|
345
|
+
default: 'Purchase',
|
|
346
|
+
},
|
|
347
|
+
// Document Data for Invoice
|
|
319
348
|
{
|
|
320
349
|
displayName: 'Document Data',
|
|
321
350
|
name: 'documentData',
|
|
@@ -330,6 +359,21 @@ class OptimaRestApi {
|
|
|
330
359
|
default: '{\n "platnik": {\n "akronim": "KLIENT01"\n },\n "pozycje": [\n {\n "kod": "PROD01",\n "ilosc": 1,\n "cena": 100\n }\n ]\n}',
|
|
331
360
|
description: 'Document data in JSON format',
|
|
332
361
|
},
|
|
362
|
+
// Record Data for Additional Record
|
|
363
|
+
{
|
|
364
|
+
displayName: 'Record Data',
|
|
365
|
+
name: 'recordData',
|
|
366
|
+
type: 'json',
|
|
367
|
+
required: true,
|
|
368
|
+
displayOptions: {
|
|
369
|
+
show: {
|
|
370
|
+
resource: ['document'],
|
|
371
|
+
operation: ['createAdditionalRecord'],
|
|
372
|
+
},
|
|
373
|
+
},
|
|
374
|
+
default: '{\n "platnik": {\n "akronim": "KLIENT01"\n },\n "pozycje": [\n {\n "kod": "PROD01",\n "ilosc": 1,\n "cena": 100\n }\n ]\n}',
|
|
375
|
+
description: 'Additional record data in JSON format',
|
|
376
|
+
},
|
|
333
377
|
// Product Operations
|
|
334
378
|
{
|
|
335
379
|
displayName: 'Operation',
|
|
@@ -657,6 +701,26 @@ class OptimaRestApi {
|
|
|
657
701
|
}
|
|
658
702
|
returnData.push(result);
|
|
659
703
|
}
|
|
704
|
+
else if (operation === 'createAdditionalRecord') {
|
|
705
|
+
const recordType = this.getNodeParameter('recordType', i);
|
|
706
|
+
const recordData = JSON.parse(this.getNodeParameter('recordData', i));
|
|
707
|
+
const response = await this.helpers.request({
|
|
708
|
+
method: 'POST',
|
|
709
|
+
url: `${gatewayUrl}/api/Documents/AdditionalRecords/${recordType}`,
|
|
710
|
+
headers: {
|
|
711
|
+
Authorization: `Bearer ${token}`,
|
|
712
|
+
},
|
|
713
|
+
body: recordData,
|
|
714
|
+
json: true,
|
|
715
|
+
});
|
|
716
|
+
const result = {
|
|
717
|
+
json: response
|
|
718
|
+
};
|
|
719
|
+
if (items[i].binary) {
|
|
720
|
+
result.binary = items[i].binary;
|
|
721
|
+
}
|
|
722
|
+
returnData.push(result);
|
|
723
|
+
}
|
|
660
724
|
}
|
|
661
725
|
else if (resource === 'dictionary') {
|
|
662
726
|
const options = this.getNodeParameter('options', i, {});
|