├── AUTHORS ├── example ├── __init__.py └── mock_ofd.py ├── tests ├── __init__.py ├── example_test.py └── ofd_test.py ├── ofd ├── version.py └── __init__.py ├── setup.py ├── .gitignore ├── README.md ├── schemas ├── 1.0 │ ├── closeArchive.schema.json │ ├── document.schema.json │ ├── openShift.schema.json │ ├── currentStateReport.schema.json │ ├── fiscalReport.schema.json │ ├── fiscalReportCorrection.schema.json │ ├── closeShift.schema.json │ ├── receiptCorrection.schema.json │ ├── receipt.schema.json │ └── dictionary.schema.json ├── 1.05 │ ├── document.schema.json │ ├── closeArchive.schema.json │ ├── currentStateReport.schema.json │ ├── openShift.schema.json │ ├── fiscalReport.schema.json │ ├── closeShift.schema.json │ ├── fiscalReportCorrection.schema.json │ ├── receiptCorrection.schema.json │ └── receipt.schema.json └── 1.1 │ ├── document.schema.json │ ├── closeArchive.schema.json │ ├── currentStateReport.schema.json │ ├── openShift.schema.json │ ├── fiscalReport.schema.json │ ├── closeShift.schema.json │ ├── fiscalReportCorrection.schema.json │ ├── receiptCorrection.schema.json │ └── receipt.schema.json └── LICENSE /AUTHORS: -------------------------------------------------------------------------------- 1 | The following authors have created the source code of "Yandex OFD" 2 | published and distributed by YANDEX LLC as the owner: 3 | 4 | 5 | Evgeny Safronov 6 | Yuri Fedoseev -------------------------------------------------------------------------------- /example/__init__.py: -------------------------------------------------------------------------------- 1 | # coding: utf8 2 | # 3 | # Copyright (C) 2017 Yandex LLC 4 | # http://yandex.com 5 | # 6 | # Licensed under the Apache License, Version 2.0 (the "License"); 7 | # you may not use this file except in compliance with the License. 8 | # You may obtain a copy of the License at 9 | # 10 | # http://www.apache.org/licenses/LICENSE-2.0 11 | # 12 | # Unless required by applicable law or agreed to in writing, software 13 | # distributed under the License is distributed on an "AS IS" BASIS, 14 | # WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 15 | # See the License for the specific language governing permissions and 16 | # 17 | -------------------------------------------------------------------------------- /tests/__init__.py: -------------------------------------------------------------------------------- 1 | # coding: utf8 2 | # 3 | # Copyright (C) 2017 Yandex LLC 4 | # http://yandex.com 5 | # 6 | # Licensed under the Apache License, Version 2.0 (the "License"); 7 | # you may not use this file except in compliance with the License. 8 | # You may obtain a copy of the License at 9 | # 10 | # http://www.apache.org/licenses/LICENSE-2.0 11 | # 12 | # Unless required by applicable law or agreed to in writing, software 13 | # distributed under the License is distributed on an "AS IS" BASIS, 14 | # WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 15 | # See the License for the specific language governing permissions and 16 | # 17 | -------------------------------------------------------------------------------- /ofd/version.py: -------------------------------------------------------------------------------- 1 | # coding: utf8 2 | # 3 | # Copyright (C) 2017 Yandex LLC 4 | # http://yandex.com 5 | # 6 | # Licensed under the Apache License, Version 2.0 (the "License"); 7 | # you may not use this file except in compliance with the License. 8 | # You may obtain a copy of the License at 9 | # 10 | # http://www.apache.org/licenses/LICENSE-2.0 11 | # 12 | # Unless required by applicable law or agreed to in writing, software 13 | # distributed under the License is distributed on an "AS IS" BASIS, 14 | # WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 15 | # See the License for the specific language governing permissions and 16 | # 17 | 18 | __version__ = '0.37.4' 19 | -------------------------------------------------------------------------------- /ofd/__init__.py: -------------------------------------------------------------------------------- 1 | # coding: utf8 2 | # 3 | # Copyright (C) 2017 Yandex LLC 4 | # http://yandex.com 5 | # 6 | # Licensed under the Apache License, Version 2.0 (the "License"); 7 | # you may not use this file except in compliance with the License. 8 | # You may obtain a copy of the License at 9 | # 10 | # http://www.apache.org/licenses/LICENSE-2.0 11 | # 12 | # Unless required by applicable law or agreed to in writing, software 13 | # distributed under the License is distributed on an "AS IS" BASIS, 14 | # WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 15 | # See the License for the specific language governing permissions and 16 | # 17 | 18 | from .protocol import Byte, DOCUMENTS, FrameHeader, FVLN, SessionHeader, String, STLV, U32, UnixTime, VLN, SIGNATURE, \ 19 | pack_json 20 | from .version import __version__ 21 | 22 | __all__ = [ 23 | 'Byte', 24 | 'FrameHeader', 25 | 'FVLN', 'SessionHeader', 'DOCUMENTS', 'String', 'STLV', 'U32', 'UnixTime', 'VLN', 26 | 'SIGNATURE', 'pack_json', 'unpack_container_message', 27 | '__version__' 28 | ] 29 | -------------------------------------------------------------------------------- /setup.py: -------------------------------------------------------------------------------- 1 | #!/usr/bin/env python 2 | # encoding: utf-8 3 | 4 | from setuptools import setup 5 | import sys 6 | 7 | if sys.version_info < (3, 5): 8 | sys.exit('Sorry, Python < 3.5 is not supported') 9 | 10 | exec(open('ofd/version.py').read()) 11 | 12 | setup( 13 | name='ofd', 14 | version=__version__, 15 | author='Evgeny Safronov', 16 | author_email='esafronov@yandex-team.ru', 17 | maintainer='Yuri Fedoseev', 18 | maintainer_email='yfedoseev@yandex-team.ru', 19 | url='https://github.com/yandex/ofd', 20 | description='Yandex OFD', 21 | packages=[ 22 | 'ofd', 23 | ], 24 | platforms=["Linux", "BSD", "MacOS"], 25 | license='APACHE 2.0', 26 | install_requires=[ 27 | 'jsonschema', 28 | 'crcmod' 29 | ], 30 | test_suite='tests', 31 | setup_requires=[ 32 | 'pytest-runner', 33 | ], 34 | tests_require=['pytest', 'pytest_asyncio', 'asynctest'], 35 | zip_safe=True, 36 | classifiers=[ 37 | 'Programming Language :: Python', 38 | 'Programming Language :: Python :: 3.5', 39 | # 'Development Status :: 1 - Planning', 40 | # 'Development Status :: 2 - Pre-Alpha', 41 | # 'Development Status :: 3 - Alpha', 42 | 'Development Status :: 4 - Beta', 43 | # 'Development Status :: 5 - Production/Stable', 44 | # 'Development Status :: 6 - Mature', 45 | # 'Development Status :: 7 - Inactive', 46 | ], 47 | ) 48 | -------------------------------------------------------------------------------- /.gitignore: -------------------------------------------------------------------------------- 1 | # Build 2 | .idea/ 3 | .ssl/ 4 | build/ 5 | target/ 6 | 7 | # Object files 8 | *.o 9 | *.ko 10 | *.obj 11 | *.elf 12 | 13 | # Precompiled Headers 14 | *.gch 15 | *.pch 16 | 17 | # Libraries 18 | *.lib 19 | *.a 20 | *.la 21 | *.lo 22 | 23 | # Shared objects (inc. Windows DLLs) 24 | *.dll 25 | *.so 26 | *.so.* 27 | *.dylib 28 | 29 | # Executables 30 | *.exe 31 | *.out 32 | *.app 33 | *.i*86 34 | *.x86_64 35 | *.hex 36 | 37 | # Debug files 38 | *.dSYM/ 39 | *.su 40 | 41 | # Byte-compiled / optimized / DLL files 42 | __pycache__/ 43 | *.py[cod] 44 | *$py.class 45 | 46 | # Distribution / packaging 47 | .Python 48 | env/ 49 | develop-eggs/ 50 | dist/ 51 | downloads/ 52 | eggs/ 53 | .eggs/ 54 | lib/ 55 | lib64/ 56 | parts/ 57 | sdist/ 58 | var/ 59 | *.egg-info/ 60 | .installed.cfg 61 | *.egg 62 | 63 | # PyInstaller 64 | # Usually these files are written by a python script from a template 65 | # before PyInstaller builds the exe, so as to inject date/other infos into it. 66 | *.manifest 67 | *.spec 68 | 69 | # Installer logs 70 | pip-log.txt 71 | pip-delete-this-directory.txt 72 | 73 | # Unit test / coverage reports 74 | htmlcov/ 75 | .tox/ 76 | .coverage 77 | .coverage.* 78 | .cache 79 | nosetests.xml 80 | coverage.xml 81 | *,cover 82 | .hypothesis/ 83 | 84 | # Translations 85 | *.mo 86 | *.pot 87 | 88 | # Django stuff: 89 | *.log 90 | local_settings.py 91 | 92 | # Flask stuff: 93 | instance/ 94 | .webassets-cache 95 | 96 | # Scrapy stuff: 97 | .scrapy 98 | 99 | # Sphinx documentation 100 | docs/_build/ 101 | 102 | # IPython Notebook 103 | .ipynb_checkpoints 104 | 105 | # pyenv 106 | .python-version 107 | 108 | # celery beat schedule file 109 | celerybeat-schedule 110 | 111 | # dotenv 112 | .env 113 | 114 | # virtualenv 115 | venv/ 116 | ENV/ 117 | 118 | # Spyder project settings 119 | .spyderproject 120 | 121 | # Rope project settings 122 | .ropeproject 123 | -------------------------------------------------------------------------------- /README.md: -------------------------------------------------------------------------------- 1 | # ОФД 2 | Библиотека для работы с бинарным протоколом, используемым кассовыми аппаратами для обмена данными с оператором фискальных данных (ОФД). 3 | Подробнее об ОФД и новом порядке применения кассовой технике можно прочитать здесь: https://kkt-online.nalog.ru 4 | 5 | ФФД (формат фискальных данных) - бинарный формат, используемый для обмена сообщениями между кассой и ОФД. 6 | Для передачи фискальных документов от ОФД в налоговую (ФНС) используется описание документов в JSON формате. 7 | 8 | ## Распаковка сообщения от кассы 9 | ```python 10 | import ofd 11 | 12 | message = b'\x5a\x01\x5d\xa8\xa5...' # Контейнер сообщения от кассы в бинарном виде. 13 | fiscal_sign = b'\x23\14\12..' # Фискальный признак документа в бинарном формате - дописывается в конец поля rawData. 14 | doc = ofd.unpack_container_message(message, fiscal_sign) 15 | ``` 16 | 17 | ## Упаковка json документа в бинарный формат 18 | ```python 19 | import ofd 20 | 21 | doc = {'receipt': { .. }} # Фискальный документ в JSON формате. 22 | message = ofd.pack_json(doc, ofd.DOCS_BY_NAME) # Получаем контейнер ФФД в бинарном формате. 23 | ``` 24 | 25 | ## Запуск тестов 26 | ```bash 27 | python3.5 setup.py pytest 28 | ``` 29 | 30 | ## Эмулятор ОФД 31 | В директории ./example написан эмулятор ОФД, демонстрирующий использование протокола. Это TCP-сервер, которое слушает заданный порт. 32 | Если отправить на вход данные бинарного протокола, то приложение расшифрует сообщение в json-формат и выведет его в stdout. 33 | В ответ эмулятор отправит документ "подтверждение оператора" в бинарном формате. Эмулятор работает без использования 34 | шифровальной машины, поэтому сможет прочитать только незашифрованные входящие сообщения. Пример отправки документа можно посмотреть в tests/example_test.py 35 | Запустить пример можно следующей командой, указав желаемый номер порта: 36 | 37 | ```bash 38 | python3.5 example/mock_ofd.py --port 12345 39 | ``` 40 | Для запуска под windows 41 | ``` 42 | py -3.5 example/mock_ofd.py --port 12345 43 | ``` 44 | 45 | 46 | -------------------------------------------------------------------------------- /schemas/1.0/closeArchive.schema.json: -------------------------------------------------------------------------------- 1 | { 2 | "$schema": "http://json-schema.org/draft-04/schema#", 3 | "type": "object", 4 | "description": "Документ полученый от ККТ", 5 | "properties": { 6 | "closeArchive": { 7 | "type": "object", 8 | "description": "Отчет о закрытии фискального накопителя", 9 | "properties": { 10 | "code": { 11 | "type": "integer", 12 | "enum": [ 13 | 6 14 | ] 15 | }, 16 | "userInn": { 17 | "$ref": "dictionary.schema.json#/definitions/userInn" 18 | }, 19 | "operator": { 20 | "$ref": "dictionary.schema.json#/definitions/operator" 21 | }, 22 | "dateTime": { 23 | "$ref": "dictionary.schema.json#/definitions/dateTime" 24 | }, 25 | "kktRegId": { 26 | "$ref": "dictionary.schema.json#/definitions/kktRegId" 27 | }, 28 | "fiscalDriveNumber": { 29 | "$ref": "dictionary.schema.json#/definitions/fiscalDriveNumber" 30 | }, 31 | "fiscalDocumentNumber": { 32 | "$ref": "dictionary.schema.json#/definitions/fiscalDocumentNumber" 33 | }, 34 | "fiscalSign": { 35 | "$ref": "dictionary.schema.json#/definitions/fiscalSign" 36 | }, 37 | "properties": { 38 | "$ref": "dictionary.schema.json#/definitions/propertiesType" 39 | }, 40 | "rawData": { 41 | "$ref": "dictionary.schema.json#/definitions/rawData" 42 | } 43 | }, 44 | "required": [ 45 | "code", 46 | "userInn", 47 | "operator", 48 | "dateTime", 49 | "kktRegId", 50 | "fiscalDriveNumber", 51 | "fiscalDocumentNumber", 52 | "fiscalSign", 53 | "rawData" 54 | ] 55 | } 56 | }, 57 | "required": [ 58 | "closeArchive" 59 | ] 60 | } 61 | -------------------------------------------------------------------------------- /tests/example_test.py: -------------------------------------------------------------------------------- 1 | import pytest 2 | import asyncio 3 | from pytest_asyncio.plugin import unused_tcp_port 4 | from example.mock_ofd import handle_connection, unpack_incoming_message 5 | 6 | 7 | @pytest.mark.asyncio(True) 8 | async def test_ofd_emulation(event_loop): 9 | binary_dump = b'*\x08A\n\x81\xa2\x00\x019999078900005488\xb4\x01\x14\x00\x00\x00\xb4\x01%x\xa5\x0b\x01\x10\t\x99\x99' \ 10 | b'\x07\x89\x00\x00T\x88\x00\x00\x01\x84\xecL\x14\xc2\x00\x00\x01\x00\x04\x01\x8a\x0b\x00\x86\x01\x11' \ 11 | b'\x04\x10\x009999078900005488\r\x04\x14\x000000000005008570 \xfa\x03\x0c\x007702203276 \x10\x04' \ 12 | b'\x04\x00\x01\x00\x00\x00\xf4\x03\x04\x00\x98U\xb9X5\x04\x06\x00!\x04\xaa\x10uA \x04\x01\x00\x00' \ 13 | b'\xea\x03\x01\x00\x00\xe9\x03\x01\x00\x00U\x04\x01\x00\x01V\x04\x01\x00\x00T\x04\x01\x00\x00&\x04' \ 14 | b'\x01\x00\x06M\x04\x01\x00\x01\xf5\x03\x0c\x00000000000002\x18\x04\x11\x00\x8e\x8e\x8e \x90\x80\x8f' \ 15 | b'\x8a\x80\x92-\xe6\xa5\xad\xe2\xe0 \xf1\x030\x00111141 \xa3.\x8c\xae\xe1\xaa\xa2\xa0, \xe3\xab. \x8a' \ 16 | b'\xe3\xe1\xaa\xae\xa2\xe1\xaa\xa0\xef \xa4.20\x80 \xae\xe4\xa8\xe1 \x82-202\xf9\x03\x0c' \ 17 | b'\x007704358518 $\x04\x08\x00nalog.ru]\x04\x13\x00example@example.com\xfd\x03\n\x00\x98\xa5\xad\xad' \ 18 | b'\xae\xad \x8a. \x16\x04\n\x00OOO TAXCOM\xa5\x04\x01\x00\x02\xb9\x04\x01\x00\x02\xa4\x04\x03\x002.0' \ 19 | b'\xa3\x041\x00111141 \xa3.\x8c\xae\xe1\xaa\xa2\xa0, \xe3\xab. \x8a\xe3\xe1\xaa\xae\xa2\xe1\xaa\xa0' \ 20 | b'\xef\r\n\xa4.20\x80 \xae\xe4\xa8\xe1 \x82-202\xb3\x04\x0c\x00771234567890\xc5\x04\x01\x00\x00\xb7' \ 21 | b'\x04\x01\x00\x01\x81\x06\xa5Z\xe1\x0cMu\x00\x00' 22 | 23 | port = unused_tcp_port() 24 | server = await asyncio.start_server(handle_connection, port=port, loop=event_loop) 25 | rd, wr = await asyncio.open_connection(port=port, loop=event_loop) 26 | 27 | wr.write(binary_dump) 28 | await wr.drain() 29 | try: 30 | doc, session, header = await unpack_incoming_message(rd) 31 | assert 'operatorAck' in doc 32 | assert doc['operatorAck']['fiscalDriveNumber'] == '9999078900005488' 33 | assert doc['operatorAck']['fiscalDocumentNumber'] == 1 34 | assert doc['operatorAck']['ofdInn'] == '7704358518' 35 | assert doc['operatorAck']['messageToFn'] == {'ofdResponseCode': 0} 36 | finally: 37 | server.close() 38 | -------------------------------------------------------------------------------- /schemas/1.0/document.schema.json: -------------------------------------------------------------------------------- 1 | { 2 | "$schema": "http://json-schema.org/draft-04/schema#", 3 | "type": "object", 4 | "description": "Документ полученый от ККТ", 5 | "properties": { 6 | "fiscalReport": { 7 | "$ref": "fiscalReport.schema.json#/properties/fiscalReport" 8 | }, 9 | "fiscalReportCorrection": { 10 | "$ref": "fiscalReportCorrection.schema.json#/properties/fiscalReportCorrection" 11 | }, 12 | "openShift": { 13 | "$ref": "openShift.schema.json#/properties/openShift" 14 | }, 15 | "currentStateReport": { 16 | "$ref": "currentStateReport.schema.json#/properties/currentStateReport" 17 | }, 18 | "receipt": { 19 | "$ref": "receipt.schema.json#/oneOf/0/properties/receipt" 20 | }, 21 | "receiptCorrection": { 22 | "$ref": "receiptCorrection.schema.json#/oneOf/0/properties/receiptCorrection" 23 | }, 24 | "bso": { 25 | "$ref": "receipt.schema.json#/oneOf/1/properties/bso" 26 | }, 27 | "bsoCorrection": { 28 | "$ref": "receiptCorrection.schema.json#/oneOf/1/properties/bsoCorrection" 29 | }, 30 | "closeShift": { 31 | "$ref": "closeShift.schema.json#/properties/closeShift" 32 | }, 33 | "closeArchive": { 34 | "$ref": "closeArchive.schema.json#/properties/closeArchive" 35 | } 36 | }, 37 | "oneOf": [ 38 | { 39 | "required": [ 40 | "fiscalReport" 41 | ] 42 | }, 43 | { 44 | "required": [ 45 | "fiscalReportCorrection" 46 | ] 47 | }, 48 | { 49 | "required": [ 50 | "openShift" 51 | ] 52 | }, 53 | { 54 | "required": [ 55 | "currentStateReport" 56 | ] 57 | }, 58 | { 59 | "required": [ 60 | "receipt" 61 | ] 62 | }, 63 | { 64 | "required": [ 65 | "receiptCorrection" 66 | ] 67 | }, 68 | { 69 | "required": [ 70 | "bso" 71 | ] 72 | }, 73 | { 74 | "required": [ 75 | "bsoCorrection" 76 | ] 77 | }, 78 | { 79 | "required": [ 80 | "closeShift" 81 | ] 82 | }, 83 | { 84 | "required": [ 85 | "closeArchive" 86 | ] 87 | } 88 | ] 89 | } 90 | -------------------------------------------------------------------------------- /schemas/1.05/document.schema.json: -------------------------------------------------------------------------------- 1 | { 2 | "$schema": "http://json-schema.org/draft-04/schema#", 3 | "type": "object", 4 | "description": "Документ полученый от ККТ", 5 | "properties": { 6 | "fiscalReport": { 7 | "$ref": "fiscalReport.schema.json#/properties/fiscalReport" 8 | }, 9 | "fiscalReportCorrection": { 10 | "$ref": "fiscalReportCorrection.schema.json#/properties/fiscalReportCorrection" 11 | }, 12 | "openShift": { 13 | "$ref": "openShift.schema.json#/properties/openShift" 14 | }, 15 | "currentStateReport": { 16 | "$ref": "currentStateReport.schema.json#/properties/currentStateReport" 17 | }, 18 | "receipt": { 19 | "$ref": "receipt.schema.json#/oneOf/0/properties/receipt" 20 | }, 21 | "receiptCorrection": { 22 | "$ref": "receiptCorrection.schema.json#/oneOf/0/properties/receiptCorrection" 23 | }, 24 | "bso": { 25 | "$ref": "receipt.schema.json#/oneOf/1/properties/bso" 26 | }, 27 | "bsoCorrection": { 28 | "$ref": "receiptCorrection.schema.json#/oneOf/1/properties/bsoCorrection" 29 | }, 30 | "closeShift": { 31 | "$ref": "closeShift.schema.json#/properties/closeShift" 32 | }, 33 | "closeArchive": { 34 | "$ref": "closeArchive.schema.json#/properties/closeArchive" 35 | } 36 | }, 37 | "oneOf": [ 38 | { 39 | "required": [ 40 | "fiscalReport" 41 | ] 42 | }, 43 | { 44 | "required": [ 45 | "fiscalReportCorrection" 46 | ] 47 | }, 48 | { 49 | "required": [ 50 | "openShift" 51 | ] 52 | }, 53 | { 54 | "required": [ 55 | "currentStateReport" 56 | ] 57 | }, 58 | { 59 | "required": [ 60 | "receipt" 61 | ] 62 | }, 63 | { 64 | "required": [ 65 | "receiptCorrection" 66 | ] 67 | }, 68 | { 69 | "required": [ 70 | "bso" 71 | ] 72 | }, 73 | { 74 | "required": [ 75 | "bsoCorrection" 76 | ] 77 | }, 78 | { 79 | "required": [ 80 | "closeShift" 81 | ] 82 | }, 83 | { 84 | "required": [ 85 | "closeArchive" 86 | ] 87 | } 88 | ] 89 | } 90 | -------------------------------------------------------------------------------- /schemas/1.0/openShift.schema.json: -------------------------------------------------------------------------------- 1 | { 2 | "$schema": "http://json-schema.org/draft-04/schema#", 3 | "type": "object", 4 | "description": "Документ полученый от ККТ", 5 | "properties": { 6 | "openShift": { 7 | "type": "object", 8 | "description": "Отчет об открытии смены", 9 | "properties": { 10 | "code": { 11 | "type": "integer", 12 | "enum": [ 13 | 2 14 | ] 15 | }, 16 | "user": { 17 | "$ref": "dictionary.schema.json#/definitions/user" 18 | }, 19 | "userInn": { 20 | "$ref": "dictionary.schema.json#/definitions/userInn" 21 | }, 22 | "operator": { 23 | "$ref": "dictionary.schema.json#/definitions/operator" 24 | }, 25 | "retailPlaceAddress": { 26 | "$ref": "dictionary.schema.json#/definitions/retailPlaceAddress" 27 | }, 28 | "dateTime": { 29 | "$ref": "dictionary.schema.json#/definitions/dateTime" 30 | }, 31 | "shiftNumber": { 32 | "$ref": "dictionary.schema.json#/definitions/shiftNumber" 33 | }, 34 | "kktRegId": { 35 | "$ref": "dictionary.schema.json#/definitions/kktRegId" 36 | }, 37 | "fiscalDriveNumber": { 38 | "$ref": "dictionary.schema.json#/definitions/fiscalDriveNumber" 39 | }, 40 | "fiscalDocumentNumber": { 41 | "$ref": "dictionary.schema.json#/definitions/fiscalDocumentNumber" 42 | }, 43 | "fiscalSign": { 44 | "$ref": "dictionary.schema.json#/definitions/fiscalSign" 45 | }, 46 | "message": { 47 | "$ref": "dictionary.schema.json#/definitions/message" 48 | }, 49 | "properties": { 50 | "$ref": "dictionary.schema.json#/definitions/propertiesType" 51 | }, 52 | "rawData": { 53 | "$ref": "dictionary.schema.json#/definitions/rawData" 54 | } 55 | }, 56 | "required": [ 57 | "code", 58 | "userInn", 59 | "dateTime", 60 | "shiftNumber", 61 | "kktRegId", 62 | "fiscalDriveNumber", 63 | "fiscalDocumentNumber", 64 | "fiscalSign", 65 | "rawData" 66 | ] 67 | } 68 | }, 69 | "required": [ 70 | "openShift" 71 | ] 72 | } 73 | -------------------------------------------------------------------------------- /schemas/1.1/document.schema.json: -------------------------------------------------------------------------------- 1 | { 2 | "$schema": "http://json-schema.org/draft-04/schema#", 3 | "type": "object", 4 | "description": "Документ полученый от ККТ", 5 | "properties": { 6 | "fiscalReport": { 7 | "$ref": "fiscalReport.schema.json#/properties/document/properties/fiscalReport" 8 | }, 9 | "fiscalReportCorrection": { 10 | "$ref": "fiscalReportCorrection.schema.json#/properties/document/properties/fiscalReportCorrection" 11 | }, 12 | "openShift": { 13 | "$ref": "openShift.schema.json#/properties/document/properties/openShift" 14 | }, 15 | "currentStateReport": { 16 | "$ref": "currentStateReport.schema.json#/properties/document/properties/currentStateReport" 17 | }, 18 | "receipt": { 19 | "$ref": "receipt.schema.json#/properties/document/oneOf/0/properties/receipt" 20 | }, 21 | "receiptCorrection": { 22 | "$ref": "receiptCorrection.schema.json#/properties/document/oneOf/0/properties/receiptCorrection" 23 | }, 24 | "bso": { 25 | "$ref": "receipt.schema.json#/properties/document/oneOf/1/properties/bso" 26 | }, 27 | "bsoCorrection": { 28 | "$ref": "receiptCorrection.schema.json#/properties/document/oneOf/1/properties/bsoCorrection" 29 | }, 30 | "closeShift": { 31 | "$ref": "closeShift.schema.json#/properties/document/properties/closeShift" 32 | }, 33 | "closeArchive": { 34 | "$ref": "closeArchive.schema.json#/properties/document/properties/closeArchive" 35 | } 36 | }, 37 | "oneOf": [ 38 | { 39 | "required": [ 40 | "fiscalReport" 41 | ] 42 | }, 43 | { 44 | "required": [ 45 | "fiscalReportCorrection" 46 | ] 47 | }, 48 | { 49 | "required": [ 50 | "openShift" 51 | ] 52 | }, 53 | { 54 | "required": [ 55 | "currentStateReport" 56 | ] 57 | }, 58 | { 59 | "required": [ 60 | "receipt" 61 | ] 62 | }, 63 | { 64 | "required": [ 65 | "receiptCorrection" 66 | ] 67 | }, 68 | { 69 | "required": [ 70 | "bso" 71 | ] 72 | }, 73 | { 74 | "required": [ 75 | "bsoCorrection" 76 | ] 77 | }, 78 | { 79 | "required": [ 80 | "closeShift" 81 | ] 82 | }, 83 | { 84 | "required": [ 85 | "closeArchive" 86 | ] 87 | } 88 | ] 89 | } 90 | -------------------------------------------------------------------------------- /schemas/1.0/currentStateReport.schema.json: -------------------------------------------------------------------------------- 1 | { 2 | "$schema": "http://json-schema.org/draft-04/schema#", 3 | "type": "object", 4 | "description": "Документ полученый от ККТ", 5 | "properties": { 6 | "currentStateReport": { 7 | "type": "object", 8 | "description": "Отчёт о текущем состоянии расчетов", 9 | "properties": { 10 | "code": { 11 | "type": "integer", 12 | "enum": [ 13 | 21 14 | ] 15 | }, 16 | "userInn": { 17 | "$ref": "dictionary.schema.json#/definitions/userInn" 18 | }, 19 | "dateTime": { 20 | "$ref": "dictionary.schema.json#/definitions/dateTime" 21 | }, 22 | "shiftNumber": { 23 | "$ref": "dictionary.schema.json#/definitions/shiftNumber" 24 | }, 25 | "offlineMode": { 26 | "$ref": "dictionary.schema.json#/definitions/offlineMode" 27 | }, 28 | "notTransmittedDocumentNumber": { 29 | "type": "integer", 30 | "minimum": 0, 31 | "maximum": 4294967295, 32 | "description": "номер первого непереданного документа" 33 | }, 34 | "notTransmittedDocumentsQuantity": { 35 | "$ref": "dictionary.schema.json#/definitions/notTransmittedDocumentsQuantity" 36 | }, 37 | "notTransmittedDocumentsDateTime": { 38 | "$ref": "dictionary.schema.json#/definitions/notTransmittedDocumentsDateTime" 39 | }, 40 | "kktRegId": { 41 | "$ref": "dictionary.schema.json#/definitions/kktRegId" 42 | }, 43 | "fiscalDriveNumber": { 44 | "$ref": "dictionary.schema.json#/definitions/fiscalDriveNumber" 45 | }, 46 | "fiscalDocumentNumber": { 47 | "$ref": "dictionary.schema.json#/definitions/fiscalDocumentNumber" 48 | }, 49 | "fiscalSign": { 50 | "$ref": "dictionary.schema.json#/definitions/fiscalSign" 51 | }, 52 | "properties": { 53 | "$ref": "dictionary.schema.json#/definitions/propertiesType" 54 | }, 55 | "rawData": { 56 | "$ref": "dictionary.schema.json#/definitions/rawData" 57 | } 58 | }, 59 | "required": [ 60 | "code", 61 | "userInn", 62 | "dateTime", 63 | "offlineMode", 64 | "notTransmittedDocumentNumber", 65 | "notTransmittedDocumentsQuantity", 66 | "notTransmittedDocumentsDateTime", 67 | "kktRegId", 68 | "fiscalDriveNumber", 69 | "fiscalDocumentNumber", 70 | "fiscalSign", 71 | "rawData" 72 | ] 73 | } 74 | }, 75 | "required": [ 76 | "currentStateReport" 77 | ] 78 | } 79 | -------------------------------------------------------------------------------- /schemas/1.05/closeArchive.schema.json: -------------------------------------------------------------------------------- 1 | { 2 | "$schema": "http://json-schema.org/draft-04/schema#", 3 | "type": "object", 4 | "description": "Документ полученый от ККТ", 5 | "properties": { 6 | "closeArchive": { 7 | "type": "object", 8 | "description": "Отчет о закрытии фискального накопителя", 9 | "properties": { 10 | "fiscalDocumentFormatVer": { 11 | "$ref": "dictionary.schema.json#/definitions/fiscalDocumentFormatVer" 12 | }, 13 | "retailPlace": { 14 | "$ref": "dictionary.schema.json#/definitions/retailPlace" 15 | }, 16 | "retailPlaceAddress": { 17 | "$ref": "dictionary.schema.json#/definitions/retailPlaceAddress" 18 | }, 19 | "operatorInn": { 20 | "$ref": "dictionary.schema.json#/definitions/cashierInn" 21 | }, 22 | "fiscalDriveSumReports": { 23 | "$ref": "dictionary.schema.json#/definitions/fiscalDriveSumReports" 24 | }, 25 | "shiftNumber": { 26 | "$ref": "dictionary.schema.json#/definitions/shiftNumber" 27 | }, 28 | 29 | "code": { 30 | "type": "integer", 31 | "enum": [ 32 | 6 33 | ] 34 | }, 35 | "userInn": { 36 | "$ref": "dictionary.schema.json#/definitions/userInn" 37 | }, 38 | "operator": { 39 | "$ref": "dictionary.schema.json#/definitions/operator" 40 | }, 41 | "dateTime": { 42 | "$ref": "dictionary.schema.json#/definitions/dateTime" 43 | }, 44 | "kktRegId": { 45 | "$ref": "dictionary.schema.json#/definitions/kktRegId" 46 | }, 47 | "fiscalDriveNumber": { 48 | "$ref": "dictionary.schema.json#/definitions/fiscalDriveNumber" 49 | }, 50 | "fiscalDocumentNumber": { 51 | "$ref": "dictionary.schema.json#/definitions/fiscalDocumentNumber" 52 | }, 53 | "fiscalSign": { 54 | "$ref": "dictionary.schema.json#/definitions/fiscalSign" 55 | }, 56 | "properties": { 57 | "$ref": "dictionary.schema.json#/definitions/propertiesType" 58 | }, 59 | "rawData": { 60 | "$ref": "dictionary.schema.json#/definitions/rawData" 61 | } 62 | }, 63 | "required": [ 64 | "fiscalDocumentFormatVer", 65 | "user", 66 | "retailPlace", 67 | "code", 68 | "userInn", 69 | "operator", 70 | "dateTime", 71 | "kktRegId", 72 | "fiscalDriveNumber", 73 | "fiscalDocumentNumber", 74 | "fiscalSign", 75 | "rawData" 76 | ] 77 | } 78 | }, 79 | "required": [ 80 | "closeArchive" 81 | ] 82 | } 83 | -------------------------------------------------------------------------------- /schemas/1.05/currentStateReport.schema.json: -------------------------------------------------------------------------------- 1 | { 2 | "$schema": "http://json-schema.org/draft-04/schema#", 3 | "type": "object", 4 | "description": "Документ полученый от ККТ", 5 | "properties": { 6 | "currentStateReport": { 7 | "type": "object", 8 | "description": "Отчёт о текущем состоянии расчетов", 9 | "properties": { 10 | "fiscalDocumentFormatVer": { 11 | "$ref": "dictionary.schema.json#/definitions/fiscalDocumentFormatVer" 12 | }, 13 | "retailPlace": { 14 | "$ref": "dictionary.schema.json#/definitions/retailPlace" 15 | }, 16 | "retailPlaceAddress": { 17 | "$ref": "dictionary.schema.json#/definitions/retailPlaceAddress" 18 | }, 19 | "fiscalDriveSumReports": { 20 | "$ref": "dictionary.schema.json#/definitions/fiscalDriveSumReports" 21 | }, 22 | "notTransmittedDocumentsSumReports": { 23 | "$ref": "dictionary.schema.json#/definitions/fiscalDriveSumReports" 24 | }, 25 | "code": { 26 | "type": "integer", 27 | "enum": [ 28 | 21 29 | ] 30 | }, 31 | "userInn": { 32 | "$ref": "dictionary.schema.json#/definitions/userInn" 33 | }, 34 | "dateTime": { 35 | "$ref": "dictionary.schema.json#/definitions/dateTime" 36 | }, 37 | "shiftNumber": { 38 | "$ref": "dictionary.schema.json#/definitions/shiftNumber" 39 | }, 40 | "offlineMode": { 41 | "$ref": "dictionary.schema.json#/definitions/offlineMode" 42 | }, 43 | "notTransmittedDocumentNumber": { 44 | "type": "integer", 45 | "minimum": 0, 46 | "maximum": 4294967295, 47 | "description": "номер первого непереданного документа" 48 | }, 49 | "notTransmittedDocumentsQuantity": { 50 | "$ref": "dictionary.schema.json#/definitions/notTransmittedDocumentsQuantity" 51 | }, 52 | "notTransmittedDocumentsDateTime": { 53 | "$ref": "dictionary.schema.json#/definitions/notTransmittedDocumentsDateTime" 54 | }, 55 | "kktRegId": { 56 | "$ref": "dictionary.schema.json#/definitions/kktRegId" 57 | }, 58 | "fiscalDriveNumber": { 59 | "$ref": "dictionary.schema.json#/definitions/fiscalDriveNumber" 60 | }, 61 | "fiscalDocumentNumber": { 62 | "$ref": "dictionary.schema.json#/definitions/fiscalDocumentNumber" 63 | }, 64 | "fiscalSign": { 65 | "$ref": "dictionary.schema.json#/definitions/fiscalSign" 66 | }, 67 | "properties": { 68 | "$ref": "dictionary.schema.json#/definitions/propertiesType" 69 | }, 70 | "rawData": { 71 | "$ref": "dictionary.schema.json#/definitions/rawData" 72 | } 73 | }, 74 | "required": [ 75 | "fiscalDocumentFormatVer", 76 | 77 | "code", 78 | "userInn", 79 | "dateTime", 80 | "offlineMode", 81 | "notTransmittedDocumentNumber", 82 | "notTransmittedDocumentsQuantity", 83 | "notTransmittedDocumentsDateTime", 84 | "kktRegId", 85 | "fiscalDriveNumber", 86 | "fiscalDocumentNumber", 87 | "fiscalSign", 88 | "rawData" 89 | ] 90 | } 91 | }, 92 | "required": [ 93 | "currentStateReport" 94 | ] 95 | } 96 | -------------------------------------------------------------------------------- /schemas/1.1/closeArchive.schema.json: -------------------------------------------------------------------------------- 1 | { 2 | "$schema": "http://json-schema.org/draft-04/schema#", 3 | "type": "object", 4 | "description": "Документ полученый от ККТ", 5 | "properties": { 6 | "document": { 7 | "type": "object", 8 | "description": "Документ", 9 | "properties": { 10 | "closeArchive": { 11 | "type": "object", 12 | "description": "Отчет о закрытии фискального накопителя", 13 | "properties": { 14 | "fiscalDocumentFormatVer": { 15 | "$ref": "dictionary.schema.json#/definitions/fiscalDocumentFormatVer" 16 | }, 17 | "retailPlace": { 18 | "$ref": "dictionary.schema.json#/definitions/retailPlace" 19 | }, 20 | "retailPlaceAddress": { 21 | "$ref": "dictionary.schema.json#/definitions/retailPlaceAddress" 22 | }, 23 | "operatorInn": { 24 | "$ref": "dictionary.schema.json#/definitions/cashierInn" 25 | }, 26 | "fiscalDriveSumReports": { 27 | "$ref": "dictionary.schema.json#/definitions/fiscalDriveSumReports" 28 | }, 29 | "shiftNumber": { 30 | "$ref": "dictionary.schema.json#/definitions/shiftNumber" 31 | }, 32 | 33 | "code": { 34 | "type": "integer", 35 | "enum": [ 36 | 6 37 | ] 38 | }, 39 | "userInn": { 40 | "$ref": "dictionary.schema.json#/definitions/userInn" 41 | }, 42 | "operator": { 43 | "$ref": "dictionary.schema.json#/definitions/operator" 44 | }, 45 | "dateTime": { 46 | "$ref": "dictionary.schema.json#/definitions/dateTime" 47 | }, 48 | "kktRegId": { 49 | "$ref": "dictionary.schema.json#/definitions/kktRegId" 50 | }, 51 | "fiscalDriveNumber": { 52 | "$ref": "dictionary.schema.json#/definitions/fiscalDriveNumber" 53 | }, 54 | "fiscalDocumentNumber": { 55 | "$ref": "dictionary.schema.json#/definitions/fiscalDocumentNumber" 56 | }, 57 | "fiscalSign": { 58 | "$ref": "dictionary.schema.json#/definitions/fiscalSign" 59 | }, 60 | "properties": { 61 | "$ref": "dictionary.schema.json#/definitions/propertiesType" 62 | }, 63 | "rawData": { 64 | "$ref": "dictionary.schema.json#/definitions/rawData" 65 | } 66 | }, 67 | "required": [ 68 | "fiscalDocumentFormatVer", 69 | "user", 70 | "retailPlace", 71 | "code", 72 | "userInn", 73 | "operator", 74 | "dateTime", 75 | "kktRegId", 76 | "fiscalDriveNumber", 77 | "fiscalDocumentNumber", 78 | "fiscalSign", 79 | "rawData" 80 | ] 81 | } 82 | }, 83 | "required": [ 84 | "closeArchive" 85 | ] 86 | } 87 | }, 88 | "required": [ 89 | "document" 90 | ] 91 | } 92 | -------------------------------------------------------------------------------- /schemas/1.0/fiscalReport.schema.json: -------------------------------------------------------------------------------- 1 | { 2 | "$schema": "http://json-schema.org/draft-04/schema#", 3 | "type": "object", 4 | "description": "Документ полученый от ККТ", 5 | "properties": { 6 | "fiscalReport": { 7 | "type": "object", 8 | "description": "Отчет о регистрации", 9 | "properties": { 10 | "code": { 11 | "type": "integer", 12 | "enum": [ 13 | 1 14 | ] 15 | }, 16 | "user": { 17 | "$ref": "dictionary.schema.json#/definitions/user" 18 | }, 19 | "userInn": { 20 | "$ref": "dictionary.schema.json#/definitions/userInn" 21 | }, 22 | "taxationsType": { 23 | "$ref": "dictionary.schema.json#/definitions/taxationsType" 24 | }, 25 | "dateTime": { 26 | "$ref": "dictionary.schema.json#/definitions/dateTime" 27 | }, 28 | "kktRegId": { 29 | "$ref": "dictionary.schema.json#/definitions/kktRegId" 30 | }, 31 | "offlineMode": { 32 | "$ref": "dictionary.schema.json#/definitions/offlineMode" 33 | }, 34 | "bsoSign": { 35 | "$ref": "dictionary.schema.json#/definitions/bsoSign" 36 | }, 37 | "serviceSign": { 38 | "$ref": "dictionary.schema.json#/definitions/serviceSign" 39 | }, 40 | "encryptionSign": { 41 | "$ref": "dictionary.schema.json#/definitions/encryptionSign" 42 | }, 43 | "autoMode": { 44 | "$ref": "dictionary.schema.json#/definitions/autoMode" 45 | }, 46 | "machineNumber": { 47 | "$ref": "dictionary.schema.json#/definitions/machineNumber" 48 | }, 49 | "internetSign": { 50 | "$ref": "dictionary.schema.json#/definitions/internetSign" 51 | }, 52 | "fiscalDocumentNumber": { 53 | "$ref": "dictionary.schema.json#/definitions/fiscalDocumentNumber" 54 | }, 55 | "fiscalDriveNumber": { 56 | "$ref": "dictionary.schema.json#/definitions/fiscalDriveNumber" 57 | }, 58 | "operator": { 59 | "$ref": "dictionary.schema.json#/definitions/operator" 60 | }, 61 | "retailPlaceAddress": { 62 | "$ref": "dictionary.schema.json#/definitions/retailPlaceAddress" 63 | }, 64 | "ofdInn": { 65 | "$ref": "dictionary.schema.json#/definitions/ofdInn" 66 | }, 67 | "kktNumber": { 68 | "$ref": "dictionary.schema.json#/definitions/kktNumber" 69 | }, 70 | "fiscalSign": { 71 | "$ref": "dictionary.schema.json#/definitions/fiscalSign" 72 | }, 73 | "properties": { 74 | "$ref": "dictionary.schema.json#/definitions/propertiesType" 75 | }, 76 | "rawData": { 77 | "$ref": "dictionary.schema.json#/definitions/rawData" 78 | } 79 | }, 80 | "required": [ 81 | "code", 82 | "user", 83 | "userInn", 84 | "taxationType", 85 | "dateTime", 86 | "kktRegId", 87 | "offlineMode", 88 | "bsoSign", 89 | "serviceSign", 90 | "encryptionSign", 91 | "autoMode", 92 | "internetSign", 93 | "fiscalDocumentNumber", 94 | "fiscalDriveNumber", 95 | "operator", 96 | "ofdInn", 97 | "fiscalSign", 98 | "rawData" 99 | ] 100 | } 101 | }, 102 | "required": [ 103 | "fiscalReport" 104 | ] 105 | } 106 | -------------------------------------------------------------------------------- /schemas/1.05/openShift.schema.json: -------------------------------------------------------------------------------- 1 | { 2 | "$schema": "http://json-schema.org/draft-04/schema#", 3 | "type": "object", 4 | "description": "Документ полученый от ККТ", 5 | "properties": { 6 | "openShift": { 7 | "type": "object", 8 | "description": "Отчет об открытии смены", 9 | "properties": { 10 | "fiscalDocumentFormatVer": { 11 | "$ref": "dictionary.schema.json#/definitions/fiscalDocumentFormatVer" 12 | }, 13 | "operatorInn": { 14 | "$ref": "dictionary.schema.json#/definitions/cashierInn" 15 | }, 16 | "operatorMessage": { 17 | "$ref": "dictionary.schema.json#/definitions/operatorMessage" 18 | }, 19 | "ofdResponseTimeoutSign": { 20 | "$ref": "dictionary.schema.json#/definitions/ofdResponseTimeoutSign" 21 | }, 22 | "fiscalDriveReplaceRequiredSign": { 23 | "$ref": "dictionary.schema.json#/definitions/fiscalDriveReplaceRequiredSign" 24 | }, 25 | "fiscalDriveMemoryExceededSign": { 26 | "$ref": "dictionary.schema.json#/definitions/fiscalDriveMemoryExceededSign" 27 | }, 28 | "fiscalDriveExhaustionSign": { 29 | "$ref": "dictionary.schema.json#/definitions/fiscalDriveExhaustionSign" 30 | }, 31 | "kktVersion": { 32 | "$ref": "dictionary.schema.json#/definitions/kktVersion" 33 | }, 34 | "documentKktVersion": { 35 | "$ref": "dictionary.schema.json#/definitions/documentKktVersion" 36 | }, 37 | "code": { 38 | "type": "integer", 39 | "enum": [ 40 | 2 41 | ] 42 | }, 43 | "user": { 44 | "$ref": "dictionary.schema.json#/definitions/user" 45 | }, 46 | "userInn": { 47 | "$ref": "dictionary.schema.json#/definitions/userInn" 48 | }, 49 | "operator": { 50 | "$ref": "dictionary.schema.json#/definitions/operator" 51 | }, 52 | "retailPlaceAddress": { 53 | "$ref": "dictionary.schema.json#/definitions/retailPlaceAddress" 54 | }, 55 | "retailPlace": { 56 | "$ref": "dictionary.schema.json#/definitions/retailPlace" 57 | }, 58 | "dateTime": { 59 | "$ref": "dictionary.schema.json#/definitions/dateTime" 60 | }, 61 | "shiftNumber": { 62 | "$ref": "dictionary.schema.json#/definitions/shiftNumber" 63 | }, 64 | "kktRegId": { 65 | "$ref": "dictionary.schema.json#/definitions/kktRegId" 66 | }, 67 | "fiscalDriveNumber": { 68 | "$ref": "dictionary.schema.json#/definitions/fiscalDriveNumber" 69 | }, 70 | "fiscalDocumentNumber": { 71 | "$ref": "dictionary.schema.json#/definitions/fiscalDocumentNumber" 72 | }, 73 | "fiscalSign": { 74 | "$ref": "dictionary.schema.json#/definitions/fiscalSign" 75 | }, 76 | "message": { 77 | "$ref": "dictionary.schema.json#/definitions/message" 78 | }, 79 | "properties": { 80 | "$ref": "dictionary.schema.json#/definitions/propertiesType" 81 | }, 82 | "rawData": { 83 | "$ref": "dictionary.schema.json#/definitions/rawData" 84 | } 85 | }, 86 | "required": [ 87 | "fiscalDocumentFormatVer", 88 | 89 | "code", 90 | "userInn", 91 | "dateTime", 92 | "shiftNumber", 93 | "kktRegId", 94 | "fiscalDriveNumber", 95 | "fiscalDocumentNumber", 96 | "fiscalSign", 97 | "rawData" 98 | ] 99 | } 100 | }, 101 | "required": [ 102 | "openShift" 103 | ] 104 | } 105 | -------------------------------------------------------------------------------- /schemas/1.0/fiscalReportCorrection.schema.json: -------------------------------------------------------------------------------- 1 | { 2 | "$schema": "http://json-schema.org/draft-04/schema#", 3 | "type": "object", 4 | "description": "Документ полученый от ККТ", 5 | "properties": { 6 | "fiscalReportCorrection": { 7 | "type": "object", 8 | "description": "Отчет об изменении параметров регистрации", 9 | "properties": { 10 | "code": { 11 | "type": "integer", 12 | "enum": [ 13 | 11 14 | ] 15 | }, 16 | "user": { 17 | "$ref": "dictionary.schema.json#/definitions/user" 18 | }, 19 | "userInn": { 20 | "$ref": "dictionary.schema.json#/definitions/userInn" 21 | }, 22 | "taxationsType": { 23 | "$ref": "dictionary.schema.json#/definitions/taxationsType" 24 | }, 25 | "dateTime": { 26 | "$ref": "dictionary.schema.json#/definitions/dateTime" 27 | }, 28 | "kktRegId": { 29 | "$ref": "dictionary.schema.json#/definitions/kktRegId" 30 | }, 31 | "offlineMode": { 32 | "$ref": "dictionary.schema.json#/definitions/offlineMode" 33 | }, 34 | "bsoSign": { 35 | "$ref": "dictionary.schema.json#/definitions/bsoSign" 36 | }, 37 | "serviceSign": { 38 | "$ref": "dictionary.schema.json#/definitions/serviceSign" 39 | }, 40 | "encryptionSign": { 41 | "$ref": "dictionary.schema.json#/definitions/encryptionSign" 42 | }, 43 | "autoMode": { 44 | "$ref": "dictionary.schema.json#/definitions/autoMode" 45 | }, 46 | "machineNumber": { 47 | "$ref": "dictionary.schema.json#/definitions/machineNumber" 48 | }, 49 | "internetSign": { 50 | "$ref": "dictionary.schema.json#/definitions/internetSign" 51 | }, 52 | "fiscalDocumentNumber": { 53 | "$ref": "dictionary.schema.json#/definitions/fiscalDocumentNumber" 54 | }, 55 | "fiscalDriveNumber": { 56 | "$ref": "dictionary.schema.json#/definitions/fiscalDriveNumber" 57 | }, 58 | "operator": { 59 | "$ref": "dictionary.schema.json#/definitions/operator" 60 | }, 61 | "retailPlaceAddress": { 62 | "$ref": "dictionary.schema.json#/definitions/retailPlaceAddress" 63 | }, 64 | "ofdInn": { 65 | "$ref": "dictionary.schema.json#/definitions/ofdInn" 66 | }, 67 | "kktNumber": { 68 | "$ref": "dictionary.schema.json#/definitions/kktNumber" 69 | }, 70 | "correctionReasonCode": { 71 | "type": "array", 72 | "uniqueItems": false, 73 | "minItems": 1, 74 | "description": "причина перерегистрации", 75 | "items": { 76 | "type": "integer", 77 | "minimum": 0, 78 | "maximum": 255 79 | } 80 | }, 81 | "fiscalSign": { 82 | "$ref": "dictionary.schema.json#/definitions/fiscalSign" 83 | }, 84 | "properties": { 85 | "$ref": "dictionary.schema.json#/definitions/propertiesType" 86 | }, 87 | "rawData": { 88 | "$ref": "dictionary.schema.json#/definitions/rawData" 89 | } 90 | }, 91 | "required": [ 92 | "code", 93 | "user", 94 | "userInn", 95 | "taxationType", 96 | "dateTime", 97 | "kktRegId", 98 | "offlineMode", 99 | "bsoSign", 100 | "serviceSign", 101 | "encryptionSign", 102 | "autoMode", 103 | "internetSign", 104 | "fiscalDocumentNumber", 105 | "fiscalDriveNumber", 106 | "operator", 107 | "ofdInn", 108 | "correctionReasonCode", 109 | "fiscalSign", 110 | "rawData" 111 | ] 112 | } 113 | }, 114 | "required": [ 115 | "fiscalReportCorrection" 116 | ] 117 | } 118 | -------------------------------------------------------------------------------- /schemas/1.1/currentStateReport.schema.json: -------------------------------------------------------------------------------- 1 | { 2 | "$schema": "http://json-schema.org/draft-04/schema#", 3 | "type": "object", 4 | "description": "Документ полученый от ККТ", 5 | "properties": { 6 | "document": { 7 | "type": "object", 8 | "description": "Документ", 9 | "properties": { 10 | "currentStateReport": { 11 | "type": "object", 12 | "description": "Отчёт о текущем состоянии расчетов", 13 | "properties": { 14 | "fiscalDocumentFormatVer": { 15 | "$ref": "dictionary.schema.json#/definitions/fiscalDocumentFormatVer" 16 | }, 17 | "retailPlace": { 18 | "$ref": "dictionary.schema.json#/definitions/retailPlace" 19 | }, 20 | "retailPlaceAddress": { 21 | "$ref": "dictionary.schema.json#/definitions/retailPlaceAddress" 22 | }, 23 | "fiscalDriveSumReports": { 24 | "$ref": "dictionary.schema.json#/definitions/fiscalDriveSumReports" 25 | }, 26 | "notTransmittedDocumentsSumReports": { 27 | "$ref": "dictionary.schema.json#/definitions/fiscalDriveSumReports" 28 | }, 29 | "code": { 30 | "type": "integer", 31 | "enum": [ 32 | 21 33 | ] 34 | }, 35 | "userInn": { 36 | "$ref": "dictionary.schema.json#/definitions/userInn" 37 | }, 38 | "dateTime": { 39 | "$ref": "dictionary.schema.json#/definitions/dateTime" 40 | }, 41 | "shiftNumber": { 42 | "$ref": "dictionary.schema.json#/definitions/shiftNumber" 43 | }, 44 | "offlineMode": { 45 | "$ref": "dictionary.schema.json#/definitions/offlineMode" 46 | }, 47 | "notTransmittedDocumentNumber": { 48 | "type": "integer", 49 | "minimum": 0, 50 | "maximum": 4294967295, 51 | "description": "номер первого непереданного документа" 52 | }, 53 | "notTransmittedDocumentsQuantity": { 54 | "$ref": "dictionary.schema.json#/definitions/notTransmittedDocumentsQuantity" 55 | }, 56 | "notTransmittedDocumentsDateTime": { 57 | "$ref": "dictionary.schema.json#/definitions/notTransmittedDocumentsDateTime" 58 | }, 59 | "kktRegId": { 60 | "$ref": "dictionary.schema.json#/definitions/kktRegId" 61 | }, 62 | "fiscalDriveNumber": { 63 | "$ref": "dictionary.schema.json#/definitions/fiscalDriveNumber" 64 | }, 65 | "fiscalDocumentNumber": { 66 | "$ref": "dictionary.schema.json#/definitions/fiscalDocumentNumber" 67 | }, 68 | "fiscalSign": { 69 | "$ref": "dictionary.schema.json#/definitions/fiscalSign" 70 | }, 71 | "properties": { 72 | "$ref": "dictionary.schema.json#/definitions/propertiesType" 73 | }, 74 | "rawData": { 75 | "$ref": "dictionary.schema.json#/definitions/rawData" 76 | } 77 | }, 78 | "required": [ 79 | "fiscalDocumentFormatVer", 80 | 81 | "code", 82 | "userInn", 83 | "dateTime", 84 | "offlineMode", 85 | "notTransmittedDocumentNumber", 86 | "notTransmittedDocumentsQuantity", 87 | "notTransmittedDocumentsDateTime", 88 | "kktRegId", 89 | "fiscalDriveNumber", 90 | "fiscalDocumentNumber", 91 | "fiscalSign", 92 | "rawData" 93 | ] 94 | } 95 | }, 96 | "required": [ 97 | "currentStateReport" 98 | ] 99 | } 100 | }, 101 | "required": [ 102 | "document" 103 | ] 104 | } 105 | -------------------------------------------------------------------------------- /schemas/1.0/closeShift.schema.json: -------------------------------------------------------------------------------- 1 | { 2 | "$schema": "http://json-schema.org/draft-04/schema#", 3 | "type": "object", 4 | "description": "Документ полученый от ККТ", 5 | "properties": { 6 | "closeShift": { 7 | "type": "object", 8 | "description": "Отчёт о закрытии смены", 9 | "properties": { 10 | "code": { 11 | "type": "integer", 12 | "enum": [ 13 | 5 14 | ] 15 | }, 16 | "user": { 17 | "$ref": "dictionary.schema.json#/definitions/user" 18 | }, 19 | "userInn": { 20 | "$ref": "dictionary.schema.json#/definitions/userInn" 21 | }, 22 | "operator": { 23 | "$ref": "dictionary.schema.json#/definitions/operator" 24 | }, 25 | "dateTime": { 26 | "$ref": "dictionary.schema.json#/definitions/dateTime" 27 | }, 28 | "shiftNumber": { 29 | "$ref": "dictionary.schema.json#/definitions/shiftNumber" 30 | }, 31 | "receiptsQuantity": { 32 | "type": "integer", 33 | "minimum": 0, 34 | "maximum": 4294967295, 35 | "description": "количество кассовых чеков за смену" 36 | }, 37 | "documentsQuantity": { 38 | "type": "integer", 39 | "minimum": 0, 40 | "maximum": 4294967295, 41 | "description": "количество фискальных документов за смену" 42 | }, 43 | "notTransmittedDocumentsQuantity": { 44 | "$ref": "dictionary.schema.json#/definitions/notTransmittedDocumentsQuantity" 45 | }, 46 | "notTransmittedDocumentsDateTime": { 47 | "$ref": "dictionary.schema.json#/definitions/notTransmittedDocumentsDateTime" 48 | }, 49 | "ofdResponseTimeoutSign": { 50 | "type": "integer", 51 | "minimum": 0, 52 | "maximum": 255, 53 | "description": "признак превышения времени ожидания ответа ОФД" 54 | }, 55 | "fiscalDriveReplaceRequiredSign": { 56 | "type": "integer", 57 | "minimum": 0, 58 | "maximum": 255, 59 | "description": "признак необходимости срочной замены ФН" 60 | }, 61 | "fiscalDriveMemoryExceededSign": { 62 | "type": "integer", 63 | "minimum": 0, 64 | "maximum": 255, 65 | "description": "признак переполнения памяти ФН" 66 | }, 67 | "fiscalDriveExhaustionSign": { 68 | "type": "integer", 69 | "minimum": 0, 70 | "maximum": 255, 71 | "description": "признак исчерпания ресурса ФН" 72 | }, 73 | "kktRegId": { 74 | "$ref": "dictionary.schema.json#/definitions/kktRegId" 75 | }, 76 | "fiscalDriveNumber": { 77 | "$ref": "dictionary.schema.json#/definitions/fiscalDriveNumber" 78 | }, 79 | "fiscalDocumentNumber": { 80 | "$ref": "dictionary.schema.json#/definitions/fiscalDocumentNumber" 81 | }, 82 | "fiscalSign": { 83 | "$ref": "dictionary.schema.json#/definitions/fiscalSign" 84 | }, 85 | "message": { 86 | "$ref": "dictionary.schema.json#/definitions/message" 87 | }, 88 | "properties": { 89 | "$ref": "dictionary.schema.json#/definitions/propertiesType" 90 | }, 91 | "rawData": { 92 | "$ref": "dictionary.schema.json#/definitions/rawData" 93 | } 94 | }, 95 | "required": [ 96 | "code", 97 | "userInn", 98 | "dateTime", 99 | "shiftNumber", 100 | "receiptsQuantity", 101 | "documentsQuantity", 102 | "notTransmittedDocumentsQuantity", 103 | "notTransmittedDocumentsDateTime", 104 | "ofdResponseTimeoutSign", 105 | "fiscalDriveReplaceRequiredSign", 106 | "fiscalDriveMemoryExceededSign", 107 | "fiscalDriveExhaustionSign", 108 | "kktRegId", 109 | "fiscalDriveNumber", 110 | "fiscalDocumentNumber", 111 | "fiscalSign", 112 | "rawData" 113 | ] 114 | } 115 | }, 116 | "required": [ 117 | "closeShift" 118 | ] 119 | } 120 | -------------------------------------------------------------------------------- /example/mock_ofd.py: -------------------------------------------------------------------------------- 1 | # coding: utf8 2 | # 3 | # Copyright (C) 2017 Yandex LLC 4 | # http://yandex.com 5 | # 6 | # Licensed under the Apache License, Version 2.0 (the "License"); 7 | # you may not use this file except in compliance with the License. 8 | # You may obtain a copy of the License at 9 | # 10 | # http://www.apache.org/licenses/LICENSE-2.0 11 | # 12 | # Unless required by applicable law or agreed to in writing, software 13 | # distributed under the License is distributed on an "AS IS" BASIS, 14 | # WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 15 | # See the License for the specific language governing permissions and 16 | # 17 | 18 | import asyncio 19 | import json 20 | import time 21 | import argparse 22 | from ofd.protocol import SessionHeader, FrameHeader, unpack_container_message, pack_json, DOCS_BY_NAME, DocCodes, \ 23 | String 24 | 25 | 26 | async def unpack_incoming_message(rd): 27 | """ 28 | Прочитать входящий поток бинарных данных и распаковать их в json документ 29 | """ 30 | session_raw = await rd.readexactly(SessionHeader.STRUCT.size) 31 | session = SessionHeader.unpack_from(session_raw) 32 | print(session) 33 | container_raw = await rd.readexactly(session.length) 34 | header_raw, message_raw = container_raw[:FrameHeader.STRUCT.size], container_raw[FrameHeader.STRUCT.size:] 35 | header = FrameHeader.unpack_from(header_raw) 36 | print(header) 37 | return unpack_container_message(message_raw, b'0')[0], session, header 38 | 39 | 40 | def create_response(doc, in_session, in_header): 41 | """ 42 | Запаковать в протокол "подтверждение оператора" от ОФД к кассе 43 | :param doc: полученный документ 44 | :param in_header: заголовок контейнера входящего сообщения 45 | :param in_session: заголовок сессии входящего сообщения 46 | :return: 47 | """ 48 | doc_body = doc[next(iter(doc))] # получаем тело документа 49 | message = { 50 | 'operatorAck': { 51 | 'ofdInn': '7704358518', # ИНН Яндекс.ОФД 52 | 'fiscalDriveNumber': doc_body.get('fiscalDriveNumber'), 53 | 'fiscalDocumentNumber': doc_body.get('fiscalDocumentNumber'), 54 | 'dateTime': int(time.time()), 55 | 'messageToFn': {'ofdResponseCode': 0} # код ответа 0 при успешном получении документа 56 | # Теги ФПО и ФПП не указаны, т.к. должны быть добавлены реальным шифровальным комплексом 57 | } 58 | } 59 | message_raw = pack_json(message, docs=DOCS_BY_NAME) 60 | 61 | # в реальных ОФД FrameHeader формируется автоматически шифровальной машиной 62 | out_header = FrameHeader(length=FrameHeader.STRUCT.size + len(message_raw), 63 | crc=0, 64 | doctype=DocCodes.OPERATOR_ACK, 65 | devnum=in_header.devnum, 66 | docnum=String.pack(str(doc_body.get('fiscalDocumentNumber'))), 67 | extra1=in_header.extra1, 68 | extra2=String.pack('0'.rjust(12))) 69 | 70 | out_header.recalculate_crc(message_raw) 71 | container_raw = out_header.pack() + message_raw 72 | 73 | out_session = SessionHeader(pva=in_session.pva, fs_id=in_session.fs_id, length=len(container_raw), crc=0, 74 | flags=0b0000000000010100) 75 | 76 | return out_session.pack() + container_raw 77 | 78 | 79 | async def handle_connection(rd, wr): 80 | """ 81 | Пример использования протокола для эмуляции работы ОФД. Сервер принимает входящее сообщение и распаковывает его, 82 | выводя значения в stdout. В ответ сервер формирует сообщение "подтверждение оператора" и передает его обратно кассе. 83 | Эмулятор работает без использования шифровальный машины, поэтому считаем, что сообщение приходит в ОФД 84 | в незашифрованном виде. 85 | :param rd: readable stream. 86 | :param wr: writable stream. 87 | """ 88 | try: 89 | doc, session, header = await unpack_incoming_message(rd) 90 | print(json.dumps(doc, ensure_ascii=False, indent=4)) 91 | response = create_response(doc, in_session=session, in_header=header) 92 | print('raw response', response) 93 | wr.write(response) 94 | finally: 95 | wr.write_eof() 96 | wr.drain() 97 | 98 | 99 | if __name__ == '__main__': 100 | parser = argparse.ArgumentParser() 101 | parser.add_argument('--host', default=None, help='хост для запуска сервера') 102 | parser.add_argument('--port', default=12345, type=int, help='порт для запуска сервера') 103 | argv = parser.parse_args() 104 | host = None if argv.host in ['::', 'localhost'] else argv.host 105 | 106 | loop = asyncio.get_event_loop() 107 | server = asyncio.start_server(handle_connection, host=host, port=argv.port, loop=loop) 108 | loop.run_until_complete(server) 109 | print('mock ofd server has been started at port', argv.port) 110 | 111 | try: 112 | loop.run_forever() 113 | except KeyboardInterrupt: 114 | print('received SIGINT, shutting down') 115 | 116 | server.close() 117 | 118 | loop.run_until_complete(server.wait_closed()) 119 | loop.close() 120 | -------------------------------------------------------------------------------- /schemas/1.1/openShift.schema.json: -------------------------------------------------------------------------------- 1 | { 2 | "$schema": "http://json-schema.org/draft-04/schema#", 3 | "type": "object", 4 | "description": "Документ полученый от ККТ", 5 | "properties": { 6 | "document": { 7 | "type": "object", 8 | "description": "Документ", 9 | "properties": { 10 | "openShift": { 11 | "type": "object", 12 | "description": "Отчет об открытии смены", 13 | "properties": { 14 | "fiscalDocumentFormatVer": { 15 | "$ref": "dictionary.schema.json#/definitions/fiscalDocumentFormatVer" 16 | }, 17 | "operatorInn": { 18 | "$ref": "dictionary.schema.json#/definitions/cashierInn" 19 | }, 20 | "operatorMessage": { 21 | "$ref": "dictionary.schema.json#/definitions/operatorMessage" 22 | }, 23 | "ofdResponseTimeoutSign": { 24 | "$ref": "dictionary.schema.json#/definitions/ofdResponseTimeoutSign" 25 | }, 26 | "fiscalDriveReplaceRequiredSign": { 27 | "$ref": "dictionary.schema.json#/definitions/fiscalDriveReplaceRequiredSign" 28 | }, 29 | "fiscalDriveMemoryExceededSign": { 30 | "$ref": "dictionary.schema.json#/definitions/fiscalDriveMemoryExceededSign" 31 | }, 32 | "fiscalDriveExhaustionSign": { 33 | "$ref": "dictionary.schema.json#/definitions/fiscalDriveExhaustionSign" 34 | }, 35 | "kktVersion": { 36 | "$ref": "dictionary.schema.json#/definitions/kktVersion" 37 | }, 38 | "documentKktVersion": { 39 | "$ref": "dictionary.schema.json#/definitions/documentKktVersion" 40 | }, 41 | "code": { 42 | "type": "integer", 43 | "enum": [ 44 | 2 45 | ] 46 | }, 47 | "user": { 48 | "$ref": "dictionary.schema.json#/definitions/user" 49 | }, 50 | "userInn": { 51 | "$ref": "dictionary.schema.json#/definitions/userInn" 52 | }, 53 | "operator": { 54 | "$ref": "dictionary.schema.json#/definitions/operator" 55 | }, 56 | "retailPlaceAddress": { 57 | "$ref": "dictionary.schema.json#/definitions/retailPlaceAddress" 58 | }, 59 | "retailPlace": { 60 | "$ref": "dictionary.schema.json#/definitions/retailPlace" 61 | }, 62 | "dateTime": { 63 | "$ref": "dictionary.schema.json#/definitions/dateTime" 64 | }, 65 | "shiftNumber": { 66 | "$ref": "dictionary.schema.json#/definitions/shiftNumber" 67 | }, 68 | "kktRegId": { 69 | "$ref": "dictionary.schema.json#/definitions/kktRegId" 70 | }, 71 | "fiscalDriveNumber": { 72 | "$ref": "dictionary.schema.json#/definitions/fiscalDriveNumber" 73 | }, 74 | "fiscalDocumentNumber": { 75 | "$ref": "dictionary.schema.json#/definitions/fiscalDocumentNumber" 76 | }, 77 | "fiscalSign": { 78 | "$ref": "dictionary.schema.json#/definitions/fiscalSign" 79 | }, 80 | "message": { 81 | "$ref": "dictionary.schema.json#/definitions/message" 82 | }, 83 | "properties": { 84 | "$ref": "dictionary.schema.json#/definitions/propertiesType" 85 | }, 86 | "rawData": { 87 | "$ref": "dictionary.schema.json#/definitions/rawData" 88 | } 89 | }, 90 | "required": [ 91 | "fiscalDocumentFormatVer", 92 | 93 | "code", 94 | "userInn", 95 | "dateTime", 96 | "shiftNumber", 97 | "kktRegId", 98 | "fiscalDriveNumber", 99 | "fiscalDocumentNumber", 100 | "fiscalSign", 101 | "rawData" 102 | ] 103 | } 104 | }, 105 | "required": [ 106 | "openShift" 107 | ] 108 | } 109 | }, 110 | "required": [ 111 | "document" 112 | ] 113 | } 114 | -------------------------------------------------------------------------------- /schemas/1.0/receiptCorrection.schema.json: -------------------------------------------------------------------------------- 1 | { 2 | "$schema": "http://json-schema.org/draft-04/schema#", 3 | "definitions": { 4 | "baseObject": { 5 | "type": "object", 6 | "properties": { 7 | "user": { 8 | "$ref": "dictionary.schema.json#/definitions/user" 9 | }, 10 | "userInn": { 11 | "$ref": "dictionary.schema.json#/definitions/userInn" 12 | }, 13 | "requestNumber": { 14 | "$ref": "dictionary.schema.json#/definitions/requestNumber" 15 | }, 16 | "dateTime": { 17 | "$ref": "dictionary.schema.json#/definitions/dateTime" 18 | }, 19 | "shiftNumber": { 20 | "$ref": "dictionary.schema.json#/definitions/shiftNumber" 21 | }, 22 | "operationType": { 23 | "$ref": "dictionary.schema.json#/definitions/operationType" 24 | }, 25 | "taxationType": { 26 | "$ref": "dictionary.schema.json#/definitions/taxationType" 27 | }, 28 | "operator": { 29 | "$ref": "dictionary.schema.json#/definitions/operator" 30 | }, 31 | "kktRegId": { 32 | "$ref": "dictionary.schema.json#/definitions/kktRegId" 33 | }, 34 | "fiscalDriveNumber": { 35 | "$ref": "dictionary.schema.json#/definitions/fiscalDriveNumber" 36 | }, 37 | "totalSum": { 38 | "$ref": "dictionary.schema.json#/definitions/sum" 39 | }, 40 | "cashTotalSum": { 41 | "$ref": "dictionary.schema.json#/definitions/sum" 42 | }, 43 | "ecashTotalSum": { 44 | "$ref": "dictionary.schema.json#/definitions/sum" 45 | }, 46 | "fiscalDocumentNumber": { 47 | "$ref": "dictionary.schema.json#/definitions/fiscalDocumentNumber" 48 | }, 49 | "fiscalSign": { 50 | "$ref": "dictionary.schema.json#/definitions/fiscalSign" 51 | }, 52 | "properties": { 53 | "$ref": "dictionary.schema.json#/definitions/propertiesType" 54 | }, 55 | "rawData": { 56 | "$ref": "dictionary.schema.json#/definitions/rawData" 57 | } 58 | }, 59 | "required": [ 60 | "userInn", 61 | "requestNumber", 62 | "dateTime", 63 | "shiftNumber", 64 | "operationType", 65 | "taxationType", 66 | "operator", 67 | "kktRegId", 68 | "fiscalDriveNumber", 69 | "totalSum", 70 | "fiscalDocumentNumber", 71 | "fiscalSign", 72 | "rawData" 73 | ] 74 | } 75 | }, 76 | "type": "object", 77 | "description": "Документ полученый от ККТ", 78 | "oneOf": [ 79 | { 80 | "properties": { 81 | "receiptCorrection": { 82 | "description": "Кассовый чек коррекции", 83 | "allOf": [ 84 | { 85 | "$ref": "#/definitions/baseObject" 86 | }, 87 | { 88 | "properties": { 89 | "receiptCorrectionCode": { 90 | "type": "integer", 91 | "enum": [ 92 | 31 93 | ] 94 | } 95 | }, 96 | "required": [ 97 | "receiptCorrectionCode" 98 | ] 99 | } 100 | ] 101 | } 102 | }, 103 | "required": [ 104 | "receiptCorrection" 105 | ] 106 | }, 107 | { 108 | "properties": { 109 | "bsoCorrection": { 110 | "description": "Бланк строгой отчетности коррекции", 111 | "allOf": [ 112 | { 113 | "$ref": "#/definitions/baseObject" 114 | }, 115 | { 116 | "properties": { 117 | "bsoCorrectionCode": { 118 | "type": "integer", 119 | "enum": [ 120 | 41 121 | ] 122 | } 123 | }, 124 | "required": [ 125 | "bsoCorrectionCode" 126 | ] 127 | } 128 | ] 129 | } 130 | }, 131 | "required": [ 132 | "bsoCorrection" 133 | ] 134 | } 135 | ] 136 | } 137 | -------------------------------------------------------------------------------- /schemas/1.05/fiscalReport.schema.json: -------------------------------------------------------------------------------- 1 | { 2 | "$schema": "http://json-schema.org/draft-04/schema#", 3 | "type": "object", 4 | "description": "Документ полученый от ККТ", 5 | "properties": { 6 | "fiscalReport": { 7 | "type": "object", 8 | "description": "Отчет о регистрации", 9 | "properties": { 10 | "fiscalDocumentFormatVer": { 11 | "$ref": "dictionary.schema.json#/definitions/fiscalDocumentFormatVer" 12 | }, 13 | "printInMachineSign": { 14 | "$ref": "dictionary.schema.json#/definitions/printInMachineSign" 15 | }, 16 | "exciseDutyProductSign": { 17 | "$ref": "dictionary.schema.json#/definitions/exciseDutyProductSign" 18 | }, 19 | "operatorInn": { 20 | "$ref": "dictionary.schema.json#/definitions/cashierInn" 21 | }, 22 | "fnKeyResource": { 23 | "$ref": "dictionary.schema.json#/definitions/fnKeyResource" 24 | }, 25 | "kktVersion": { 26 | "$ref": "dictionary.schema.json#/definitions/kktVersion" 27 | }, 28 | "documentKktVersion": { 29 | "$ref": "dictionary.schema.json#/definitions/documentKktVersion" 30 | }, 31 | "documentFnVersion": { 32 | "$ref": "dictionary.schema.json#/definitions/documentFnVersion" 33 | }, 34 | 35 | "code": { 36 | "type": "integer", 37 | "enum": [ 38 | 1 39 | ] 40 | }, 41 | "user": { 42 | "$ref": "dictionary.schema.json#/definitions/user" 43 | }, 44 | "userInn": { 45 | "$ref": "dictionary.schema.json#/definitions/userInn" 46 | }, 47 | "taxationType": { 48 | "$ref": "dictionary.schema.json#/definitions/taxationsType" 49 | }, 50 | "dateTime": { 51 | "$ref": "dictionary.schema.json#/definitions/dateTime" 52 | }, 53 | "kktRegId": { 54 | "$ref": "dictionary.schema.json#/definitions/kktRegId" 55 | }, 56 | "offlineMode": { 57 | "$ref": "dictionary.schema.json#/definitions/offlineMode" 58 | }, 59 | "bsoSign": { 60 | "$ref": "dictionary.schema.json#/definitions/bsoSign" 61 | }, 62 | "serviceSign": { 63 | "$ref": "dictionary.schema.json#/definitions/serviceSign" 64 | }, 65 | "encryptionSign": { 66 | "$ref": "dictionary.schema.json#/definitions/encryptionSign" 67 | }, 68 | "autoMode": { 69 | "$ref": "dictionary.schema.json#/definitions/autoMode" 70 | }, 71 | "machineNumber": { 72 | "$ref": "dictionary.schema.json#/definitions/machineNumber" 73 | }, 74 | "internetSign": { 75 | "$ref": "dictionary.schema.json#/definitions/internetSign" 76 | }, 77 | "fiscalDocumentNumber": { 78 | "$ref": "dictionary.schema.json#/definitions/fiscalDocumentNumber" 79 | }, 80 | "fiscalDriveNumber": { 81 | "$ref": "dictionary.schema.json#/definitions/fiscalDriveNumber" 82 | }, 83 | "operator": { 84 | "$ref": "dictionary.schema.json#/definitions/operator" 85 | }, 86 | "retailPlaceAddress": { 87 | "$ref": "dictionary.schema.json#/definitions/retailPlaceAddress" 88 | }, 89 | "retailPlace": { 90 | "$ref": "dictionary.schema.json#/definitions/retailPlace" 91 | }, 92 | "ofdInn": { 93 | "$ref": "dictionary.schema.json#/definitions/ofdInn" 94 | }, 95 | "kktNumber": { 96 | "$ref": "dictionary.schema.json#/definitions/kktNumber" 97 | }, 98 | "fiscalSign": { 99 | "$ref": "dictionary.schema.json#/definitions/fiscalSign" 100 | }, 101 | "properties": { 102 | "$ref": "dictionary.schema.json#/definitions/propertiesType" 103 | }, 104 | "rawData": { 105 | "$ref": "dictionary.schema.json#/definitions/rawData" 106 | } 107 | }, 108 | "required": [ 109 | "fiscalDocumentFormatVer", 110 | "printInMachineSign", 111 | "kktVersion", 112 | "documentKktVersion", 113 | "kktNumber", 114 | 115 | "code", 116 | "user", 117 | "userInn", 118 | "taxationType", 119 | "dateTime", 120 | "kktRegId", 121 | "offlineMode", 122 | "bsoSign", 123 | "serviceSign", 124 | "encryptionSign", 125 | "autoMode", 126 | "internetSign", 127 | "fiscalDocumentNumber", 128 | "fiscalDriveNumber", 129 | "operator", 130 | "retailPlace", 131 | "ofdInn", 132 | "fiscalSign", 133 | "rawData" 134 | ] 135 | } 136 | }, 137 | "required": [ 138 | "fiscalReport" 139 | ] 140 | } 141 | -------------------------------------------------------------------------------- /schemas/1.05/closeShift.schema.json: -------------------------------------------------------------------------------- 1 | { 2 | "$schema": "http://json-schema.org/draft-04/schema#", 3 | "type": "object", 4 | "description": "Документ полученый от ККТ", 5 | "properties": { 6 | "closeShift": { 7 | "type": "object", 8 | "description": "Отчёт о закрытии смены", 9 | "properties": { 10 | "fiscalDocumentFormatVer": { 11 | "$ref": "dictionary.schema.json#/definitions/fiscalDocumentFormatVer" 12 | }, 13 | "retailPlace": { 14 | "$ref": "dictionary.schema.json#/definitions/retailPlace" 15 | }, 16 | "retailPlaceAddress": { 17 | "$ref": "dictionary.schema.json#/definitions/retailPlaceAddress" 18 | }, 19 | "operatorInn": { 20 | "$ref": "dictionary.schema.json#/definitions/cashierInn" 21 | }, 22 | "operatorMessage": { 23 | "$ref": "dictionary.schema.json#/definitions/operatorMessage" 24 | }, 25 | "shiftSumReports": { 26 | 27 | }, 28 | "fiscalDriveSumReports": { 29 | "$ref": "dictionary.schema.json#/definitions/fiscalDriveSumReports" 30 | }, 31 | "fnKeyResource": { 32 | "$ref": "dictionary.schema.json#/definitions/fnKeyResource" 33 | }, 34 | "code": { 35 | "type": "integer", 36 | "enum": [ 37 | 5 38 | ] 39 | }, 40 | "user": { 41 | "$ref": "dictionary.schema.json#/definitions/user" 42 | }, 43 | "userInn": { 44 | "$ref": "dictionary.schema.json#/definitions/userInn" 45 | }, 46 | "operator": { 47 | "$ref": "dictionary.schema.json#/definitions/operator" 48 | }, 49 | "dateTime": { 50 | "$ref": "dictionary.schema.json#/definitions/dateTime" 51 | }, 52 | "shiftNumber": { 53 | "$ref": "dictionary.schema.json#/definitions/shiftNumber" 54 | }, 55 | "receiptsQuantity": { 56 | "type": "integer", 57 | "minimum": 0, 58 | "maximum": 4294967295, 59 | "description": "количество кассовых чеков за смену" 60 | }, 61 | "documentsQuantity": { 62 | "type": "integer", 63 | "minimum": 0, 64 | "maximum": 4294967295, 65 | "description": "количество фискальных документов за смену" 66 | }, 67 | "notTransmittedDocumentsQuantity": { 68 | "$ref": "dictionary.schema.json#/definitions/notTransmittedDocumentsQuantity" 69 | }, 70 | "notTransmittedDocumentsDateTime": { 71 | "$ref": "dictionary.schema.json#/definitions/notTransmittedDocumentsDateTime" 72 | }, 73 | "ofdResponseTimeoutSign": { 74 | "type": "integer", 75 | "minimum": 0, 76 | "maximum": 255, 77 | "description": "признак превышения времени ожидания ответа ОФД" 78 | }, 79 | "fiscalDriveReplaceRequiredSign": { 80 | "type": "integer", 81 | "minimum": 0, 82 | "maximum": 255, 83 | "description": "признак необходимости срочной замены ФН" 84 | }, 85 | "fiscalDriveMemoryExceededSign": { 86 | "type": "integer", 87 | "minimum": 0, 88 | "maximum": 255, 89 | "description": "признак переполнения памяти ФН" 90 | }, 91 | "fiscalDriveExhaustionSign": { 92 | "type": "integer", 93 | "minimum": 0, 94 | "maximum": 255, 95 | "description": "признак исчерпания ресурса ФН" 96 | }, 97 | "kktRegId": { 98 | "$ref": "dictionary.schema.json#/definitions/kktRegId" 99 | }, 100 | "fiscalDriveNumber": { 101 | "$ref": "dictionary.schema.json#/definitions/fiscalDriveNumber" 102 | }, 103 | "fiscalDocumentNumber": { 104 | "$ref": "dictionary.schema.json#/definitions/fiscalDocumentNumber" 105 | }, 106 | "fiscalSign": { 107 | "$ref": "dictionary.schema.json#/definitions/fiscalSign" 108 | }, 109 | "message": { 110 | "$ref": "dictionary.schema.json#/definitions/message" 111 | }, 112 | "properties": { 113 | "$ref": "dictionary.schema.json#/definitions/propertiesType" 114 | }, 115 | "rawData": { 116 | "$ref": "dictionary.schema.json#/definitions/rawData" 117 | } 118 | }, 119 | "required": [ 120 | "fiscalDocumentFormatVer", 121 | 122 | "code", 123 | "userInn", 124 | "dateTime", 125 | "shiftNumber", 126 | "receiptsQuantity", 127 | "documentsQuantity", 128 | "notTransmittedDocumentsQuantity", 129 | "notTransmittedDocumentsDateTime", 130 | "ofdResponseTimeoutSign", 131 | "fiscalDriveReplaceRequiredSign", 132 | "fiscalDriveMemoryExceededSign", 133 | "fiscalDriveExhaustionSign", 134 | "kktRegId", 135 | "fiscalDriveNumber", 136 | "fiscalDocumentNumber", 137 | "fiscalSign", 138 | "rawData" 139 | ] 140 | } 141 | }, 142 | "required": [ 143 | "closeShift" 144 | ] 145 | 146 | } 147 | -------------------------------------------------------------------------------- /schemas/1.05/fiscalReportCorrection.schema.json: -------------------------------------------------------------------------------- 1 | { 2 | "$schema": "http://json-schema.org/draft-04/schema#", 3 | "type": "object", 4 | "description": "Документ полученый от ККТ", 5 | "properties": { 6 | "fiscalReportCorrection": { 7 | "type": "object", 8 | "description": "Отчет об изменении параметров регистрации", 9 | "properties": { 10 | "fiscalDocumentFormatVer": { 11 | "$ref": "dictionary.schema.json#/definitions/fiscalDocumentFormatVer" 12 | }, 13 | "printInMachineSign": { 14 | "$ref": "dictionary.schema.json#/definitions/printInMachineSign" 15 | }, 16 | "exciseDutyProductSign": { 17 | "$ref": "dictionary.schema.json#/definitions/exciseDutyProductSign" 18 | }, 19 | "operatorInn": { 20 | "$ref": "dictionary.schema.json#/definitions/cashierInn" 21 | }, 22 | "fnKeyResource": { 23 | "$ref": "dictionary.schema.json#/definitions/fnKeyResource" 24 | }, 25 | "kktVersion": { 26 | "$ref": "dictionary.schema.json#/definitions/kktVersion" 27 | }, 28 | "documentKktVersion": { 29 | "$ref": "dictionary.schema.json#/definitions/documentKktVersion" 30 | }, 31 | "documentFnVersion": { 32 | "$ref": "dictionary.schema.json#/definitions/documentFnVersion" 33 | }, 34 | "correctionKktReasonCode": { 35 | "type": "array", 36 | "uniqueItems": true, 37 | "minItems": 1, 38 | "description": "коды причин изменения сведений о ККТ", 39 | "items": { 40 | "type": "integer" 41 | } 42 | }, 43 | "fiscalDriveSumReports": { 44 | "$ref": "dictionary.schema.json#/definitions/fiscalDriveSumReports" 45 | }, 46 | 47 | "code": { 48 | "type": "integer", 49 | "enum": [ 50 | 11 51 | ] 52 | }, 53 | "user": { 54 | "$ref": "dictionary.schema.json#/definitions/user" 55 | }, 56 | "userInn": { 57 | "$ref": "dictionary.schema.json#/definitions/userInn" 58 | }, 59 | "taxationsType": { 60 | "$ref": "dictionary.schema.json#/definitions/taxationsType" 61 | }, 62 | "dateTime": { 63 | "$ref": "dictionary.schema.json#/definitions/dateTime" 64 | }, 65 | "kktRegId": { 66 | "$ref": "dictionary.schema.json#/definitions/kktRegId" 67 | }, 68 | "offlineMode": { 69 | "$ref": "dictionary.schema.json#/definitions/offlineMode" 70 | }, 71 | "bsoSign": { 72 | "$ref": "dictionary.schema.json#/definitions/bsoSign" 73 | }, 74 | "serviceSign": { 75 | "$ref": "dictionary.schema.json#/definitions/serviceSign" 76 | }, 77 | "encryptionSign": { 78 | "$ref": "dictionary.schema.json#/definitions/encryptionSign" 79 | }, 80 | "autoMode": { 81 | "$ref": "dictionary.schema.json#/definitions/autoMode" 82 | }, 83 | "machineNumber": { 84 | "$ref": "dictionary.schema.json#/definitions/machineNumber" 85 | }, 86 | "internetSign": { 87 | "$ref": "dictionary.schema.json#/definitions/internetSign" 88 | }, 89 | "fiscalDocumentNumber": { 90 | "$ref": "dictionary.schema.json#/definitions/fiscalDocumentNumber" 91 | }, 92 | "fiscalDriveNumber": { 93 | "$ref": "dictionary.schema.json#/definitions/fiscalDriveNumber" 94 | }, 95 | "operator": { 96 | "$ref": "dictionary.schema.json#/definitions/operator" 97 | }, 98 | "retailPlaceAddress": { 99 | "$ref": "dictionary.schema.json#/definitions/retailPlaceAddress" 100 | }, 101 | "retailPlace": { 102 | "$ref": "dictionary.schema.json#/definitions/retailPlace" 103 | }, 104 | "ofdInn": { 105 | "$ref": "dictionary.schema.json#/definitions/ofdInn" 106 | }, 107 | "kktNumber": { 108 | "$ref": "dictionary.schema.json#/definitions/kktNumber" 109 | }, 110 | "correctionReasonCode": { 111 | "type": "array", 112 | "uniqueItems": false, 113 | "minItems": 1, 114 | "description": "причина перерегистрации", 115 | "items": { 116 | "type": "integer", 117 | "minimum": 0, 118 | "maximum": 255 119 | } 120 | }, 121 | "fiscalSign": { 122 | "$ref": "dictionary.schema.json#/definitions/fiscalSign" 123 | }, 124 | "properties": { 125 | "$ref": "dictionary.schema.json#/definitions/propertiesType" 126 | }, 127 | "rawData": { 128 | "$ref": "dictionary.schema.json#/definitions/rawData" 129 | } 130 | }, 131 | "required": [ 132 | "fiscalDocumentFormatVer", 133 | "printInMachineSign", 134 | "kktVersion", 135 | "documentKktVersion", 136 | "kktNumber", 137 | 138 | "code", 139 | "user", 140 | "userInn", 141 | "taxationType", 142 | "dateTime", 143 | "kktRegId", 144 | "offlineMode", 145 | "bsoSign", 146 | "serviceSign", 147 | "encryptionSign", 148 | "autoMode", 149 | "internetSign", 150 | "fiscalDocumentNumber", 151 | "fiscalDriveNumber", 152 | "operator", 153 | "retailPlace", 154 | "ofdInn", 155 | "correctionReasonCode", 156 | "fiscalSign", 157 | "rawData" 158 | ] 159 | } 160 | }, 161 | "required": [ 162 | "fiscalReportCorrection" 163 | ] 164 | } 165 | -------------------------------------------------------------------------------- /schemas/1.1/fiscalReport.schema.json: -------------------------------------------------------------------------------- 1 | { 2 | "$schema": "http://json-schema.org/draft-04/schema#", 3 | "type": "object", 4 | "description": "Документ полученый от ККТ", 5 | "properties": { 6 | "document": { 7 | "type": "object", 8 | "description": "Документ", 9 | "properties": { 10 | "fiscalReport": { 11 | "type": "object", 12 | "description": "Отчет о регистрации", 13 | "properties": { 14 | "fiscalDocumentFormatVer": { 15 | "$ref": "dictionary.schema.json#/definitions/fiscalDocumentFormatVer" 16 | }, 17 | "printInMachineSign": { 18 | "$ref": "dictionary.schema.json#/definitions/printInMachineSign" 19 | }, 20 | "exciseDutyProductSign": { 21 | "$ref": "dictionary.schema.json#/definitions/exciseDutyProductSign" 22 | }, 23 | "operatorInn": { 24 | "$ref": "dictionary.schema.json#/definitions/cashierInn" 25 | }, 26 | "fnKeyResource": { 27 | "$ref": "dictionary.schema.json#/definitions/fnKeyResource" 28 | }, 29 | "kktVersion": { 30 | "$ref": "dictionary.schema.json#/definitions/kktVersion" 31 | }, 32 | "documentKktVersion": { 33 | "$ref": "dictionary.schema.json#/definitions/documentKktVersion" 34 | }, 35 | "documentFnVersion": { 36 | "$ref": "dictionary.schema.json#/definitions/documentFnVersion" 37 | }, 38 | 39 | "code": { 40 | "type": "integer", 41 | "enum": [ 42 | 1 43 | ] 44 | }, 45 | "user": { 46 | "$ref": "dictionary.schema.json#/definitions/user" 47 | }, 48 | "userInn": { 49 | "$ref": "dictionary.schema.json#/definitions/userInn" 50 | }, 51 | "taxationsType": { 52 | "$ref": "dictionary.schema.json#/definitions/taxationsType" 53 | }, 54 | "dateTime": { 55 | "$ref": "dictionary.schema.json#/definitions/dateTime" 56 | }, 57 | "kktRegId": { 58 | "$ref": "dictionary.schema.json#/definitions/kktRegId" 59 | }, 60 | "offlineMode": { 61 | "$ref": "dictionary.schema.json#/definitions/offlineMode" 62 | }, 63 | "bsoSign": { 64 | "$ref": "dictionary.schema.json#/definitions/bsoSign" 65 | }, 66 | "serviceSign": { 67 | "$ref": "dictionary.schema.json#/definitions/serviceSign" 68 | }, 69 | "encryptionSign": { 70 | "$ref": "dictionary.schema.json#/definitions/encryptionSign" 71 | }, 72 | "autoMode": { 73 | "$ref": "dictionary.schema.json#/definitions/autoMode" 74 | }, 75 | "machineNumber": { 76 | "$ref": "dictionary.schema.json#/definitions/machineNumber" 77 | }, 78 | "internetSign": { 79 | "$ref": "dictionary.schema.json#/definitions/internetSign" 80 | }, 81 | "fiscalDocumentNumber": { 82 | "$ref": "dictionary.schema.json#/definitions/fiscalDocumentNumber" 83 | }, 84 | "fiscalDriveNumber": { 85 | "$ref": "dictionary.schema.json#/definitions/fiscalDriveNumber" 86 | }, 87 | "operator": { 88 | "$ref": "dictionary.schema.json#/definitions/operator" 89 | }, 90 | "retailPlaceAddress": { 91 | "$ref": "dictionary.schema.json#/definitions/retailPlaceAddress" 92 | }, 93 | "retailPlace": { 94 | "$ref": "dictionary.schema.json#/definitions/retailPlace" 95 | }, 96 | "ofdInn": { 97 | "$ref": "dictionary.schema.json#/definitions/ofdInn" 98 | }, 99 | "kktNumber": { 100 | "$ref": "dictionary.schema.json#/definitions/kktNumber" 101 | }, 102 | "fiscalSign": { 103 | "$ref": "dictionary.schema.json#/definitions/fiscalSign" 104 | }, 105 | "properties": { 106 | "$ref": "dictionary.schema.json#/definitions/propertiesType" 107 | }, 108 | "rawData": { 109 | "$ref": "dictionary.schema.json#/definitions/rawData" 110 | } 111 | }, 112 | "required": [ 113 | "fiscalDocumentFormatVer", 114 | "printInMachineSign", 115 | "kktVersion", 116 | "documentKktVersion", 117 | "kktNumber", 118 | 119 | "code", 120 | "user", 121 | "userInn", 122 | "taxationType", 123 | "dateTime", 124 | "kktRegId", 125 | "offlineMode", 126 | "bsoSign", 127 | "serviceSign", 128 | "encryptionSign", 129 | "autoMode", 130 | "internetSign", 131 | "fiscalDocumentNumber", 132 | "fiscalDriveNumber", 133 | "operator", 134 | "retailPlace", 135 | "ofdInn", 136 | "fiscalSign", 137 | "rawData" 138 | ] 139 | } 140 | }, 141 | "required": [ 142 | "fiscalReport" 143 | ] 144 | } 145 | }, 146 | "required": [ 147 | "document" 148 | ] 149 | } 150 | -------------------------------------------------------------------------------- /schemas/1.1/closeShift.schema.json: -------------------------------------------------------------------------------- 1 | { 2 | "$schema": "http://json-schema.org/draft-04/schema#", 3 | "type": "object", 4 | "description": "Документ полученый от ККТ", 5 | "properties": { 6 | "document": { 7 | "type": "object", 8 | "description": "Документ", 9 | "properties": { 10 | "closeShift": { 11 | "type": "object", 12 | "description": "Отчёт о закрытии смены", 13 | "properties": { 14 | "fiscalDocumentFormatVer": { 15 | "$ref": "dictionary.schema.json#/definitions/fiscalDocumentFormatVer" 16 | }, 17 | "retailPlace": { 18 | "$ref": "dictionary.schema.json#/definitions/retailPlace" 19 | }, 20 | "retailPlaceAddress": { 21 | "$ref": "dictionary.schema.json#/definitions/retailPlaceAddress" 22 | }, 23 | "operatorInn": { 24 | "$ref": "dictionary.schema.json#/definitions/cashierInn" 25 | }, 26 | "operatorMessage": { 27 | "$ref": "dictionary.schema.json#/definitions/operatorMessage" 28 | }, 29 | "shiftSumReports": { 30 | 31 | }, 32 | "fiscalDriveSumReports": { 33 | "$ref": "dictionary.schema.json#/definitions/fiscalDriveSumReports" 34 | }, 35 | "fnKeyResource": { 36 | "$ref": "dictionary.schema.json#/definitions/fnKeyResource" 37 | }, 38 | "code": { 39 | "type": "integer", 40 | "enum": [ 41 | 5 42 | ] 43 | }, 44 | "user": { 45 | "$ref": "dictionary.schema.json#/definitions/user" 46 | }, 47 | "userInn": { 48 | "$ref": "dictionary.schema.json#/definitions/userInn" 49 | }, 50 | "operator": { 51 | "$ref": "dictionary.schema.json#/definitions/operator" 52 | }, 53 | "dateTime": { 54 | "$ref": "dictionary.schema.json#/definitions/dateTime" 55 | }, 56 | "shiftNumber": { 57 | "$ref": "dictionary.schema.json#/definitions/shiftNumber" 58 | }, 59 | "receiptsQuantity": { 60 | "type": "integer", 61 | "minimum": 0, 62 | "maximum": 4294967295, 63 | "description": "количество кассовых чеков за смену" 64 | }, 65 | "documentsQuantity": { 66 | "type": "integer", 67 | "minimum": 0, 68 | "maximum": 4294967295, 69 | "description": "количество фискальных документов за смену" 70 | }, 71 | "notTransmittedDocumentsQuantity": { 72 | "$ref": "dictionary.schema.json#/definitions/notTransmittedDocumentsQuantity" 73 | }, 74 | "notTransmittedDocumentsDateTime": { 75 | "$ref": "dictionary.schema.json#/definitions/notTransmittedDocumentsDateTime" 76 | }, 77 | "ofdResponseTimeoutSign": { 78 | "type": "integer", 79 | "minimum": 0, 80 | "maximum": 255, 81 | "description": "признак превышения времени ожидания ответа ОФД" 82 | }, 83 | "fiscalDriveReplaceRequiredSign": { 84 | "type": "integer", 85 | "minimum": 0, 86 | "maximum": 255, 87 | "description": "признак необходимости срочной замены ФН" 88 | }, 89 | "fiscalDriveMemoryExceededSign": { 90 | "type": "integer", 91 | "minimum": 0, 92 | "maximum": 255, 93 | "description": "признак переполнения памяти ФН" 94 | }, 95 | "fiscalDriveExhaustionSign": { 96 | "type": "integer", 97 | "minimum": 0, 98 | "maximum": 255, 99 | "description": "признак исчерпания ресурса ФН" 100 | }, 101 | "kktRegId": { 102 | "$ref": "dictionary.schema.json#/definitions/kktRegId" 103 | }, 104 | "fiscalDriveNumber": { 105 | "$ref": "dictionary.schema.json#/definitions/fiscalDriveNumber" 106 | }, 107 | "fiscalDocumentNumber": { 108 | "$ref": "dictionary.schema.json#/definitions/fiscalDocumentNumber" 109 | }, 110 | "fiscalSign": { 111 | "$ref": "dictionary.schema.json#/definitions/fiscalSign" 112 | }, 113 | "message": { 114 | "$ref": "dictionary.schema.json#/definitions/message" 115 | }, 116 | "properties": { 117 | "$ref": "dictionary.schema.json#/definitions/propertiesType" 118 | }, 119 | "rawData": { 120 | "$ref": "dictionary.schema.json#/definitions/rawData" 121 | } 122 | }, 123 | "required": [ 124 | "fiscalDocumentFormatVer", 125 | 126 | "code", 127 | "userInn", 128 | "dateTime", 129 | "shiftNumber", 130 | "receiptsQuantity", 131 | "documentsQuantity", 132 | "notTransmittedDocumentsQuantity", 133 | "notTransmittedDocumentsDateTime", 134 | "ofdResponseTimeoutSign", 135 | "fiscalDriveReplaceRequiredSign", 136 | "fiscalDriveMemoryExceededSign", 137 | "fiscalDriveExhaustionSign", 138 | "kktRegId", 139 | "fiscalDriveNumber", 140 | "fiscalDocumentNumber", 141 | "fiscalSign", 142 | "rawData" 143 | ] 144 | } 145 | }, 146 | "required": [ 147 | "closeShift" 148 | ] 149 | } 150 | }, 151 | "required": [ 152 | "document" 153 | ] 154 | } 155 | -------------------------------------------------------------------------------- /schemas/1.1/fiscalReportCorrection.schema.json: -------------------------------------------------------------------------------- 1 | { 2 | "$schema": "http://json-schema.org/draft-04/schema#", 3 | "type": "object", 4 | "description": "Документ полученый от ККТ", 5 | "properties": { 6 | "document": { 7 | "type": "object", 8 | "description": "Документ", 9 | "properties": { 10 | "fiscalReportCorrection": { 11 | "type": "object", 12 | "description": "Отчет об изменении параметров регистрации", 13 | "properties": { 14 | "fiscalDocumentFormatVer": { 15 | "$ref": "dictionary.schema.json#/definitions/fiscalDocumentFormatVer" 16 | }, 17 | "printInMachineSign": { 18 | "$ref": "dictionary.schema.json#/definitions/printInMachineSign" 19 | }, 20 | "exciseDutyProductSign": { 21 | "$ref": "dictionary.schema.json#/definitions/exciseDutyProductSign" 22 | }, 23 | "operatorInn": { 24 | "$ref": "dictionary.schema.json#/definitions/cashierInn" 25 | }, 26 | "fnKeyResource": { 27 | "$ref": "dictionary.schema.json#/definitions/fnKeyResource" 28 | }, 29 | "kktVersion": { 30 | "$ref": "dictionary.schema.json#/definitions/kktVersion" 31 | }, 32 | "documentKktVersion": { 33 | "$ref": "dictionary.schema.json#/definitions/documentKktVersion" 34 | }, 35 | "documentFnVersion": { 36 | "$ref": "dictionary.schema.json#/definitions/documentFnVersion" 37 | }, 38 | "correctionKktReasonCode": { 39 | "type": "array", 40 | "uniqueItems": true, 41 | "minItems": 1, 42 | "description": "коды причин изменения сведений о ККТ", 43 | "items": { 44 | "type": "integer" 45 | } 46 | }, 47 | "fiscalDriveSumReports": { 48 | "$ref": "dictionary.schema.json#/definitions/fiscalDriveSumReports" 49 | }, 50 | 51 | "code": { 52 | "type": "integer", 53 | "enum": [ 54 | 11 55 | ] 56 | }, 57 | "user": { 58 | "$ref": "dictionary.schema.json#/definitions/user" 59 | }, 60 | "userInn": { 61 | "$ref": "dictionary.schema.json#/definitions/userInn" 62 | }, 63 | "taxationsType": { 64 | "$ref": "dictionary.schema.json#/definitions/taxationsType" 65 | }, 66 | "dateTime": { 67 | "$ref": "dictionary.schema.json#/definitions/dateTime" 68 | }, 69 | "kktRegId": { 70 | "$ref": "dictionary.schema.json#/definitions/kktRegId" 71 | }, 72 | "offlineMode": { 73 | "$ref": "dictionary.schema.json#/definitions/offlineMode" 74 | }, 75 | "bsoSign": { 76 | "$ref": "dictionary.schema.json#/definitions/bsoSign" 77 | }, 78 | "serviceSign": { 79 | "$ref": "dictionary.schema.json#/definitions/serviceSign" 80 | }, 81 | "encryptionSign": { 82 | "$ref": "dictionary.schema.json#/definitions/encryptionSign" 83 | }, 84 | "autoMode": { 85 | "$ref": "dictionary.schema.json#/definitions/autoMode" 86 | }, 87 | "machineNumber": { 88 | "$ref": "dictionary.schema.json#/definitions/machineNumber" 89 | }, 90 | "internetSign": { 91 | "$ref": "dictionary.schema.json#/definitions/internetSign" 92 | }, 93 | "fiscalDocumentNumber": { 94 | "$ref": "dictionary.schema.json#/definitions/fiscalDocumentNumber" 95 | }, 96 | "fiscalDriveNumber": { 97 | "$ref": "dictionary.schema.json#/definitions/fiscalDriveNumber" 98 | }, 99 | "operator": { 100 | "$ref": "dictionary.schema.json#/definitions/operator" 101 | }, 102 | "retailPlaceAddress": { 103 | "$ref": "dictionary.schema.json#/definitions/retailPlaceAddress" 104 | }, 105 | "retailPlace": { 106 | "$ref": "dictionary.schema.json#/definitions/retailPlace" 107 | }, 108 | "ofdInn": { 109 | "$ref": "dictionary.schema.json#/definitions/ofdInn" 110 | }, 111 | "kktNumber": { 112 | "$ref": "dictionary.schema.json#/definitions/kktNumber" 113 | }, 114 | "correctionReasonCode": { 115 | "type": "array", 116 | "uniqueItems": false, 117 | "minItems": 1, 118 | "description": "причина перерегистрации", 119 | "items": { 120 | "type": "integer", 121 | "minimum": 0, 122 | "maximum": 255 123 | } 124 | }, 125 | "fiscalSign": { 126 | "$ref": "dictionary.schema.json#/definitions/fiscalSign" 127 | }, 128 | "properties": { 129 | "$ref": "dictionary.schema.json#/definitions/propertiesType" 130 | }, 131 | "rawData": { 132 | "$ref": "dictionary.schema.json#/definitions/rawData" 133 | } 134 | }, 135 | "required": [ 136 | "fiscalDocumentFormatVer", 137 | "printInMachineSign", 138 | "kktVersion", 139 | "documentKktVersion", 140 | "kktNumber", 141 | 142 | "code", 143 | "user", 144 | "userInn", 145 | "taxationType", 146 | "dateTime", 147 | "kktRegId", 148 | "offlineMode", 149 | "bsoSign", 150 | "serviceSign", 151 | "encryptionSign", 152 | "autoMode", 153 | "internetSign", 154 | "fiscalDocumentNumber", 155 | "fiscalDriveNumber", 156 | "operator", 157 | "retailPlace", 158 | "ofdInn", 159 | "correctionReasonCode", 160 | "fiscalSign", 161 | "rawData" 162 | ] 163 | } 164 | }, 165 | "required": [ 166 | "fiscalReportCorrection" 167 | ] 168 | } 169 | }, 170 | "required": [ 171 | "document" 172 | ] 173 | } 174 | -------------------------------------------------------------------------------- /schemas/1.05/receiptCorrection.schema.json: -------------------------------------------------------------------------------- 1 | { 2 | "$schema": "http://json-schema.org/draft-04/schema#", 3 | "definitions": { 4 | "baseObject": { 5 | "type": "object", 6 | "properties": { 7 | "fiscalDocumentFormatVer": { 8 | "$ref": "dictionary.schema.json#/definitions/fiscalDocumentFormatVer" 9 | }, 10 | "machineNumber": { 11 | "$ref": "dictionary.schema.json#/definitions/machineNumber" 12 | }, 13 | "prepaidSum": { 14 | "$ref": "dictionary.schema.json#/definitions/prepaidSum" 15 | }, 16 | "creditSum": { 17 | "$ref": "dictionary.schema.json#/definitions/creditSum" 18 | }, 19 | "provisionSum": { 20 | "$ref": "dictionary.schema.json#/definitions/provisionSum" 21 | }, 22 | "retailPlace": { 23 | "$ref": "dictionary.schema.json#/definitions/retailPlace" 24 | }, 25 | "correctionType": { 26 | "type": "integer", 27 | "enum": [0,1], 28 | "description": "тип коррекции" 29 | }, 30 | "correctionBase": { 31 | "type": "object", 32 | "description": "основание для коррекции", 33 | "properties": { 34 | "correctionName": { 35 | "type": "string", 36 | "maxLength": 256, 37 | "description": "наименование основания для коррекции'" 38 | }, 39 | "correctionDocumentDate": { 40 | "type": "integer", 41 | "minimum": 0, 42 | "maximum": 4294967295, 43 | "description": "дата документа основания для коррекции" 44 | }, 45 | "correctionDocumentNumber": { 46 | "type": "string", 47 | "maxLength": 32, 48 | "description": "номер документа для основания коррекции" 49 | } 50 | }, 51 | "required": ["correctionName", "correctionDocumentDate", "correctionDocumentNumber"] 52 | }, 53 | 54 | "user": { 55 | "$ref": "dictionary.schema.json#/definitions/user" 56 | }, 57 | "userInn": { 58 | "$ref": "dictionary.schema.json#/definitions/userInn" 59 | }, 60 | "requestNumber": { 61 | "$ref": "dictionary.schema.json#/definitions/requestNumber" 62 | }, 63 | "dateTime": { 64 | "$ref": "dictionary.schema.json#/definitions/dateTime" 65 | }, 66 | "shiftNumber": { 67 | "$ref": "dictionary.schema.json#/definitions/shiftNumber" 68 | }, 69 | "operationType": { 70 | "$ref": "dictionary.schema.json#/definitions/operationType" 71 | }, 72 | "taxationType": { 73 | "$ref": "dictionary.schema.json#/definitions/taxationType" 74 | }, 75 | "operator": { 76 | "$ref": "dictionary.schema.json#/definitions/operator" 77 | }, 78 | "operatorInn": { 79 | "$ref": "dictionary.schema.json#/definitions/cashierInn" 80 | }, 81 | "kktRegId": { 82 | "$ref": "dictionary.schema.json#/definitions/kktRegId" 83 | }, 84 | "fiscalDriveNumber": { 85 | "$ref": "dictionary.schema.json#/definitions/fiscalDriveNumber" 86 | }, 87 | "totalSum": { 88 | "$ref": "dictionary.schema.json#/definitions/sum" 89 | }, 90 | "cashTotalSum": { 91 | "$ref": "dictionary.schema.json#/definitions/sum" 92 | }, 93 | "ecashTotalSum": { 94 | "$ref": "dictionary.schema.json#/definitions/sum" 95 | }, 96 | "fiscalDocumentNumber": { 97 | "$ref": "dictionary.schema.json#/definitions/fiscalDocumentNumber" 98 | }, 99 | "fiscalSign": { 100 | "$ref": "dictionary.schema.json#/definitions/fiscalSign" 101 | }, 102 | "properties": { 103 | "$ref": "dictionary.schema.json#/definitions/propertiesType" 104 | }, 105 | "rawData": { 106 | "$ref": "dictionary.schema.json#/definitions/rawData" 107 | } 108 | }, 109 | "required": [ 110 | "fiscalDocumentFormatVer", 111 | "correctionType", 112 | "correctionBase", 113 | 114 | "userInn", 115 | "requestNumber", 116 | "dateTime", 117 | "shiftNumber", 118 | "operationType", 119 | "taxationType", 120 | "operator", 121 | "kktRegId", 122 | "fiscalDriveNumber", 123 | "totalSum", 124 | "fiscalDocumentNumber", 125 | "fiscalSign", 126 | "rawData" 127 | ] 128 | } 129 | }, 130 | "type": "object", 131 | "description": "Документ полученый от ККТ", 132 | "oneOf": [ 133 | { 134 | "properties": { 135 | "receiptCorrection": { 136 | "description": "Кассовый чек коррекции", 137 | "allOf": [ 138 | { 139 | "$ref": "#/definitions/baseObject" 140 | }, 141 | { 142 | "properties": { 143 | "receiptCorrectionCode": { 144 | "type": "integer", 145 | "enum": [ 146 | 31 147 | ] 148 | } 149 | }, 150 | "required": [ 151 | "receiptCorrectionCode" 152 | ] 153 | } 154 | ] 155 | } 156 | }, 157 | "required": [ 158 | "receiptCorrection" 159 | ] 160 | }, 161 | { 162 | "properties": { 163 | "bsoCorrection": { 164 | "description": "Бланк строгой отчетности коррекции", 165 | "allOf": [ 166 | { 167 | "$ref": "#/definitions/baseObject" 168 | }, 169 | { 170 | "properties": { 171 | "bsoCorrectionCode": { 172 | "type": "integer", 173 | "enum": [ 174 | 41 175 | ] 176 | } 177 | }, 178 | "required": [ 179 | "bsoCorrectionCode" 180 | ] 181 | } 182 | ] 183 | } 184 | }, 185 | "required": [ 186 | "bsoCorrection" 187 | ] 188 | } 189 | ] 190 | } 191 | -------------------------------------------------------------------------------- /schemas/1.1/receiptCorrection.schema.json: -------------------------------------------------------------------------------- 1 | { 2 | "$schema": "http://json-schema.org/draft-04/schema#", 3 | "definitions": { 4 | "baseObject": { 5 | "type": "object", 6 | "properties": { 7 | "fiscalDocumentFormatVer": { 8 | "$ref": "dictionary.schema.json#/definitions/fiscalDocumentFormatVer" 9 | }, 10 | "machineNumber": { 11 | "$ref": "dictionary.schema.json#/definitions/machineNumber" 12 | }, 13 | "prepaidSum": { 14 | "$ref": "dictionary.schema.json#/definitions/prepaidSum" 15 | }, 16 | "creditSum": { 17 | "$ref": "dictionary.schema.json#/definitions/creditSum" 18 | }, 19 | "provisionSum": { 20 | "$ref": "dictionary.schema.json#/definitions/provisionSum" 21 | }, 22 | "retailPlace": { 23 | "$ref": "dictionary.schema.json#/definitions/retailPlace" 24 | }, 25 | "correctionType": { 26 | "type": "integer", 27 | "enum": [0,1], 28 | "description": "тип коррекции" 29 | }, 30 | "correctionBase": { 31 | "type": "object", 32 | "description": "основание для коррекции", 33 | "properties": { 34 | "correctionName": { 35 | "type": "string", 36 | "maxLength": 256, 37 | "description": "наименование основания для коррекции'" 38 | }, 39 | "correctionDocumentDate": { 40 | "type": "integer", 41 | "minimum": 0, 42 | "maximum": 4294967295, 43 | "description": "дата документа основания для коррекции" 44 | }, 45 | "correctionDocumentNumber": { 46 | "type": "string", 47 | "maxLength": 32, 48 | "description": "номер документа для основания коррекции" 49 | } 50 | }, 51 | "required": ["correctionName", "correctionDocumentDate", "correctionDocumentNumber"] 52 | }, 53 | 54 | "user": { 55 | "$ref": "dictionary.schema.json#/definitions/user" 56 | }, 57 | "userInn": { 58 | "$ref": "dictionary.schema.json#/definitions/userInn" 59 | }, 60 | "requestNumber": { 61 | "$ref": "dictionary.schema.json#/definitions/requestNumber" 62 | }, 63 | "dateTime": { 64 | "$ref": "dictionary.schema.json#/definitions/dateTime" 65 | }, 66 | "shiftNumber": { 67 | "$ref": "dictionary.schema.json#/definitions/shiftNumber" 68 | }, 69 | "operationType": { 70 | "$ref": "dictionary.schema.json#/definitions/operationType" 71 | }, 72 | "taxationType": { 73 | "$ref": "dictionary.schema.json#/definitions/taxationType" 74 | }, 75 | "operator": { 76 | "$ref": "dictionary.schema.json#/definitions/operator" 77 | }, 78 | "kktRegId": { 79 | "$ref": "dictionary.schema.json#/definitions/kktRegId" 80 | }, 81 | "fiscalDriveNumber": { 82 | "$ref": "dictionary.schema.json#/definitions/fiscalDriveNumber" 83 | }, 84 | "totalSum": { 85 | "$ref": "dictionary.schema.json#/definitions/sum" 86 | }, 87 | "cashTotalSum": { 88 | "$ref": "dictionary.schema.json#/definitions/sum" 89 | }, 90 | "ecashTotalSum": { 91 | "$ref": "dictionary.schema.json#/definitions/sum" 92 | }, 93 | "fiscalDocumentNumber": { 94 | "$ref": "dictionary.schema.json#/definitions/fiscalDocumentNumber" 95 | }, 96 | "fiscalSign": { 97 | "$ref": "dictionary.schema.json#/definitions/fiscalSign" 98 | }, 99 | "properties": { 100 | "$ref": "dictionary.schema.json#/definitions/propertiesType" 101 | }, 102 | "rawData": { 103 | "$ref": "dictionary.schema.json#/definitions/rawData" 104 | }, 105 | "operatorInn": { 106 | "$ref": "dictionary.schema.json#/definitions/cashierInn" 107 | } 108 | }, 109 | "required": [ 110 | "fiscalDocumentFormatVer", 111 | "correctionType", 112 | "correctionBase", 113 | 114 | "userInn", 115 | "requestNumber", 116 | "dateTime", 117 | "shiftNumber", 118 | "operationType", 119 | "taxationType", 120 | "operator", 121 | "kktRegId", 122 | "fiscalDriveNumber", 123 | "totalSum", 124 | "fiscalDocumentNumber", 125 | "fiscalSign", 126 | "rawData" 127 | ] 128 | } 129 | }, 130 | "type": "object", 131 | "description": "Документ полученый от ККТ", 132 | "properties": { 133 | "document": { 134 | "type": "object", 135 | "description": "Документ", 136 | "oneOf": [ 137 | { 138 | "properties": { 139 | "receiptCorrection": { 140 | "description": "Кассовый чек коррекции", 141 | "allOf": [ 142 | { 143 | "$ref": "#/definitions/baseObject" 144 | }, 145 | { 146 | "properties": { 147 | "receiptCorrectionCode": { 148 | "type": "integer", 149 | "enum": [ 150 | 31 151 | ] 152 | } 153 | }, 154 | "required": [ 155 | "receiptCorrectionCode" 156 | ] 157 | } 158 | ] 159 | } 160 | }, 161 | "required": [ 162 | "receiptCorrection" 163 | ] 164 | }, 165 | { 166 | "properties": { 167 | "bsoCorrection": { 168 | "description": "Бланк строгой отчетности коррекции", 169 | "allOf": [ 170 | { 171 | "$ref": "#/definitions/baseObject" 172 | }, 173 | { 174 | "properties": { 175 | "bsoCorrectionCode": { 176 | "type": "integer", 177 | "enum": [ 178 | 41 179 | ] 180 | } 181 | }, 182 | "required": [ 183 | "bsoCorrectionCode" 184 | ] 185 | } 186 | ] 187 | } 188 | }, 189 | "required": [ 190 | "bsoCorrection" 191 | ] 192 | } 193 | ] 194 | } 195 | }, 196 | "required": [ 197 | "document" 198 | ] 199 | } 200 | -------------------------------------------------------------------------------- /schemas/1.0/receipt.schema.json: -------------------------------------------------------------------------------- 1 | { 2 | "$schema": "http://json-schema.org/draft-04/schema#", 3 | "definitions": { 4 | "baseObject": { 5 | "type": "object", 6 | "properties": { 7 | "user": { 8 | "$ref": "dictionary.schema.json#/definitions/user" 9 | }, 10 | "userInn": { 11 | "$ref": "dictionary.schema.json#/definitions/userInn" 12 | }, 13 | "fiscalDriveNumber": { 14 | "$ref": "dictionary.schema.json#/definitions/fiscalDriveNumber" 15 | }, 16 | "operationType": { 17 | "$ref": "dictionary.schema.json#/definitions/operationType" 18 | }, 19 | "cashTotalSum": { 20 | "$ref": "dictionary.schema.json#/definitions/sum" 21 | }, 22 | "totalSum": { 23 | "$ref": "dictionary.schema.json#/definitions/sum" 24 | }, 25 | "ecashTotalSum": { 26 | "$ref": "dictionary.schema.json#/definitions/sum" 27 | }, 28 | "nds18": { 29 | "$ref": "dictionary.schema.json#/definitions/sum" 30 | }, 31 | "nds10": { 32 | "$ref": "dictionary.schema.json#/definitions/sum" 33 | }, 34 | "nds0": { 35 | "$ref": "dictionary.schema.json#/definitions/sum" 36 | }, 37 | "ndsNo": { 38 | "$ref": "dictionary.schema.json#/definitions/sum" 39 | }, 40 | "ndsCalculated18": { 41 | "$ref": "dictionary.schema.json#/definitions/sum" 42 | }, 43 | "ndsCalculated10": { 44 | "$ref": "dictionary.schema.json#/definitions/sum" 45 | }, 46 | "dateTime": { 47 | "$ref": "dictionary.schema.json#/definitions/dateTime" 48 | }, 49 | "taxationType": { 50 | "$ref": "dictionary.schema.json#/definitions/taxationType" 51 | }, 52 | "fiscalSign": { 53 | "$ref": "dictionary.schema.json#/definitions/fiscalSign" 54 | }, 55 | "requestNumber": { 56 | "$ref": "dictionary.schema.json#/definitions/requestNumber" 57 | }, 58 | "operator": { 59 | "$ref": "dictionary.schema.json#/definitions/operator" 60 | }, 61 | "fiscalDocumentNumber": { 62 | "$ref": "dictionary.schema.json#/definitions/fiscalDocumentNumber" 63 | }, 64 | "retailPlaceAddress": { 65 | "$ref": "dictionary.schema.json#/definitions/retailPlaceAddress" 66 | }, 67 | "buyerAddress": { 68 | "$ref": "dictionary.schema.json#/definitions/buyerAddress" 69 | }, 70 | "senderAddress": { 71 | "$ref": "dictionary.schema.json#/definitions/senderAddress" 72 | }, 73 | "addressToCheckFiscalSign": { 74 | "$ref": "dictionary.schema.json#/definitions/addressToCheckFiscalSign" 75 | }, 76 | "kktRegId": { 77 | "$ref": "dictionary.schema.json#/definitions/kktRegId" 78 | }, 79 | "shiftNumber": { 80 | "$ref": "dictionary.schema.json#/definitions/shiftNumber" 81 | }, 82 | "properties": { 83 | "$ref": "dictionary.schema.json#/definitions/propertiesType" 84 | }, 85 | "message": { 86 | "$ref": "dictionary.schema.json#/definitions/message" 87 | }, 88 | "items": { 89 | "$ref": "dictionary.schema.json#/definitions/receiptItems" 90 | }, 91 | "stornoItems": { 92 | "$ref": "dictionary.schema.json#/definitions/receiptItems" 93 | }, 94 | "paymentAgentRemuneration": { 95 | "$ref": "dictionary.schema.json#/definitions/paymentAgentRemuneration" 96 | }, 97 | "paymentAgentPhone": { 98 | "$ref": "dictionary.schema.json#/definitions/paymentAgentPhone" 99 | }, 100 | "paymentSubagentPhone": { 101 | "$ref": "dictionary.schema.json#/definitions/paymentSubagentPhone" 102 | }, 103 | "operatorPhoneToReceive": { 104 | "$ref": "dictionary.schema.json#/definitions/operatorPhoneToReceive" 105 | }, 106 | "operatorPhoneToTransfer": { 107 | "$ref": "dictionary.schema.json#/definitions/operatorPhoneToTransfer" 108 | }, 109 | "bankAgentPhone": { 110 | "$ref": "dictionary.schema.json#/definitions/bankAgentPhone" 111 | }, 112 | "bankSubagentPhone": { 113 | "$ref": "dictionary.schema.json#/definitions/bankSubagentPhone" 114 | }, 115 | "bankAgentOperation": { 116 | "$ref": "dictionary.schema.json#/definitions/bankAgentOperation" 117 | }, 118 | "bankSubagentOperation": { 119 | "$ref": "dictionary.schema.json#/definitions/bankSubagentOperation" 120 | }, 121 | "bankAgentRemuneration": { 122 | "$ref": "dictionary.schema.json#/definitions/bankAgentRemuneration" 123 | }, 124 | "operatorName": { 125 | "$ref": "dictionary.schema.json#/definitions/operatorName" 126 | }, 127 | "operatorAddress": { 128 | "$ref": "dictionary.schema.json#/definitions/operatorAddress" 129 | }, 130 | "operatorTransferInn": { 131 | "$ref": "dictionary.schema.json#/definitions/operatorTransferInn" 132 | }, 133 | "operatorInn": { 134 | "$ref": "dictionary.schema.json#/definitions/operatorInn" 135 | }, 136 | "modifiers": { 137 | "type": "array", 138 | "uniqueItems": false, 139 | "description": "скидки/наценки", 140 | "items": { 141 | "$ref": "dictionary.schema.json#/definitions/modifiers" 142 | } 143 | }, 144 | "rawData": { 145 | "$ref": "dictionary.schema.json#/definitions/rawData" 146 | } 147 | }, 148 | "required": [ 149 | "requestNumber", 150 | "dateTime", 151 | "shiftNumber", 152 | "operationType", 153 | "taxationType", 154 | "kktRegId", 155 | "fiscalDriveNumber", 156 | "fiscalDocumentNumber", 157 | "totalSum", 158 | "fiscalSign", 159 | "rawData" 160 | ] 161 | } 162 | }, 163 | "type": "object", 164 | "description": "Документ полученый от ККТ", 165 | "oneOf": [ 166 | { 167 | "properties": { 168 | "receipt": { 169 | "description": "Кассовый чек", 170 | "allOf": [ 171 | { 172 | "$ref": "#/definitions/baseObject" 173 | }, 174 | { 175 | "properties": { 176 | "receiptCode": { 177 | "type": "integer", 178 | "enum": [ 179 | 3 180 | ] 181 | } 182 | }, 183 | "required": [ 184 | "receiptCode" 185 | ] 186 | } 187 | ] 188 | } 189 | }, 190 | "required": [ 191 | "receipt" 192 | ] 193 | }, 194 | { 195 | "properties": { 196 | "bso": { 197 | "description": "БСО", 198 | "allOf": [ 199 | { 200 | "$ref": "#/definitions/baseObject" 201 | }, 202 | { 203 | "properties": { 204 | "bsoCode": { 205 | "type": "integer", 206 | "enum": [ 207 | 4 208 | ] 209 | } 210 | }, 211 | "required": [ 212 | "bsoCode" 213 | ] 214 | } 215 | ] 216 | } 217 | }, 218 | "required": [ 219 | "bso" 220 | ] 221 | } 222 | ] 223 | } 224 | -------------------------------------------------------------------------------- /schemas/1.05/receipt.schema.json: -------------------------------------------------------------------------------- 1 | { 2 | "$schema": "http://json-schema.org/draft-04/schema#", 3 | "definitions": { 4 | "baseObject": { 5 | "type": "object", 6 | "properties": { 7 | "fiscalDocumentFormatVer": { 8 | "$ref": "dictionary.schema.json#/definitions/fiscalDocumentFormatVer" 9 | }, 10 | "machineNumber": { 11 | "$ref": "dictionary.schema.json#/definitions/machineNumber" 12 | }, 13 | "prepaidSum": { 14 | "$ref": "dictionary.schema.json#/definitions/prepaidSum" 15 | }, 16 | "creditSum": { 17 | "$ref": "dictionary.schema.json#/definitions/creditSum" 18 | }, 19 | "provisionSum": { 20 | "$ref": "dictionary.schema.json#/definitions/provisionSum" 21 | }, 22 | "propertiesData": { 23 | "$ref": "dictionary.schema.json#/definitions/propertiesData" 24 | }, 25 | 26 | "user": { 27 | "$ref": "dictionary.schema.json#/definitions/user" 28 | }, 29 | "userInn": { 30 | "$ref": "dictionary.schema.json#/definitions/userInn" 31 | }, 32 | "fiscalDriveNumber": { 33 | "$ref": "dictionary.schema.json#/definitions/fiscalDriveNumber" 34 | }, 35 | "operationType": { 36 | "$ref": "dictionary.schema.json#/definitions/operationType" 37 | }, 38 | "cashTotalSum": { 39 | "$ref": "dictionary.schema.json#/definitions/sum" 40 | }, 41 | "totalSum": { 42 | "$ref": "dictionary.schema.json#/definitions/sum" 43 | }, 44 | "ecashTotalSum": { 45 | "$ref": "dictionary.schema.json#/definitions/sum" 46 | }, 47 | "nds18": { 48 | "$ref": "dictionary.schema.json#/definitions/sum" 49 | }, 50 | "nds10": { 51 | "$ref": "dictionary.schema.json#/definitions/sum" 52 | }, 53 | "nds0": { 54 | "$ref": "dictionary.schema.json#/definitions/sum" 55 | }, 56 | "ndsNo": { 57 | "$ref": "dictionary.schema.json#/definitions/sum" 58 | }, 59 | "ndsCalculated18": { 60 | "$ref": "dictionary.schema.json#/definitions/sum" 61 | }, 62 | "ndsCalculated10": { 63 | "$ref": "dictionary.schema.json#/definitions/sum" 64 | }, 65 | "dateTime": { 66 | "$ref": "dictionary.schema.json#/definitions/dateTime" 67 | }, 68 | "taxationType": { 69 | "$ref": "dictionary.schema.json#/definitions/taxationType" 70 | }, 71 | "fiscalSign": { 72 | "$ref": "dictionary.schema.json#/definitions/fiscalSign" 73 | }, 74 | "requestNumber": { 75 | "$ref": "dictionary.schema.json#/definitions/requestNumber" 76 | }, 77 | "operator": { 78 | "$ref": "dictionary.schema.json#/definitions/operator" 79 | }, 80 | "fiscalDocumentNumber": { 81 | "$ref": "dictionary.schema.json#/definitions/fiscalDocumentNumber" 82 | }, 83 | "retailPlaceAddress": { 84 | "$ref": "dictionary.schema.json#/definitions/retailPlaceAddress" 85 | }, 86 | "retailPlace": { 87 | "$ref": "dictionary.schema.json#/definitions/retailPlace" 88 | }, 89 | "buyerAddress": { 90 | "$ref": "dictionary.schema.json#/definitions/buyerAddress" 91 | }, 92 | "senderAddress": { 93 | "$ref": "dictionary.schema.json#/definitions/senderAddress" 94 | }, 95 | "addressToCheckFiscalSign": { 96 | "$ref": "dictionary.schema.json#/definitions/addressToCheckFiscalSign" 97 | }, 98 | "kktRegId": { 99 | "$ref": "dictionary.schema.json#/definitions/kktRegId" 100 | }, 101 | "shiftNumber": { 102 | "$ref": "dictionary.schema.json#/definitions/shiftNumber" 103 | }, 104 | "properties": { 105 | "$ref": "dictionary.schema.json#/definitions/propertiesType" 106 | }, 107 | "message": { 108 | "$ref": "dictionary.schema.json#/definitions/message" 109 | }, 110 | "items": { 111 | "$ref": "dictionary.schema.json#/definitions/receiptItems" 112 | }, 113 | "stornoItems": { 114 | "$ref": "dictionary.schema.json#/definitions/receiptItems" 115 | }, 116 | "paymentAgentRemuneration": { 117 | "$ref": "dictionary.schema.json#/definitions/paymentAgentRemuneration" 118 | }, 119 | "paymentAgentPhone": { 120 | "$ref": "dictionary.schema.json#/definitions/paymentAgentPhone" 121 | }, 122 | "paymentSubagentPhone": { 123 | "$ref": "dictionary.schema.json#/definitions/paymentSubagentPhone" 124 | }, 125 | "operatorPhoneToReceive": { 126 | "$ref": "dictionary.schema.json#/definitions/operatorPhoneToReceive" 127 | }, 128 | "operatorPhoneToTransfer": { 129 | "$ref": "dictionary.schema.json#/definitions/operatorPhoneToTransfer" 130 | }, 131 | "operatorName": { 132 | "$ref": "dictionary.schema.json#/definitions/operatorName" 133 | }, 134 | "operatorAddress": { 135 | "$ref": "dictionary.schema.json#/definitions/operatorAddress" 136 | }, 137 | "operatorInn": { 138 | "$ref": "dictionary.schema.json#/definitions/cashierInn" 139 | }, 140 | "operatorTransferInn": { 141 | "$ref": "dictionary.schema.json#/definitions/operatorTransferInn" 142 | }, 143 | "modifiers": { 144 | "type": "array", 145 | "uniqueItems": false, 146 | "description": "скидки/наценки", 147 | "items": { 148 | "$ref": "dictionary.schema.json#/definitions/modifiers" 149 | } 150 | }, 151 | "rawData": { 152 | "$ref": "dictionary.schema.json#/definitions/rawData" 153 | } 154 | }, 155 | "required": [ 156 | "fiscalDocumentFormatVer", 157 | 158 | 159 | "requestNumber", 160 | "dateTime", 161 | "shiftNumber", 162 | "operationType", 163 | "taxationType", 164 | "kktRegId", 165 | "fiscalDriveNumber", 166 | "fiscalDocumentNumber", 167 | "totalSum", 168 | "fiscalSign", 169 | "rawData" 170 | ] 171 | } 172 | }, 173 | "type": "object", 174 | "description": "Документ полученый от ККТ", 175 | "oneOf": [ 176 | { 177 | "properties": { 178 | "receipt": { 179 | "description": "Кассовый чек", 180 | "allOf": [ 181 | { 182 | "$ref": "#/definitions/baseObject" 183 | }, 184 | { 185 | "properties": { 186 | "receiptCode": { 187 | "type": "integer", 188 | "enum": [ 189 | 3 190 | ] 191 | } 192 | }, 193 | "required": [ 194 | "receiptCode" 195 | ] 196 | } 197 | ] 198 | } 199 | }, 200 | "required": [ 201 | "receipt" 202 | ] 203 | }, 204 | { 205 | "properties": { 206 | "bso": { 207 | "description": "БСО", 208 | "allOf": [ 209 | { 210 | "$ref": "#/definitions/baseObject" 211 | }, 212 | { 213 | "properties": { 214 | "bsoCode": { 215 | "type": "integer", 216 | "enum": [ 217 | 4 218 | ] 219 | } 220 | }, 221 | "required": [ 222 | "bsoCode" 223 | ] 224 | } 225 | ] 226 | } 227 | }, 228 | "required": [ 229 | "bso" 230 | ] 231 | } 232 | ] 233 | } 234 | -------------------------------------------------------------------------------- /schemas/1.1/receipt.schema.json: -------------------------------------------------------------------------------- 1 | { 2 | "$schema": "http://json-schema.org/draft-04/schema#", 3 | "definitions": { 4 | "baseObject": { 5 | "type": "object", 6 | "properties": { 7 | "fiscalDocumentFormatVer": { 8 | "$ref": "dictionary.schema.json#/definitions/fiscalDocumentFormatVer" 9 | }, 10 | "machineNumber": { 11 | "$ref": "dictionary.schema.json#/definitions/machineNumber" 12 | }, 13 | "prepaidSum": { 14 | "$ref": "dictionary.schema.json#/definitions/prepaidSum" 15 | }, 16 | "creditSum": { 17 | "$ref": "dictionary.schema.json#/definitions/creditSum" 18 | }, 19 | "provisionSum": { 20 | "$ref": "dictionary.schema.json#/definitions/provisionSum" 21 | }, 22 | "propertiesData": { 23 | "$ref": "dictionary.schema.json#/definitions/propertiesData" 24 | }, 25 | 26 | "user": { 27 | "$ref": "dictionary.schema.json#/definitions/user" 28 | }, 29 | "userInn": { 30 | "$ref": "dictionary.schema.json#/definitions/userInn" 31 | }, 32 | "fiscalDriveNumber": { 33 | "$ref": "dictionary.schema.json#/definitions/fiscalDriveNumber" 34 | }, 35 | "operationType": { 36 | "$ref": "dictionary.schema.json#/definitions/operationType" 37 | }, 38 | "cashTotalSum": { 39 | "$ref": "dictionary.schema.json#/definitions/sum" 40 | }, 41 | "totalSum": { 42 | "$ref": "dictionary.schema.json#/definitions/sum" 43 | }, 44 | "ecashTotalSum": { 45 | "$ref": "dictionary.schema.json#/definitions/sum" 46 | }, 47 | "nds18": { 48 | "$ref": "dictionary.schema.json#/definitions/sum" 49 | }, 50 | "nds10": { 51 | "$ref": "dictionary.schema.json#/definitions/sum" 52 | }, 53 | "nds0": { 54 | "$ref": "dictionary.schema.json#/definitions/sum" 55 | }, 56 | "ndsNo": { 57 | "$ref": "dictionary.schema.json#/definitions/sum" 58 | }, 59 | "ndsCalculated18": { 60 | "$ref": "dictionary.schema.json#/definitions/sum" 61 | }, 62 | "ndsCalculated10": { 63 | "$ref": "dictionary.schema.json#/definitions/sum" 64 | }, 65 | "dateTime": { 66 | "$ref": "dictionary.schema.json#/definitions/dateTime" 67 | }, 68 | "taxationType": { 69 | "$ref": "dictionary.schema.json#/definitions/taxationType" 70 | }, 71 | "fiscalSign": { 72 | "$ref": "dictionary.schema.json#/definitions/fiscalSign" 73 | }, 74 | "requestNumber": { 75 | "$ref": "dictionary.schema.json#/definitions/requestNumber" 76 | }, 77 | "operator": { 78 | "$ref": "dictionary.schema.json#/definitions/operator" 79 | }, 80 | "fiscalDocumentNumber": { 81 | "$ref": "dictionary.schema.json#/definitions/fiscalDocumentNumber" 82 | }, 83 | "retailPlaceAddress": { 84 | "$ref": "dictionary.schema.json#/definitions/retailPlaceAddress" 85 | }, 86 | "retailPlace": { 87 | "$ref": "dictionary.schema.json#/definitions/retailPlace" 88 | }, 89 | "buyerAddress": { 90 | "$ref": "dictionary.schema.json#/definitions/buyerAddress" 91 | }, 92 | "senderAddress": { 93 | "$ref": "dictionary.schema.json#/definitions/senderAddress" 94 | }, 95 | "addressToCheckFiscalSign": { 96 | "$ref": "dictionary.schema.json#/definitions/addressToCheckFiscalSign" 97 | }, 98 | "kktRegId": { 99 | "$ref": "dictionary.schema.json#/definitions/kktRegId" 100 | }, 101 | "shiftNumber": { 102 | "$ref": "dictionary.schema.json#/definitions/shiftNumber" 103 | }, 104 | "properties": { 105 | "$ref": "dictionary.schema.json#/definitions/propertiesType" 106 | }, 107 | "message": { 108 | "$ref": "dictionary.schema.json#/definitions/message" 109 | }, 110 | "items": { 111 | "$ref": "dictionary.schema.json#/definitions/receiptItems" 112 | }, 113 | "stornoItems": { 114 | "$ref": "dictionary.schema.json#/definitions/receiptItems" 115 | }, 116 | "paymentAgentRemuneration": { 117 | "$ref": "dictionary.schema.json#/definitions/paymentAgentRemuneration" 118 | }, 119 | "paymentAgentPhone": { 120 | "$ref": "dictionary.schema.json#/definitions/paymentAgentPhone" 121 | }, 122 | "paymentSubagentPhone": { 123 | "$ref": "dictionary.schema.json#/definitions/paymentSubagentPhone" 124 | }, 125 | "operatorPhoneToReceive": { 126 | "$ref": "dictionary.schema.json#/definitions/operatorPhoneToReceive" 127 | }, 128 | "operatorPhoneToTransfer": { 129 | "$ref": "dictionary.schema.json#/definitions/operatorPhoneToTransfer" 130 | }, 131 | "operatorName": { 132 | "$ref": "dictionary.schema.json#/definitions/operatorName" 133 | }, 134 | "operatorAddress": { 135 | "$ref": "dictionary.schema.json#/definitions/operatorAddress" 136 | }, 137 | "operatorTransferInn": { 138 | "$ref": "dictionary.schema.json#/definitions/operatorTransferInn" 139 | }, 140 | "operatorInn": { 141 | "$ref": "dictionary.schema.json#/definitions/cashierInn" 142 | }, 143 | "modifiers": { 144 | "type": "array", 145 | "uniqueItems": false, 146 | "description": "скидки/наценки", 147 | "items": { 148 | "$ref": "dictionary.schema.json#/definitions/modifiers" 149 | } 150 | }, 151 | "rawData": { 152 | "$ref": "dictionary.schema.json#/definitions/rawData" 153 | } 154 | }, 155 | "required": [ 156 | "fiscalDocumentFormatVer", 157 | 158 | 159 | "requestNumber", 160 | "dateTime", 161 | "shiftNumber", 162 | "operationType", 163 | "taxationType", 164 | "kktRegId", 165 | "fiscalDriveNumber", 166 | "fiscalDocumentNumber", 167 | "totalSum", 168 | "fiscalSign", 169 | "rawData" 170 | ] 171 | } 172 | }, 173 | "type": "object", 174 | "description": "Документ полученый от ККТ", 175 | "properties": { 176 | "document": { 177 | "type": "object", 178 | "description": "Документ", 179 | "oneOf": [ 180 | { 181 | "properties": { 182 | "receipt": { 183 | "description": "Кассовый чек", 184 | "allOf": [ 185 | { 186 | "$ref": "#/definitions/baseObject" 187 | }, 188 | { 189 | "properties": { 190 | "receiptCode": { 191 | "type": "integer", 192 | "enum": [ 193 | 3 194 | ] 195 | } 196 | }, 197 | "required": [ 198 | "receiptCode" 199 | ] 200 | } 201 | ] 202 | } 203 | }, 204 | "required": [ 205 | "receipt" 206 | ] 207 | }, 208 | { 209 | "properties": { 210 | "bso": { 211 | "description": "БСО", 212 | "allOf": [ 213 | { 214 | "$ref": "#/definitions/baseObject" 215 | }, 216 | { 217 | "properties": { 218 | "bsoCode": { 219 | "type": "integer", 220 | "enum": [ 221 | 4 222 | ] 223 | } 224 | }, 225 | "required": [ 226 | "bsoCode" 227 | ] 228 | } 229 | ] 230 | } 231 | }, 232 | "required": [ 233 | "bso" 234 | ] 235 | } 236 | ] 237 | } 238 | }, 239 | "required": [ 240 | "document" 241 | ] 242 | } 243 | -------------------------------------------------------------------------------- /LICENSE: -------------------------------------------------------------------------------- 1 | Apache License 2 | Version 2.0, January 2004 3 | http://www.apache.org/licenses/ 4 | 5 | TERMS AND CONDITIONS FOR USE, REPRODUCTION, AND DISTRIBUTION 6 | 7 | 1. Definitions. 8 | 9 | "License" shall mean the terms and conditions for use, reproduction, 10 | and distribution as defined by Sections 1 through 9 of this document. 11 | 12 | "Licensor" shall mean the copyright owner or entity authorized by 13 | the copyright owner that is granting the License. 14 | 15 | "Legal Entity" shall mean the union of the acting entity and all 16 | other entities that control, are controlled by, or are under common 17 | control with that entity. For the purposes of this definition, 18 | "control" means (i) the power, direct or indirect, to cause the 19 | direction or management of such entity, whether by contract or 20 | otherwise, or (ii) ownership of fifty percent (50%) or more of the 21 | outstanding shares, or (iii) beneficial ownership of such entity. 22 | 23 | "You" (or "Your") shall mean an individual or Legal Entity 24 | exercising permissions granted by this License. 25 | 26 | "Source" form shall mean the preferred form for making modifications, 27 | including but not limited to software source code, documentation 28 | source, and configuration files. 29 | 30 | "Object" form shall mean any form resulting from mechanical 31 | transformation or translation of a Source form, including but 32 | not limited to compiled object code, generated documentation, 33 | and conversions to other media types. 34 | 35 | "Work" shall mean the work of authorship, whether in Source or 36 | Object form, made available under the License, as indicated by a 37 | copyright notice that is included in or attached to the work 38 | (an example is provided in the Appendix below). 39 | 40 | "Derivative Works" shall mean any work, whether in Source or Object 41 | form, that is based on (or derived from) the Work and for which the 42 | editorial revisions, annotations, elaborations, or other modifications 43 | represent, as a whole, an original work of authorship. For the purposes 44 | of this License, Derivative Works shall not include works that remain 45 | separable from, or merely link (or bind by name) to the interfaces of, 46 | the Work and Derivative Works thereof. 47 | 48 | "Contribution" shall mean any work of authorship, including 49 | the original version of the Work and any modifications or additions 50 | to that Work or Derivative Works thereof, that is intentionally 51 | submitted to Licensor for inclusion in the Work by the copyright owner 52 | or by an individual or Legal Entity authorized to submit on behalf of 53 | the copyright owner. For the purposes of this definition, "submitted" 54 | means any form of electronic, verbal, or written communication sent 55 | to the Licensor or its representatives, including but not limited to 56 | communication on electronic mailing lists, source code control systems, 57 | and issue tracking systems that are managed by, or on behalf of, the 58 | Licensor for the purpose of discussing and improving the Work, but 59 | excluding communication that is conspicuously marked or otherwise 60 | designated in writing by the copyright owner as "Not a Contribution." 61 | 62 | "Contributor" shall mean Licensor and any individual or Legal Entity 63 | on behalf of whom a Contribution has been received by Licensor and 64 | subsequently incorporated within the Work. 65 | 66 | 2. Grant of Copyright License. Subject to the terms and conditions of 67 | this License, each Contributor hereby grants to You a perpetual, 68 | worldwide, non-exclusive, no-charge, royalty-free, irrevocable 69 | copyright license to reproduce, prepare Derivative Works of, 70 | publicly display, publicly perform, sublicense, and distribute the 71 | Work and such Derivative Works in Source or Object form. 72 | 73 | 3. Grant of Patent License. Subject to the terms and conditions of 74 | this License, each Contributor hereby grants to You a perpetual, 75 | worldwide, non-exclusive, no-charge, royalty-free, irrevocable 76 | (except as stated in this section) patent license to make, have made, 77 | use, offer to sell, sell, import, and otherwise transfer the Work, 78 | where such license applies only to those patent claims licensable 79 | by such Contributor that are necessarily infringed by their 80 | Contribution(s) alone or by combination of their Contribution(s) 81 | with the Work to which such Contribution(s) was submitted. If You 82 | institute patent litigation against any entity (including a 83 | cross-claim or counterclaim in a lawsuit) alleging that the Work 84 | or a Contribution incorporated within the Work constitutes direct 85 | or contributory patent infringement, then any patent licenses 86 | granted to You under this License for that Work shall terminate 87 | as of the date such litigation is filed. 88 | 89 | 4. Redistribution. You may reproduce and distribute copies of the 90 | Work or Derivative Works thereof in any medium, with or without 91 | modifications, and in Source or Object form, provided that You 92 | meet the following conditions: 93 | 94 | (a) You must give any other recipients of the Work or 95 | Derivative Works a copy of this License; and 96 | 97 | (b) You must cause any modified files to carry prominent notices 98 | stating that You changed the files; and 99 | 100 | (c) You must retain, in the Source form of any Derivative Works 101 | that You distribute, all copyright, patent, trademark, and 102 | attribution notices from the Source form of the Work, 103 | excluding those notices that do not pertain to any part of 104 | the Derivative Works; and 105 | 106 | (d) If the Work includes a "NOTICE" text file as part of its 107 | distribution, then any Derivative Works that You distribute must 108 | include a readable copy of the attribution notices contained 109 | within such NOTICE file, excluding those notices that do not 110 | pertain to any part of the Derivative Works, in at least one 111 | of the following places: within a NOTICE text file distributed 112 | as part of the Derivative Works; within the Source form or 113 | documentation, if provided along with the Derivative Works; or, 114 | within a display generated by the Derivative Works, if and 115 | wherever such third-party notices normally appear. The contents 116 | of the NOTICE file are for informational purposes only and 117 | do not modify the License. You may add Your own attribution 118 | notices within Derivative Works that You distribute, alongside 119 | or as an addendum to the NOTICE text from the Work, provided 120 | that such additional attribution notices cannot be construed 121 | as modifying the License. 122 | 123 | You may add Your own copyright statement to Your modifications and 124 | may provide additional or different license terms and conditions 125 | for use, reproduction, or distribution of Your modifications, or 126 | for any such Derivative Works as a whole, provided Your use, 127 | reproduction, and distribution of the Work otherwise complies with 128 | the conditions stated in this License. 129 | 130 | 5. Submission of Contributions. Unless You explicitly state otherwise, 131 | any Contribution intentionally submitted for inclusion in the Work 132 | by You to the Licensor shall be under the terms and conditions of 133 | this License, without any additional terms or conditions. 134 | Notwithstanding the above, nothing herein shall supersede or modify 135 | the terms of any separate license agreement you may have executed 136 | with Licensor regarding such Contributions. 137 | 138 | 6. Trademarks. This License does not grant permission to use the trade 139 | names, trademarks, service marks, or product names of the Licensor, 140 | except as required for reasonable and customary use in describing the 141 | origin of the Work and reproducing the content of the NOTICE file. 142 | 143 | 7. Disclaimer of Warranty. Unless required by applicable law or 144 | agreed to in writing, Licensor provides the Work (and each 145 | Contributor provides its Contributions) on an "AS IS" BASIS, 146 | WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or 147 | implied, including, without limitation, any warranties or conditions 148 | of TITLE, NON-INFRINGEMENT, MERCHANTABILITY, or FITNESS FOR A 149 | PARTICULAR PURPOSE. You are solely responsible for determining the 150 | appropriateness of using or redistributing the Work and assume any 151 | risks associated with Your exercise of permissions under this License. 152 | 153 | 8. Limitation of Liability. In no event and under no legal theory, 154 | whether in tort (including negligence), contract, or otherwise, 155 | unless required by applicable law (such as deliberate and grossly 156 | negligent acts) or agreed to in writing, shall any Contributor be 157 | liable to You for damages, including any direct, indirect, special, 158 | incidental, or consequential damages of any character arising as a 159 | result of this License or out of the use or inability to use the 160 | Work (including but not limited to damages for loss of goodwill, 161 | work stoppage, computer failure or malfunction, or any and all 162 | other commercial damages or losses), even if such Contributor 163 | has been advised of the possibility of such damages. 164 | 165 | 9. Accepting Warranty or Additional Liability. While redistributing 166 | the Work or Derivative Works thereof, You may choose to offer, 167 | and charge a fee for, acceptance of support, warranty, indemnity, 168 | or other liability obligations and/or rights consistent with this 169 | License. However, in accepting such obligations, You may act only 170 | on Your own behalf and on Your sole responsibility, not on behalf 171 | of any other Contributor, and only if You agree to indemnify, 172 | defend, and hold each Contributor harmless for any liability 173 | incurred by, or claims asserted against, such Contributor by reason 174 | of your accepting any such warranty or additional liability. 175 | 176 | END OF TERMS AND CONDITIONS 177 | 178 | APPENDIX: How to apply the Apache License to your work. 179 | 180 | To apply the Apache License to your work, attach the following 181 | boilerplate notice, with the fields enclosed by brackets "{}" 182 | replaced with your own identifying information. (Don't include 183 | the brackets!) The text should be enclosed in the appropriate 184 | comment syntax for the file format. We also recommend that a 185 | file or class name and description of purpose be included on the 186 | same "printed page" as the copyright notice for easier 187 | identification within third-party archives. 188 | 189 | Copyright {yyyy} {name of copyright owner} 190 | 191 | Licensed under the Apache License, Version 2.0 (the "License"); 192 | you may not use this file except in compliance with the License. 193 | You may obtain a copy of the License at 194 | 195 | http://www.apache.org/licenses/LICENSE-2.0 196 | 197 | Unless required by applicable law or agreed to in writing, software 198 | distributed under the License is distributed on an "AS IS" BASIS, 199 | WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 200 | See the License for the specific language governing permissions and 201 | limitations under the License. -------------------------------------------------------------------------------- /schemas/1.0/dictionary.schema.json: -------------------------------------------------------------------------------- 1 | { 2 | "$schema": "http://json-schema.org/draft-04/schema#", 3 | "type": "object", 4 | "definitions": { 5 | "shiftNumber": { 6 | "type": "integer", 7 | "minimum": 1, 8 | "maximum": 4294967295, 9 | "description": "номер смены" 10 | }, 11 | "message": { 12 | "type": "array", 13 | "uniqueItems": false, 14 | "description": "сообщение оператору", 15 | "items": { 16 | "type": "object", 17 | "properties": { 18 | "type": { 19 | "type": "string", 20 | "minLength": 1, 21 | "maxLength": 64 22 | }, 23 | "message": { 24 | "type": "string", 25 | "maxLength": 256 26 | } 27 | }, 28 | "required": [ 29 | "type", 30 | "message" 31 | ] 32 | } 33 | }, 34 | "propertiesType": { 35 | "type": "array", 36 | "uniqueItems": false, 37 | "description": "сообщение оператору", 38 | "items": { 39 | "type": "object", 40 | "properties": { 41 | "key": { 42 | "type": "string", 43 | "minLength": 1, 44 | "maxLength": 64 45 | }, 46 | "value": { 47 | "type": "string", 48 | "maxLength": 256 49 | } 50 | }, 51 | "required": [] 52 | } 53 | }, 54 | "fiscalDriveNumber": { 55 | "type": "string", 56 | "minLength": 16, 57 | "maxLength": 16, 58 | "description": "заводской номер фискального накопителя" 59 | }, 60 | "kktRegId": { 61 | "type": "string", 62 | "minLength": 1, 63 | "maxLength": 20, 64 | "description": "регистрационный номер ККТ" 65 | }, 66 | "sum": { 67 | "type": "integer", 68 | "minimum": 0, 69 | "description": "общая стоимость с учетом скидок и наценок, в копейках" 70 | }, 71 | "modifiers": { 72 | "type": "object", 73 | "description": "скидка/наценка", 74 | "properties": { 75 | "discountName": { 76 | "type": "string", 77 | "minLength": 1, 78 | "maxLength": 64, 79 | "description": "наименование скидкм" 80 | }, 81 | "markupName": { 82 | "type": "string", 83 | "minLength": 1, 84 | "maxLength": 64, 85 | "description": "наименование наценки" 86 | }, 87 | "discount": { 88 | "type": "number", 89 | "minimum": 0, 90 | "description": "скидка (ставка) %" 91 | }, 92 | "discountSum": { 93 | "type": "integer", 94 | "minimum": 0, 95 | "description": "скидка (сумма), в копейках" 96 | }, 97 | "markup": { 98 | "type": "number", 99 | "minimum": 0, 100 | "description": "наценка (ставка) %" 101 | }, 102 | "markupSum": { 103 | "type": "integer", 104 | "minimum": 0, 105 | "description": "наценка (сумма), в копейках" 106 | } 107 | } 108 | }, 109 | "user": { 110 | "type": "string", 111 | "minLength": 0, 112 | "maxLength": 256, 113 | "description": "наименование пользователя" 114 | }, 115 | "userInn": { 116 | "type": "string", 117 | "pattern": "^([0-9][1-9]|[1-9][0-9])(([0-9]{8} {2})|([0-9]{10}))$", 118 | "description": "ИНН пользователя" 119 | }, 120 | "operationType": { 121 | "type": "integer", 122 | "minimum": 1, 123 | "maximum": 4, 124 | "description": "признак расчета" 125 | }, 126 | "buyerAddress": { 127 | "type": "string", 128 | "minLength": 0, 129 | "maxLength": 64, 130 | "description": "адрес покупателя" 131 | }, 132 | "dateTime": { 133 | "type": "integer", 134 | "minimum": 0, 135 | "maximum": 4294967295, 136 | "description": "дата, время совершения транзакции" 137 | }, 138 | "taxationsType": { 139 | "type": "integer", 140 | "minimum": 0, 141 | "maximum": 256, 142 | "description": "системы налогообложения" 143 | }, 144 | "taxationType": { 145 | "type": "integer", 146 | "minimum": 0, 147 | "maximum": 256, 148 | "description": "применяемая система налогообложения" 149 | }, 150 | "fiscalSign": { 151 | "type": "integer", 152 | "minimum": 0, 153 | "maximum": 281474976710655, 154 | "description": "фискальный признак документа" 155 | }, 156 | "requestNumber": { 157 | "type": "integer", 158 | "minimum": 1, 159 | "maximum": 4294967295, 160 | "description": "номер чека за смену" 161 | }, 162 | "operator": { 163 | "type": "string", 164 | "minLength": 0, 165 | "maxLength": 256, 166 | "description": "кассир" 167 | }, 168 | "fiscalDocumentNumber": { 169 | "type": "integer", 170 | "minimum": 1, 171 | "maximum": 4294967295, 172 | "description": "порядковый номер фискального документа" 173 | }, 174 | "receiptItems": { 175 | "type": "array", 176 | "uniqueItems": false, 177 | "description": "реквизиты товаров", 178 | "items": { 179 | "type": "object", 180 | "properties": { 181 | "name": { 182 | "type": "string", 183 | "minLength": 1, 184 | "maxLength": 64, 185 | "description": "наименование товара" 186 | }, 187 | "barcode": { 188 | "type": "string", 189 | "minLength": 0, 190 | "maxLength": 16, 191 | "description": "штриховой код EAN13" 192 | }, 193 | "quantity": { 194 | "type": "number", 195 | "minimum": 0, 196 | "description": "количество" 197 | }, 198 | "price": { 199 | "type": "integer", 200 | "minimum": 0, 201 | "description": "цена за единицу" 202 | }, 203 | "modifiers": { 204 | "type": "array", 205 | "uniqueItems": false, 206 | "description": "скидки/наценки", 207 | "items": { 208 | "$ref": "#/definitions/modifiers" 209 | } 210 | }, 211 | "ndsCalculated18": { 212 | "$ref": "#/definitions/sum" 213 | }, 214 | "ndsCalculated10": { 215 | "$ref": "#/definitions/sum" 216 | }, 217 | "sum": { 218 | "type": "integer", 219 | "minimum": 0, 220 | "description": "общая стоимость позиции с учетом скидок и наценок, в копейках" 221 | }, 222 | "properties": { 223 | "$ref": "#/definitions/propertiesType" 224 | } 225 | }, 226 | "required": [ 227 | "name", 228 | "quantity", 229 | "sum" 230 | ] 231 | } 232 | }, 233 | "senderAddress": { 234 | "type": "string", 235 | "minLength": 0, 236 | "maxLength": 64, 237 | "description": "адрес отправителя" 238 | }, 239 | "addressToCheckFiscalSign": { 240 | "type": "string", 241 | "minLength": 0, 242 | "maxLength": 256, 243 | "description": "адрес сайта для проверки ФП" 244 | }, 245 | "paymentAgentRemuneration": { 246 | "type": "number", 247 | "minimum": 0, 248 | "description": "размер вознаграждения платежного агента (субагента)" 249 | }, 250 | "paymentAgentPhone": { 251 | "type": "string", 252 | "minLength": 0, 253 | "maxLength": 19, 254 | "description": "телефон платежного агента" 255 | }, 256 | "paymentSubagentPhone": { 257 | "type": "string", 258 | "minLength": 0, 259 | "maxLength": 19, 260 | "description": "телефон платежного субагента" 261 | }, 262 | "operatorPhoneToReceive": { 263 | "type": "string", 264 | "minLength": 0, 265 | "maxLength": 19, 266 | "description": "телефон оператора по приему платежей" 267 | }, 268 | "operatorPhoneToTransfer": { 269 | "type": "string", 270 | "minLength": 0, 271 | "maxLength": 19, 272 | "description": "телефон оператора по переводу денежных средств" 273 | }, 274 | "bankAgentPhone": { 275 | "type": "string", 276 | "minLength": 0, 277 | "maxLength": 19, 278 | "description": "телефон банковского агента" 279 | }, 280 | "bankSubagentPhone": { 281 | "type": "string", 282 | "minLength": 0, 283 | "maxLength": 19, 284 | "description": "телефон банковского субагента" 285 | }, 286 | "bankAgentOperation": { 287 | "type": "string", 288 | "minLength": 0, 289 | "maxLength": 24, 290 | "description": "операция банковского агента" 291 | }, 292 | "bankSubagentOperation": { 293 | "type": "string", 294 | "minLength": 0, 295 | "maxLength": 24, 296 | "description": "операция банковского субагента" 297 | }, 298 | "bankAgentRemuneration": { 299 | "type": "number", 300 | "minimum": 0, 301 | "description": "размер вознаграждения банковского агента (субагента)" 302 | }, 303 | "operatorName": { 304 | "type": "string", 305 | "minLength": 0, 306 | "maxLength": 64, 307 | "description": "наименование оператора по переводу денежных средств" 308 | }, 309 | "operatorAddress": { 310 | "type": "string", 311 | "minLength": 0, 312 | "maxLength": 256, 313 | "description": "адрес оператора по переводу денежных средств" 314 | }, 315 | "operatorTransferInn": { 316 | "type": "string", 317 | "pattern": "^([0-9][1-9]|[1-9][0-9])(([0-9]{8} {2})|([0-9]{10}))$", 318 | "description": "ИНН оператора по переводу денежных средств" 319 | }, 320 | "operatorInn": { 321 | "type": "string", 322 | "pattern": "^([0-9][1-9]|[1-9][0-9])(([0-9]{8} {2})|([0-9]{10}))$", 323 | "description": "ИНН кассира" 324 | }, 325 | "offlineMode": { 326 | "type": "integer", 327 | "minimum": 0, 328 | "maximum": 255, 329 | "description": "автономный режим" 330 | }, 331 | "bsoSign": { 332 | "type": "integer", 333 | "minimum": 0, 334 | "maximum": 255, 335 | "description": "признак БСО" 336 | }, 337 | "serviceSign": { 338 | "type": "integer", 339 | "minimum": 0, 340 | "maximum": 255, 341 | "description": "признак услуги" 342 | }, 343 | "encryptionSign": { 344 | "type": "integer", 345 | "minimum": 0, 346 | "maximum": 255, 347 | "description": "признак шифрования" 348 | }, 349 | "autoMode": { 350 | "type": "integer", 351 | "minimum": 0, 352 | "maximum": 255, 353 | "description": "автоматический режим" 354 | }, 355 | "machineNumber": { 356 | "type": "string", 357 | "maxLength": 20, 358 | "description": "номер автомата" 359 | }, 360 | "internetSign": { 361 | "type": "integer", 362 | "minimum": 0, 363 | "maximum": 255, 364 | "description": "признак рассчетов в Интернете" 365 | }, 366 | "retailPlaceAddress": { 367 | "type": "string", 368 | "maxLength": 256, 369 | "description": "адрес (место) рассчетов" 370 | }, 371 | "ofdInn": { 372 | "type": "string", 373 | "pattern": "^([0-9][1-9]|[1-9][0-9])(([0-9]{8} {2})|([0-9]{10}))$", 374 | "description": "ОФД ИНН" 375 | }, 376 | "kktNumber": { 377 | "type": "string", 378 | "maxLength": 20, 379 | "description": "заводской номер ККТ" 380 | }, 381 | "rawData": { 382 | "type": "string", 383 | "minLength": 1, 384 | "description": "бинарное представление документа в формате протокола ККТ с ФП2" 385 | }, 386 | "notTransmittedDocumentsQuantity": { 387 | "type": "integer", 388 | "minimum": 0, 389 | "maximum": 4294967295, 390 | "description": "кол-во неподтвержденных документов ФД" 391 | }, 392 | "notTransmittedDocumentsDateTime": { 393 | "type": "integer", 394 | "minimum": 0, 395 | "maximum": 4294967295, 396 | "description": "дата и время первого из непереданных ФД" 397 | } 398 | } 399 | } 400 | -------------------------------------------------------------------------------- /tests/ofd_test.py: -------------------------------------------------------------------------------- 1 | # coding: utf8 2 | # 3 | # Copyright (C) 2017 Yandex LLC 4 | # http://yandex.com 5 | # 6 | # Licensed under the Apache License, Version 2.0 (the "License"); 7 | # you may not use this file except in compliance with the License. 8 | # You may obtain a copy of the License at 9 | # 10 | # http://www.apache.org/licenses/LICENSE-2.0 11 | # 12 | # Unless required by applicable law or agreed to in writing, software 13 | # distributed under the License is distributed on an "AS IS" BASIS, 14 | # WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 15 | # See the License for the specific language governing permissions and 16 | # 17 | 18 | import array 19 | import ofd 20 | import struct 21 | import unittest 22 | from ofd.protocol import ProtocolPacker, pack_json, DOCS_BY_NAME, unpack_container_message 23 | 24 | 25 | class TestU32(unittest.TestCase): 26 | def test_unpack(self): 27 | actual = ofd.U32(name='', desc='').unpack(b'\x01\x00\x00\x00') 28 | self.assertEqual(1, actual) 29 | 30 | 31 | class TestVLN(unittest.TestCase): 32 | def test_unpack(self): 33 | actual = ofd.VLN(name='', desc='', maxlen=3).unpack(b'\xe9\x2d\x06') 34 | self.assertEqual(404969, actual) 35 | 36 | def test_pack_when_max_length_less_8_bytes(self): 37 | number = 87892227523633 38 | vln = ofd.VLN(name='fiscalSign', desc='фискальный признак', maxlen=6) 39 | 40 | packed = vln.pack(number) 41 | assert b'1\x04\x00\x01\xf0O' == packed 42 | assert number == vln.unpack(packed) 43 | 44 | def test_pack_when_number_greater_then_max(self): 45 | number = 87892227523633222 46 | vln = ofd.VLN(name='fiscalSign', desc='фискальный признак', maxlen=6) 47 | with self.assertRaises(ValueError): 48 | vln.pack(number) 49 | 50 | 51 | class TestFVLN(unittest.TestCase): 52 | def test_unpack(self): 53 | actual = ofd.FVLN(name='', desc='', maxlen=5).unpack(b'\x02\x15\xcd\x5b\x07') 54 | self.assertAlmostEqual(1234567.89, actual, delta=1e-3) 55 | 56 | def test_pack_two_points(self): 57 | number = 1234567.89 58 | fvln = ofd.FVLN(name='', desc='', maxlen=5) 59 | packed = fvln.pack(number) 60 | assert b'\x02\x15\xcd\x5b\x07' == packed 61 | unpacked = fvln.unpack(packed) 62 | assert number == unpacked 63 | 64 | def test_pack_several_points(self): 65 | number = 1453.67 66 | fvln = ofd.FVLN(name='', desc='', maxlen=8) 67 | packed = fvln.pack(number) 68 | assert b'\x02\xd77\x02\x00\x00\x00\x00' == packed 69 | unpacked = fvln.unpack(packed) 70 | assert number == unpacked 71 | 72 | def test_pack_bigger_number_should_raise_error(self): 73 | number = 1234567123.893 74 | fvln = ofd.FVLN(name='', desc='', maxlen=5) 75 | with self.assertRaises(ValueError): 76 | fvln.pack(number) 77 | 78 | 79 | class TestString(unittest.TestCase): 80 | def test_unpack_zero_string(self): 81 | data = b'' 82 | self.assertEqual(b'', struct.unpack('{}s'.format(len(data)), data)[0]) 83 | 84 | def test_unpack(self): 85 | actual = ofd.String(name='', desc='', maxlen=4).unpack(b'\x92\xa5\xe1\xe2') 86 | self.assertEqual(u'Тест', actual) 87 | 88 | 89 | class TestUnix(unittest.TestCase): 90 | def test_unpack(self): 91 | actual = ofd.UnixTime(name='', desc='').unpack(b'\x8a\x02\x9e\x55') 92 | self.assertEqual(1436418698, actual) 93 | 94 | 95 | class TestByte(unittest.TestCase): 96 | def test_unpack_byte(self): 97 | self.assertEqual(3, ofd.Byte(name='', desc='').unpack(b'\x03')) 98 | 99 | def test_pack_byte(self): 100 | self.assertEqual(b'\x03', ofd.Byte(name='', desc='').pack(3)) 101 | 102 | def test_pack_byte_throws_on_length_mismatch(self): 103 | with self.assertRaises(Exception): 104 | ofd.Byte(name='', desc='').pack(256) 105 | 106 | def test_unpack_byte_throws_on_length_mismatch(self): 107 | with self.assertRaises(Exception): 108 | ofd.Byte(name='', desc='').unpack('\x03\x04') 109 | 110 | 111 | class TestSessionHeader(unittest.TestCase): 112 | def test_unpack(self): 113 | expected = ofd.SessionHeader(256, b'9999078950 ', 305, 0b10100, crc=0) 114 | data = [ 115 | 0x2a, 0x08, 0x41, 0x0a, 0x81, 0xa2, 0x00, 0x01, 116 | 0x39, 0x39, 0x39, 0x39, 0x30, 0x37, 0x38, 0x39, 117 | 0x35, 0x30, 0x20, 0x20, 0x20, 0x20, 0x20, 0x20, 118 | 0x31, 0x01, 0x14, 0x00, 0x00, 0x00 119 | ] 120 | data = array.array('B', data).tobytes() 121 | 122 | actual = ofd.SessionHeader.unpack_from(data) 123 | 124 | self.assertEqual(expected.pva, actual.pva) 125 | self.assertEqual(expected.fs_id, actual.fs_id) 126 | self.assertEqual(expected.length, actual.length) 127 | self.assertEqual(expected.flags, actual.flags) 128 | self.assertEqual(expected.crc, actual.crc) 129 | 130 | def test_pack_unpack(self): 131 | data = [ 132 | 0x2a, 0x08, 0x41, 0x0a, 0x81, 0xa2, 0x00, 0x01, 133 | 0x39, 0x39, 0x39, 0x39, 0x30, 0x37, 0x38, 0x39, 134 | 0x35, 0x30, 0x20, 0x20, 0x20, 0x20, 0x20, 0x20, 135 | 0x31, 0x01, 0x14, 0x00, 0x00, 0x00 136 | ] 137 | data = array.array('B', data).tobytes() 138 | 139 | self.assertEqual(data, ofd.SessionHeader.unpack_from(data).pack()) 140 | 141 | 142 | class TestFrameHeader(unittest.TestCase): 143 | def test_unpack(self): 144 | expected = ofd.FrameHeader( 145 | length=305, 146 | crc=60419, 147 | doctype=1, 148 | devnum=b'\x99\x99\x07\x89\x124V\x7f', 149 | docnum=b'\x00\x00\x01', 150 | extra1=b'\x10\t', 151 | extra2=b'\x00#\t\x82\xc4\x00\x00\x01\x00\x02\x01\x07') 152 | data = [ 153 | 0x31, 0x01, 0x03, 0xec, 0xa5, 0x01, 0x01, 0x10, 154 | 0x09, 0x99, 0x99, 0x07, 0x89, 0x12, 0x34, 0x56, 155 | 0x7f, 0x00, 0x00, 0x01, 0x00, 0x23, 0x09, 0x82, 156 | 0xc4, 0x00, 0x00, 0x01, 0x00, 0x02, 0x01, 0x07 157 | ] 158 | data = array.array('B', data).tobytes() 159 | 160 | actual = ofd.FrameHeader.unpack_from(data) 161 | 162 | self.assertEqual(expected.length, actual.length) 163 | self.assertEqual(expected.crc, actual.crc) 164 | self.assertEqual(expected.msgtype, actual.msgtype) 165 | self.assertEqual(expected.doctype, actual.doctype) 166 | self.assertEqual(expected.version, actual.version) 167 | self.assertEqual(expected.devnum, actual.devnum) 168 | self.assertEqual(expected.docnum(), actual.docnum()) 169 | self.assertEqual(expected.extra1, actual.extra1) 170 | self.assertEqual(expected.extra2, actual.extra2) 171 | 172 | def test_pack_unpack(self): 173 | data = [ 174 | 0x31, 0x01, 0x03, 0xec, 0xa5, 0x01, 0x01, 0x10, 175 | 0x09, 0x99, 0x99, 0x07, 0x89, 0x12, 0x34, 0x56, 176 | 0x7f, 0x00, 0x00, 0x01, 0x00, 0x23, 0x09, 0x82, 177 | 0xc4, 0x00, 0x00, 0x01, 0x00, 0x02, 0x01, 0x07 178 | ] 179 | data = array.array('B', data).tobytes() 180 | 181 | self.assertEqual(data, ofd.FrameHeader.unpack_from(data).pack()) 182 | 183 | def test_update_crc(self): 184 | head = ofd.FrameHeader( 185 | length=305, 186 | crc=0, 187 | doctype=1, 188 | devnum=b'\x99\x99\x07\x89\x124V\x7f', 189 | docnum=b'\x00\x00\x01', 190 | extra1=b'\x10\t', 191 | extra2=b'\x00#\t\x82\xc4\x00\x00\x01\x00\x02\x01\x07') 192 | 193 | body = [ 194 | 0x01, 0x00, 0x03, 0x01, 0x11, 0x04, 0x10, 0x00, 195 | 0x39, 0x39, 0x39, 0x39, 0x30, 0x37, 0x38, 0x39, 196 | 0x31, 0x32, 0x33, 0x34, 0x35, 0x36, 0x37, 0x20, 197 | 0x0d, 0x04, 0x14, 0x00, 0x31, 0x32, 0x30, 0x30, 198 | 0x30, 0x30, 0x31, 0x33, 0x30, 0x30, 0x30, 0x30, 199 | 0x20, 0x20, 0x20, 0x20, 0x20, 0x20, 0x20, 0x20, 200 | 0xfa, 0x03, 0x0c, 0x00, 0x31, 0x31, 0x32, 0x32, 201 | 0x33, 0x33, 0x34, 0x34, 0x35, 0x35, 0x36, 0x36, 202 | 0x10, 0x04, 0x04, 0x00, 0x01, 0x00, 0x00, 0x00, 203 | 0xf4, 0x03, 0x04, 0x00, 0x28, 0x54, 0x0e, 0x57, 204 | 0x35, 0x04, 0x06, 0x00, 0x21, 0x04, 0x1c, 0x6b, 205 | 0x81, 0xa4, 0xe9, 0x03, 0x01, 0x00, 0x00, 0xea, 206 | 0x03, 0x01, 0x00, 0x00, 0x20, 0x04, 0x01, 0x00, 207 | 0x00, 0x26, 0x04, 0x01, 0x00, 0x01, 0x18, 0x04, 208 | 0x09, 0x00, 0x8e, 0x8e, 0x8e, 0x20, 0x22, 0x8c, 209 | 0x8c, 0x8c, 0x22, 0x21, 0x04, 0x01, 0x00, 0x00, 210 | 0x22, 0x04, 0x01, 0x00, 0x00, 0xf1, 0x03, 0x26, 211 | 0x00, 0x8c, 0xae, 0xe1, 0xaa, 0xa2, 0xa0, 0x2c, 212 | 0x20, 0x87, 0xa5, 0xab, 0xa5, 0xad, 0xeb, 0xa9, 213 | 0x20, 0xaf, 0xe0, 0xae, 0xe1, 0xaf, 0xa5, 0xaa, 214 | 0xe2, 0x2c, 0x20, 0xa4, 0x2e, 0x36, 0x36, 0x20, 215 | 0xaa, 0xae, 0xe0, 0xaf, 0x2e, 0x20, 0x32, 0x16, 216 | 0x04, 0x08, 0x00, 0x8e, 0x94, 0x84, 0x2d, 0xe2, 217 | 0xa5, 0xe1, 0xe2, 0x25, 0x04, 0x0a, 0x00, 0x77, 218 | 0x77, 0x77, 0x2e, 0x6f, 0x66, 0x64, 0x2e, 0x72, 219 | 0x75, 0x24, 0x04, 0x0c, 0x00, 0x77, 0x77, 0x77, 220 | 0x2e, 0x6e, 0x61, 0x6c, 0x6f, 0x67, 0x2e, 0x72, 221 | 0x75, 0x19, 0x04, 0x06, 0x00, 0x31, 0x31, 0x31, 222 | 0x32, 0x33, 0x34, 0xfd, 0x03, 0x12, 0x00, 0x91, 223 | 0x88, 0x91, 0x2e, 0x20, 0x80, 0x84, 0x8c, 0x88, 224 | 0x8d, 0x88, 0x91, 0x92, 0x90, 0x80, 0x92, 0x8e, 225 | 0x90, 0xf5, 0x03, 0x0a, 0x00, 0x30, 0x36, 0x32, 226 | 0x30, 0x30, 0x30, 0x30, 0x30, 0x30, 0x31, 0x81, 227 | 0x06, 0x73, 0xfc, 0xa3, 0x4b, 0x28, 0x72, 0x00, 228 | 0x00 229 | ] 230 | data = array.array('B', body).tobytes() 231 | 232 | head.recalculate_crc(data) 233 | self.assertEqual(60419, head.crc) 234 | 235 | 236 | class TestProtocolPack(unittest.TestCase): 237 | def test_pack_array_of_ints_from_json(self): 238 | doc = { 239 | 'Отчёт об изменении параметров регистрации': { 240 | 'коды причин изменения сведений о ККТ': [12, 9] 241 | } 242 | } 243 | 244 | code1 = b'' 245 | code1 += struct.pack('