@disruptive-learning/n8n-nodes-gigstack 1.1.7 → 1.1.9

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.
@@ -91,5 +91,16 @@ function buildFilterQuery(filters) {
91
91
  if (filters.createdBefore) {
92
92
  qs['created[lte]'] = Math.floor(new Date(filters.createdBefore).getTime() / 1000);
93
93
  }
94
+ // Metadata filters - supports both dot notation (metadata.key) and underscore notation (metadata_key)
95
+ if (filters.metadataFilters) {
96
+ const metadataFilters = filters.metadataFilters;
97
+ const metadataFilterItems = metadataFilters.filters || [];
98
+ for (const filter of metadataFilterItems) {
99
+ if (filter.key && filter.value) {
100
+ // Use dot notation as per API spec: metadata.{key}={value}
101
+ qs[`metadata.${filter.key}`] = filter.value;
102
+ }
103
+ }
104
+ }
94
105
  return qs;
95
106
  }
@@ -595,13 +595,29 @@ class Gigstack {
595
595
  };
596
596
  if (additionalFields.currency)
597
597
  body.currency = additionalFields.currency;
598
+ if (additionalFields.exchange_rate)
599
+ body.exchange_rate = additionalFields.exchange_rate;
598
600
  if (additionalFields.periodicity)
599
601
  body.periodicity = additionalFields.periodicity;
600
602
  if (additionalFields.payment_form)
601
603
  body.payment_form = additionalFields.payment_form;
604
+ if (additionalFields.idempotency_key)
605
+ body.idempotency_key = additionalFields.idempotency_key;
602
606
  if (additionalFields.metadata) {
603
607
  body.metadata = JSON.parse(additionalFields.metadata);
604
608
  }
609
+ // Handle invoice_config
610
+ const invoiceConfig = this.getNodeParameter('invoiceConfig', i, {});
611
+ if (invoiceConfig && Object.keys(invoiceConfig).length > 0) {
612
+ const config = {};
613
+ if (invoiceConfig.serie)
614
+ config.serie = invoiceConfig.serie;
615
+ if (invoiceConfig.folio && invoiceConfig.folio !== 0)
616
+ config.folio = invoiceConfig.folio;
617
+ if (Object.keys(config).length > 0) {
618
+ body.invoice_config = config;
619
+ }
620
+ }
605
621
  responseData = await GenericFunctions_1.gigstackApiRequest.call(this, 'POST', '/receipts', body, qs);
606
622
  responseData = (0, GenericFunctions_1.simplifyResponse)(responseData);
607
623
  }
@@ -575,6 +575,40 @@ exports.clientFields = [
575
575
  default: '',
576
576
  description: 'Filter clients created before this date',
577
577
  },
578
+ {
579
+ displayName: 'Metadata Filters',
580
+ name: 'metadataFilters',
581
+ type: 'fixedCollection',
582
+ typeOptions: {
583
+ multipleValues: true,
584
+ },
585
+ default: {},
586
+ description: 'Filter by metadata fields using key-value pairs',
587
+ options: [
588
+ {
589
+ name: 'filters',
590
+ displayName: 'Metadata Filter',
591
+ values: [
592
+ {
593
+ displayName: 'Key',
594
+ name: 'key',
595
+ type: 'string',
596
+ default: '',
597
+ placeholder: 'e.g., external_id',
598
+ description: 'The metadata field key to filter on',
599
+ },
600
+ {
601
+ displayName: 'Value',
602
+ name: 'value',
603
+ type: 'string',
604
+ default: '',
605
+ placeholder: 'e.g., EXT-123',
606
+ description: 'The value to match',
607
+ },
608
+ ],
609
+ },
610
+ ],
611
+ },
578
612
  ],
579
613
  },
580
614
  // ----------------------------------
@@ -502,6 +502,40 @@ exports.invoiceFields = [
502
502
  default: '',
503
503
  description: 'Filter invoices created before this date',
504
504
  },
505
+ {
506
+ displayName: 'Metadata Filters',
507
+ name: 'metadataFilters',
508
+ type: 'fixedCollection',
509
+ typeOptions: {
510
+ multipleValues: true,
511
+ },
512
+ default: {},
513
+ description: 'Filter by metadata fields using key-value pairs',
514
+ options: [
515
+ {
516
+ name: 'filters',
517
+ displayName: 'Metadata Filter',
518
+ values: [
519
+ {
520
+ displayName: 'Key',
521
+ name: 'key',
522
+ type: 'string',
523
+ default: '',
524
+ placeholder: 'e.g., external_id',
525
+ description: 'The metadata field key to filter on',
526
+ },
527
+ {
528
+ displayName: 'Value',
529
+ name: 'value',
530
+ type: 'string',
531
+ default: '',
532
+ placeholder: 'e.g., INV-12345',
533
+ description: 'The value to match',
534
+ },
535
+ ],
536
+ },
537
+ ],
538
+ },
505
539
  ],
506
540
  },
507
541
  // ----------------------------------
@@ -502,6 +502,40 @@ exports.paymentFields = [
502
502
  default: '',
503
503
  description: 'Filter payments created before this date',
504
504
  },
