@disruptive-learning/n8n-nodes-gigstack 1.1.9 → 1.2.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.
@@ -10,6 +10,7 @@ const ReceiptDescription_1 = require("./descriptions/ReceiptDescription");
10
10
  const TeamDescription_1 = require("./descriptions/TeamDescription");
11
11
  const UserDescription_1 = require("./descriptions/UserDescription");
12
12
  const WebhookDescription_1 = require("./descriptions/WebhookDescription");
13
+ const DescargarMasivaDescription_1 = require("./descriptions/DescargarMasivaDescription");
13
14
  class Gigstack {
14
15
  constructor() {
15
16
  this.description = {
@@ -70,6 +71,10 @@ class Gigstack {
70
71
  name: 'Webhook',
71
72
  value: 'webhook',
72
73
  },
74
+ {
75
+ name: 'Descarga Masiva (SAT)',
76
+ value: 'descargarMasiva',
77
+ },
73
78
  ],
74
79
  default: 'client',
75
80
  },
@@ -90,6 +95,8 @@ class Gigstack {
90
95
  ...UserDescription_1.userFields,
91
96
  ...WebhookDescription_1.webhookOperations,
92
97
  ...WebhookDescription_1.webhookFields,
98
+ ...DescargarMasivaDescription_1.descargarMasivaOperations,
99
+ ...DescargarMasivaDescription_1.descargarMasivaFields,
93
100
  ],
94
101
  };
95
102
  }
@@ -233,6 +240,11 @@ class Gigstack {
233
240
  const clientId = this.getNodeParameter('clientId', i);
234
241
  responseData = await GenericFunctions_1.gigstackApiRequest.call(this, 'POST', `/clients/${clientId}/stamp-pending-receipts`, {}, qs);
235
242
  }
243
+ else if (operation === 'getSupportDocuments') {
244
+ const clientId = this.getNodeParameter('clientId', i);
245
+ responseData = await GenericFunctions_1.gigstackApiRequest.call(this, 'GET', `/clients/${clientId}/support-documents`, {}, qs);
246
+ responseData = (0, GenericFunctions_1.simplifyResponse)(responseData);
247
+ }
236
248
  }
237
249
  // =====================
238
250
  // SERVICE OPERATIONS
@@ -451,6 +463,144 @@ class Gigstack {
451
463
  responseData = await GenericFunctions_1.gigstackApiRequest.call(this, 'GET', `/invoices/${invoiceId}/files`, {}, qs);
452
464
  responseData = (0, GenericFunctions_1.simplifyResponse)(responseData);
453
465
  }
