openapi: 3.0.3 info: title: HOMM — 1C HTTP service (site → 1C) version: 1.0.0 description: | Контракт, который должна реализовать сторона 1С. Сайт вызывает эти методы через `apps.integration.client.OneCClient`. Базовый URL задаётся переменной `ONEC_BASE_URL`, учётные данные — `ONEC_USERNAME` / `ONEC_PASSWORD` (HTTP Basic). Рекомендуемая реализация на стороне 1С — HTTP-сервис `homm` с методами `catalog/changes`, `orders`, `orders/{id}/status`, `customers`. servers: - url: http://1c.example.com/homm/hs/homm description: HTTP-сервис 1С security: - BasicAuth: [] tags: - name: catalog - name: orders - name: customers paths: /catalog/changes: get: tags: [catalog] summary: Изменения каталога с указанного момента parameters: - name: since in: query required: false description: Вернуть изменения после этой даты (ISO 8601) schema: type: string format: date-time responses: '200': description: Пакет изменений content: application/json: schema: $ref: '#/components/schemas/CatalogBatch' '401': $ref: '#/components/responses/Unauthorized' /orders: post: tags: [orders] summary: Создать заказ клиента в 1С requestBody: required: true content: application/json: schema: $ref: '#/components/schemas/OrderPush' responses: '200': description: Заказ создан content: application/json: schema: type: object properties: external_id: type: string description: ID заказа в 1С number: type: string description: Номер заказа в 1С '400': $ref: '#/components/responses/BadRequest' '401': $ref: '#/components/responses/Unauthorized' /orders/{externalId}/status: get: tags: [orders] summary: Получить статус заказа parameters: - $ref: '#/components/parameters/ExternalId' responses: '200': description: Статус заказа content: application/json: schema: $ref: '#/components/schemas/OrderStatus' '401': $ref: '#/components/responses/Unauthorized' '404': $ref: '#/components/responses/NotFound' post: tags: [orders] summary: Передать статус заказа на сайт description: | Используется, если 1С инициирует обмен статусами. Сайт также умеет забирать статусы через GET. parameters: - $ref: '#/components/parameters/ExternalId' requestBody: required: true content: application/json: schema: $ref: '#/components/schemas/OrderStatus' responses: '200': description: Принято '401': $ref: '#/components/responses/Unauthorized' /customers: post: tags: [customers] summary: Создать или обновить клиента requestBody: required: true content: application/json: schema: $ref: '#/components/schemas/CustomerPush' responses: '200': description: Клиент создан/обновлён content: application/json: schema: type: object properties: external_id: type: string '400': $ref: '#/components/responses/BadRequest' '401': $ref: '#/components/responses/Unauthorized' components: securitySchemes: BasicAuth: type: http scheme: basic parameters: ExternalId: name: externalId in: path required: true schema: type: string responses: BadRequest: description: Ошибка валидации content: application/json: schema: $ref: '#/components/schemas/Error' Unauthorized: description: Неверные учётные данные NotFound: description: Объект не найден schemas: Error: type: object properties: error: type: object properties: code: type: string message: type: string CatalogBatch: type: object properties: sync_id: type: string categories: type: array items: $ref: '#/components/schemas/Category' products: type: array items: $ref: '#/components/schemas/Product' deleted_product_external_ids: type: array items: type: string deleted_category_external_ids: type: array items: type: string Category: type: object required: [external_id, name] properties: external_id: type: string parent_external_id: type: string nullable: true name: type: string slug: type: string description: type: string image_url: type: string format: uri is_active: type: boolean sort_order: type: integer Product: type: object required: [external_id, sku, name, price] properties: external_id: type: string sku: type: string name: type: string slug: type: string category_external_id: type: string nullable: true brand: type: string short_description: type: string description: type: string price: type: string old_price: type: string nullable: true stock: type: integer stock_status: type: string enum: [in_stock, preorder, out_of_stock] is_hit: type: boolean is_new: type: boolean is_active: type: boolean attributes: type: object additionalProperties: true images: type: array items: $ref: '#/components/schemas/ProductImage' external_updated_at: type: string format: date-time nullable: true ProductImage: type: object required: [url] properties: url: type: string format: uri alt: type: string sort_order: type: integer is_main: type: boolean OrderPush: type: object required: [number, customer, items, totals] properties: number: type: string created_at: type: string format: date-time customer: $ref: '#/components/schemas/Customer' delivery: type: object properties: method: type: string address: type: string cost: type: string items: type: array items: $ref: '#/components/schemas/OrderItem' totals: type: object properties: subtotal: type: string discount: type: string bonus: type: string certificate: type: string delivery: type: string total: type: string payment: type: object properties: status: type: string promo_code: type: string certificate_code: type: string Customer: type: object properties: name: type: string phone: type: string email: type: string CustomerPush: type: object required: [phone] properties: phone: type: string email: type: string name: type: string OrderItem: type: object properties: sku: type: string external_id: type: string name: type: string price: type: string quantity: type: integer total: type: string OrderStatus: type: object required: [status] properties: status: type: string example: Выполнен comment: type: string changed_at: type: string format: date-time external_id: type: string