
Core library for fiscal cash register systems — implements business rules, data validation, offline queuing with retries, OFD delivery and configurable HTML receipt rendering with multiple layouts, themes and localization.
superkassa-core is the core multi-project Kotlin Multiplatform (KMP) library for the Superkassa fiscal cash register system. It implements all business rules, data validation, domain entities, and use cases, separated into seven distinct modules:
core-domain: Pure Kotlin Multiplatform domain entities (Receipt, KkmInfo, ShiftInfo) and port definitions (StoragePort, ClockPort, DeliveryPort).core-data: Implementations of storage backing, OFD communication orchestration, retry policies, and lease locking.core-presentation: Presentation layer facade (SuperkassaApi) that exposes the core system functions to client applications.offline-queue: Offline database command queue, handling request caching, retry scheduling with backoff policies, state mapping, and error reporting.core-string: Base localizable string assets, templates, and text resource mappings.delivery: Transportation network delivery layer for sending documents to remote servers.receipt-renderer: Print layout engine for building and formatting receipts in HTML and raw configurations, supporting multiple layouts, sizes (58mm, 80mm, Fullscreen), color themes, and multi-language translations (Russian, Kazakh, English).To use the unified core KMP module in your Multiplatform or JVM Gradle build:
dependencies {
// For Multiplatform targets
implementation("io.github.texport:superkassa-core:1.1.4")
// Or for JVM-only targets (like server)
implementation("io.github.texport:superkassa-core-jvm:1.1.4")
}The iOS target is packaged as a unified SuperkassaCore binary XCFramework distributed via Swift Package Manager. Add the package reference to your Package.swift:
dependencies: [
.package(url: "https://github.com/texport/superkassa-core", from: "1.1.4")
]superkassa-core — это основная мультипроектная библиотека Kotlin Multiplatform (KMP) для фискальной системы Superkassa. Она реализует все бизнес-правила, валидацию данных, доменные сущности и сценарии использования (Use Cases), разделенные на семь модулей:
core-domain: Чистые сущности предметной области KMP (Receipt, KkmInfo, ShiftInfo) и интерфейсы портов (StoragePort, ClockPort, DeliveryPort).core-data: Реализации портов хранения, отправки документов в ОФД, политик повторных попыток и межпроцессных блокировок.core-presentation: Фасад презентационного слоя (SuperkassaApi), предоставляющий методы интеграции ядра с внешними клиентами.offline-queue: Очередь оффлайн-команд в базе данных, кэширование запросов, политики повторных отправлений (backoff) и статусное логирование.core-string: Базовые локализуемые строковые ресурсы, шаблоны и текстовые маппинги.delivery: Транспортный сетевой уровень для доставки фискальных документов на удаленные серверы.receipt-renderer: Движок генерации печатных форм чеков в формате HTML, поддерживающий различные макеты, размеры ленты (58мм, 80мм, Fullscreen), цветовые схемы и многоязыковую локализацию (русский, казахский, английский).Подключите единый KMP модуль в зависимости вашего Gradle-проекта:
dependencies {
// Для мультиплатформенных (KMP) проектов
implementation("io.github.texport:superkassa-core:1.1.4")
// Для классических JVM-проектов (например, сервер)
implementation("io.github.texport:superkassa-core-jvm:1.1.4")
}Для iOS-проектов ядро скомпилировано в бинарный фреймворк SuperkassaCore.xcframework и распространяется через Swift Package Manager. Добавьте зависимость в ваш Package.swift:
dependencies: [
.package(url: "https://github.com/texport/superkassa-core", from: "1.1.4")
]Here is a quick example of how to initialize and interact with SuperkassaApi in your application:
import io.github.texport.superkassa.core.presentation.api.SuperkassaApi
import io.github.texport.superkassa.core.presentation.api.model.kkm.KkmInitDirectRequest
import io.github.texport.superkassa.core.presentation.api.model.receipt.ReceiptSellRequest
import io.github.texport.superkassa.core.presentation.api.model.receipt.ReceiptItemRequest
import io.github.texport.superkassa.core.presentation.api.model.receipt.ReceiptPaymentRequest
// Retrieve the API implementation (e.g., via dependency injection)
val api: SuperkassaApi = ...
// 1. Initialize a physical KKM (Direct)
val kkm = api.initKkm(
pin = "1234",
request = KkmInitDirectRequest(
ofdId = "kazakhtelecom",
ofdEnvironment = "prod",
ofdSystemId = "sys-12345",
ofdToken = "token-abc-123",
kkmKgdId = "123456789012",
factoryNumber = "SWK-0001",
manufactureYear = 2026
)
)
// 2. Register a cashier sell receipt
val sellResult = api.createSellReceipt(
kkmId = kkm.id,
pin = "1111",
request = ReceiptSellRequest(
items = listOf(
ReceiptItemRequest(
name = "Фискальный товар",
price = 1500.0,
quantity = 1L,
vatGroup = "VAT_12",
measureUnitCode = "796"
)
),
payments = listOf(
ReceiptPaymentRequest(type = "CASH", sum = 1500.0)
),
idempotencyKey = "unique-receipt-key-1"
)
)
println("Receipt registered successfully with ticket number: ${sellResult.ticketNumber}")The project follows a strict Clean Architecture boundary design across all seven modules:
Receipt, ShiftInfo) are fully decoupled from serialization libraries (no @Serializable annotations) and have no framework dependencies.internal adapters to prevent detail leakage.SuperkassaApi and decoupled structures (like ReceiptSellRequest, UserRole) containing serialization descriptors, preventing leakage of serialization frameworks into the domain layer.To integrate superkassa-core into your host platform (JVM Server, Android App, iOS App), the developer must provide implementation adapters for the following core domain ports:
Для интеграции superkassa-core в целевую платформу (JVM Сервер, Android, iOS) разработчик должен предоставить реализации следующих портов:
StoragePort:
CoreSettingsRepositoryPort:
CoreSettings).CoreSettings).DeliveryPort:
ReceiptRenderPort & DocumentConvertPort:
OfdConnectionPort / OfdManagerPort:
ClockPort / IdGeneratorPort / PinHasherPort:
superkassa-core is the core multi-project Kotlin Multiplatform (KMP) library for the Superkassa fiscal cash register system. It implements all business rules, data validation, domain entities, and use cases, separated into seven distinct modules:
core-domain: Pure Kotlin Multiplatform domain entities (Receipt, KkmInfo, ShiftInfo) and port definitions (StoragePort, ClockPort, DeliveryPort).core-data: Implementations of storage backing, OFD communication orchestration, retry policies, and lease locking.core-presentation: Presentation layer facade (SuperkassaApi) that exposes the core system functions to client applications.offline-queue: Offline database command queue, handling request caching, retry scheduling with backoff policies, state mapping, and error reporting.core-string: Base localizable string assets, templates, and text resource mappings.delivery: Transportation network delivery layer for sending documents to remote servers.receipt-renderer: Print layout engine for building and formatting receipts in HTML and raw configurations, supporting multiple layouts, sizes (58mm, 80mm, Fullscreen), color themes, and multi-language translations (Russian, Kazakh, English).To use the unified core KMP module in your Multiplatform or JVM Gradle build:
dependencies {
// For Multiplatform targets
implementation("io.github.texport:superkassa-core:1.1.4")
// Or for JVM-only targets (like server)
implementation("io.github.texport:superkassa-core-jvm:1.1.4")
}The iOS target is packaged as a unified SuperkassaCore binary XCFramework distributed via Swift Package Manager. Add the package reference to your Package.swift:
dependencies: [
.package(url: "https://github.com/texport/superkassa-core", from: "1.1.4")
]superkassa-core — это основная мультипроектная библиотека Kotlin Multiplatform (KMP) для фискальной системы Superkassa. Она реализует все бизнес-правила, валидацию данных, доменные сущности и сценарии использования (Use Cases), разделенные на семь модулей:
core-domain: Чистые сущности предметной области KMP (Receipt, KkmInfo, ShiftInfo) и интерфейсы портов (StoragePort, ClockPort, DeliveryPort).core-data: Реализации портов хранения, отправки документов в ОФД, политик повторных попыток и межпроцессных блокировок.core-presentation: Фасад презентационного слоя (SuperkassaApi), предоставляющий методы интеграции ядра с внешними клиентами.offline-queue: Очередь оффлайн-команд в базе данных, кэширование запросов, политики повторных отправлений (backoff) и статусное логирование.core-string: Базовые локализуемые строковые ресурсы, шаблоны и текстовые маппинги.delivery: Транспортный сетевой уровень для доставки фискальных документов на удаленные серверы.receipt-renderer: Движок генерации печатных форм чеков в формате HTML, поддерживающий различные макеты, размеры ленты (58мм, 80мм, Fullscreen), цветовые схемы и многоязыковую локализацию (русский, казахский, английский).Подключите единый KMP модуль в зависимости вашего Gradle-проекта:
dependencies {
// Для мультиплатформенных (KMP) проектов
implementation("io.github.texport:superkassa-core:1.1.4")
// Для классических JVM-проектов (например, сервер)
implementation("io.github.texport:superkassa-core-jvm:1.1.4")
}Для iOS-проектов ядро скомпилировано в бинарный фреймворк SuperkassaCore.xcframework и распространяется через Swift Package Manager. Добавьте зависимость в ваш Package.swift:
dependencies: [
.package(url: "https://github.com/texport/superkassa-core", from: "1.1.4")
]Here is a quick example of how to initialize and interact with SuperkassaApi in your application:
import io.github.texport.superkassa.core.presentation.api.SuperkassaApi
import io.github.texport.superkassa.core.presentation.api.model.kkm.KkmInitDirectRequest
import io.github.texport.superkassa.core.presentation.api.model.receipt.ReceiptSellRequest
import io.github.texport.superkassa.core.presentation.api.model.receipt.ReceiptItemRequest
import io.github.texport.superkassa.core.presentation.api.model.receipt.ReceiptPaymentRequest
// Retrieve the API implementation (e.g., via dependency injection)
val api: SuperkassaApi = ...
// 1. Initialize a physical KKM (Direct)
val kkm = api.initKkm(
pin = "1234",
request = KkmInitDirectRequest(
ofdId = "kazakhtelecom",
ofdEnvironment = "prod",
ofdSystemId = "sys-12345",
ofdToken = "token-abc-123",
kkmKgdId = "123456789012",
factoryNumber = "SWK-0001",
manufactureYear = 2026
)
)
// 2. Register a cashier sell receipt
val sellResult = api.createSellReceipt(
kkmId = kkm.id,
pin = "1111",
request = ReceiptSellRequest(
items = listOf(
ReceiptItemRequest(
name = "Фискальный товар",
price = 1500.0,
quantity = 1L,
vatGroup = "VAT_12",
measureUnitCode = "796"
)
),
payments = listOf(
ReceiptPaymentRequest(type = "CASH", sum = 1500.0)
),
idempotencyKey = "unique-receipt-key-1"
)
)
println("Receipt registered successfully with ticket number: ${sellResult.ticketNumber}")The project follows a strict Clean Architecture boundary design across all seven modules:
Receipt, ShiftInfo) are fully decoupled from serialization libraries (no @Serializable annotations) and have no framework dependencies.internal adapters to prevent detail leakage.SuperkassaApi and decoupled structures (like ReceiptSellRequest, UserRole) containing serialization descriptors, preventing leakage of serialization frameworks into the domain layer.To integrate superkassa-core into your host platform (JVM Server, Android App, iOS App), the developer must provide implementation adapters for the following core domain ports:
Для интеграции superkassa-core в целевую платформу (JVM Сервер, Android, iOS) разработчик должен предоставить реализации следующих портов:
StoragePort:
CoreSettingsRepositoryPort:
CoreSettings).CoreSettings).DeliveryPort:
ReceiptRenderPort & DocumentConvertPort:
OfdConnectionPort / OfdManagerPort:
ClockPort / IdGeneratorPort / PinHasherPort: