n8n-nodes-ritsa-crm 2.5.0 → 2.7.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.
@@ -36,58 +36,42 @@ class RitsaTools {
36
36
  {
37
37
  displayName: 'Modül (Kaynak)',
38
38
  name: 'resource',
39
- type: 'options',
40
- noDataExpression: true,
41
- options: [
42
- { name: 'Geri Aramalar (Callbacks)', value: 'callback' },
43
- { name: 'Hizmetler', value: 'service' },
44
- { name: 'Kasa ve Satış (POS)', value: 'pos' },
45
- { name: 'Mesajlar', value: 'message' },
46
- { name: 'Müşteriler', value: 'customer' },
47
- { name: 'Otomasyonlar', value: 'automation' },
48
- { name: 'Ödemeler', value: 'payment' },
49
- { name: 'Randevular', value: 'appointment' },
50
- { name: 'Satış Fırsatları (Kanban)', value: 'opportunity' },
51
- { name: 'Stok ve Ürünler', value: 'product' },
52
- { name: 'Şube ve Personel', value: 'staff' },
53
- { name: 'Özet (Dashboard)', value: 'dashboard' },
54
- ],
39
+ type: 'string',
55
40
  default: 'customer',
56
- description: 'İşlem yapmak istediğiniz CRM modülünü seçin',
41
+ description: 'İşlem yapılacak CRM modülü. Örn: customer, appointment, message, opportunity, pos, payment, callback, product, service, staff, automation, dashboard.',
57
42
  },
58
- // ---------------------------------------------------------------------------
59
- // CUSTOMER OPERATIONS
60
- // ---------------------------------------------------------------------------
61
43
  {
62
- displayName: 'İşlem',
44
+ displayName: 'İşlem (Operation)',
63
45
  name: 'operation',
64
- type: 'options',
65
- noDataExpression: true,
66
- displayOptions: { show: { resource: ['customer'] } },
67
- options: [
68
- { name: 'Müşteri Detaylarını Getir', value: 'getCustomerDetails', action: 'Müşteri detaylarını getir' },
69
- { name: 'Müşteri Ekle', value: 'createCustomer', action: 'Yeni müşteri oluştur' },
70
- { name: 'Müşteri Güncelle', value: 'updateCustomer', action: 'Müşteri bilgilerini güncelle' },
71
- { name: 'Müşterileri Ara / Listele', value: 'getCustomers', action: 'Müşterileri listele' },
72
- ],
46
+ type: 'string',
73
47
  default: 'getCustomers',
48
+ description: 'Yapılacak teknik işlem. Örn: getCustomers, getCustomerDetails, createCustomer, updateCustomer, getAppointments, createAppointment, updateAppointmentStatus, sendMessage, getMessages, getOpportunities, updateLeadStatus, getCurrentSession, toggleSession, makeSale, getReceivables, collectReceivable, getAutomationRules, toggleAutomation, runAutomation, getDailySummary, createPayment, refundPayment, getCallbacks, createCallback, markAsCalled, getDashboardSummary, getNavBadges, checkStock, getServices, getStaff, getBranches.',
49
+ },
50
+ {
51
+ displayName: 'Parametreler (JSON)',
52
+ name: 'parameters',
53
+ type: 'json',
54
+ default: '{}',
55
+ description: 'Yapay zeka veya dinamik çağrılar için gönderilecek parametreler (JSON objesi). Örn: { "searchQuery": "Ahmet" }',
74
56
  },
57
+ // ---------------------------------------------------------------------------
58
+ // PARAMETERS (SHOW CONDITIONALLY ON GLOBAL OPERATION FIELD)
59
+ // ---------------------------------------------------------------------------
75
60
  {
76
61
  displayName: 'Arama Sorgusu',
77
62
  name: 'searchQuery',
78
63
  type: 'string',
79
64
  default: '',
80
65
  description: 'Örn: "Ahmet", "+905551234567" veya e-posta adresi ile müşteri arayın',
81
- displayOptions: { show: { resource: ['customer'], operation: ['getCustomers'] } },
66
+ displayOptions: { show: { operation: ['getCustomers'] } },
82
67
  },
83
68
  {
84
69
  displayName: 'Müşteri ID',
85
70
  name: 'customerId',
86
71
  type: 'string',
87
- required: true,
88
72
  default: '',
89
- description: 'Örn: "15" (CRM üzerindeki müşteri numarası)',
90
- displayOptions: { show: { resource: ['customer'], operation: ['getCustomerDetails', 'updateCustomer'] } },
73
+ description: 'Örn: "15"',
74
+ displayOptions: { show: { operation: ['getCustomerDetails', 'updateCustomer', 'createAppointment', 'sendMessage', 'getMessages'] } },
91
75
  },
92
76
  {
93
77
  displayName: 'Ad (First Name)',
@@ -95,7 +79,7 @@ class RitsaTools {
95
79
  type: 'string',
96
80
  default: '',
97
81
  description: 'Örn: "Ayşe"',
98
- displayOptions: { show: { resource: ['customer'], operation: ['createCustomer', 'updateCustomer'] } },
82
+ displayOptions: { show: { operation: ['createCustomer', 'updateCustomer'] } },
99
83
  },
100
84
  {
101
85
  displayName: 'Soyad (Last Name)',
@@ -103,31 +87,15 @@ class RitsaTools {
103
87
  type: 'string',
104
88
  default: '',
105
89
  description: 'Örn: "Yılmaz"',
106
- displayOptions: { show: { resource: ['customer'], operation: ['createCustomer', 'updateCustomer'] } },
90
+ displayOptions: { show: { operation: ['createCustomer', 'updateCustomer'] } },
107
91
  },
108
92
  {
109
93
  displayName: 'Telefon',
110
94
  name: 'phone',
111
95
  type: 'string',
112
96
  default: '',
113
- description: 'Örn: "+905551234567" (Ülke koduyla birlikte)',
114
- displayOptions: { show: { resource: ['customer'], operation: ['createCustomer', 'updateCustomer'] } },
115
- },
116
- // ---------------------------------------------------------------------------
117
- // APPOINTMENT OPERATIONS
118
- // ---------------------------------------------------------------------------
119
- {
120
- displayName: 'İşlem',
121
- name: 'operation',
122
- type: 'options',
123
- noDataExpression: true,
124
- displayOptions: { show: { resource: ['appointment'] } },
125
- options: [
126
- { name: 'Randevu Durumunu Güncelle', value: 'updateAppointmentStatus', action: 'Randevu iptal / onay' },
127
- { name: 'Randevu Oluştur', value: 'createAppointment', action: 'Yeni randevu oluştur' },
128
- { name: 'Randevuları Listele', value: 'getAppointments', action: 'Randevuları getir' },
129
- ],
130
- default: 'getAppointments',
97
+ description: 'Örn: "+905551234567"',
98
+ displayOptions: { show: { operation: ['createCustomer', 'updateCustomer'] } },
131
99
  },
132
100
  {
133
101
  displayName: 'Tarih (Yıl-Ay-Gün)',
@@ -135,7 +103,7 @@ class RitsaTools {
135
103
  type: 'string',
136
104
  default: '',
137
105
  description: 'Örn: "2026-06-25". Boş bırakılırsa bugünün randevuları gelir.',
138
- displayOptions: { show: { resource: ['appointment'], operation: ['getAppointments', 'createAppointment'] } },
106
+ displayOptions: { show: { operation: ['getAppointments', 'createAppointment'] } },
139
107
  },
140
108
  {
141
109
  displayName: 'Saat (Saat:Dakika)',
@@ -143,23 +111,15 @@ class RitsaTools {
143
111
  type: 'string',
144
112
  default: '',
145
113
  description: 'Örn: "14:30" veya "09:00"',
146
- displayOptions: { show: { resource: ['appointment'], operation: ['createAppointment'] } },
147
- },
148
- {
149
- displayName: 'Müşteri ID',
150
- name: 'customerId',
151
- type: 'string',
152
- default: '',
153
- description: 'Randevu alınacak müşterinin ID numarası. Örn: "42"',
154
- displayOptions: { show: { resource: ['appointment'], operation: ['createAppointment'] } },
114
+ displayOptions: { show: { operation: ['createAppointment'] } },
155
115
  },
156
116
  {
157
117
  displayName: 'Randevu ID',
158
118
  name: 'appointmentId',
159
119
  type: 'string',
160
120
  default: '',
161
- description: 'Güncellenecek randevunun ID numarası. Örn: "105"',
162
- displayOptions: { show: { resource: ['appointment'], operation: ['updateAppointmentStatus'] } },
121
+ description: 'Örn: "105"',
122
+ displayOptions: { show: { operation: ['updateAppointmentStatus'] } },
163
123
  },
164
124
  {
165
125
  displayName: 'Yeni Durum',
@@ -172,31 +132,7 @@ class RitsaTools {
172
132
  { name: 'Tamamlandı (Completed)', value: 'completed' },
173
133
  ],
174
134
  default: 'confirmed',
175
- displayOptions: { show: { resource: ['appointment'], operation: ['updateAppointmentStatus'] } },
176
- },
177
- // ---------------------------------------------------------------------------
178
- // MESSAGE OPERATIONS
179
- // ---------------------------------------------------------------------------
180
- {
181
- displayName: 'İşlem',
182
- name: 'operation',
183
- type: 'options',
184
- noDataExpression: true,
185
- displayOptions: { show: { resource: ['message'] } },
186
- options: [
187
- { name: 'Mesaj Gönder', value: 'sendMessage', action: 'Mesaj gönder' },
188
- { name: 'Son Mesajları Oku', value: 'getMessages', action: 'Mesajları getir' },
189
- ],
190
- default: 'sendMessage',
191
- },
192
- {
193
- displayName: 'Müşteri Telefonu veya ID',
194
- name: 'customerId',
195
- type: 'string',
196
- required: true,
197
- default: '',
198
- description: 'Örn: "+905551234567" veya CRM Müşteri ID "15"',
199
- displayOptions: { show: { resource: ['message'], operation: ['sendMessage', 'getMessages'] } },
135
+ displayOptions: { show: { operation: ['updateAppointmentStatus'] } },
200
136
  },
201
137
  {
202
138
  displayName: 'Gönderilecek Mesaj',
@@ -205,53 +141,23 @@ class RitsaTools {
205
141
  typeOptions: { alwaysOpenEditWindow: true },
206
142
  default: '',
207
143
  description: 'Müşteriye iletilecek WhatsApp / SMS mesajı metni',
208
- displayOptions: { show: { resource: ['message'], operation: ['sendMessage'] } },
209
- },
210
- // ---------------------------------------------------------------------------
211
- // OPPORTUNITY / KANBAN OPERATIONS
212
- // ---------------------------------------------------------------------------
213
- {
214
- displayName: 'İşlem',
215
- name: 'operation',
216
- type: 'options',
217
- noDataExpression: true,
218
- displayOptions: { show: { resource: ['opportunity'] } },
219
- options: [
220
- { name: 'Fırsat Aşaması Güncelle', value: 'updateLeadStatus', action: 'Pipeline aşaması güncelle' },
221
- { name: 'Fırsat Ekle', value: 'createOpportunity', action: 'Yeni fırsat oluştur' },
222
- { name: 'Fırsatları / Leadleri Listele', value: 'getOpportunities', action: 'Aktif fırsatları listele' },
223
- ],
224
- default: 'getOpportunities',
144
+ displayOptions: { show: { operation: ['sendMessage'] } },
225
145
  },
226
146
  {
227
147
  displayName: 'Fırsat (Lead) ID',
228
148
  name: 'leadId',
229
149
  type: 'string',
230
150
  default: '',
231
- description: 'Örn: "7". Kanban panosundaki kartın numarası.',
232
- displayOptions: { show: { resource: ['opportunity'], operation: ['updateLeadStatus'] } },
151
+ description: 'Örn: "7"',
152
+ displayOptions: { show: { operation: ['updateLeadStatus'] } },
233
153
  },
234
154
  {
235
155
  displayName: 'Yeni Aşama (Durum)',
236
- name: 'newStatus',
156
+ name: 'newStatusText',
237
157
  type: 'string',
238
158
  default: '',
239
159
  description: 'Örn: "Ön Görüşme Yapıldı" veya "Satışa Döndü"',
240
- displayOptions: { show: { resource: ['opportunity'], operation: ['updateLeadStatus'] } },
241
- },
242
- // ---------------------------------------------------------------------------
243
- // INVENTORY / PRODUCT OPERATIONS
244
- // ---------------------------------------------------------------------------
245
- {
246
- displayName: 'İşlem',
247
- name: 'operation',
248
- type: 'options',
249
- noDataExpression: true,
250
- displayOptions: { show: { resource: ['product'] } },
251
- options: [
252
- { name: 'Stok ve Fiyat Sorgula', value: 'checkStock', action: 'Stok ve fiyat bilgisi çek' },
253
- ],
254
- default: 'checkStock',
160
+ displayOptions: { show: { operation: ['updateLeadStatus'] } },
255
161
  },
256
162
  {
257
163
  displayName: 'Ürün Adı / Barkodu',
@@ -259,39 +165,7 @@ class RitsaTools {
259
165
  type: 'string',
260
166
  default: '',
261
167
  description: 'Örn: "Lazer Başlığı" veya "869123456"',
262
- displayOptions: { show: { resource: ['product'], operation: ['checkStock'] } },
263
- },
264
- // ---------------------------------------------------------------------------
265
- // SERVICE OPERATIONS
266
- // ---------------------------------------------------------------------------
267
- {
268
- displayName: 'İşlem',
269
- name: 'operation',
270
- type: 'options',
271
- noDataExpression: true,
272
- displayOptions: { show: { resource: ['service'] } },
273
- options: [
274
- { name: 'Hizmetleri ve Fiyatları Listele', value: 'getServices', action: 'Hizmetleri getir' },
275
- ],
276
- default: 'getServices',
277
- },
278
- // ---------------------------------------------------------------------------
279
- // POS / SALES OPERATIONS
280
- // ---------------------------------------------------------------------------
281
- {
282
- displayName: 'İşlem',
283
- name: 'operation',
284
- type: 'options',
285
- noDataExpression: true,
286
- displayOptions: { show: { resource: ['pos'] } },
287
- options: [
288
- { name: 'Açık Alacakları Getir', value: 'getReceivables' },
289
- { name: 'Alacak Tahsilatı Gir', value: 'collectReceivable' },
290
- { name: 'Kasa Aç / Kapat', value: 'toggleSession' },
291
- { name: 'Mevcut Kasa Oturumu', value: 'getCurrentSession' },
292
- { name: 'Serbest Satış Yap', value: 'makeSale' },
293
- ],
294
- default: 'getCurrentSession',
168
+ displayOptions: { show: { operation: ['checkStock'] } },
295
169
  },
296
170
  {
297
171
  displayName: 'Kasa Aksiyonu',
@@ -302,7 +176,7 @@ class RitsaTools {
302
176
  { name: 'Kasayı Kapat', value: 'close' },
303
177
  ],
304
178
  default: 'open',
305
- displayOptions: { show: { resource: ['pos'], operation: ['toggleSession'] } },
179
+ displayOptions: { show: { operation: ['toggleSession'] } },
306
180
  },
307
181
  {
308
182
  displayName: 'Satış Kalemleri (JSON Array)',
@@ -310,119 +184,39 @@ class RitsaTools {
310
184
  type: 'json',
311
185
  default: '[{ "name": "Örnek Hizmet", "quantity": 1, "unit_price": 200 }]',
312
186
  description: 'Sepete eklenecek ürün/hizmetleri JSON dizisi olarak girin.',
313
- displayOptions: { show: { resource: ['pos'], operation: ['makeSale'] } },
187
+ displayOptions: { show: { operation: ['makeSale'] } },
314
188
  },
315
189
  {
316
190
  displayName: 'Alacak (Receivable) ID',
317
191
  name: 'receivableId',
318
192
  type: 'string',
319
193
  default: '',
320
- description: 'Örn: "15". Tahsilatı yapılacak açık hesabın numarası.',
321
- displayOptions: { show: { resource: ['pos'], operation: ['collectReceivable'] } },
322
- },
323
- // ---------------------------------------------------------------------------
324
- // AUTOMATION OPERATIONS
325
- // ---------------------------------------------------------------------------
326
- {
327
- displayName: 'İşlem',
328
- name: 'operation',
329
- type: 'options',
330
- noDataExpression: true,
331
- displayOptions: { show: { resource: ['automation'] } },
332
- options: [
333
- { name: 'Otomasyon Kurallarını Listele', value: 'getAutomationRules' },
334
- { name: 'Otomasyonu Aç / Kapat', value: 'toggleAutomation' },
335
- { name: 'Otomasyonu Manuel Çalıştır (Tetikle)', value: 'runAutomation' },
336
- ],
337
- default: 'getAutomationRules',
194
+ description: 'Örn: "15"',
195
+ displayOptions: { show: { operation: ['collectReceivable'] } },
338
196
  },
339
197
  {
340
198
  displayName: 'Kural (Rule) ID',
341
199
  name: 'ruleId',
342
200
  type: 'string',
343
201
  default: '',
344
- description: 'Örn: "1". Tetiklenecek veya ayarlanacak otomasyon ID numarası.',
345
- displayOptions: { show: { resource: ['automation'], operation: ['toggleAutomation', 'runAutomation'] } },
346
- },
347
- // ---------------------------------------------------------------------------
348
- // PAYMENT OPERATIONS
349
- // ---------------------------------------------------------------------------
350
- {
351
- displayName: 'İşlem',
352
- name: 'operation',
353
- type: 'options',
354
- noDataExpression: true,
355
- displayOptions: { show: { resource: ['payment'] } },
356
- options: [
357
- { name: 'Günlük Ciro / Kasa Özeti', value: 'getDailySummary' },
358
- { name: 'Ödeme (Tahsilat) Oluştur', value: 'createPayment' },
359
- { name: 'Ödeme İade / İptal Et', value: 'refundPayment' },
360
- ],
361
- default: 'getDailySummary',
202
+ description: 'Örn: "1"',
203
+ displayOptions: { show: { operation: ['toggleAutomation', 'runAutomation'] } },
362
204
  },
363
205
  {
364
206
  displayName: 'Ödeme ID',
365
207
  name: 'paymentId',
366
208
  type: 'string',
367
209
  default: '',
368
- description: 'Örn: "55". İade edilecek ödemenin numarası.',
369
- displayOptions: { show: { resource: ['payment'], operation: ['refundPayment'] } },
370
- },
371
- // ---------------------------------------------------------------------------
372
- // CALLBACK OPERATIONS
373
- // ---------------------------------------------------------------------------
374
- {
375
- displayName: 'İşlem',
376
- name: 'operation',
377
- type: 'options',
378
- noDataExpression: true,
379
- displayOptions: { show: { resource: ['callback'] } },
380
- options: [
381
- { name: 'Geri Arama Görevi Oluştur', value: 'createCallback' },
382
- { name: 'Geri Aramaları Listele', value: 'getCallbacks' },
383
- { name: 'Tamamlandı (Arandı) İşaretle', value: 'markAsCalled' },
384
- ],
385
- default: 'getCallbacks',
210
+ description: 'Örn: "55"',
211
+ displayOptions: { show: { operation: ['refundPayment'] } },
386
212
  },
387
213
  {
388
214
  displayName: 'Arama (Callback) ID',
389
215
  name: 'callbackId',
390
216
  type: 'string',
391
217
  default: '',
392
- description: 'Örn: "3". Arandı olarak işaretlenecek görevin numarası.',
393
- displayOptions: { show: { resource: ['callback'], operation: ['markAsCalled'] } },
394
- },
395
- // ---------------------------------------------------------------------------
396
- // DASHBOARD OPERATIONS
397
- // ---------------------------------------------------------------------------
398
- {
399
- displayName: 'İşlem',
400
- name: 'operation',
401
- type: 'options',
402
- noDataExpression: true,
403
- displayOptions: { show: { resource: ['dashboard'] } },
404
- options: [
405
- { name: 'Ana Özet Verilerini Getir', value: 'getDashboardSummary' },
406
- { name: 'Menü Bildirim Sayılarını Getir', value: 'getNavBadges' },
407
- ],
408
- default: 'getDashboardSummary',
409
- },
410
- // ---------------------------------------------------------------------------
411
- // STAFF & BRANCH OPERATIONS
412
- // ---------------------------------------------------------------------------
413
- {
414
- displayName: 'İşlem',
415
- name: 'operation',
416
- type: 'options',
417
- noDataExpression: true,
418
- displayOptions: { show: { resource: ['staff'] } },
419
- options: [
420
- { name: 'Personelleri Getir', value: 'getStaff' },
421
- { name: 'Personel Ekle', value: 'createStaff' },
422
- { name: 'Şubeleri Getir', value: 'getBranches' },
423
- { name: 'Şube Ekle', value: 'createBranch' },
424
- ],
425
- default: 'getStaff',
218
+ description: 'Örn: "3"',
219
+ displayOptions: { show: { operation: ['markAsCalled'] } },
426
220
  },
427
221
  ],
428
222
  };
@@ -440,6 +234,27 @@ class RitsaTools {
440
234
  // Resolve branch ID from node parameter, fallback to credentials
441
235
  const nodeBranchId = this.getNodeParameter('branchId', i, '');
442
236
  const resolvedBranchId = nodeBranchId ? parseInt(nodeBranchId, 10) : branchId;
237
+ // Parse JSON parameters if supplied (for AI agent dynamic calls)
238
+ const nodeParamsStr = this.getNodeParameter('parameters', i, '{}');
239
+ let nodeParams = {};
240
+ try {
241
+ nodeParams = JSON.parse(nodeParamsStr);
242
+ }
243
+ catch (e) {
244
+ nodeParams = {};
245
+ }
246
+ // Helper to resolve parameters from JSON body or from standard node inputs
247
+ const getParam = (name, defaultValue = '') => {
248
+ if (nodeParams && nodeParams[name] !== undefined) {
249
+ return nodeParams[name];
250
+ }
251
+ try {
252
+ return this.getNodeParameter(name, i, defaultValue);
253
+ }
254
+ catch (e) {
255
+ return defaultValue;
256
+ }
257
+ };
443
258
  try {
444
259
  let responseData;
445
260
  let method = 'GET';
@@ -450,32 +265,32 @@ class RitsaTools {
450
265
  if (operation === 'getCustomers') {
451
266
  method = 'GET';
452
267
  path = '/customers';
453
- const searchQuery = this.getNodeParameter('searchQuery', i, '');
268
+ const searchQuery = getParam('searchQuery');
454
269
  if (searchQuery)
455
270
  qs.search = searchQuery;
456
271
  }
457
272
  else if (operation === 'getCustomerDetails') {
458
273
  method = 'GET';
459
- const customerId = this.getNodeParameter('customerId', i);
274
+ const customerId = getParam('customerId');
460
275
  path = `/customers/${customerId}`;
461
276
  }
462
277
  else if (operation === 'createCustomer') {
463
278
  method = 'POST';
464
279
  path = '/customers';
465
280
  body = {
466
- first_name: this.getNodeParameter('firstName', i, ''),
467
- last_name: this.getNodeParameter('lastName', i, ''),
468
- phone: this.getNodeParameter('phone', i, ''),
281
+ first_name: getParam('firstName'),
282
+ last_name: getParam('lastName'),
283
+ phone: getParam('phone'),
469
284
  };
470
285
  }
471
286
  else if (operation === 'updateCustomer') {
472
- const customerId = this.getNodeParameter('customerId', i);
287
+ const customerId = getParam('customerId');
473
288
  method = 'PUT';
474
289
  path = `/customers/${customerId}`;
475
290
  body = {
476
- first_name: this.getNodeParameter('firstName', i, ''),
477
- last_name: this.getNodeParameter('lastName', i, ''),
478
- phone: this.getNodeParameter('phone', i, ''),
291
+ first_name: getParam('firstName'),
292
+ last_name: getParam('lastName'),
293
+ phone: getParam('phone'),
479
294
  };
480
295
  }
481
296
  }
@@ -483,7 +298,7 @@ class RitsaTools {
483
298
  if (operation === 'getAppointments') {
484
299
  method = 'GET';
485
300
  path = '/appointments';
486
- const date = this.getNodeParameter('date', i, '');
301
+ const date = getParam('date');
487
302
  if (date)
488
303
  qs.date = date;
489
304
  }
@@ -491,16 +306,16 @@ class RitsaTools {
491
306
  method = 'POST';
492
307
  path = '/appointments';
493
308
  body = {
494
- customer_id: this.getNodeParameter('customerId', i),
495
- scheduled_at: `${this.getNodeParameter('date', i)}T${this.getNodeParameter('time', i)}:00`,
309
+ customer_id: getParam('customerId'),
310
+ scheduled_at: `${getParam('date')}T${getParam('time')}:00`,
496
311
  };
497
312
  }
498
313
  else if (operation === 'updateAppointmentStatus') {
499
- const appointmentId = this.getNodeParameter('appointmentId', i);
314
+ const appointmentId = getParam('appointmentId');
500
315
  method = 'PUT';
501
316
  path = `/appointments/${appointmentId}`;
502
317
  body = {
503
- status: this.getNodeParameter('newStatus', i),
318
+ status: getParam('newStatus'),
504
319
  };
505
320
  }
506
321
  }
@@ -512,10 +327,10 @@ class RitsaTools {
512
327
  else if (operation === 'sendMessage') {
513
328
  method = 'POST';
514
329
  path = '/opportunities/send-bulk-message';
515
- const customerId = this.getNodeParameter('customerId', i);
330
+ const customerId = getParam('customerId');
516
331
  body = {
517
332
  customer_ids: [parseInt(customerId, 10)],
518
- message: this.getNodeParameter('messageContent', i),
333
+ message: getParam('messageContent'),
519
334
  };
520
335
  }
521
336
  }
@@ -524,6 +339,14 @@ class RitsaTools {
524
339
  method = 'GET';
525
340
  path = '/opportunities';
526
341
  }
342
+ else if (operation === 'updateLeadStatus') {
343
+ const leadId = getParam('leadId');
344
+ method = 'PUT';
345
+ path = `/opportunities/${leadId}`; // Fallback implementation
346
+ body = {
347
+ status: getParam('newStatusText'),
348
+ };
349
+ }
527
350
  }
528
351
  else if (resource === 'pos') {
529
352
  if (operation === 'getCurrentSession') {
@@ -531,21 +354,35 @@ class RitsaTools {
531
354
  path = '/pos/sessions/current';
532
355
  }
533
356
  else if (operation === 'toggleSession') {
534
- const action = this.getNodeParameter('sessionAction', i);
357
+ const action = getParam('sessionAction');
535
358
  method = 'POST';
536
359
  path = `/pos/sessions/${action}`;
537
360
  }
538
361
  else if (operation === 'makeSale') {
539
362
  method = 'POST';
540
363
  path = '/pos/sale';
541
- const saleItemsStr = this.getNodeParameter('saleItems', i, '[]');
542
- try {
543
- body = JSON.parse(saleItemsStr);
364
+ const saleItemsVal = getParam('saleItems');
365
+ if (typeof saleItemsVal === 'string') {
366
+ try {
367
+ body = JSON.parse(saleItemsVal);
368
+ }
369
+ catch (e) {
370
+ body = {};
371
+ }
544
372
  }
545
- catch (e) {
546
- body = {};
373
+ else {
374
+ body = saleItemsVal;
547
375
  }
548
376
  }
377
+ else if (operation === 'getReceivables') {
378
+ method = 'GET';
379
+ path = '/pos/receivables';
380
+ }
381
+ else if (operation === 'collectReceivable') {
382
+ const receivableId = getParam('receivableId');
383
+ method = 'POST';
384
+ path = `/pos/receivables/${receivableId}/collect`;
385
+ }
549
386
  }
550
387
  else if (resource === 'automation') {
551
388
  if (operation === 'getAutomationRules') {
@@ -553,14 +390,14 @@ class RitsaTools {
553
390
  path = '/automations';
554
391
  }
555
392
  else if (operation === 'toggleAutomation') {
556
- const ruleId = this.getNodeParameter('ruleId', i);
393
+ const ruleId = getParam('ruleId');
557
394
  method = 'POST';
558
395
  path = `/automations/${ruleId}/toggle`;
559
396
  }
560
397
  else if (operation === 'runAutomation') {
561
398
  method = 'POST';
562
399
  path = `/automations/run-now`;
563
- const ruleId = this.getNodeParameter('ruleId', i);
400
+ const ruleId = getParam('ruleId');
564
401
  body = { rule_id: parseInt(ruleId, 10) };
565
402
  }
566
403
  }
@@ -574,7 +411,7 @@ class RitsaTools {
574
411
  path = '/payments';
575
412
  }
576
413
  else if (operation === 'refundPayment') {
577
- const paymentId = this.getNodeParameter('paymentId', i);
414
+ const paymentId = getParam('paymentId');
578
415
  method = 'POST';
579
416
  path = `/payments/${paymentId}/refund`;
580
417
  }
@@ -589,7 +426,7 @@ class RitsaTools {
589
426
  path = '/callbacks';
590
427
  }
591
428
  else if (operation === 'markAsCalled') {
592
- const callbackId = this.getNodeParameter('callbackId', i);
429
+ const callbackId = getParam('callbackId');
593
430
  method = 'POST';
594
431
  path = `/callbacks/${callbackId}/mark-called`;
595
432
  }
@@ -608,7 +445,7 @@ class RitsaTools {
608
445
  if (operation === 'checkStock') {
609
446
  method = 'GET';
610
447
  path = '/products';
611
- const productQuery = this.getNodeParameter('productQuery', i, '');
448
+ const productQuery = getParam('productQuery');
612
449
  if (productQuery)
613
450
  qs.search = productQuery;
614
451
  }