ЕСОЗ - публічна документація
Will be DEPRECATED_Reject Medication Dispense
- 1 Purpose
- 1.1 Key points
- 2 Specification
- 3 Logic
- 4 Preconditions
- 5 Global and configurable parameters
- 6 Input parameters
- 7 Filters
- 8 Request structure
- 9 Authorize
- 10 Headers
- 11 Validate request
- 12 Request data validation
- 12.1 Validate Medication dispense
- 12.1.1 Validate User
- 12.1.2 Validate transition
- 12.1 Validate Medication dispense
- 13 Processing
- 14 Response structure
- 15 Post-processing processes
- 15.1 HTTP status codes
- 16 Backward compatibility
Purpose
This method is designed to reject previously created Medication dispense
Key points
Only authenticated and authorized users of a legal entity who has created Medication dispense can reject Medication dispense.
Medication dispense can be rejected only from ‘NEW' status.
Specification
Link | Посилання на Apiary або Swagger | |
Resource | /api/medication_dispenses/{{id}}/actions/reject | Посилання на ресурс, наприклад: /api/persons/create |
Scope | medication_dispense:reject | Scope для доступу |
Components | ePrescription | Зазначається перелік бізнес компонентів, які використовують цей метод, наприклад: ePrescription |
Microservices | API paragraph not found | Перелік мікросервісів, які використовує метод API, наприклад: Auth, ABAC |
Protocol type | REST | Тип протоколу, який використовується запитом, наприклад: SOAP | REST |
Request type | PATCH | Тип запиту API, наприклад: GET, POST, PATCH… |
Sync/Async | Sync | Метод є синхронним чи асинхронним? |
Public/Private/Internal | Public |
|
Logic
Update Medication dispense data in OPS DB:
set status = ‘REJECTED’
updated_by = user_id
updated_at = now().
Preconditions
No
Global and configurable parameters
No
Input parameters
Input parameter | Values | Type | Description | Example |
---|---|---|---|---|
id |
| String | Medication Dispense Response Identifier. Required. | b075f148-7f93-4fc2-b2ec-2d81b19a9b7b |
Filters
No
Request structure
API paragraph not found
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 = 'medication_dispense:reject')
return 403 (“Your scope does not allow to access this resource. Missing allowances: medication_dispense:reject”) in case of invalid scope(s).
Headers
API paragraph not found
Validate request
API paragraph not found
Request data validation
Validate Medication dispense
Get Medication dispense identifier from the URL
Check Medication dispense exists in DB (OPS)
Return 404 ('not_found') in case of error.
Check Medication dispense belongs to legal entity
Return 404 ('not_found') in case of error.
Validate User
Extract user_id from token
Return 404 ('not_found') in case employee didn’t create medication dispense.
Validate transition
Get status of Medication dispense by $.id in OPS DB. Check that Medication dispense is in status ‘NEW’
in case of error - return 409 ("Can't update medication dispense status from {status} to REJECTED").
For more information look at Medication dispense status model.
Processing
API paragraph not found
Response structure
Example:
Post-processing processes
No
HTTP status codes
HTTP status code | Message | What caused the error |
---|---|---|
200 | Response |
|
401 | Invalid access token |
|
403 | Your scope does not allow to access this resource. Missing allowances: medication_dispense:reject |
|
404 | Not found |
|
409 | Can't update medication dispense status from {status} to REJECTED |
|
Backward compatibility
API paragraph not found
ЕСОЗ - публічна документація