Created
January 7, 2019 08:56
-
-
Save smgladkovskiy/44fbec1e8bffcbf8628741d9fd455ddf to your computer and use it in GitHub Desktop.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
{ | |
"$schema": "http://json-schema.org/draft-07/schema#", | |
"$id": "https://schema.tmc24.io/accounting/ticket_process/request.schema.json", | |
"type": "object", | |
"title": "Запрос на передачу данных по оказанной услуге для формирования счёта", | |
"definitions": { | |
"service_alias": { | |
"type": "string", | |
"title": "Алиас сервиса", | |
"enum": ["avia", "railway", "aeroexpress", "hotel"] | |
}, | |
"provider_alias": { | |
"$id": "#/definitions/provider_alias", | |
"type": "object", | |
"title": "Алиасы провайдеров услуг", | |
"properties": { | |
"avia": { | |
"title": "Провайдеры авиа услуг", | |
"enum": ["amadeus", "sirena", "s7"] | |
}, | |
"railway": { | |
"title": "Провайдеры ЖД услуг", | |
"enum": ["im", "ufs"] | |
}, | |
"aeroexpress": { | |
"title": "Провайдеры аэроэкспресс услуг", | |
"enum": ["im", "sirena"] | |
}, | |
"hotel": { | |
"title": "Провайдеры отельных услуг", | |
"enum": ["hotelbook", "aanda", "acase"] | |
} | |
} | |
}, | |
"operation_alias": { | |
"$id": "#/definitions/provider_alias", | |
"type": "string", | |
"title": "alias тип операции (покупка, возврат, etc)", | |
"enum": ["sell", "refund"] | |
}, | |
"booking_id": { | |
"$id": "#/definitions/booking_id", | |
"type": "string", | |
"title": "Номер бронирования в системе tmc24.io", | |
"pattern": "^(AVIA|RWY|AEX|HOT)[0-9]+$" | |
}, | |
"ticket_id": { | |
"$id": "#/definitions/ticket_id", | |
"type": "object", | |
"title": "Формат номеров билетов для разных услуг", | |
"properties": { | |
"avia": { | |
"type": "string", | |
"title": "Номер авиа билета", | |
"pattern": "^([0-9]{3}-[0-9]{10})$" | |
}, | |
"railway": { | |
"type": "string", | |
"title": "Номер бланка ЖД билета", | |
"pattern": "^([0-9]{14})$" | |
}, | |
"aeroexpress": { | |
"type": "string", | |
"title": "Номер бланка аэроэкспресс билета", | |
"pattern": "^([0-9]{16})$" | |
} | |
} | |
}, | |
"order_id": { | |
"$id": "#/definitions/order_id", | |
"type": "object", | |
"title": "Формат номеров заказов для разных услуг", | |
"properties": { | |
"railway": { | |
"type": "string", | |
"title": "Номер заказа ЖД", | |
"pattern": "^([0-9]{14})$" | |
}, | |
"aeroexpress": { | |
"type": "string", | |
"title": "Номер заказа аэроэкспресс", | |
"pattern": "^([0-9]{8})$" | |
}, | |
"hotel": { | |
"type": "string", | |
"title": "Номер заказа в отеле", | |
"pattern": "^([0-9]{12})$" | |
} | |
} | |
}, | |
"url_meta": { | |
"$id":"#/definitions/url_meta", | |
"type": "object", | |
"required":["service","path","query"], | |
"properties": { | |
"service": {"$ref":"#/definitions/service_alias"}, | |
"path": {"pattern":"^[a-z_/]+$"}, | |
"query": {"type":["string","null"], "default":null} | |
} | |
} | |
}, | |
"oneOf": [ | |
{ | |
"properties": { | |
"service": { | |
"const": "avia" | |
}, | |
"provider": { | |
"$ref": "#/definitions/provider_alias/properties/avia" | |
}, | |
"bills": { | |
"items": { | |
"properties": { | |
"data": { | |
"properties": { | |
"booking_id": { | |
"pattern": "^AVIA[0-9]+$" | |
}, | |
"ticket_id": { | |
"$ref": "#/definitions/ticket_id/properties/avia" | |
} | |
}, | |
"required": ["ticket_id"] | |
} | |
} | |
} | |
} | |
} | |
}, | |
{ | |
"properties": { | |
"service": { | |
"const": "aeroexpress" | |
}, | |
"provider": { | |
"$ref": "#/definitions/provider_alias/properties/aeroexpress" | |
}, | |
"bills": { | |
"items": { | |
"properties": { | |
"data": { | |
"properties": { | |
"booking_id": { | |
"pattern": "^AEX[0-9]+$" | |
}, | |
"order_id": { | |
"$ref": "#/definitions/order_id/properties/aeroexpress" | |
}, | |
"ticket_id": { | |
"$ref": "#/definitions/ticket_id/properties/aeroexpress" | |
} | |
}, | |
"required": ["order_id", "ticket_id"] | |
} | |
} | |
} | |
} | |
} | |
}, | |
{ | |
"properties": { | |
"service": { | |
"const": "railway" | |
}, | |
"provider": { | |
"$ref": "#/definitions/provider_alias/properties/railway" | |
}, | |
"bills": { | |
"items": { | |
"properties": { | |
"data": { | |
"properties": { | |
"booking_id": { | |
"pattern": "^RWY[0-9]+$" | |
}, | |
"order_id": { | |
"$ref": "#/definitions/order_id/properties/railway" | |
}, | |
"ticket_id": { | |
"$ref": "#/definitions/ticket_id/properties/railway" | |
} | |
}, | |
"required": ["order_id", "ticket_id"] | |
} | |
} | |
} | |
} | |
} | |
}, | |
{ | |
"properties": { | |
"service": { | |
"const": "hotel" | |
}, | |
"provider": { | |
"$ref": "#/definitions/provider_alias/properties/hotel" | |
}, | |
"bills": { | |
"items": { | |
"properties": { | |
"data": { | |
"properties": { | |
"booking_id": { | |
"pattern": "^HOT[0-9]+$" | |
}, | |
"order_id": { | |
"$ref": "#/definitions/order_id/properties/hotel" | |
} | |
}, | |
"required": ["order_id"] | |
} | |
} | |
} | |
} | |
} | |
} | |
], | |
"required": ["service", "client_id", "provider", "operation", "bills"], | |
"properties": { | |
"service": { | |
"$id": "#/properties/service", | |
"$ref": "#/definitions/service_alias", | |
"title": "Алиас сервиса, который отправляет запрос" | |
}, | |
"client_id": { | |
"$id": "#/properties/client_id", | |
"type": "integer", | |
"title": "ID клиента, который приобретает услугу", | |
"minimum": 1, | |
"maximum": 9999999 | |
}, | |
"provider": { | |
"$id": "#/properties/provider", | |
"title": "Алиас поставщика, у которого приобретается услуга" | |
}, | |
"operation": { | |
"$id": "#/properties/operation", | |
"$ref": "#/definitions/operation_alias", | |
"title": "Алиас операции, производимой клиентом, за которую снимается денежка" | |
}, | |
"bills": { | |
"$id": "#/properties/bills", | |
"type": "array", | |
"title": "Перечень данных для формирования счёта", | |
"minItems": 1, | |
"items": { | |
"$id": "#/properties/bills/items", | |
"type": "object", | |
"title": "Данные для формирования счёта", | |
"required": ["data", "pricing", "title", "url"], | |
"properties": { | |
"data": { | |
"$id": "#/properties/bills/items/data", | |
"type": "object", | |
"title": "Мета-информация по объекту бронирования/билету/ваучеру/etc", | |
"required": ["booking_id"], | |
"properties": { | |
"booking_id": { | |
"$ref": "#/definitions/booking_id" | |
}, | |
"ticket_id": true, | |
"order_id": true | |
} | |
}, | |
"pricing": true, | |
"title": true, | |
"url": { | |
"$ref":"#/definitions/url_meta" | |
} | |
} | |
} | |
} | |
} | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment