ЕСОЗ - публічна документація
RC__Stop Device dispense
Purpose
This method is designed to stop previously created Device dispense
Key points
Only authenticated and authorized users of legal entity who has created Device dispense can stop Device dispense
Device dispense can be rejected only from ‘IN_PROGRESS' status.
Specification
Link | Посилання на Apiary або Swagger | |
Resource | /api/patients/{{patient_id}}/device_dispenses/{{device_dispense_id}}/actions/stop | Посилання на ресурс, наприклад: /api/persons/create |
Scope |
| Scope для доступу |
Components | Devices | Зазначається перелік бізнес компонентів, які використовують цей метод, наприклад: ePrescription |
Microservices |
| Перелік мікросервісів, які використовує метод API, наприклад: Auth, ABAC |
Protocol type | REST | Тип протоколу, який використовується запитом, наприклад: SOAP | REST |
Request type | PATCH | Тип запиту API, наприклад: GET, POST, PATCH… |
Sync/Async | Sync | Метод є синхронним чи асинхронним? |
Public/Private/Internal | Public | Потрібно зазначити тип методу за ступенем доступності |
Logic
Update Device dispense data in device_dispenses (MongoDB):
set status = ‘stopped’
updated_by = user_id
updated_at = now()
Send
StatusChangeEvent
to Event Manager
Input parameters
Input parameter | Values | Type | Description | Example |
---|---|---|---|---|
patient_id |
| String | Unique patient identifier |
|
Authorize
Verify the validity of access token
in case of error - return 401 (“Invalid access token”) in case of validation fails
Verify that token is not expired
in case of error - return 401 (“Invalid access token”)
Check user scopes in order to perform this action (scope = 'device_dispense:stop')
return 403 (“Your scope does not allow to access this resource. Missing allowances: device_dispense:stop”) in case of invalid scope(s)
Headers
Content-Type:application/json
Request data validation
Validate Legal entity
Extract client_id from token
Check legal entity exists and its status is ACTIVE
In case of error - return 409 ('client_id refers to legal entity that is not active')
Validate Device dispense
Get Device dispense identifier from the URL
Check Device dispense exists in device_dispenses (MongoDB)
Return 404 ('not_found') in case of error
Check Device dispense belongs to legal entity
Return 404 ('not_found') in case of error
Validate transition
Only device dispense in in_progress status can be stopped
Get current device dispense status
Check that status in ('in_progress')
in case of error - return 409 error ('Device dispense in status %status% cannot be stopped')
For more information look at RC__Device dispense status modelarchived .
Response structure
See on Apiary
Example:
HTTP status codes
HTTP status code | Message | What caused the error |
---|---|---|
202 |
|
|
ЕСОЗ - публічна документація