505
+ {
506
+ displayName: 'Metadata Filters',
507
+ name: 'metadataFilters',
508
+ type: 'fixedCollection',
509
+ typeOptions: {
510
+ multipleValues: true,
511
+ },
512
+ default: {},
513
+ description: 'Filter by metadata fields using key-value pairs',
514
+ options: [
515
+ {
516
+ name: 'filters',
517
+ displayName: 'Metadata Filter',
518
+ values: [
519
+ {
520
+ displayName: 'Key',
521
+ name: 'key',
522
+ type: 'string',
523
+ default: '',
524
+ placeholder: 'e.g., order_id',
525
+ description: 'The metadata field key to filter on',
526
+ },
527
+ {
528
+ displayName: 'Value',
529
+ name: 'value',
530
+ type: 'string',
531
+ default: '',
532
+ placeholder: 'e.g., ORD-12345',
533
+ description: 'The value to match',
534
+ },
535
+ ],
536
+ },
537
+ ],
538
+ },
505
539
  ],
506
540
  },
507
541
  // ----------------------------------
@@ -140,6 +140,23 @@ exports.receiptFields = [
140
140
  default: 'MXN',
141
141
  description: 'Receipt currency',
142
142
  },
143
+ {
144
+ displayName: 'Exchange Rate',
145
+ name: 'exchange_rate',
146
+ type: 'number',
147
+ default: 1,
148
+ typeOptions: {
149
+ numberPrecision: 4,
150
+ },
151
+ description: 'Exchange rate to MXN',
152
+ },
153
+ {
154
+ displayName: 'Idempotency Key',
155
+ name: 'idempotency_key',
156
+ type: 'string',
157
+ default: '',
158
+ description: 'Unique key to prevent duplicate receipts. If a receipt with this key already exists, the existing receipt will be returned.',
159
+ },
143
160
  {
144
161
  displayName: 'Periodicity',
145
162
  name: 'periodicity',
@@ -147,9 +164,9 @@ exports.receiptFields = [
147
164
  options: [
148
165
  { name: 'Day', value: 'day' },
149
166
  { name: 'Week', value: 'week' },
150
- { name: 'Two Weeks', value: 'fortnight' },
167
+ { name: 'Two Weeks', value: 'two_weeks' },
151
168
  { name: 'Month', value: 'month' },
152
- { name: 'Two Months', value: 'bimonth' },
169
+ { name: 'Two Months', value: 'two_months' },
153
170
  ],
154
171
  default: 'month',
155
172
  description: 'Validity period for stamping the receipt',
@@ -177,6 +194,36 @@ exports.receiptFields = [
177
194
  },
178
195
  ],
179
196
  },
197
+ {
198
+ displayName: 'Invoice Config',
199
+ name: 'invoiceConfig',
200
+ type: 'collection',
201
+ placeholder: 'Add Invoice Config',
202
+ default: {},
203
+ displayOptions: {
204
+ show: {
205
+ resource: ['receipt'],
206
+ operation: ['create'],
207
+ },
208
+ },
209
+ description: 'Configure invoice serie and folio for future stamping',
210
+ options: [
211
+ {
212
+ displayName: 'Serie',
213
+ name: 'serie',
214
+ type: 'string',
215
+ default: '',
216
+ description: 'Invoice serie (e.g., "A", "B"). Leave empty for default.',
217
+ },
218
+ {
219
+ displayName: 'Folio',
220
+ name: 'folio',
221
+ type: 'number',
222
+ default: 0,
223
+ description: 'Invoice folio number. Leave 0 for automatic increment.',
224
+ },
225
+ ],
226
+ },
180
227
  // ----------------------------------
181
228
  // receipt: get, cancel, stamp
182
229
  // ----------------------------------
@@ -368,6 +415,40 @@ exports.receiptFields = [
368
415
  default: '',
369
416
  description: 'Filter receipts created before this date',
370
417
  },
418
+ {
419
+ displayName: 'Metadata Filters',
420
+ name: 'metadataFilters',
421
+ type: 'fixedCollection',
422
+ typeOptions: {
423
+ multipleValues: true,
424
+ },
425
+ default: {},
426
+ description: 'Filter by metadata fields using key-value pairs',
427
+ options: [
428
+ {
429
+ name: 'filters',
430
+ displayName: 'Metadata Filter',
431
+ values: [
432
+ {
433
+ displayName: 'Key',
434
+ name: 'key',
435
+ type: 'string',
436
+ default: '',
437
+ placeholder: 'e.g., order_id',
438
+ description: 'The metadata field key to filter on',
439
+ },
440
+ {
441
+ displayName: 'Value',
442
+ name: 'value',
443
+ type: 'string',
444
+ default: '',
445
+ placeholder: 'e.g., ORD-123',
446
+ description: 'The value to match',
447
+ },
448
+ ],
449
+ },
450
+ ],
451
+ },
371
452
  ],
372
453
  },
373
454
  // ----------------------------------
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@disruptive-learning/n8n-nodes-gigstack",
3
- "version": "1.1.7",
3
+ "version": "1.1.9",
4
4
  "description": "n8n community node for Gigstack API - Mexican tax compliance, invoicing, and payment processing",
5
5
  "keywords": [
6
6
  "n8n-community-node-package",