466
+ else if (operation === 'createDraft') {
467
+ const clientId = this.getNodeParameter('clientId', i);
468
+ const itemsData = this.getNodeParameter('items', i);
469
+ const additionalFields = this.getNodeParameter('additionalFields', i);
470
+ const draftItems = itemsData.itemValues || [];
471
+ const processedDraftItems = draftItems.map((item) => {
472
+ const p = {};
473
+ if (item.id)
474
+ p.id = item.id;
475
+ if (item.description)
476
+ p.description = item.description;
477
+ if (item.quantity)
478
+ p.quantity = item.quantity;
479
+ if (item.unit_price)
480
+ p.unit_price = item.unit_price;
481
+ if (item.product_key)
482
+ p.product_key = item.product_key;
483
+ if (item.unit_key)
484
+ p.unit_key = item.unit_key;
485
+ if (item.includeIva) {
486
+ p.taxes = [{ type: 'IVA', rate: 0.16, factor: 'Tasa', withholding: false }];
487
+ }
488
+ return p;
489
+ });
490
+ const body = {
491
+ client: { id: clientId },
492
+ items: processedDraftItems,
493
+ };
494
+ if (additionalFields.currency)
495
+ body.currency = additionalFields.currency;
496
+ if (additionalFields.exchange_rate)
497
+ body.exchange_rate = additionalFields.exchange_rate;
498
+ if (additionalFields.payment_method)
499
+ body.payment_method = additionalFields.payment_method;
500
+ if (additionalFields.payment_form)
501
+ body.payment_form = additionalFields.payment_form;
502
+ if (additionalFields.use)
503
+ body.use = additionalFields.use;
504
+ if (additionalFields.series)
505
+ body.series = additionalFields.series;
506
+ if (additionalFields.metadata) {
507
+ body.metadata = JSON.parse(additionalFields.metadata);
508
+ }
509
+ responseData = await GenericFunctions_1.gigstackApiRequest.call(this, 'POST', '/invoices/draft', body, qs);
510
+ responseData = (0, GenericFunctions_1.simplifyResponse)(responseData);
511
+ }
512
+ else if (operation === 'getDraft') {
513
+ const draftId = this.getNodeParameter('draftId', i);
514
+ responseData = await GenericFunctions_1.gigstackApiRequest.call(this, 'GET', `/invoices/draft/${draftId}`, {}, qs);
515
+ responseData = (0, GenericFunctions_1.simplifyResponse)(responseData);
516
+ }
517
+ else if (operation === 'getAllDrafts') {
518
+ const returnAll = this.getNodeParameter('returnAll', i);
519
+ if (returnAll) {
520
+ responseData = await GenericFunctions_1.gigstackApiRequestAllItems.call(this, 'GET', '/invoices/draft', {}, qs);
521
+ }
522
+ else {
523
+ const limit = this.getNodeParameter('limit', i);
524
+ qs.limit = limit;
525
+ const response = await GenericFunctions_1.gigstackApiRequest.call(this, 'GET', '/invoices/draft', {}, qs);
526
+ responseData = response.data || [];
527
+ }
528
+ }
529
+ else if (operation === 'updateDraft') {
530
+ const draftId = this.getNodeParameter('draftId', i);
531
+ const updateFields = this.getNodeParameter('updateFields', i);
532
+ const body = {};
533
+ if (updateFields.currency)
534
+ body.currency = updateFields.currency;
535
+ if (updateFields.exchange_rate)
536
+ body.exchange_rate = updateFields.exchange_rate;
537
+ if (updateFields.payment_method)
538
+ body.payment_method = updateFields.payment_method;
539
+ if (updateFields.payment_form)
540
+ body.payment_form = updateFields.payment_form;
541
+ if (updateFields.use)
542
+ body.use = updateFields.use;
543
+ if (updateFields.series)
544
+ body.series = updateFields.series;
545
+ if (updateFields.metadata) {
546
+ body.metadata = JSON.parse(updateFields.metadata);
547
+ }
548
+ responseData = await GenericFunctions_1.gigstackApiRequest.call(this, 'PUT', `/invoices/draft/${draftId}`, body, qs);
549
+ responseData = (0, GenericFunctions_1.simplifyResponse)(responseData);
550
+ }
551
+ else if (operation === 'deleteDraft') {
552
+ const draftId = this.getNodeParameter('draftId', i);
553
+ responseData = await GenericFunctions_1.gigstackApiRequest.call(this, 'DELETE', `/invoices/draft/${draftId}`, {}, qs);
554
+ }
555
+ else if (operation === 'stampDraft') {
556
+ const draftId = this.getNodeParameter('draftId', i);
557
+ responseData = await GenericFunctions_1.gigstackApiRequest.call(this, 'POST', `/invoices/draft/${draftId}/stamp`, {}, qs);
558
+ responseData = (0, GenericFunctions_1.simplifyResponse)(responseData);
559
+ }
560
+ else if (operation === 'previewDraft') {
561
+ const draftId = this.getNodeParameter('draftId', i);
562
+ responseData = await GenericFunctions_1.gigstackApiRequest.call(this, 'POST', `/invoices/draft/${draftId}/preview`, {}, qs);
563
+ responseData = (0, GenericFunctions_1.simplifyResponse)(responseData);
564
+ }
565
+ else if (operation === 'getAllSat') {
566
+ const returnAll = this.getNodeParameter('returnAll', i);
567
+ const filters = this.getNodeParameter('filters', i);
568
+ if (filters.type)
569
+ qs.type = filters.type;
570
+ if (filters.status)
571
+ qs.status = filters.status;
572
+ if (filters.rfc)
573
+ qs.rfc = filters.rfc;
574
+ if (returnAll) {
575
+ responseData = await GenericFunctions_1.gigstackApiRequestAllItems.call(this, 'GET', '/invoices/sat', {}, qs);
576
+ }
577
+ else {
578
+ const limit = this.getNodeParameter('limit', i);
579
+ qs.limit = limit;
580
+ const response = await GenericFunctions_1.gigstackApiRequest.call(this, 'GET', '/invoices/sat', {}, qs);
581
+ responseData = response.data || [];
582
+ }
583
+ }
584
+ else if (operation === 'getSat') {
585
+ const satUuid = this.getNodeParameter('satUuid', i);
586
+ responseData = await GenericFunctions_1.gigstackApiRequest.call(this, 'GET', `/invoices/sat/${satUuid}`, {}, qs);
587
+ responseData = (0, GenericFunctions_1.simplifyResponse)(responseData);
588
+ }
589
+ else if (operation === 'retryXmlSat') {
590
+ const satUuid = this.getNodeParameter('satUuid', i);
591
+ responseData = await GenericFunctions_1.gigstackApiRequest.call(this, 'POST', `/invoices/sat/${satUuid}/retry-xml`, {}, qs);
592
+ responseData = (0, GenericFunctions_1.simplifyResponse)(responseData);
593
+ }
594
+ else if (operation === 'generatePdfSat') {
595
+ const satUuid = this.getNodeParameter('satUuid', i);
596
+ responseData = await GenericFunctions_1.gigstackApiRequest.call(this, 'POST', `/invoices/sat/${satUuid}/pdf`, {}, qs);
597
+ responseData = (0, GenericFunctions_1.simplifyResponse)(responseData);
598
+ }
599
+ else if (operation === 'getSupportDocuments') {
600
+ const invoiceId = this.getNodeParameter('invoiceId', i);
601
+ responseData = await GenericFunctions_1.gigstackApiRequest.call(this, 'GET', `/invoices/${invoiceId}/support-documents`, {}, qs);
602
+ responseData = (0, GenericFunctions_1.simplifyResponse)(responseData);
603
+ }
454
604
  }
455
605
  // =====================
456
606
  // PAYMENT OPERATIONS
@@ -575,6 +725,11 @@ class Gigstack {
575
725
  responseData = await GenericFunctions_1.gigstackApiRequest.call(this, 'POST', `/payments/${paymentId}/refund`, body, qs);
576
726
  responseData = (0, GenericFunctions_1.simplifyResponse)(responseData);
577
727
  }
