Table of Contents | ||||
---|---|---|---|---|
|
...
Allows to cancel approval by it's identifier in patient context. It is allowed only for the doctor who has an active declaration with a patient from url (can cancel all approvals) or approval is granted to user (can cancel own approval).
Input parameters
Input parameter | Values | Type | Description | Example |
---|---|---|---|---|
patiend_id | String | identifier of the patient |
| |
id | String | identifier of the approval |
|
Headers
Content-Type:application/json
Authorization:Bearer c2778f3064753ea70de870a53795f5c9
...
Get Approval identifier from the URL
Check it exists in DB
Return 404 ('not found') in case of error
Check approval status is active in DB is not expired (expires_at > now() )
Return 409 ('Approval can be cancelled only if it is not expired
has new or active status') in case of error
Validate User
Extract user_id from token.
Check user has an active declaration with a patient from URL (can cancel all approvals) or approval is granted to user (can cancel own approval: granted_to OR created_by):
Return 403 ('No active declaration with patient found or declaration is not from the same MSP') in case the employee doesn't have an active declaration with the patient
Service logic
Service allow to cancel of the patient approval:
Get approval by patient_id and approval id from approvals collection (MongoDB)
Update for approvals:
status(update alsoupdated_at, updated_by, expired_at = now()If patient's authentication method is OTP or third_person.OTP, send SMS to that patient with info about cancelling.
Render a response according to specification.
Response structure
See on Apiary
...
Expand | ||
---|---|---|
| ||
|
Service logic
Service allow to cancel of the patient approval:
...
After status was changed (status = CANCELLED) - add new status to event_manager
field | value |
---|---|
|
|
| Approval |
| $.id |
| $.status |
| $.update_at |
| $. |
HTTP status codes
Page Properties | |||||||||
---|---|---|---|---|---|---|---|---|---|
|
...