### GetHostTerminalsGroup and GetRestaurantSectionsByTerminalsGroup (C# Example) Source: https://github.com/iiko/front.api.doc/blob/gh-pages/_posts/2020-09-28-get-sections-of-all-groups.md Example demonstrating how to get the current host's terminal group and then retrieve its associated restaurant sections using C#. ```csharp ```csharp // Get the terminal group of the current host var currentHostGroup = PluginContext.Operations.GetHostTerminalsGroup(); // Get all restaurant sections for the current host's group var currentGroupSections = PluginContext.Operations.GetRestaurantSectionsByTerminalsGroup(currentHostGroup); // currentGroupSections now contains a list of IRestaurantSection objects // Each IRestaurantSection object has a property 'TerminalsGroup' which links back to the parent group. ``` ``` -------------------------------- ### CreateDelivery Method Example Source: https://github.com/iiko/front.api.doc/blob/gh-pages/_posts/2025-06-02-new-fields-address.md This C# code snippet demonstrates how to create a delivery order, which may involve utilizing the new address fields. Ensure the necessary plugins are installed and configured. ```csharp public void CreateDelivery() { // ... other code ... var delivery = _deliveryService.CreateDelivery(order, new DeliveryInfo { Address = _addressService.GetAddressById(deliveryAddressId), // ... other properties ... }); // ... other code ... } ``` -------------------------------- ### Example Usage: Adding a Button and Showing an Input Dialog Source: https://github.com/iiko/front.api.doc/blob/gh-pages/_posts/2024-06-21-iviewmanager-iikoagent.md This C# example demonstrates how to add a button to the iikoAgent Windows service menu and use IViewManager to show an input dialog. ```APIDOC ## Example Usage: Adding a Button and Showing an Input Dialog This C# example demonstrates how to add a button to the iikoAgent Windows service menu and use IViewManager to show an input dialog. ### Method This example uses the `AddButtonToWindowsServiceMenu` method from the `IOperationService` and `IViewManager` interface. ### Endpoint N/A (This is a client-side SDK example, not a direct API endpoint call.) ### Request Example ```csharp PluginContext.Operations.AddButtonToWindowsServiceMenu("Настройки плагина", (vm) => { var input = vm.ShowInputDialog("Введите значение", InputDialogTypes.Number, null, "OK", "Отмена"); if (input != null) { vm.ShowOkPopup("Настройка сохранена", $\"Значение: {input}\"); } }); ``` ### Description This code snippet adds a button labeled "Настройки плагина" to the iikoAgent Windows service menu. When clicked, it invokes a callback function that uses the `IViewManager` (`vm`) to display an input dialog prompting the user to enter a number. If the user provides input and clicks "OK", a confirmation popup is shown with the entered value. ``` -------------------------------- ### StornoPastOrder Example Source: https://github.com/iiko/front.api.doc/blob/gh-pages/_posts/2023-03-22-storno-past-order.md This example demonstrates how to return a past order with a write-off. Ensure the `removalType` is configured for write-off and that the necessary permissions are available. ```csharp private void StornoPastOrder() { var pastOrder = PluginContext.Operations.GetPastOrders().First(); var paymentType = pastOrder.Payments.First().PaymentType; // rt.WriteoffType.HasFlag(WriteoffType.Cafe) - сторнирование со списанием // rt.WriteoffType == WriteoffType.None - сторнирование без списания var removalType = PluginContext.Operations.GetRemovalTypesToStornoPastOrderItems().First(rt => rt.WriteoffType.HasFlag(WriteoffType.Cafe)); var section = pastOrder.RestaurantSection; var orderType = pastOrder.OrderType; var taxationSystem = PluginContext.Operations.GetTaxationSystemsToStornoPastOrderItems().Select(ts => (TaxationSystem?)ts).FirstOrDefault(); PluginContext.Operations.StornoPastOrder( PluginContext.Operations.GetCredentials(), pastOrder, paymentType, removalType, section, orderType, null, taxationSystem, ``` -------------------------------- ### Hotel System Payment Integration Example Source: https://github.com/iiko/front.api.doc/blob/gh-pages/articles/ru/PaymentProcessor.md An example demonstrating how to integrate with a hotel system for payments. It includes showing input dialogs for room numbers or card swipes, processing the payment with the hotel system, and handling success or failure scenarios. ```cs [Serializable] internal class IsCardClass { public bool IsCard; } public void Pay(decimal sum, Guid? orderId, Guid paymentTypeId, Guid transactionId, IPointOfSale pointOfSale, IUser cashier, IReceiptPrinter printer, IViewManager viewManager, IPaymentDataContext context, IProgressBar progressBar) { // Показать в iikoFront окно ввода номера и прокатки карты var input = viewManager.ShowInputDialog("Введите номер или прокатайте карту", InputDialogTypes.Card | InputDialogTypes.Number); string room = null; string cardTrack = null; // Если был введен номер, то результат типа NumberInputDialogResult var roomNum = input as NumberInputDialogResult; if (roomNum != null) room = roomNum.Number.ToString(); // Если была прокатана карта, то результат типа CardInputDialogResult var card = input as CardInputDialogResult; if (card != null) cardTrack = card.FullCardTrack; if (room == null && cardTrack == null) // Ничего не было введено, прекращаем операцию. throw new PaymentActionFailedException("Не было введено данных."); // Получаем заказ средствами API по id через IOperationService. var order = PluginContext.Operations.TryGetOrderById(orderId.Value); // Выполняем произвольные методы. Например, проводим платёж в некой hotelSystem, которая вернет имя гостя, если платёж «принят» и null, если платёж отклонён. var guestName = hotelSystem.ProcessPaymentOnGuest(cardTrack, room, order?.Number, transactionId, sum); if (guestName == null) // Платёж не прошёл, прекращаем операцию. throw new PaymentActionFailedException("Платеж не прошёл."); // Формирование квитанции для печати. Квитанция состоит из XElement var slip = new ReceiptSlip { Doc = new XElement(Tags.Doc, new XElement(Tags.Pair, "Гость", guestName), new XElement(Tags.Pair, "Сумма", sum)) }; // Печать. printer.Print(slip); var cardInfoData = new IsCardClass { IsCard = card != null }; var cardType = cardInfoData.IsCard ? "My Hotel System Card" : "My Hotel System Room"; // Сохранение данных, которые будут показаны в отчётах. context.SetInfoForReports(room ?? cardTrack, cardType); ``` -------------------------------- ### Start a Service in an Order Source: https://github.com/iiko/front.api.doc/blob/gh-pages/articles/ru/TimeRatedServices.md This C# snippet shows how to add and start a service item for an order. It retrieves the latest new order, an active service product, and then adds the service to the order before starting it. ```csharp private static void StartService() { var order = PluginContext.Operations.GetOrders().Last(x => x.Status == OrderStatus.New); var serviceProduct = PluginContext.Operations.GetActiveProducts().Last(x => x.Type == ProductType.Service && x.RateSchedule != null); var credentials = PluginContext.Operations.GetCredentials(); var service = PluginContext.Operations.AddOrderServiceItem(serviceProduct, order, order.Guests.Last(), credentials, TimeSpan.FromHours(2)); PluginContext.Operations.StartService(credentials, order, service); } ``` -------------------------------- ### Check Device Started Status (C#) Source: https://github.com/iiko/front.api.doc/blob/gh-pages/articles/ru/Devices.md Implement this check in target methods to ensure a device is running before executing commands. If the device is not started, throwing a DeviceNotStartedException will trigger iikoFront to attempt to start it. ```csharp private void CheckStarted() { if (state != State.Running) throw new DeviceNotStartedException("Device not started"); } ``` -------------------------------- ### Frontmatter Tags Example Source: https://github.com/iiko/front.api.doc/blob/gh-pages/_internal_doc/UI-COMPONENTS.md Add tags to your frontmatter to categorize content. This example shows how to include API, plugin, and v8 tags. ```yaml --- title: Название страницы tags: [api, plugin, v8] --- ``` -------------------------------- ### Start FR Source: https://github.com/iiko/front.api.doc/blob/gh-pages/articles/ru/CashRegisters.md Starts the Fiscal Register. This command is invoked manually from iikoOffice or can be set to run automatically upon device addition. ```APIDOC ## POST /api/fr/start ### Description Starts the Fiscal Register. This command is invoked manually from iikoOffice or can be set to run automatically upon device addition. It typically involves driver initialization, port opening, and connection testing. ### Method POST ### Endpoint /api/fr/start ### Response #### Success Response (200) - **Success** (boolean) - Indicates if the start operation was successful. #### Response Example ```json { "Success": true } ``` ``` -------------------------------- ### Get Restaurant Kitchen Settings Source: https://github.com/iiko/front.api.doc/blob/gh-pages/_posts/2025-09-29-webkds-api-methods.md Retrieves the cooking modes and kitchen screen settings for a restaurant. ```APIDOC ## GET /api/operations/GetRestaurantKitchenSettings ### Description Retrieves the current settings for the kitchen screen and cooking modes within a restaurant. This endpoint is part of the `IOperationService`. ### Method GET ### Endpoint /api/operations/GetRestaurantKitchenSettings ### Parameters None ### Request Example None ### Response #### Success Response (200) - **ServeDishesAsFastAsPossible** (boolean) - Indicates if dishes should be served as fast as possible or with simultaneous serving. - **CourseDishesCookingMode** (boolean) - Indicates if dishes are cooked using courses. - **Course2PrintToCookingDelay** (integer) - Delay in minutes for the second course to start cooking. - **Course3PrintToCookingDelay** (integer) - Delay in minutes for the third course to start cooking. - **Course4PrintToCookingDelay** (integer) - Delay in minutes for the fourth course to start cooking. - **HighCourseDelayInterval** (integer) - Interval in minutes for high course delays. - **DishesOverdueInterval** (integer) - Interval in minutes after which dishes are considered overdue. - **NotifyWaitersOnCookingComplete** (boolean) - Indicates if waiters should be notified when cooking is complete. - **PackedStatusOnCookingEnabled** (boolean) - Indicates if the order assembly process is enabled. - **TimePeakIntervals** (object) - Schedule for peak hours. The exact structure of this object is detailed in `IRestaurantKitchenSettings`. #### Response Example ```json { "serveDishesAsFastAsPossible": true, "courseDishesCookingMode": false, "course2PrintToCookingDelay": 5, "course3PrintToCookingDelay": 10, "course4PrintToCookingDelay": 15, "highCourseDelayInterval": 20, "dishesOverdueInterval": 30, "notifyWaitersOnCookingComplete": true, "packedStatusOnCookingEnabled": false, "timePeakIntervals": { "startTime": "09:00", "endTime": "11:00" } } ``` ``` -------------------------------- ### Get Product by ID in C# Source: https://github.com/iiko/front.api.doc/blob/gh-pages/articles/ru/CashRegisters.md Retrieves a product using its unique identifier. Ensure PluginContext and chequeTask are properly initialized. ```csharp PluginContext.Operations.GetProductById(chequeTask.Sales[0].ProductId) ``` -------------------------------- ### Run Local Jekyll Server Source: https://github.com/iiko/front.api.doc/blob/gh-pages/_internal_doc/SUMMARY.md Use this command to serve your Jekyll site locally for testing. Ensure you have Jekyll and its dependencies installed. ```bash bundle exec jekyll serve ``` -------------------------------- ### Настройка отладки для SDK-style .csproj в Visual Studio Source: https://github.com/iiko/front.api.doc/blob/gh-pages/commonArticles/debugging.md Пример конфигурации отладки для проектов нового формата SDK-style .csproj, использующих файл launchsettings.json. Определяет исполняемый файл и аргументы командной строки. ```json { "profiles": { "Resto.Front.Api.SamplePlugin": { "commandName": "Executable", "executablePath": "C:\\Program Files\\iiko\\iikoRMS\\Front.Net\\Resto.Front.Api.Host.exe", "commandLineArgs": "/a=\"C:\\Projects\\Front.Api Sdk\\Resto.Front.Api.SamplePlugin\\bin\\Debug\\Resto.Front.Api.SamplePlugin.dll\" /c=Resto.Front.Api.SamplePlugin.SamplePlugin /m=21005108 /l=\"C:\\Projects\\Front.Api Sdk\\Logs\\sample-plugin.log\"" } } } ``` -------------------------------- ### Get Cashier Name by ID Source: https://github.com/iiko/front.api.doc/blob/gh-pages/articles/ru/CashRegisters.md Retrieve a cashier's name using their unique Guid identifier. This requires accessing the operations and user information through the PluginContext. ```csharp IUser user = PluginContext.Operations.GetUserById(cashierId); var name = user.Name; ``` -------------------------------- ### Implementing Payment Return Logic Source: https://github.com/iiko/front.api.doc/blob/gh-pages/articles/ru/PaymentProcessor.md This example shows how to implement the `ReturnPayment` method, including processing the return via a hypothetical `hotelSystem`, retrieving rollback data, and printing a receipt. The `EmergencyCancelPayment` method is shown to simply call `ReturnPayment`. ```csharp [Serializable] public class IsCardClass { public bool IsCard; } public void ReturnPayment(decimal sum, Guid? orderId, Guid paymentTypeId, Guid transactionId, [NotNull] IPointOfSale pointOfSale, [NotNull] IUser cashier, IReceiptPrinter printer, IViewManager viewManager, IPaymentDataContext context, IProgressBar progressBar) { // Выполняются произвольные методы. Например, по id транзакции платёж возвращается в некой hotelSystem, которая вернет true, если платёж успешно откатился и false, если возврат не удался. var success = hotelSystem.ProcessReturnPayment(transactionId); if (!success) throw new PaymentActionFailedException("Не получилось вернуть плату."); // Получаем данные, сохранённые в элементе оплаты. var isCard = context.GetRollbackData(); var slip = new ReceiptSlip { Doc = new XElement(Tags.Doc, new XElement(Tags.Pair, "Возврат суммы", sum), new XElement(Tags.Pair, "Была ли карта", isCard.IsCard ? "ДА" : "НЕТ" )) }; printer.Print(slip); } public void EmergencyCancelPayment(decimal sum, Guid? orderId, Guid paymentTypeId, Guid transactionId, [NotNull] IPointOfSale pointOfSale, [NotNull] IUser cashier, IReceiptPrinter printer, IViewManager viewManager, IPaymentDataContext context, IProgressBar progressBar) { ReturnPayment(sum, orderId, paymentTypeId, transactionId, pointOfSale, cashier, printer, viewManager, context, progressBar); } ``` -------------------------------- ### Create and Send Delivery Example Source: https://github.com/iiko/front.api.doc/blob/gh-pages/_posts/2020-06-14-delivery-sending.md This C# code demonstrates the process of creating a delivery, confirming it if necessary, printing order items, preparing it for sending, assigning a courier, printing the bill, and finally sending the delivery. It includes assertions to verify the status changes at each step. Note that payment before sending is not supported. ```csharp private void CreateAndSendDelivery() { if (PluginContext.Operations.GetHostDeliverySettings().DeliveryPaymentTimeOption == DeliveryPaymentTimeOption.BeforeSending) return; // not supported yet var credentials = PluginContext.Operations.AuthenticateByPin(pin); var delivery = CreateDelivery(false); // EditorTester.CreateDelivery method from SamplePlugin if (PluginContext.Operations.IsDeliveryConfirmationActive()) { Debug.Assert(delivery.DeliveryStatus == DeliveryStatus.Unconfirmed); PluginContext.Operations.ChangeDeliveryConfirmTime(DateTime.Now, delivery, credentials); delivery = PluginContext.Operations.GetDeliveryOrderById(delivery.Id); } PluginContext.Operations.PrintOrderItems(credentials, delivery, delivery.Items.OfType().ToList()); Debug.Assert(delivery.DeliveryStatus == DeliveryStatus.New); PluginContext.Operations.PrepareDeliveryForSending(credentials, delivery); delivery = PluginContext.Operations.GetDeliveryOrderById(delivery.Id); Debug.Assert(delivery.DeliveryStatus == DeliveryStatus.Waiting); var courier = PluginContext.Operations.GetUsers().Single(x => x.Name == courierName); Debug.Assert(delivery.Courier == null); PluginContext.Operations.ChangeDeliveryCourier(true, delivery, courier, credentials); delivery = PluginContext.Operations.GetDeliveryOrderById(delivery.Id); Debug.Assert(Equals(delivery.Courier, courier)); Debug.Assert(!delivery.IsPrintedBillActual); PluginContext.Operations.PrintDeliveryBill(credentials, delivery); delivery = PluginContext.Operations.GetDeliveryOrderById(delivery.Id); Debug.Assert(delivery.IsPrintedBillActual); PluginContext.Operations.SendDelivery(credentials, delivery); delivery = PluginContext.Operations.GetDeliveryOrderById(delivery.Id); Debug.Assert(delivery.DeliveryStatus == DeliveryStatus.OnWay); } ``` -------------------------------- ### ChangeDeliveryOrderTypeOnCourier Method Example Source: https://github.com/iiko/front.api.doc/blob/gh-pages/_posts/2025-06-02-new-fields-address.md This C# code snippet illustrates changing the delivery order type to a courier, potentially interacting with address data. Ensure the necessary plugins are installed and configured. ```csharp public void ChangeDeliveryOrderTypeOnCourier(long deliveryId) { // ... other code ... var delivery = _deliveryService.GetDelivery(deliveryId); _deliveryService.ChangeDeliveryOrderTypeOnCourier(delivery); // ... other code ... } ``` -------------------------------- ### Get Cash Register Driver Parameters C# Source: https://github.com/iiko/front.api.doc/blob/gh-pages/articles/ru/CashRegisters.md Retrieves the configuration parameters for the cash register driver. These settings inform iiko Front about the device's capabilities, such as text printing, QR code support, and session handling. It's typically read after the driver starts as parameters are unknown beforehand. ```csharp public CashRegisterDriverParameters GetCashRegisterDriverParameters() { return new CashRegisterDriverParameters { CanPrintText = true, \ Поддерживает ли ККМ печать текста SupportsPayInAfterSessionClose = true, \ Поддерживает ли ККМ внесение при закрытой кассовой смене CanPrintBarcode = true, \ Поддерживает ли ККМ печать простых штрихкодов CanPrintQRCode = true, \ Поддерживает ли ККМ печать QR-кодов CanUseFontSizes = true, \ Поддерживает ли ККМ использование шрифтов для печати текста Font0Width = 44, \ Ширина строки шрифтом F0 Font1Width = 42,\ Ширина строки шрифтом F1 Font2Width = 22,\ Ширина строки шрифтом F2 IsCancellationSupported = true, \ Поддерживает ли ФР операцию Аннулирования ZeroCashOnClose = false, \ Обнуляет ли ККМ сумму наличных в кассе при закрытии смены IsBillTaskSupported = false, \ Поддерживается ли ФР печать пречека через команду «Счет» }; } ``` -------------------------------- ### Execute Custom Command for Greeting Source: https://github.com/iiko/front.api.doc/blob/gh-pages/articles/ru/CashRegisters.md Implement the DirectIo method to handle the execution of the 'HelloWorld' command. It retrieves the 'UserName' parameter and returns a personalized greeting message. ```csharp public DirectIoResult DirectIo(CommandExecute command) { if (command == null) throw new ArgumentNullException(nameof(command)); var result = new DirectIoResult { Document = new Document { Lines = new List() } }; // находим команду приветствия пользователя по кодовому имени "HelloWorld" if (command.Name == "HelloWorld") { // считываем данные из параметра ввода имени пользователя const string paramName = "UserName"; var userName = command.Parameters.FirstOrDefault(item => item.Name == paramName)?.Value; // записываем приветственное сообщение result.Message = userName != null ? $"Привет, {userName}!" : "Привет всем!"; } return result; } ``` -------------------------------- ### Setup Fiscal Register Settings Source: https://github.com/iiko/front.api.doc/blob/gh-pages/articles/ru/CashRegisters.md Use this method to apply new configurations to a fiscal register. It typically involves stopping the driver, applying settings, and restarting the FR if it was running. ```cs public void Setup([NotNull] DeviceSettings newSettings) { if (newSettings == null) throw new ArgumentNullException(nameof(newSettings)); Stop(); Settings = (CashRegisterSettings)newSettings; if (newSettings.Autorun && wasConnected) Start(); } ``` -------------------------------- ### Использование Debugger.Launch() для отладки без лицензии разработчика Source: https://github.com/iiko/front.api.doc/blob/gh-pages/commonArticles/debugging.md Пример кода для принудительного подключения отладчика в начале конструктора плагина. Полезно, когда лицензия разработчика отсутствует и плагин устанавливается штатным способом. ```csharp Debugger.Launch() ``` -------------------------------- ### File Structure Overview Source: https://github.com/iiko/front.api.doc/blob/gh-pages/_internal_doc/MODERNIZATION.md Illustrates the directory structure for the modernized documentation portal, highlighting key layout files and the optional dark theme CSS file. ```text _layouts/ ├── default.html # Основной шаблон с новым дизайном └── tagpage.html # Обновленная страница тегов assets/ └── css/ └── dark-theme.css # Опциональная темная тема ``` -------------------------------- ### Cash Register Start Source: https://github.com/iiko/front.api.doc/blob/gh-pages/_posts/2023-05-15-api-cashregister.md Starts the fiscal register. Typically used to free up a COM port or other resource and then restart the device without restarting iikoFront. ```APIDOC ## POST /api/v8Preview6/operations/CashRegisterStart ### Description Starts the fiscal register. ### Method POST ### Endpoint /api/v8Preview6/operations/CashRegisterStart ### Parameters (No specific parameters documented for this operation) ### Request Body (No specific request body documented for this operation) ### Response #### Success Response (200) (Response details not explicitly provided in the source text) #### Response Example (No example provided) ``` -------------------------------- ### Create an Ordered List with Steps Source: https://github.com/iiko/front.api.doc/blob/gh-pages/_internal_doc/UI-COMPONENTS.md Implement a styled ordered list for step-by-step instructions. This component uses a distinct background and clear list item formatting for readability. ```html
  1. Шаг 1: Описание первого шага
  2. Шаг 2: Описание второго шага
  3. Шаг 3: Описание третьего шага
