n8n-nodes-pragma-bitrix24 1.0.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.
Files changed (51) hide show
  1. package/LICENSE +51 -0
  2. package/README.md +340 -0
  3. package/dist/credentials/Bitrix24Api.credentials.js +55 -0
  4. package/dist/nodes/Bitrix24/Bitrix24.node.js +1410 -0
  5. package/dist/nodes/Bitrix24/Company.js +17 -0
  6. package/dist/nodes/Bitrix24/Contact.js +31 -0
  7. package/dist/nodes/Bitrix24/Deal.js +17 -0
  8. package/dist/nodes/Bitrix24/Helpers.js +300 -0
  9. package/dist/nodes/Bitrix24/Lead.js +17 -0
  10. package/dist/nodes/Bitrix24/SmartProcess.js +1 -0
  11. package/dist/nodes/Bitrix24/bitrix24.svg +7 -0
  12. package/dist/nodes/Bitrix24/types.js +58 -0
  13. package/dist/nodes/Bitrix24AI/Bitrix24AI.node.js +205 -0
  14. package/dist/nodes/Bitrix24App/Bitrix24App.node.js +179 -0
  15. package/dist/nodes/Bitrix24Auxiliary/Bitrix24Auxiliary.node.js +566 -0
  16. package/dist/nodes/Bitrix24Booking/Bitrix24Booking.node.js +871 -0
  17. package/dist/nodes/Bitrix24Calendar/Bitrix24Calendar.node.js +471 -0
  18. package/dist/nodes/Bitrix24ChatBot/Bitrix24ChatBot.node.js +522 -0
  19. package/dist/nodes/Bitrix24Commerce/Bitrix24Commerce.node.js +431 -0
  20. package/dist/nodes/Bitrix24Department/Bitrix24Department.node.js +317 -0
  21. package/dist/nodes/Bitrix24Disk/Bitrix24Disk.node.js +334 -0
  22. package/dist/nodes/Bitrix24Document/Bitrix24Document.node.js +280 -0
  23. package/dist/nodes/Bitrix24Entity/Bitrix24Entity.node.js +263 -0
  24. package/dist/nodes/Bitrix24Group/Bitrix24Group.node.js +327 -0
  25. package/dist/nodes/Bitrix24Lists/Bitrix24Lists.node.js +406 -0
  26. package/dist/nodes/Bitrix24Log/Bitrix24Log.node.js +309 -0
  27. package/dist/nodes/Bitrix24Mail/Bitrix24Mail.node.js +109 -0
  28. package/dist/nodes/Bitrix24MessageService/Bitrix24MessageService.node.js +218 -0
  29. package/dist/nodes/Bitrix24OpenChannels/Bitrix24OpenChannels.node.js +379 -0
  30. package/dist/nodes/Bitrix24PaySystem/Bitrix24PaySystem.node.js +241 -0
  31. package/dist/nodes/Bitrix24Pipeline/Bitrix24Pipeline.node.js +553 -0
  32. package/dist/nodes/Bitrix24Pipeline/bitrix24.svg +7 -0
  33. package/dist/nodes/Bitrix24Sale/Bitrix24Sale.node.js +391 -0
  34. package/dist/nodes/Bitrix24Scrum/Bitrix24Scrum.node.js +555 -0
  35. package/dist/nodes/Bitrix24Scrum/bitrix24.svg +7 -0
  36. package/dist/nodes/Bitrix24Sign/Bitrix24Sign.node.js +132 -0
  37. package/dist/nodes/Bitrix24Social/Bitrix24Social.node.js +224 -0
  38. package/dist/nodes/Bitrix24Task/Bitrix24Task.node.js +444 -0
  39. package/dist/nodes/Bitrix24Telephony/Bitrix24Telephony.node.js +511 -0
  40. package/dist/nodes/Bitrix24Timeman/Bitrix24Timeman.node.js +196 -0
  41. package/dist/nodes/Bitrix24Tool/Bitrix24Tool.node.js +1035 -0
  42. package/dist/nodes/Bitrix24Tool/bitrix24.svg +7 -0
  43. package/dist/nodes/Bitrix24Trigger/Bitrix24Trigger.node.js +184 -0
  44. package/dist/nodes/Bitrix24User/Bitrix24User.node.js +351 -0
  45. package/dist/nodes/Bitrix24UserField/Bitrix24UserField.node.js +386 -0
  46. package/dist/nodes/Bitrix24UserField/bitrix24.svg +7 -0
  47. package/dist/nodes/shared/bitrix24.svg +7 -0
  48. package/dist/nodes/shared/localization.js +189 -0
  49. package/dist/nodes/shared/types.js +22 -0
  50. package/index.js +10 -0
  51. package/package.json +108 -0
