Versions Compared

Key

  • This line was added.
  • This line was removed.
  • Formatting was changed.
Table of Contents

Purpose

This WS allows to update a previously created license for a legal entity.

Key points

  1. Only authenticated and authorized user with an appropriate scope can update licenses.

  2. The license can be updated for PRIMARY_CARE, EMERGENCY, OUTPATIENT, or PHARMACY legal entity.

  3. The license can be updated for legal entities in ACTIVE or SUSPENDED statuses.

  4. Only an additional license can be updated with this WS.

  5. The additional license can be updated for legal entities with an active primary license.

Specification

APPROVED
Page Properties

Project Name

Електронний рецепт

COVID-certificate

Project abreviation

ePrescription

SVC

Developer

Edenlab

Розробник методу API. Наприклад, Edenlab

Project Manager

Mari Hulko (Unlicensed)

@Єлизавета Гессен-Дармштадська

Tech Lead

Mynchenko Andrii (SoE eHealth)

@Іоанн Воїнов

Product Owner

Igor Kostyria

@Нікодім Святогорцев

Вusiness analyst

Iryna Lishtaba (SoE eHealth) Oleksandr Zhuk (SoE eHealth) Oksana Demchenko

@Пантелеймон Нікомедійський

Status

Status
colourGreen
title
Status
colourGreen
titleAPPROVED

Version

API paragraph not found

1.0

Date of release

PROD

Link

https://ehealthmisapi1.docs.apiary.io/#reference/public.-medical-service-provider-integration-layer/licenses/update-license

Посилання на Apiary або Swagger

Resource

/api/licenses/{{id}}

НаприкладПосилання на ресурс, наприклад: /api/persons/create

Scope

license:write

Зазначається потрібний scopeScope для доступу

Components

ePrescriptionLegal Entities

Зазначається перелік бізнес компонентів, які використовують цей метод, наприклад: ePrescription

Microservices

API paragraph not found

Перелік мікросервісів, які використовує метод API. Наприклад, наприклад: Auth, ABAC

Protocol type

REST

Тип протоколу, який використовується запитом, наприклад: SOAP | REST

Request type

PATCH

Тип HTTP методу, який використовується запитомзапиту API, наприклад: GET, POST | GET…, PATCH…

Sync/Async

Sync

Метод є синхронним чи асинхронним?

Public/Private/Internal

Public

Logic

  1. Check if any attribute has changed comparing request and licenses table data (PRM DB). If any, then:

    1. Update license data according to received request in licenses table (PRM DB)

    2. Set updated_at = now()

    3. Set updated_by = user_id.

Preconditions

Legal Entity exists and has Primary license.

Global and configurable parameters

No

Input parameters

Input parameter

Values

Type

Description

Example

id

String

Required

d290f1ee-6c54-4b01-90e6-d701748f0851

...

No

Request structure

See on Apiary

Example:

Expand
titleRequest example
Code Block
{
  "type": "MSP",
  "license_number": "fd123443",
  "issued_by": "Кваліфікацйна комісія",
  "issued_date": "2022-02-28",
  "expiry_date": "2026-02-28",
  "active_from_date": "2022-02-28",
  "what_licensed": "реалізація наркотичних засобів",
  "order_no": "ВА43234",
  "is_primary": false
}

...

  • Check that updated license exists in database

    • in case of error - return 404 (“License was not found”)

  • Check that updated license has is_primary=false flag

    • in case of error - return 409 (“Only additional license can be updated”)

  • Check that additional license flag was passed in request ($.is_primary = false)

    • in case of error - return 422 (“Additional license can not be changed to primary”)

  • Check that updated license belongs to legal entity from access token

    • in case of error - return 409 (“License doesn't correspond to your legal entity")

  • Check that license type in request equals updated license type

    • in case of error - return 409 (“License type can not be updated”)

  • Check that legal entity has active primary license (request: select id from licenses where is_active=true and is_primary=true and legal_entity_id=$.legal_entity.id and (expiry_date >= current_date() or expiry_date is null); returns at least one value returns at least one value)

    • in case of error - return 404 (“No active primary license found for legal entity”)

...

  • Check that $.issued_date is not greater than $.active_from_date

    • in case of error - return 422 (“License can not be issued later than active from date”)

  • Check that $.active_from_date is not greater than $.expiry_date

    • in case of error - return 422 (“License can not have active from date later than expiration date”)

  • Check that $.expiry_date is not lesser than current_date

    • in case of error - return 409 (“License is expired”)

Parameters that are used when processing the request

Configuration parameters

Access to the method is defined by the scope license:write. Permission for this scope is determined by the System administrator by configuring scopes in the context of clients and roles.

Dictionaries

...

Processing

API paragraph not found

Response structure

See on Apiary

Example:

Expand
titleResponse example
Code Block
{
  "meta": {
    "code": 200,
    "url": "https://example.com/resource",
    "type": "object",
    "request_id": "req-adasdoijasdojsda"
  },
  "data": {
    "id": "d290f1ee-6c54-4b01-90e6-d701748f0851",
    "type": "MSP",
    "license_number": "fd123443",
    "issued_by": "Кваліфікацйна комісія",
    "issued_date": "2022-02-28",
    "expiry_date": "2026-02-28",
    "active_from_date": "2022-02-28",
    "what_licensed": "реалізація наркотичних засобів",
    "order_no": "ВА43234",
    "legal_entity_id": "28d9c1be-08f0-403b-aa76-bff228c9904f",
    "is_primary": true
  }
}

...