``` -------------------------------- ### Start Fiscal Register Driver Source: https://github.com/iiko/front.api.doc/blob/gh-pages/articles/ru/CashRegisters.md Initiates the fiscal register's operation. This is called when manually starting the device or if automatic startup is enabled. It includes driver initialization, port opening, and connection testing. ```cs public void Start() { SetState(State.Starting); try { driver = new Driver(); // инициализация драйвера устройства driver.Start() } catch (Exception e) { PluginContext.Log.Error($"Failed to load driver with error: {e.Message}"); SetState(State.Stopped); throw new DeviceException(e.Message); } SetState(State.Running); } ``` -------------------------------- ### Add Card External Processed Payment Example Source: https://github.com/iiko/front.api.doc/blob/gh-pages/_posts/2024-04-03-add-custom-data-to-card-payment.md This example demonstrates how to add an external processed payment using a card, including populating the CustomData field and retrieving it later. Ensure necessary operations and data are available in PluginContext. ```csharp /// /// Добавление внешнего проведенного платежа картой. /// private void AddCardExternalProcessedPayment() { const bool isProcessed = true; var order = PluginContext.Operations.GetOrders().Last(o => o.Status == OrderStatus.New); var paymentType = PluginContext.Operations.GetPaymentTypes().First(x => x.Kind == PaymentTypeKind.Card && x.Name.ToUpper() == "VISA"); var additionalData = new CardPaymentItemAdditionalData("123456", "0987654321"); var credentials = PluginContext.Operations.GetDefaultCredentials(); var paymentItem = PluginContext.Operations.AddExternalPaymentItem(order.ResultSum / 2, isProcessed, additionalData, null, paymentType, order, credentials); MessageBox.Show(((CardPaymentItemAdditionalData)paymentItem.AdditionalData).CustomData); } ``` -------------------------------- ### Define Custom Command for Greeting Source: https://github.com/iiko/front.api.doc/blob/gh-pages/articles/ru/CashRegisters.md Implement the GetQueryInfo method to define a custom command named 'HelloWorld' with a 'UserName' input parameter. This allows iikoFront to register and display the command. ```csharp public QueryInfoResult GetQueryInfo() { var supportedCommands = new List { // команда приветствия пользователя с кодовым именем "HelloWorld" new SupportedCommand("HelloWorld", "Приветствие") { // параметры ввода Parameters = new List { // поле для ввода имени пользователя new RequiredParameter("UserName", "Имя пользователя", "Введите имя пользователя", "string") } } }; var result = new QueryInfoResult { SupportedCommands = supportedCommands }; return result; } ``` -------------------------------- ### Get Host Terminals Group Source: https://github.com/iiko/front.api.doc/blob/gh-pages/articles/ru/GroupsAndPointsOfSale.md Retrieves the terminal group for the host terminal where the plugin is running. ```APIDOC ## GET IOperationService.GetHostTerminalsGroup ### Description Retrieves the terminal group associated with the current host terminal. ### Method GET ### Endpoint /api/v6/IOperationService/GetHostTerminalsGroup ### Parameters None ### Response #### Success Response (200) - **ITerminalsGroup** (object) - Represents a terminal group with settings like Name and AskCashierForMultiCashRegisterPayment. #### Response Example ```json { "Name": "Main Hall", "AskCashierForMultiCashRegisterPayment": true } ``` ``` -------------------------------- ### Calculate Discount Percentage in C# Source: https://github.com/iiko/front.api.doc/blob/gh-pages/articles/ru/CashRegisters.md Demonstrates how to calculate the discount percentage based on the total discount sum and the sum of items. This calculation is provided for informational purposes. ```csharp DiscountPercent = (Сумма блюд / DiscountSum) * 100 ``` -------------------------------- ### Get Users with Department Filter Source: https://github.com/iiko/front.api.doc/blob/gh-pages/_posts/2023-07-27-users-of-current-department.md Retrieves users, with an option to fetch all users across departments. ```APIDOC ## GET /api/users ### Description Retrieves a list of users. By default, it returns only employees of the current establishment. To get all iikoChain users, set `fromAllDepartments` to `true`. ### Method GET ### Endpoint /api/users ### Query Parameters - **fromAllDepartments** (boolean) - Optional - If `true`, returns all users from all departments. Defaults to `false`. ### Response #### Success Response (200) - **AssignedToCurrentDepartment** (boolean) - Indicates if the user belongs to the current department. ### Response Example ```json [ { "id": "user-id-1", "name": "John Doe", "AssignedToCurrentDepartment": true }, { "id": "user-id-2", "name": "Jane Smith", "AssignedToCurrentDepartment": false } ] ``` ``` -------------------------------- ### Настройка отладки для Classic .csproj в Visual Studio Source: https://github.com/iiko/front.api.doc/blob/gh-pages/commonArticles/debugging.md Пример заполнения полей Debug для проекта в старом формате .csproj. Указывает путь к хост-процессу и аргументы командной строки для запуска плагина. ```text Start external program: `C:\Program Files\iiko\iikoRMS\Front.Net\Resto.Front.Api.Host.exe`. Command line arguments: `/a="C:\Projects\Front.Api Sdk\Resto.Front.Api.SamplePlugin\bin\Debug\Resto.Front.Api.SamplePlugin.dll" /c=Resto.Front.Api.SamplePlugin.SamplePlugin /m=21005108 /l="C:\Projects\Front.Api Sdk\Logs\sample-plugin.log"` ``` -------------------------------- ### Изменение ИНН покупателя в BeforeDoCheckAction Source: https://github.com/iiko/front.api.doc/blob/gh-pages/_posts/2022-05-23-change-customer-tin.md Пример реализации IChequeTaskProcessor для установки ИНН покупателя. Используется для изменения ИНН перед проверкой чека. ```csharp public class CustomChequeTaskProcessor : IChequeTaskProcessor { public BeforeDoCheckActionResult BeforeDoCheckAction(ChequeTask chequeTask, IOrder order, IOperationService operations) { return new BeforeDoCheckActionResult { CustomerTin = "1234567890", // Установка ИНН покупателя CashierName = "Иванов И.И.", Sales = chequeTask.Sales }; } } ``` -------------------------------- ### AddOrderCombo with Size Source: https://github.com/iiko/front.api.doc/blob/gh-pages/_posts/2023-06-05-combo-size.md Starting from API V8PreviewV6, the AddOrderCombo method now includes an optional `IProductSize size` parameter. ```APIDOC ## POST /api/editors/AddOrderCombo ### Description Adds a combo dish to an order with an optional size specification. ### Method POST ### Endpoint /api/editors/AddOrderCombo ### Parameters #### Query Parameters - **IProductSize size** (IProductSize) - Optional - Specifies the size for the combo dish. Defaults to null. ### Request Example ```json { "comboId": "some-combo-id", "size": { "id": "medium", "name": "Medium" } } ``` ### Response #### Success Response (200) - **comboOrderId** (string) - The ID of the newly added combo order. #### Response Example ```json { "comboOrderId": "newly-generated-combo-id" } ``` ``` -------------------------------- ### Get All ExternalData for Kitchen Order Item Source: https://github.com/iiko/front.api.doc/blob/gh-pages/_posts/2024-03-24-kitchen-order-items-external-data.md Retrieves all ExternalData associated with a specific kitchen order item. ```APIDOC ## GET /api/ExternalData/GetKitchenOrderItemAllExternalData ### Description Retrieves all ExternalData entries associated with a specific item in a kitchen order. ### Method GET ### Endpoint /api/ExternalData/GetKitchenOrderItemAllExternalData ### Parameters #### Query Parameters - **orderItemId** (string) - Required - The unique identifier of the order item. ### Response #### Success Response (200) - **externalData** (object) - A collection of key-value pairs representing all ExternalData for the order item. - **key** (string) - The key of the ExternalData. - **data** (string) - The value of the ExternalData. #### Response Example ```json { "externalData": [ { "key": "preparation_notes", "data": "Cook medium-rare" }, { "key": "allergy_info", "data": "Contains nuts" } ] } ``` ``` -------------------------------- ### Get All Custom Data for a Plugin Source: https://github.com/iiko/front.api.doc/blob/gh-pages/_posts/2023-08-09-custom-data.md Retrieves all custom data entries currently stored for a specific plugin. ```APIDOC ## GET /api/customdata/all/{moduleId} ### Description Retrieves all custom data entries associated with the specified plugin. ### Method GET ### Endpoint /api/customdata/all/{moduleId} ### Parameters #### Path Parameters - **moduleId** (string) - Required - The identifier of the plugin. ### Response #### Success Response (200) - **data** (object) - A dictionary where keys are the custom data keys and values are their corresponding data. #### Response Example ```json { "data": { "user_settings": "{\"theme\": \"dark\"}", "last_login": "2023-10-27T10:00:00Z" } } ``` ``` -------------------------------- ### Setup FR Settings Source: https://github.com/iiko/front.api.doc/blob/gh-pages/articles/ru/CashRegisters.md Sets up and applies configurations for the Fiscal Register. This is the initial command executed by the plugin when adding or editing FR settings. It saves and applies new `CashRegisterSettings`. ```APIDOC ## POST /api/fr/setup ### Description Sets up and applies configurations for the Fiscal Register. This is the initial command executed by the plugin when adding or editing FR settings. It saves and applies new `CashRegisterSettings`. ### Method POST ### Endpoint /api/fr/setup ### Parameters #### Request Body - **newSettings** (CashRegisterSettings) - Required - The new settings to apply to the Fiscal Register. ### Request Example ```json { "newSettings": { "Autorun": true, "wasConnected": true } } ``` ### Response #### Success Response (200) - **Success** (boolean) - Indicates if the setup operation was successful. #### Response Example ```json { "Success": true } ``` ``` -------------------------------- ### Get Query Info Source: https://github.com/iiko/front.api.doc/blob/gh-pages/_posts/2023-05-15-api-cashregister.md Retrieves additional supported operations that can be invoked via `CashRegisterDirectIO`. Returns `QueryInfoResult.SupportedCommands`. ```APIDOC ## POST /api/v8Preview6/operations/GetQueryInfo ### Description Retrieves a list of additional supported commands for the fiscal register. ### Method POST ### Endpoint /api/v8Preview6/operations/GetQueryInfo ### Parameters (No specific parameters documented for this operation) ### Request Body (No specific request body documented for this operation) ### Response #### Success Response (200) - **SupportedCommands** (array of string) - A list of command names supported by the fiscal register. #### Response Example ```json { "SupportedCommands": [ "SomeCustomCommand", "AnotherCommand" ] } ``` ``` -------------------------------- ### Add Preliminary Payment and Process Prepayment Source: https://github.com/iiko/front.api.doc/blob/gh-pages/articles/ru/Payments.md Use AddPreliminaryPaymentItem to add a preliminary payment and then ProcessPrepay to convert it into a prepayment for a delivery order. Ensure you have the correct order, payment type, and credentials. ```cs var order = PluginContext.Operations.GetDeliveryOrders().Last(o => o.Status == OrderStatus.New || o.Status == OrderStatus.Bill); var paymentType = PluginContext.Operations.GetPaymentTypes().Last(i => i.Kind == PaymentTypeKind.Cash); var credentials = PluginContext.Operations.GetCredentials(); var paymentItem = PluginContext.Operations.AddPreliminaryPaymentItem(order.ResultSum, null, paymentType, order, credentials); PluginContext.Operations.ProcessPrepay(credentials, PluginContext.Operations.GetDeliveryOrderById(order.Id), paymentItem); ``` -------------------------------- ### Get Product By Barcode Source: https://github.com/iiko/front.api.doc/blob/gh-pages/_posts/2021-12-07-product-barcodes.md Retrieves product information using its barcode. This method was introduced in API v7. ```APIDOC ## POST /api/operation/getProductByBarcode ### Description Retrieves product information by providing its barcode. ### Method POST ### Endpoint /api/operation/getProductByBarcode ### Parameters #### Request Body - **barcode** (string) - Required - The barcode of the product to search for. ### Request Example { "barcode": "1234567890123" } ### Response #### Success Response (200) - **product** (object) - Information about the found product. - **id** (string) - The unique identifier of the product. - **name** (string) - The name of the product. - **barcodeContainers** (array) - A list of barcode containers associated with the product. - **barcode** (string) - The barcode string. - **containerType** (string) - The type of container. #### Response Example { "product": { "id": "prod_123", "name": "Sample Product", "barcodeContainers": [ { "barcode": "1234567890123", "containerType": "EAN13" } ] } } ``` -------------------------------- ### Configure Minimum Query Length Source: https://github.com/iiko/front.api.doc/blob/gh-pages/_internal_doc/SEARCH-GUIDE.md Change the minimum query length to control when the search starts returning results. ```javascript if (query.length < 2) { ```