728
+ else if (operation === 'getSupportDocuments') {
729
+ const paymentId = this.getNodeParameter('paymentId', i);
730
+ responseData = await GenericFunctions_1.gigstackApiRequest.call(this, 'GET', `/payments/${paymentId}/support-documents`, {}, qs);
731
+ responseData = (0, GenericFunctions_1.simplifyResponse)(responseData);
732
+ }
578
733
  }
579
734
  // =====================
580
735
  // RECEIPT OPERATIONS
@@ -958,6 +1113,73 @@ class Gigstack {
958
1113
  responseData = await GenericFunctions_1.gigstackApiRequest.call(this, 'DELETE', `/webhooks/${webhookId}`, {}, qs);
959
1114
  }
960
1115
  }
1116
+ // =====================
1117
+ // DESCARGA MASIVA OPERATIONS
1118
+ // =====================
1119
+ else if (resource === 'descargarMasiva') {
1120
+ if (operation === 'getActivationStatus') {
1121
+ responseData = await GenericFunctions_1.gigstackApiRequest.call(this, 'GET', '/invoices/download/activate/status', {}, qs);
1122
+ responseData = (0, GenericFunctions_1.simplifyResponse)(responseData);
1123
+ }
1124
+ else if (operation === 'activate') {
1125
+ responseData = await GenericFunctions_1.gigstackApiRequest.call(this, 'POST', '/invoices/download/activate', {}, qs);
1126
+ responseData = (0, GenericFunctions_1.simplifyResponse)(responseData);
1127
+ }
1128
+ else if (operation === 'deactivate') {
1129
+ responseData = await GenericFunctions_1.gigstackApiRequest.call(this, 'POST', '/invoices/download/deactivate', {}, qs);
1130
+ responseData = (0, GenericFunctions_1.simplifyResponse)(responseData);
1131
+ }
1132
+ else if (operation === 'createRequest') {
1133
+ const date_from = this.getNodeParameter('date_from', i);
1134
+ const date_to = this.getNodeParameter('date_to', i);
1135
+ const type = this.getNodeParameter('type', i);
1136
+ const additionalFields = this.getNodeParameter('additionalFields', i);
1137
+ const body = { date_from, date_to, type };
1138
+ if (additionalFields.rfc)
1139
+ body.rfc = additionalFields.rfc;
1140
+ responseData = await GenericFunctions_1.gigstackApiRequest.call(this, 'POST', '/invoices/download/request', body, qs);
1141
+ responseData = (0, GenericFunctions_1.simplifyResponse)(responseData);
1142
+ }
1143
+ else if (operation === 'getRequestStatus') {
1144
+ const request_id = this.getNodeParameter('request_id', i);
1145
+ responseData = await GenericFunctions_1.gigstackApiRequest.call(this, 'GET', `/invoices/download/status/${request_id}`, {}, qs);
1146
+ responseData = (0, GenericFunctions_1.simplifyResponse)(responseData);
1147
+ }
1148
+ else if (operation === 'downloadPackage') {
1149
+ const package_id = this.getNodeParameter('package_id', i);
1150
+ responseData = await GenericFunctions_1.gigstackApiRequest.call(this, 'GET', `/invoices/download/package/${package_id}`, {}, qs);
1151
+ responseData = (0, GenericFunctions_1.simplifyResponse)(responseData);
1152
+ }
1153
+ else if (operation === 'getSchedule') {
1154
+ responseData = await GenericFunctions_1.gigstackApiRequest.call(this, 'GET', '/invoices/download/schedule', {}, qs);
1155
+ responseData = (0, GenericFunctions_1.simplifyResponse)(responseData);
1156
+ }
1157
+ else if (operation === 'updateSchedule') {
1158
+ const enabled = this.getNodeParameter('enabled', i);
1159
+ const hour = this.getNodeParameter('hour', i);
1160
+ const types = this.getNodeParameter('types', i);
1161
+ responseData = await GenericFunctions_1.gigstackApiRequest.call(this, 'PUT', '/invoices/download/schedule', { enabled, hour, types }, qs);
1162
+ responseData = (0, GenericFunctions_1.simplifyResponse)(responseData);
1163
+ }
1164
+ else if (operation === 'getScheduleHistory') {
1165
+ responseData = await GenericFunctions_1.gigstackApiRequest.call(this, 'GET', '/invoices/download/schedule/history', {}, qs);
1166
+ responseData = (0, GenericFunctions_1.simplifyResponse)(responseData);
1167
+ }
1168
+ else if (operation === 'getInvoiceByUuid') {
1169
+ const uuid = this.getNodeParameter('uuid', i);
1170
+ responseData = await GenericFunctions_1.gigstackApiRequest.call(this, 'GET', `/invoices/download/invoice/${uuid}`, {}, qs);
1171
+ responseData = (0, GenericFunctions_1.simplifyResponse)(responseData);
1172
+ }
1173
+ else if (operation === 'enableSync') {
1174
+ responseData = await GenericFunctions_1.gigstackApiRequest.call(this, 'POST', '/invoices/download/enable-sync', {}, qs);
1175
+ responseData = (0, GenericFunctions_1.simplifyResponse)(responseData);
1176
+ }
1177
+ else if (operation === 'updateSyncPeriod') {
1178
+ const sync_from = this.getNodeParameter('sync_from', i);
1179
+ responseData = await GenericFunctions_1.gigstackApiRequest.call(this, 'PUT', '/invoices/download/sync-period', { sync_from }, qs);
1180
+ responseData = (0, GenericFunctions_1.simplifyResponse)(responseData);
1181
+ }
1182
+ }
961
1183
  // Return data