@@ -0,0 +1,379 @@
1
+ "use strict";
2
+ /**
3
+ * Bitrix24 OpenChannels — Нода коммуникаций
4
+ *
5
+ * Bitrix24 PRAGMA.by nodes for n8n
6
+ * Профессиональная интеграция с Битрикс24.
7
+ *
8
+ * @author PRAGMA & Азбука Решений
9
+ * @copyright 2026 PRAGMA (https://pragma.by/) & Азбука Решений (https://abc-solution.ru/)
10
+ *
11
+ * Контакты:
12
+ * 🇧🇾 PRAGMA: +375 (44) 702-70-90 | https://pragma.by/
13
+ * 🇷🇺 Азбука Решений: +7 (939) 555-19-60 | https://abc-solution.ru/
14
+ */
15
+ Object.defineProperty(exports, "__esModule", { value: true });
16
+ exports.Bitrix24OpenChannels = void 0;
17
+ const Helpers_1 = require("../Bitrix24/Helpers");
18
+ class Bitrix24OpenChannels {
19
+ constructor() {
20
+ this.description = {
21
+ displayName: 'Bitrix24 Коммуникации',
22
+ name: 'bitrix24OpenChannels',
23
+ icon: 'file:bitrix24.svg',
24
+ group: ['transform'],
25
+ version: 1,
26
+ subtitle: '={{$parameter["operation"] + ": " + $parameter["resource"]}}',
27
+ description: 'Открытые линии, чаты и слэш-команды',
28
+ defaults: {
29
+ name: 'Bitrix24 Коммуникации',
30
+ },
31
+ inputs: ['main'],
32
+ outputs: ['main'],
33
+ credentials: [
34
+ {
35
+ name: 'bitrix24Api',
36
+ required: true,
37
+ },
38
+ ],
39
+ properties: [
40
+ {
41
+ displayName: 'Resource',
42
+ name: 'resource',
43
+ type: 'options',
44
+ noDataExpression: true,
45
+ options: [
46
+ {
47
+ name: 'Internal Chat',
48
+ value: 'chat',
49
+ description: 'Manage internal chats',
50
+ },
51
+ {
52
+ name: 'Slash Command',
53
+ value: 'command',
54
+ description: 'Register and answer commands',
55
+ },
56
+ {
57
+ name: 'Message',
58
+ value: 'message',
59
+ description: 'Send messages to external channels',
60
+ },
61
+ {
62
+ name: 'Session',
63
+ value: 'session',
64
+ description: 'Manage Open Channel sessions',
65
+ },
66
+ {
67
+ name: 'Connector',
68
+ value: 'connector',
69
+ description: 'Register connectors (Advanced)',
70
+ },
71
+ ],
72
+ default: 'message',
73
+ required: true,
74
+ },
75
+ {
76
+ displayName: 'Operation',
77
+ name: 'operation',
78
+ type: 'options',
79
+ noDataExpression: true,
80
+ options: [
81
+ // Chat
82
+ {
83
+ name: 'Create',
84
+ value: 'create',
85
+ action: 'Create new chat',
86
+ displayOptions: { show: { resource: ['chat'] } },
87
+ },
88
+ {
89
+ name: 'Invite User',
90
+ value: 'invite',
91
+ action: 'Add user to chat',
92
+ displayOptions: { show: { resource: ['chat'] } },
93
+ },
94
+ {
95
+ name: 'Send Typing',
96
+ value: 'typing',
97
+ action: 'Show typing status',
98
+ displayOptions: { show: { resource: ['chat'] } },
99
+ },
100
+ // Command
101
+ {
102
+ name: 'Register',
103
+ value: 'register',
104
+ action: 'Register new command',
105
+ displayOptions: { show: { resource: ['command'] } },
106
+ },
107
+ {
108
+ name: 'Answer',
109
+ value: 'answer',
110
+ action: 'Answer command',
111
+ displayOptions: { show: { resource: ['command'] } },
112
+ },
113
+ // Message
114
+ {
115
+ name: 'Send',
116
+ value: 'send',
117
+ action: 'Send message to channel',
118
+ displayOptions: { show: { resource: ['message'] } },
119
+ },
120
+ // Session
121
+ {
122
+ name: 'Transfer',
123
+ value: 'transfer',
124
+ action: 'Transfer session to operator',
125
+ displayOptions: { show: { resource: ['session'] } },
126
+ },
127
+ {
128
+ name: 'Finish',
129
+ value: 'finish',
130
+ action: 'Finish session',
131
+ displayOptions: { show: { resource: ['session'] } },
132
+ },
133
+ {
134
+ name: 'Get History',
135
+ value: 'getHistory',
136
+ action: 'Get chat history',
137
+ displayOptions: { show: { resource: ['session'] } },
138
+ },
139
+ // Connector
140
+ {
141
+ name: 'Register',
142
+ value: 'register',
143
+ action: 'Register new connector',
144
+ displayOptions: { show: { resource: ['connector'] } },
145
+ },
146
+ ],
147
+ default: 'send',
148
+ required: true,
149
+ },
150
+ // ----------------------------------
151
+ // Chat Fields
152
+ // ----------------------------------
153
+ {
154
+ displayName: 'Chat Title',
155
+ name: 'title',
156
+ type: 'string',
157
+ default: '',
158
+ displayOptions: { show: { resource: ['chat'], operation: ['create'] } },
159
+ },
160
+ {
161
+ displayName: 'Description',
162
+ name: 'description',
163
+ type: 'string',
164
+ default: '',
165
+ displayOptions: { show: { resource: ['chat'], operation: ['create'] } },
166
+ },
167
+ {
168
+ displayName: 'Chat ID',
169
+ name: 'chatId',
170
+ type: 'string',
171
+ default: '',
172
+ displayOptions: { show: { resource: ['chat', 'session'], operation: ['invite', 'typing', 'transfer', 'finish', 'getHistory'] } },
173
+ required: true,
174
+ },
175
+ {
176
+ displayName: 'User IDs',
177
+ name: 'userIds',
178
+ type: 'string',
179
+ default: '',
180
+ displayOptions: { show: { resource: ['chat'], operation: ['invite'] } },
181
+ description: 'Comma separated user IDs',
182
+ },
183
+ // ----------------------------------
184
+ // Command Fields
185
+ // ----------------------------------
186
+ {
187
+ displayName: 'Command Name',
188
+ name: 'commandName',
189
+ type: 'string',
190
+ default: '',
191
+ displayOptions: { show: { resource: ['command'], operation: ['register'] } },
192
+ description: 'Name of the command (without slash)',
193
+ },
194
+ {
195
+ displayName: 'Handler URL',
196
+ name: 'handlerUrl', // For event registration
197
+ type: 'string',
198
+ default: '',
199
+ displayOptions: { show: { resource: ['command'], operation: ['register'] } },
200
+ },
201
+ {
202
+ displayName: 'Command ID',
203
+ name: 'commandId',
204
+ type: 'string',
205
+ default: '',
206
+ displayOptions: { show: { resource: ['command'], operation: ['answer'] } },
207
+ },
208
+ {
209
+ displayName: 'Message ID',
210
+ name: 'messageId',
211
+ type: 'string',
212
+ default: '',
213
+ displayOptions: { show: { resource: ['command'], operation: ['answer'] } },
214
+ },
215
+ {
216
+ displayName: 'Reply Message',
217
+ name: 'message',
218
+ type: 'string',
219
+ default: '',
220
+ displayOptions: { show: { resource: ['command'], operation: ['answer'] } },
221
+ },
222
+ // ----------------------------------
223
+ // Fields for Message Send
224
+ // ----------------------------------
225
+ {
226
+ displayName: 'Connector ID',
227
+ name: 'connectorId',
228
+ type: 'string',
229
+ default: '',
230
+ displayOptions: { show: { resource: ['message', 'connector'], operation: ['send', 'register'] } },
231
+ description: 'ID of the connector (e.g. telegrambot)',
232
+ required: true,
233
+ },
234
+ {
235
+ displayName: 'Line ID',
236
+ name: 'lineId',
237
+ type: 'string',
238
+ default: '',
239
+ displayOptions: { show: { resource: ['message'], operation: ['send'] } },
240
+ description: 'ID of the Open Line',
241
+ required: true,
242
+ },
243
+ {
244
+ displayName: 'Messages (JSON)',
245
+ name: 'messages',
246
+ type: 'json',
247
+ default: '',
248
+ displayOptions: { show: { resource: ['message'], operation: ['send'] } },
249
+ description: 'Array of message objects to send',
250
+ required: true,
251
+ },
252
+ // (Session fields merged above)
253
+ {
254
+ displayName: 'Target User ID',
255
+ name: 'userId',
256
+ type: 'string',
257
+ default: '',
258
+ displayOptions: { show: { resource: ['session'], operation: ['transfer'] } },
259
+ description: 'ID of the operator to transfer to',
260
+ required: true,
261
+ },
262
+ // (Connector Register fields merged)
263
+ {
264
+ displayName: 'Name',
265
+ name: 'name',
266
+ type: 'string',
267
+ default: '',
268
+ displayOptions: { show: { resource: ['connector'], operation: ['register'] } },
269
+ required: true,
270
+ },
271
+ {
272
+ displayName: 'Icon URL',
273
+ name: 'iconUrl',
274
+ type: 'string',
275
+ default: '',
276
+ displayOptions: { show: { resource: ['connector'], operation: ['register'] } },
277
+ },
278
+ ],
279
+ };
280
+ }
281
+ async execute() {
282
+ const items = this.getInputData();
283
+ const returnData = [];
284
+ const resource = this.getNodeParameter('resource', 0);
285
+ const operation = this.getNodeParameter('operation', 0);
286
+ for (let i = 0; i < items.length; i++) {
287
+ try {
288
+ let endpoint = '';
289
+ let body = {};
290
+ if (resource === 'chat') {
291
+ if (operation === 'create') {
292
+ endpoint = 'im.chat.add';
293
+ body.TITLE = this.getNodeParameter('title', i);
294
+ body.DESCRIPTION = this.getNodeParameter('description', i);
295
+ // body.COLOR = this.getNodeParameter('color', i) as string; // Optional
296
+ }
297
+ if (operation === 'invite') {
298
+ endpoint = 'im.chat.user.add';
299
+ body.CHAT_ID = this.getNodeParameter('chatId', i);
300
+ const users = this.getNodeParameter('userIds', i);
301
+ body.USERS = users.split(',').map(u => u.trim()); // Array
302
+ }
303
+ if (operation === 'typing') {
304
+ endpoint = 'im.chat.typing';
305
+ body.CHAT_ID = this.getNodeParameter('chatId', i);
306
+ }
307
+ }
308
+ if (resource === 'command') {
309
+ if (operation === 'register') {
310
+ endpoint = 'im.command.register';
311
+ body.COMMAND = this.getNodeParameter('commandName', i);
312
+ body.LANG = [{ title: this.getNodeParameter('name', i) }]; // Reuse 'name' field
313
+ body.EVENT_COMMAND_ADD = this.getNodeParameter('handlerUrl', i);
314
+ }
315
+ if (operation === 'answer') {
316
+ endpoint = 'im.command.answer';
317
+ body.COMMAND_ID = this.getNodeParameter('commandId', i);
318
+ body.MESSAGE_ID = this.getNodeParameter('messageId', i);
319
+ body.MESSAGE = this.getNodeParameter('message', i);
320
+ }
321
+ }
322
+ if (resource === 'message') {
323
+ if (operation === 'send') {
324
+ endpoint = 'imconnector.send.messages';
325
+ body.CONNECTOR = this.getNodeParameter('connectorId', i);
326
+ body.LINE = this.getNodeParameter('lineId', i);
327
+ const messages = this.getNodeParameter('messages', i);
328
+ if (typeof messages === 'string')
329
+ body.MESSAGES = JSON.parse(messages);
330
+ else
331
+ body.MESSAGES = messages;
332
+ }
333
+ }
334
+ else if (resource === 'session') {
335
+ if (operation === 'transfer') {
336
+ endpoint = 'imopenlines.session.head.update'; // Transfer head operator
337
+ body.CHAT_ID = this.getNodeParameter('chatId', i);
338
+ body.HEAD_ID = this.getNodeParameter('userId', i);
339
+ }
340
+ else if (operation === 'finish') {
341
+ endpoint = 'imopenlines.session.finish';
342
+ body.CHAT_ID = this.getNodeParameter('chatId', i);
343
+ }
344
+ else if (operation === 'getHistory') {
345
+ endpoint = 'im.dialog.messages.get';
346
+ body.CHAT_ID = this.getNodeParameter('chatId', i);
347
+ }
348
+ }
349
+ else if (resource === 'connector') {
350
+ if (operation === 'register') {
351
+ endpoint = 'imconnector.register';
352
+ body.ID = this.getNodeParameter('connectorId', i);
353
+ body.NAME = this.getNodeParameter('name', i);
354
+ body.ICON = { DATA_IMAGE: this.getNodeParameter('iconUrl', i, '') };
355
+ }
356
+ }
357
+ const response = await Helpers_1.bitrixRequestWithRetry.call(this, 'POST', endpoint, body);
358
+ let result = response.result;
359
+ if (result === undefined)
360
+ result = { success: true };
361
+ if (Array.isArray(result)) {
362
+ result.forEach((item) => returnData.push({ json: item, pairedItem: { item: i } }));
363
+ }
364
+ else {
365
+ returnData.push({ json: result, pairedItem: { item: i } });
366
+ }
367
+ }
368
+ catch (error) {
369
+ if (this.continueOnFail()) {
370
+ returnData.push({ json: { error: error.message }, pairedItem: { item: i } });
371
+ continue;
372
+ }
373
+ throw error;
374
+ }
375
+ }
376
+ return [returnData];
377
+ }
378
+ }
379
+ exports.Bitrix24OpenChannels = Bitrix24OpenChannels;
@@ -0,0 +1,241 @@
1
+ "use strict";
2
+ /**
3
+ * Bitrix24 PaySystem — Нода платёжных систем
4
+ *
5
+ * Bitrix24 PRAGMA.by nodes for n8n
6
+ * Профессиональная интеграция с Битрикс24.
7
+ *
8
+ * @author PRAGMA & Азбука Решений
9
+ * @copyright 2026 PRAGMA (https://pragma.by/) & Азбука Решений (https://abc-solution.ru/)
10
+ *
11
+ * Контакты:
12
+ * 🇧🇾 PRAGMA: +375 (44) 702-70-90 | https://pragma.by/
13
+ * 🇷🇺 Азбука Решений: +7 (939) 555-19-60 | https://abc-solution.ru/
14
+ */
15
+ Object.defineProperty(exports, "__esModule", { value: true });
16
+ exports.Bitrix24PaySystem = void 0;
17
+ const Helpers_1 = require("../Bitrix24/Helpers");
18
+ class Bitrix24PaySystem {
19
+ constructor() {
20
+ this.description = {
21
+ displayName: 'Bitrix24 Платежи',
22
+ name: 'bitrix24PaySystem',
23
+ icon: 'file:bitrix24.svg',
24
+ group: ['transform'],
25
+ version: 1,
26
+ subtitle: '={{$parameter["operation"] + ": " + $parameter["resource"]}}',
27
+ description: 'Управление платёжными системами и обработчиками',
28
+ defaults: {
29
+ name: 'Bitrix24 Платежи',
30
+ },
31
+ inputs: ['main'],
32
+ outputs: ['main'],
33
+ credentials: [
34
+ {
35
+ name: 'bitrix24Api',
36
+ required: true,
37
+ },
38
+ ],
39
+ properties: [
40
+ {
41
+ displayName: 'Resource',
42
+ name: 'resource',
43
+ type: 'options',
44
+ noDataExpression: true,
45
+ options: [
46
+ {
47
+ name: 'Handler (REST)',
48
+ value: 'handler',
49
+ description: 'Manage custom REST payment handlers (e.g. n8n workflow)',
50
+ },
51
+ {
52
+ name: 'Payment',
53
+ value: 'payment',
54
+ description: 'Process payments',
55
+ },
56
+ {
57
+ name: 'System',
58
+ value: 'system',
59
+ description: 'Payment systems',
60
+ },
61
+ ],
62
+ default: 'payment',
63
+ required: true,
64
+ },
65
+ {
66
+ displayName: 'Operation',
67
+ name: 'operation',
68
+ type: 'options',
69
+ noDataExpression: true,
70
+ options: [
71
+ // Handler
72
+ {
73
+ name: 'Register',
74
+ value: 'add',
75
+ action: 'Register new payment handler',
76
+ displayOptions: { show: { resource: ['handler'] } },
77
+ },
78
+ {
79
+ name: 'List',
80
+ value: 'list',
81
+ action: 'List handlers',
82
+ displayOptions: { show: { resource: ['handler'] } },
83
+ },
84
+ {
85
+ name: 'Delete',
86
+ value: 'delete',
87
+ action: 'Delete handler',
88
+ displayOptions: { show: { resource: ['handler'] } },
89
+ },
90
+ // Payment
91
+ {
92
+ name: 'Pay',
93
+ value: 'pay',
94
+ action: 'Initiate payment',
95
+ displayOptions: { show: { resource: ['payment'] } },
96
+ },
97
+ // System
98
+ {
99
+ name: 'List',
100
+ value: 'list',
101
+ action: 'List payment systems',
102
+ displayOptions: { show: { resource: ['system'] } },
103
+ },
104
+ ],
105
+ default: 'pay',
106
+ required: true,
107
+ },
108
+ // Fields for Handler
109
+ {
110
+ displayName: 'Name',
111
+ name: 'name',
112
+ type: 'string',
113
+ default: '',
114
+ displayOptions: { show: { resource: ['handler'], operation: ['add'] } },
115
+ description: 'Name of the payment handler',
116
+ required: true,
117
+ },
118
+ {
119
+ displayName: 'Code',
120
+ name: 'code',
121
+ type: 'string',
122
+ default: '',
123
+ displayOptions: { show: { resource: ['handler'], operation: ['add'] } },
124
+ description: 'Unique code for the handler',
125
+ required: true,
126
+ },
127
+ {
128
+ displayName: 'Sort',
129
+ name: 'sort',
130
+ type: 'number',
131
+ default: 100,
132
+ displayOptions: { show: { resource: ['handler'], operation: ['add'] } },
133
+ },
134
+ {
135
+ displayName: 'Settings (JSON)',
136
+ name: 'settings',
137
+ type: 'json',
138
+ default: '{}',
139
+ displayOptions: { show: { resource: ['handler'], operation: ['add'] } },
140
+ description: 'Handler settings (CURRENCY, CODES, etc.)',
141
+ },
142
+ {
143
+ displayName: 'Handler ID',
144
+ name: 'handlerId',
145
+ type: 'string',
146
+ default: '',
147
+ displayOptions: { show: { resource: ['handler'], operation: ['delete'] } }, // usually ID is needed
148
+ required: true,
149
+ },
150
+ // Fields for Payment
151
+ {
152
+ displayName: 'Order ID',
153
+ name: 'orderId',
154
+ type: 'string',
155
+ default: '',
156
+ displayOptions: { show: { resource: ['payment'], operation: ['pay'] } },
157
+ required: true,
158
+ },
159
+ {
160
+ displayName: 'Payment ID',
161
+ name: 'paymentId',
162
+ type: 'string',
163
+ default: '',
164
+ displayOptions: { show: { resource: ['payment'], operation: ['pay'] } },
165
+ required: true,
166
+ },
167
+ {
168
+ displayName: 'Pay System ID',
169
+ name: 'paySystemId',
170
+ type: 'string',
171
+ default: '',
172
+ displayOptions: { show: { resource: ['payment'], operation: ['pay'] } },
173
+ required: true,
174
+ },
175
+ ],
176
+ };
177
+ }
178
+ async execute() {
179
+ const items = this.getInputData();
180
+ const returnData = [];
181
+ const resource = this.getNodeParameter('resource', 0);
182
+ const operation = this.getNodeParameter('operation', 0);
183
+ for (let i = 0; i < items.length; i++) {
184
+ try {
185
+ let endpoint = '';
186
+ let body = {};
187
+ if (resource === 'handler') {
188
+ if (operation === 'add') {
189
+ endpoint = 'sale.paysystem.handler.add';
190
+ body.NAME = this.getNodeParameter('name', i);
191
+ body.CODE = this.getNodeParameter('code', i);
192
+ body.SORT = this.getNodeParameter('sort', i);
193
+ const settings = this.getNodeParameter('settings', i, '');
194
+ if (settings) {
195
+ body.SETTINGS = typeof settings === 'string' ? JSON.parse(settings) : settings;
196
+ }
197
+ }
198
+ else if (operation === 'list') {
199
+ endpoint = 'sale.paysystem.handler.list';
200
+ }
201
+ else if (operation === 'delete') {
202
+ endpoint = 'sale.paysystem.handler.delete';
203
+ body.ID = this.getNodeParameter('handlerId', i);
204
+ }
205
+ }
206
+ else if (resource === 'payment') {
207
+ if (operation === 'pay') {
208
+ endpoint = 'sale.paysystem.pay.payment';
209
+ body.ORDER_ID = this.getNodeParameter('orderId', i);
210
+ body.PAYMENT_ID = this.getNodeParameter('paymentId', i);
211
+ body.PAY_SYSTEM_ID = this.getNodeParameter('paySystemId', i);
212
+ }
213
+ }
214
+ else if (resource === 'system') {
215
+ if (operation === 'list') {
216
+ endpoint = 'sale.paysystem.list';
217
+ }
218
+ }
219
+ const response = await Helpers_1.bitrixRequestWithRetry.call(this, 'POST', endpoint, body);
220
+ let result = response.result;
221
+ if (Array.isArray(result)) {
222
+ for (const item of result) {
223
+ returnData.push({ json: item, pairedItem: { item: i } });
224
+ }
225
+ }
226
+ else {
227
+ returnData.push({ json: result, pairedItem: { item: i } });
228
+ }
229
+ }
230
+ catch (error) {
231
+ if (this.continueOnFail()) {
232
+ returnData.push({ json: { error: error.message }, pairedItem: { item: i } });
233
+ continue;
234
+ }
235
+ throw error;
236
+ }
237
+ }
238
+ return [returnData];
239
+ }
240
+ }
241
+ exports.Bitrix24PaySystem = Bitrix24PaySystem;