{
  "$schema": "https://json-schema.org/draft/2020-12/schema",
  "$id": "https://raw.githubusercontent.com/api-evangelist/raiffeisen-ru/main/json-schema/raiffeisen-ru-packet-response-schema.json",
  "title": "PacketResponse",
  "description": "Реестр поручений",
  "x-generated": "2026-10-09",
  "x-method": "derived",
  "x-generator": "derive-json-schema.py",
  "x-source": "openapi/raiffeisen-ru-agency-factoring-openapi.yml#/components/schemas/PacketResponse",
  "properties": {
    "id": {
      "description": "Идентификатор пакета",
      "format": "uuid",
      "type": "string"
    },
    "referenceId": {
      "description": "Идентификатор реестра поручений клиента, если реестр загружен через API",
      "type": "string"
    },
    "number": {
      "description": "Номер реестра поручений",
      "type": "string"
    },
    "packetDate": {
      "description": "Дата реестра поручений",
      "format": "date",
      "type": "string"
    },
    "financedDate": {
      "description": "Максимальный executionDate из исполненных поручений",
      "format": "date",
      "type": "string"
    },
    "packetSum": {
      "description": "Сумма реестра",
      "type": "number"
    },
    "ordersCount": {
      "description": "Количество поручений",
      "type": "integer"
    },
    "financedSum": {
      "description": "Сумма финансирования",
      "type": "string"
    },
    "state": {
      "allOf": [
        {
          "$ref": "#/$defs/PacketState"
        }
      ],
      "description": "Состояние пакета",
      "type": "object"
    },
    "cqrsVersion": {
      "description": "hashCode от state - состояния реестра",
      "type": "integer"
    }
  },
  "required": [
    "cqrsVersion",
    "id",
    "number",
    "packetDate",
    "referenceId",
    "state"
  ],
  "type": "object",
  "$defs": {
    "Error": {
      "properties": {
        "code": {
          "$ref": "#/$defs/ErrorCodes"
        },
        "message": {
          "description": "Сообщение",
          "type": "string"
        },
        "traceId": {
          "description": "traceId",
          "type": "string"
        }
      },
      "required": [
        "code",
        "message"
      ],
      "type": "object"
    },
    "ErrorCodes": {
      "description": "| code       | description                        |\n|------------|------------------------------------|\n| ERR_0000   | Unexpected error                   |\n| ERR_0001   | Creditor not valid                 |\n| ERR_0002   | Error getting okved from DaData    |\n| ERR_0003   | Affiliation check not valid        |\n| ERR_0004   | Affiliation check nof found        |\n| ERR_1001   | Requisites not valid               |\n| ERR_1002   | Creditor not valid                 |\n| ERR_1003   | The financing period is longer than the maximum |\n| ERR_1004   | Exceeded daily limit               |\n| ERR_1005   | Creditor not found                 |\n| ERR_1006   | Exceed maximum limit               |\n| ERR_1007   | Date is not found in calendar      |\n| ERR_1008   | Agreement not found                |\n| ERR_1009   | Agreement not valid                |\n| ERR_1010   | Agreement is blocked               |\n| ERR_1011   | Order date invalid                 |\n| ERR_1012   | Maturity date invalid              |\n| ERR_1013   | Limit not valid                    |\n| ERR_1014   | Due date is unavailable            |\n| ERR_1015   | Tariff plan not found              |\n| ERR_1016   | Order date is not working day      |\n| ERR_1017   | Tariff plan not approved           |\n| ERR_2000   | General service error              |\n| ERR_4001   | Requisites not valid               |\n| ERR_4002   | Payment rejected by operator       |\n| ERR_4003   | Payment rejected by CBR            |\n| ERR_6000   | Entry rejected by CIG              |\n| ERR_9001   | Value date is over                 |\n| ERR_9002   | First financing date is over       |\n| ERR_11001  | Minimum Margin check failed        |\n| ERR_12001  | Account is blocked                 |\n",
      "enum": [
        "ERR_0000",
        "ERR_0001",
        "ERR_0002",
        "ERR_0003",
        "ERR_0004",
        "ERR_1001",
        "ERR_1002",
        "ERR_1003",
        "ERR_1004",
        "ERR_1005",
        "ERR_1006",
        "ERR_1007",
        "ERR_1008",
        "ERR_1009",
        "ERR_1010",
        "ERR_1011",
        "ERR_1012",
        "ERR_1013",
        "ERR_1014",
        "ERR_1015",
        "ERR_1016",
        "ERR_1017",
        "ERR_2000",
        "ERR_4001",
        "ERR_4002",
        "ERR_4003",
        "ERR_6000",
        "ERR_9001",
        "ERR_9002",
        "ERR_11001",
        "ERR_12001"
      ],
      "type": "string"
    },
    "PacketState": {
      "allOf": [
        {
          "$ref": "#/$defs/State"
        },
        {
          "properties": {
            "status": {
              "$ref": "#/$defs/PacketStatus"
            }
          },
          "type": "object"
        }
      ],
      "description": "Состояние пакета",
      "type": "object"
    },
    "PacketStatus": {
      "description": "Статус реестра поручений",
      "enum": [
        "SIGN_AWAITING",
        "SIGN_REJECTED",
        "DOCUMENT_IN_PROGRESS",
        "ACCEPTED_BY_BANK"
      ],
      "type": "string"
    },
    "State": {
      "description": "Состояние объекта",
      "properties": {
        "statusDate": {
          "description": "yyyy-MM-dd'T'HH:mm:ss.SSSSSS",
          "format": "date-time",
          "pattern": "([0-9]{4})-(?:[0-9]{2})-([0-9]{2})T([0-9]{2}):([0-9]{2}):([0-9]{2}).([0-9]{6})",
          "type": "string"
        },
        "errors": {
          "description": "Ошибки",
          "items": {
            "$ref": "#/$defs/Error"
          },
          "type": "array"
        }
      },
      "required": [
        "statusDate"
      ],
      "type": "object"
    }
  }
}