@pokash/n8n-nodes-optima-rest-api 1.3.0 → 1.4.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.
|
@@ -319,9 +319,45 @@ class OptimaRestApi {
|
|
|
319
319
|
name: 'Purchase Invoice',
|
|
320
320
|
value: 'Purchase',
|
|
321
321
|
},
|
|
322
|
+
{
|
|
323
|
+
name: 'Margin Invoice (VAT marża)',
|
|
324
|
+
value: 'Margin',
|
|
325
|
+
},
|
|
322
326
|
],
|
|
323
327
|
default: 'Sale',
|
|
324
328
|
},
|
|
329
|
+
// Procedura marży - only for Margin Invoice
|
|
330
|
+
{
|
|
331
|
+
displayName: 'Margin Procedure',
|
|
332
|
+
name: 'proceduraMarzy',
|
|
333
|
+
type: 'options',
|
|
334
|
+
displayOptions: {
|
|
335
|
+
show: {
|
|
336
|
+
resource: ['document'],
|
|
337
|
+
operation: ['createInvoice'],
|
|
338
|
+
documentType: ['Margin'],
|
|
339
|
+
},
|
|
340
|
+
},
|
|
341
|
+
options: [
|
|
342
|
+
{
|
|
343
|
+
name: 'Towary używane',
|
|
344
|
+
value: 'towary używane',
|
|
345
|
+
},
|
|
346
|
+
{
|
|
347
|
+
name: 'Biura podróży',
|
|
348
|
+
value: 'biura podróży',
|
|
349
|
+
},
|
|
350
|
+
{
|
|
351
|
+
name: 'Dzieła sztuki',
|
|
352
|
+
value: 'dzieła sztuki',
|
|
353
|
+
},
|
|
354
|
+
{
|
|
355
|
+
name: 'Przedmioty kolekcjonerskie i antyki',
|
|
356
|
+
value: 'przedmioty kolekcjonerskie i antyki',
|
|
357
|
+
},
|
|
358
|
+
],
|
|
359
|
+
default: 'towary używane',
|
|
360
|
+
},
|
|
325
361
|
// Record Type for Additional Record
|
|
326
362
|
{
|
|
327
363
|
displayName: 'Record Type',
|
|
@@ -486,36 +522,54 @@ class OptimaRestApi {
|
|
|
486
522
|
],
|
|
487
523
|
default: 'printDocument',
|
|
488
524
|
},
|
|
489
|
-
// Print
|
|
525
|
+
// Print Format ID
|
|
490
526
|
{
|
|
491
|
-
displayName: '
|
|
492
|
-
name: '
|
|
493
|
-
type: '
|
|
494
|
-
required:
|
|
527
|
+
displayName: 'Format ID',
|
|
528
|
+
name: 'formatId',
|
|
529
|
+
type: 'number',
|
|
530
|
+
required: true,
|
|
495
531
|
displayOptions: {
|
|
496
532
|
show: {
|
|
497
533
|
resource: ['print'],
|
|
498
534
|
operation: ['printDocument'],
|
|
499
535
|
},
|
|
500
536
|
},
|
|
501
|
-
default:
|
|
502
|
-
|
|
503
|
-
description: 'SQL filter to select documents (e.g. "TrN_TrNID = 123" or "EDN_EDNId = 1002")',
|
|
537
|
+
default: 1,
|
|
538
|
+
description: 'ID of the print format from Optima',
|
|
504
539
|
},
|
|
505
|
-
// Print
|
|
540
|
+
// Print SQL Filter
|
|
506
541
|
{
|
|
507
|
-
displayName: '
|
|
508
|
-
name: '
|
|
509
|
-
type: '
|
|
510
|
-
|
|
542
|
+
displayName: 'SQL Filter',
|
|
543
|
+
name: 'filtrSQL',
|
|
544
|
+
type: 'fixedCollection',
|
|
545
|
+
typeOptions: {
|
|
546
|
+
multipleValues: false,
|
|
547
|
+
multipleValueButtonText: 'Add Filter',
|
|
548
|
+
},
|
|
511
549
|
displayOptions: {
|
|
512
550
|
show: {
|
|
513
551
|
resource: ['print'],
|
|
514
552
|
operation: ['printDocument'],
|
|
515
553
|
},
|
|
516
554
|
},
|
|
517
|
-
default:
|
|
518
|
-
description: '
|
|
555
|
+
default: {},
|
|
556
|
+
description: 'SQL filter to select documents',
|
|
557
|
+
options: [
|
|
558
|
+
{
|
|
559
|
+
name: 'filter',
|
|
560
|
+
displayName: 'Filter',
|
|
561
|
+
values: [
|
|
562
|
+
{
|
|
563
|
+
displayName: 'Expression',
|
|
564
|
+
name: 'expression',
|
|
565
|
+
type: 'string',
|
|
566
|
+
default: '',
|
|
567
|
+
placeholder: 'TrN_TrNID = 123',
|
|
568
|
+
description: 'SQL filter expression (e.g. "EDN_EDNId = 1002")',
|
|
569
|
+
},
|
|
570
|
+
],
|
|
571
|
+
},
|
|
572
|
+
],
|
|
519
573
|
},
|
|
520
574
|
// Print Dynamic Parameters
|
|
521
575
|
{
|
|
@@ -524,6 +578,7 @@ class OptimaRestApi {
|
|
|
524
578
|
type: 'fixedCollection',
|
|
525
579
|
typeOptions: {
|
|
526
580
|
multipleValues: true,
|
|
581
|
+
multipleValueButtonText: 'Add Parameter',
|
|
527
582
|
},
|
|
528
583
|
displayOptions: {
|
|
529
584
|
show: {
|
|
@@ -532,7 +587,6 @@ class OptimaRestApi {
|
|
|
532
587
|
},
|
|
533
588
|
},
|
|
534
589
|
default: {},
|
|
535
|
-
placeholder: 'Add Parameter',
|
|
536
590
|
description: 'Dynamic parameters passed to the print template',
|
|
537
591
|
options: [
|
|
538
592
|
{
|
|
@@ -544,14 +598,14 @@ class OptimaRestApi {
|
|
|
544
598
|
name: 'name',
|
|
545
599
|
type: 'string',
|
|
546
600
|
default: '',
|
|
547
|
-
|
|
601
|
+
placeholder: 'Parameter name',
|
|
548
602
|
},
|
|
549
603
|
{
|
|
550
604
|
displayName: 'Value',
|
|
551
605
|
name: 'value',
|
|
552
606
|
type: 'string',
|
|
553
607
|
default: '',
|
|
554
|
-
|
|
608
|
+
placeholder: 'Parameter value',
|
|
555
609
|
},
|
|
556
610
|
],
|
|
557
611
|
},
|
|
@@ -781,6 +835,11 @@ class OptimaRestApi {
|
|
|
781
835
|
if (operation === 'createInvoice') {
|
|
782
836
|
const documentType = this.getNodeParameter('documentType', i);
|
|
783
837
|
const documentData = JSON.parse(this.getNodeParameter('documentData', i));
|
|
838
|
+
// Add ProceduraMarzy for Margin invoices
|
|
839
|
+
if (documentType === 'Margin') {
|
|
840
|
+
const proceduraMarzy = this.getNodeParameter('proceduraMarzy', i);
|
|
841
|
+
documentData.ProceduraMarzy = proceduraMarzy;
|
|
842
|
+
}
|
|
784
843
|
const response = await makeAuthenticatedRequest({
|
|
785
844
|
method: 'POST',
|
|
786
845
|
url: `${gatewayUrl}/api/Documents/Invoice/${documentType}`,
|
|
@@ -974,14 +1033,17 @@ class OptimaRestApi {
|
|
|
974
1033
|
}
|
|
975
1034
|
else if (resource === 'print') {
|
|
976
1035
|
if (operation === 'printDocument') {
|
|
977
|
-
const filtrSQL = this.getNodeParameter('filtrSQL', i, '');
|
|
978
1036
|
const formatId = this.getNodeParameter('formatId', i);
|
|
1037
|
+
const filtrSQLRaw = this.getNodeParameter('filtrSQL', i, {});
|
|
979
1038
|
const dynamicParamsRaw = this.getNodeParameter('dynamicParameters', i, {});
|
|
980
1039
|
const requestBody = {
|
|
981
1040
|
FormatId: formatId,
|
|
982
1041
|
};
|
|
983
|
-
if (
|
|
984
|
-
|
|
1042
|
+
if (filtrSQLRaw.filter) {
|
|
1043
|
+
const filter = filtrSQLRaw.filter;
|
|
1044
|
+
if (filter.expression) {
|
|
1045
|
+
requestBody.FiltrSQL = filter.expression;
|
|
1046
|
+
}
|
|
985
1047
|
}
|
|
986
1048
|
if (dynamicParamsRaw.parameter) {
|
|
987
1049
|
const params = dynamicParamsRaw.parameter;
|