962
1184
  if (Array.isArray(responseData)) {
963
1185
  returnData.push(...responseData.map((item) => ({ json: item })));
@@ -49,6 +49,12 @@ exports.clientOperations = [
49
49
  description: 'Stamp all pending receipts for a client',
50
50
  action: 'Stamp pending receipts',
51
51
  },
52
+ {
53
+ name: 'Get Support Documents',
54
+ value: 'getSupportDocuments',
55
+ description: 'List support documents attached to a client',
56
+ action: 'Get client support documents',
57
+ },
52
58
  {
53
59
  name: 'Update',
54
60
  value: 'update',
@@ -326,7 +332,7 @@ exports.clientFields = [
326
332
  displayOptions: {
327
333
  show: {
328
334
  resource: ['client'],
329
- operation: ['get', 'update', 'delete', 'validate', 'stampPendingReceipts'],
335
+ operation: ['get', 'update', 'delete', 'validate', 'stampPendingReceipts', 'getSupportDocuments'],
330
336
  },
331
337
  },
332
338
  description: 'The ID of the client',
@@ -0,0 +1,3 @@
1
+ import type { INodeProperties } from 'n8n-workflow';
2
+ export declare const descargarMasivaOperations: INodeProperties[];
3
+ export declare const descargarMasivaFields: INodeProperties[];
@@ -0,0 +1,301 @@
1
+ "use strict";
2
+ Object.defineProperty(exports, "__esModule", { value: true });
3
+ exports.descargarMasivaFields = exports.descargarMasivaOperations = void 0;
4
+ exports.descargarMasivaOperations = [
5
+ {
6
+ displayName: 'Operation',
7
+ name: 'operation',
8
+ type: 'options',
9
+ noDataExpression: true,
10
+ displayOptions: {
11
+ show: {
12
+ resource: ['descargarMasiva'],
13
+ },
14
+ },
15
+ options: [
16
+ {
17
+ name: 'Activate',
18
+ value: 'activate',
19
+ description: 'Activate Descarga Masiva (enables SAT bulk download billing)',
20
+ action: 'Activate descarga masiva',
21
+ },
22
+ {
23
+ name: 'Create Download Request',
24
+ value: 'createRequest',
25
+ description: 'Create a SAT bulk download request (max 1 month range per request)',
26
+ action: 'Create a download request',
27
+ },
28
+ {
29
+ name: 'Deactivate',
30
+ value: 'deactivate',
31
+ description: 'Deactivate Descarga Masiva',
32
+ action: 'Deactivate descarga masiva',
33
+ },
34
+ {
35
+ name: 'Enable Auto Sync',
36
+ value: 'enableSync',
37
+ description: 'Enable automatic SAT synchronization',
38
+ action: 'Enable auto sync',
39
+ },
40
+ {
41
+ name: 'Get Activation Status',
42
+ value: 'getActivationStatus',
43
+ description: 'Check activation status and billing info for Descarga Masiva',
44
+ action: 'Get activation status',
45
+ },
46
+ {
47
+ name: 'Get Invoice By UUID',
48
+ value: 'getInvoiceByUuid',
49
+ description: 'Fetch a single CFDI from SAT by UUID',
50
+ action: 'Get invoice by UUID',
51
+ },
52
+ {
53
+ name: 'Get Package',
54
+ value: 'downloadPackage',
55
+ description: 'Download a ZIP package of XML files by package ID',
56
+ action: 'Get a download package',
57
+ },
58
+ {
59
+ name: 'Get Request Status',
60
+ value: 'getRequestStatus',
61
+ description: 'Check the status of a download request',
62
+ action: 'Get request status',
63
+ },
64
+ {
65
+ name: 'Get Schedule',
66
+ value: 'getSchedule',
67
+ description: 'Get current download schedule config and FIEL/registration status',
68
+ action: 'Get download schedule',
69
+ },
70
+ {
71
+ name: 'Get Schedule History',
72
+ value: 'getScheduleHistory',
73
+ description: 'Get the last 20 scheduled download requests with live SAT status',
74
+ action: 'Get schedule history',
75
+ },
76
+ {
77
+ name: 'Update Schedule',
78
+ value: 'updateSchedule',
79
+ description: 'Save or update the daily download schedule',
80
+ action: 'Update download schedule',
81
+ },
82
+ {
83
+ name: 'Update Sync Period',
84
+ value: 'updateSyncPeriod',
85
+ description: 'Update the sync start date (defaults to 71 months ago)',
86
+ action: 'Update sync period',
87
+ },
88
+ ],
89
+ default: 'getActivationStatus',
90
+ },
91
+ ];
92
+ exports.descargarMasivaFields = [
93
+ // ----------------------------------
94
+ // descargarMasiva: createRequest
95
+ // ----------------------------------
96
+ {
97
+ displayName: 'Date From',
98
+ name: 'date_from',
99
+ type: 'string',
100
+ required: true,
101
+ default: '',
102
+ placeholder: 'YYYY-MM-DD',
103
+ displayOptions: {
104
+ show: {
105
+ resource: ['descargarMasiva'],
106
+ operation: ['createRequest'],
107
+ },
108
+ },
109
+ description: 'Start date for the download request (YYYY-MM-DD format). Max range is 1 month.',
110
+ },
111
+ {
112
+ displayName: 'Date To',
113
+ name: 'date_to',
114
+ type: 'string',
115
+ required: true,
116
+ default: '',
117
+ placeholder: 'YYYY-MM-DD',
118
+ displayOptions: {
119
+ show: {
120
+ resource: ['descargarMasiva'],
121
+ operation: ['createRequest'],
122
+ },
123
+ },
124
+ description: 'End date for the download request (YYYY-MM-DD format). Max range is 1 month.',
125
+ },
126
+ {
127
+ displayName: 'CFDI Type',
128
+ name: 'type',
129
+ type: 'options',
130
+ required: true,
131
+ options: [
132
+ { name: 'Received - CFDIs received by the business', value: 'received' },
133
+ { name: 'Issued - CFDIs issued by the business', value: 'issued' },
134
+ ],
135
+ default: 'received',
136
+ displayOptions: {
137
+ show: {
138
+ resource: ['descargarMasiva'],
139
+ operation: ['createRequest'],
140
+ },
141
+ },
142
+ description: 'Whether to download CFDIs received or issued by the business',
143
+ },
144
+ {
145
+ displayName: 'Additional Fields',
146
+ name: 'additionalFields',
147
+ type: 'collection',
148
+ placeholder: 'Add Field',
149
+ default: {},
150
+ displayOptions: {
151
+ show: {
152
+ resource: ['descargarMasiva'],
153
+ operation: ['createRequest'],
154
+ },
155
+ },
156
+ options: [
157
+ {
158
+ displayName: 'RFC Filter',
159
+ name: 'rfc',
160
+ type: 'string',
161
+ default: '',
162
+ description: 'Filter by a specific RFC (counterpart RFC for received, or your own for issued)',
163
+ },
164
+ ],
165
+ },
166
+ // ----------------------------------
167
+ // descargarMasiva: getRequestStatus
168
+ // ----------------------------------
169
+ {
170
+ displayName: 'Request ID',
171
+ name: 'request_id',
172
+ type: 'string',
173
+ required: true,
174
+ default: '',
175
+ displayOptions: {
176
+ show: {
177
+ resource: ['descargarMasiva'],
178
+ operation: ['getRequestStatus'],
179
+ },
180
+ },
181
+ description: 'The ID of the download request to check',
182
+ },
183
+ // ----------------------------------
184
+ // descargarMasiva: downloadPackage
185
+ // ----------------------------------
186
+ {
187
+ displayName: 'Package ID',
188
+ name: 'package_id',
189
+ type: 'string',
190
+ required: true,
191
+ default: '',
192
+ displayOptions: {
193
+ show: {
194
+ resource: ['descargarMasiva'],
195
+ operation: ['downloadPackage'],
196
+ },
197
+ },
198
+ description: 'The package ID to download (obtained from a completed download request)',
199
+ },
200
+ // ----------------------------------
201
+ // descargarMasiva: getInvoiceByUuid
202
+ // ----------------------------------
203
+ {
204
+ displayName: 'UUID',
205
+ name: 'uuid',
206
+ type: 'string',
207
+ required: true,
208
+ default: '',
209
+ displayOptions: {
210
+ show: {
211
+ resource: ['descargarMasiva'],
212
+ operation: ['getInvoiceByUuid'],
213
+ },
214
+ },
215
+ description: 'The UUID of the CFDI to fetch from SAT',
216
+ },
217
+ // ----------------------------------
218
+ // descargarMasiva: updateSchedule
219
+ // ----------------------------------
220
+ {
221
+ displayName: 'Enabled',
222
+ name: 'enabled',
223
+ type: 'boolean',
224
+ required: true,
225
+ default: true,
226
+ displayOptions: {
227
+ show: {
228
+ resource: ['descargarMasiva'],
229
+ operation: ['updateSchedule'],
230
+ },
231
+ },
232
+ description: 'Whether to enable the daily download schedule',
233
+ },
234
+ {
235
+ displayName: 'Download Hour (UTC)',
236
+ name: 'hour',
237
+ type: 'number',
238
+ default: 3,
239
+ typeOptions: {
240
+ minValue: 0,
241
+ maxValue: 23,
242
+ },
243
+ displayOptions: {
244
+ show: {
245
+ resource: ['descargarMasiva'],
246
+ operation: ['updateSchedule'],
247
+ },
248
+ },
249
+ description: 'Hour of day (UTC, 0-23) to run the scheduled download',
250
+ },
251
+ {
252
+ displayName: 'CFDI Types to Download',
253
+ name: 'types',
254
+ type: 'multiOptions',
255
+ options: [
256
+ { name: 'Received', value: 'received' },
257
+ { name: 'Issued', value: 'issued' },
258
+ ],
259
+ default: ['received', 'issued'],
260
+ displayOptions: {
261
+ show: {
262
+ resource: ['descargarMasiva'],
263
+ operation: ['updateSchedule'],
264
+ },
265
+ },
266
+ description: 'Which CFDI types to include in scheduled downloads',
267
+ },
268
+ // ----------------------------------
269
+ // descargarMasiva: updateSyncPeriod
270
+ // ----------------------------------
271
+ {
272
+ displayName: 'Sync Start Date',
273
+ name: 'sync_from',
274
+ type: 'string',
275
+ required: true,
276
+ default: '',
277
+ placeholder: 'YYYY-MM-DD',
278
+ displayOptions: {
279
+ show: {
280
+ resource: ['descargarMasiva'],
281
+ operation: ['updateSyncPeriod'],
282
+ },
283
+ },
284
+ description: 'The date from which to start syncing CFDIs (YYYY-MM-DD). SAT allows up to 71 months back.',
285
+ },
286
+ // ----------------------------------
287
+ // descargarMasiva: Common - Team
288
+ // ----------------------------------
289
+ {
290
+ displayName: 'Team ID',
291
+ name: 'team',
292
+ type: 'string',
293
+ default: '',
294
+ displayOptions: {
295
+ show: {
296
+ resource: ['descargarMasiva'],
297
+ },
298
+ },
299
+ description: 'Team ID for Gigstack Connect (multi-team access). Leave empty to use default team.',
300
+ },
301
+ ];
@@ -61,6 +61,78 @@ exports.invoiceOperations = [
61
61
  description: 'Get many payment complement invoices (CFDI type P)',
62
62
  action: 'Get many payment invoices',
63
63
  },
64
+ {
65
+ name: 'Create Draft',
66
+ value: 'createDraft',
67
+ description: 'Create a draft invoice (not stamped yet)',
68
+ action: 'Create a draft invoice',
69
+ },
70
+ {
71
+ name: 'Delete Draft',
72
+ value: 'deleteDraft',
73
+ description: 'Delete a draft invoice',
74
+ action: 'Delete a draft invoice',
75
+ },
76
+ {
77
+ name: 'Get Draft',
78
+ value: 'getDraft',
79
+ description: 'Get a draft invoice by ID',
80
+ action: 'Get a draft invoice',
81
+ },
82
+ {
83
+ name: 'Get Many Drafts',
84
+ value: 'getAllDrafts',
85
+ description: 'Get many draft invoices',
86
+ action: 'Get many draft invoices',
87
+ },
88
+ {
89
+ name: 'Preview Draft',
90
+ value: 'previewDraft',
91
+ description: 'Generate a preview PDF for a draft invoice',
92
+ action: 'Preview a draft invoice',
93
+ },
94
+ {
95
+ name: 'Stamp Draft',
96
+ value: 'stampDraft',
97
+ description: 'Stamp (finalize) a draft into a real CFDI invoice',
98
+ action: 'Stamp a draft invoice',
99
+ },
100
+ {
101
+ name: 'Update Draft',
102
+ value: 'updateDraft',
103
+ description: 'Update a draft invoice',
104
+ action: 'Update a draft invoice',
105
+ },
106
+ {
107
+ name: 'Get Many SAT Invoices',
108
+ value: 'getAllSat',
109
+ description: 'Get many SAT invoices downloaded via Descarga Masiva',
110
+ action: 'Get many SAT invoices',
111
+ },
112
+ {
113
+ name: 'Get SAT Invoice',
114
+ value: 'getSat',
115
+ description: 'Get a single SAT invoice by UUID',
116
+ action: 'Get a SAT invoice',
117
+ },
118
+ {
119
+ name: 'Generate SAT Invoice PDF',
120
+ value: 'generatePdfSat',
121
+ description: 'Generate a PDF for a received SAT invoice',
122
+ action: 'Generate SAT invoice PDF',
123
+ },
124
+ {
125
+ name: 'Retry SAT Invoice XML',
126
+ value: 'retryXmlSat',
127
+ description: 'Retry XML download for a stuck or errored SAT invoice',
128
+ action: 'Retry SAT invoice XML',
129
+ },
130
+ {
131
+ name: 'Get Support Documents',
132
+ value: 'getSupportDocuments',
133
+ description: 'List support documents attached to an invoice',
134
+ action: 'Get invoice support documents',
135
+ },
64
136
  ],
65
137
  default: 'getAllIncome',
66
138
  },
@@ -539,6 +611,372 @@ exports.invoiceFields = [
539
611
  ],
540
612
  },
