Table of Contents |
---|
Purpose
This WS is designed to terminate active declaration by Patient.
Specification
Authorization
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 = 'declaration:terminate_pis')
return 403 (“Your scope does not allow to access this resource. Missing allowances: ‘declaration:terminate_pis’) in case of invalid scope(s)
...
Check that declaration with such ID:
exists in the system (ops DB)
belongs to patient
in case of error - return 404 ('not found')
Check declaration status = activein case of error return 403. Message: ‘Declaration is not active’
Check declaration status one of the following (
active
,pending_verification
)in case of error return 409. Message: ‘Invalid declaration status’
Service logic
Update declaration in ops.declarations table:
set status = 'TERMINATED'
set reason_description = $.reason_description from request
set declarations.reason to `manual_person`
Add new status to event manager
...