Versions Compared

Key

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

Purpose

...

Page Properties

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

Scope для доступу

Components

Legal Entities

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

Microservices

API paragraph not found

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

Protocol type

REST

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

Request type

PATCH

Тип запиту API, наприклад: GET, POST, PATCH…

Sync/Async

Sync

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

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.

...

  • 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”)

...