541
613
  // ----------------------------------
614
+ // invoice: Draft operations
615
+ // ----------------------------------
616
+ {
617
+ displayName: 'Client ID',
618
+ name: 'clientId',
619
+ type: 'string',
620
+ required: true,
621
+ default: '',
622
+ displayOptions: {
623
+ show: {
624
+ resource: ['invoice'],
625
+ operation: ['createDraft'],
626
+ },
627
+ },
628
+ description: 'The ID of the client for this draft invoice',
629
+ },
630
+ {
631
+ displayName: 'Items',
632
+ name: 'items',
633
+ type: 'fixedCollection',
634
+ typeOptions: {
635
+ multipleValues: true,
636
+ minValue: 1,
637
+ },
638
+ required: true,
639
+ default: { itemValues: [{}] },
640
+ displayOptions: {
641
+ show: {
642
+ resource: ['invoice'],
643
+ operation: ['createDraft'],
644
+ },
645
+ },
646
+ placeholder: 'Add Item',
647
+ options: [
648
+ {
649
+ name: 'itemValues',
650
+ displayName: 'Item',
651
+ values: [
652
+ {
653
+ displayName: 'Description',
654
+ name: 'description',
655
+ type: 'string',
656
+ default: '',
657
+ },
658
+ {
659
+ displayName: 'Quantity',
660
+ name: 'quantity',
661
+ type: 'number',
662
+ default: 1,
663
+ },
664
+ {
665
+ displayName: 'Unit Price',
666
+ name: 'unit_price',
667
+ type: 'number',
668
+ default: 0,
669
+ typeOptions: { numberPrecision: 2 },
670
+ },
671
+ {
672
+ displayName: 'Product Key (SAT)',
673
+ name: 'product_key',
674
+ type: 'string',
675
+ default: '80141503',
676
+ },
677
+ {
678
+ displayName: 'Unit Key (SAT)',
679
+ name: 'unit_key',
680
+ type: 'string',
681
+ default: 'E48',
682
+ },
683
+ {
684
+ displayName: 'Service ID',
685
+ name: 'id',
686
+ type: 'string',
687
+ default: '',
688
+ description: 'Service ID to use (inherits service properties)',
689
+ },
690
+ {
691
+ displayName: 'Include IVA 16%',
692
+ name: 'includeIva',
693
+ type: 'boolean',
694
+ default: true,
695
+ },
696
+ ],
697
+ },
698
+ ],
699
+ description: 'Draft invoice line items',
700
+ },
701
+ {
702
+ displayName: 'Additional Fields',
703
+ name: 'additionalFields',
704
+ type: 'collection',
705
+ placeholder: 'Add Field',
706
+ default: {},
707
+ displayOptions: {
708
+ show: {
709
+ resource: ['invoice'],
710
+ operation: ['createDraft'],
711
+ },
712
+ },
713
+ options: [
714
+ {
715
+ displayName: 'Currency',
716
+ name: 'currency',
717
+ type: 'options',
718
+ options: [
719
+ { name: 'MXN - Mexican Peso', value: 'MXN' },
720
+ { name: 'USD - US Dollar', value: 'USD' },
721
+ { name: 'EUR - Euro', value: 'EUR' },
722
+ ],
723
+ default: 'MXN',
724
+ },
725
+ {
726
+ displayName: 'Exchange Rate',
727
+ name: 'exchange_rate',
728
+ type: 'number',
729
+ default: 1,
730
+ typeOptions: { numberPrecision: 4 },
731
+ },
732
+ {
733
+ displayName: 'Payment Method',
734
+ name: 'payment_method',
735
+ type: 'options',
736
+ options: [
737
+ { name: 'PUE - Pago en Una Exhibicion', value: 'PUE' },
738
+ { name: 'PPD - Pago en Parcialidades o Diferido', value: 'PPD' },
739
+ ],
740
+ default: 'PUE',
741
+ },
742
+ {
743
+ displayName: 'Payment Form',
744
+ name: 'payment_form',
745
+ type: 'string',
746
+ default: '03',
747
+ description: 'SAT payment form code (e.g. 03 for transfer)',
748
+ },
749
+ {
750
+ displayName: 'CFDI Use',
751
+ name: 'use',
752
+ type: 'string',
753
+ default: 'G03',
754
+ description: 'CFDI use code (e.g. G03)',
755
+ },
756
+ {
757
+ displayName: 'Series',
758
+ name: 'series',
759
+ type: 'string',
760
+ default: '',
761
+ },
762
+ {
763
+ displayName: 'Metadata',
764
+ name: 'metadata',
765
+ type: 'json',
766
+ default: '{}',
767
+ },
768
+ ],
769
+ },
770
+ // Draft ID field (get, update, delete, stamp, preview)
771
+ {
772
+ displayName: 'Draft ID',
773
+ name: 'draftId',
774
+ type: 'string',
775
+ required: true,
776
+ default: '',
777
+ displayOptions: {
778
+ show: {
779
+ resource: ['invoice'],
780
+ operation: ['getDraft', 'updateDraft', 'deleteDraft', 'stampDraft', 'previewDraft'],
781
+ },
782
+ },
783
+ description: 'The ID of the draft invoice',
784
+ },
785
+ // updateDraft fields
786
+ {
787
+ displayName: 'Update Fields',
788
+ name: 'updateFields',
789
+ type: 'collection',
790
+ placeholder: 'Add Field',
791
+ default: {},
792
+ displayOptions: {
793
+ show: {
794
+ resource: ['invoice'],
795
+ operation: ['updateDraft'],
796
+ },
797
+ },
798
+ options: [
799
+ {
800
+ displayName: 'Currency',
801
+ name: 'currency',
802
+ type: 'string',
803
+ default: '',
804
+ },
805
+ {
806
+ displayName: 'Exchange Rate',
807
+ name: 'exchange_rate',
808
+ type: 'number',
809
+ default: 1,
810
+ typeOptions: { numberPrecision: 4 },
811
+ },
812
+ {
813
+ displayName: 'Payment Method',
814
+ name: 'payment_method',
815
+ type: 'string',
816
+ default: '',
817
+ },
818
+ {
819
+ displayName: 'Payment Form',
820
+ name: 'payment_form',
821
+ type: 'string',
822
+ default: '',
823
+ },
824
+ {
825
+ displayName: 'CFDI Use',
826
+ name: 'use',
827
+ type: 'string',
828
+ default: '',
829
+ },
830
+ {
831
+ displayName: 'Series',
832
+ name: 'series',
833
+ type: 'string',
834
+ default: '',
835
+ },
836
+ {
837
+ displayName: 'Metadata',
838
+ name: 'metadata',
839
+ type: 'json',
840
+ default: '{}',
841
+ },
842
+ ],
843
+ },
844
+ // getAllDrafts
845
+ {
846
+ displayName: 'Return All',
847
+ name: 'returnAll',
848
+ type: 'boolean',
849
+ default: false,
850
+ displayOptions: {
851
+ show: {
852
+ resource: ['invoice'],
853
+ operation: ['getAllDrafts'],
854
+ },
855
+ },
856
+ description: 'Whether to return all results or only up to a given limit',
857
+ },
858
+ {
859
+ displayName: 'Limit',
860
+ name: 'limit',
861
+ type: 'number',
862
+ default: 50,
863
+ typeOptions: { minValue: 1, maxValue: 100 },
864
+ displayOptions: {
865
+ show: {
866
+ resource: ['invoice'],
867
+ operation: ['getAllDrafts'],
868
+ returnAll: [false],
869
+ },
870
+ },
871
+ description: 'Max number of results to return',
872
+ },
873
+ // ----------------------------------
874
+ // invoice: SAT Invoices
875
+ // ----------------------------------
876
+ {
877
+ displayName: 'UUID',
878
+ name: 'satUuid',
879
+ type: 'string',
880
+ required: true,
881
+ default: '',
882
+ displayOptions: {
883
+ show: {
884
+ resource: ['invoice'],
885
+ operation: ['getSat', 'retryXmlSat', 'generatePdfSat'],
886
+ },
887
+ },
888
+ description: 'The UUID of the SAT invoice',
889
+ },
890
+ {
891
+ displayName: 'Return All',
892
+ name: 'returnAll',
893
+ type: 'boolean',
894
+ default: false,
895
+ displayOptions: {
896
+ show: {
897
+ resource: ['invoice'],
898
+ operation: ['getAllSat'],
899
+ },
900
+ },
901
+ description: 'Whether to return all results or only up to a given limit',
902
+ },
903
+ {
904
+ displayName: 'Limit',
905
+ name: 'limit',
906
+ type: 'number',
907
+ default: 50,
908
+ typeOptions: { minValue: 1, maxValue: 100 },
909
+ displayOptions: {
910
+ show: {
911
+ resource: ['invoice'],
912
+ operation: ['getAllSat'],
913
+ returnAll: [false],
914
+ },
915
+ },
916
+ description: 'Max number of results to return',
917
+ },
918
+ {
919
+ displayName: 'Filters',
920
+ name: 'filters',
921
+ type: 'collection',
922
+ placeholder: 'Add Filter',
923
+ default: {},
924
+ displayOptions: {
925
+ show: {
926
+ resource: ['invoice'],
927
+ operation: ['getAllSat'],
928
+ },
929
+ },
930
+ options: [
931
+ {
932
+ displayName: 'Type',
933
+ name: 'type',
934
+ type: 'options',
935
+ options: [
936
+ { name: 'Received', value: 'received' },
937
+ { name: 'Issued', value: 'issued' },
938
+ ],
939
+ default: '',
940
+ description: 'Filter by CFDI direction',
941
+ },
942
+ {
943
+ displayName: 'Status',
944
+ name: 'status',
945
+ type: 'options',
946
+ options: [
947
+ { name: 'Valid', value: 'valid' },
948
+ { name: 'Canceled', value: 'canceled' },
949
+ { name: 'Error', value: 'error' },
950
+ ],
951
+ default: '',
952
+ },
953
+ {
954
+ displayName: 'RFC',
955
+ name: 'rfc',
956
+ type: 'string',
957
+ default: '',
958
+ description: 'Filter by counterpart RFC',
959
+ },
960
+ ],
961
+ },
962
+ // ----------------------------------
963
+ // invoice: Support Documents
964
+ // ----------------------------------
965
+ {
966
+ displayName: 'Invoice ID',
967
+ name: 'invoiceId',
968
+ type: 'string',
969
+ required: true,
970
+ default: '',
971
+ displayOptions: {
972
+ show: {
973
+ resource: ['invoice'],
974
+ operation: ['getSupportDocuments'],
975
+ },
976
+ },
977
+ description: 'The ID of the invoice',
978
+ },
979
+ // ----------------------------------
542
980
  // invoice: Common - Team
543
981
  // ----------------------------------
544
982
  {
@@ -43,6 +43,12 @@ exports.paymentOperations = [
43
43
  description: 'Refund a payment',
44
44
  action: 'Refund a payment',
45
45
  },
46
+ {
47
+ name: 'Get Support Documents',
48
+ value: 'getSupportDocuments',
49
+ description: 'List support documents attached to a payment',
50
+ action: 'Get payment support documents',
51
+ },
46
52
  {
47
53
  name: 'Register',
48
54
  value: 'register',
@@ -292,7 +298,7 @@ exports.paymentFields = [
292
298
  displayOptions: {
293
299
  show: {
294
300
  resource: ['payment'],
295
- operation: ['get', 'cancel', 'markAsPaid', 'refund'],
301
+ operation: ['get', 'cancel', 'markAsPaid', 'refund', 'getSupportDocuments'],
296
302
  },
297
303
  },
298
304
  description: 'The ID of the payment',
@@ -6,3 +6,4 @@ export * from './ReceiptDescription';
6
6
  export * from './TeamDescription';
7
7
  export * from './UserDescription';
8
8
  export * from './WebhookDescription';
9
+ export * from './DescargarMasivaDescription';
@@ -22,3 +22,4 @@ __exportStar(require("./ReceiptDescription"), exports);
22
22
  __exportStar(require("./TeamDescription"), exports);
23
23
  __exportStar(require("./UserDescription"), exports);
24
24
  __exportStar(require("./WebhookDescription"), exports);
25
+ __exportStar(require("./DescargarMasivaDescription"), exports);
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@disruptive-learning/n8n-nodes-gigstack",
3
- "version": "1.1.9",
3
+ "version": "1.2.0",
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",