Specification
Service logic
- Only authenticated and authorized user can use this service
- Only NEW patient request can be activated
- The request can be activated only by the employee who works in the same legal entity in which the request was made.
Validate request
- Validate request using JSON schema
- In case validation failed - generate 422 error
Code Block | ||||||
---|---|---|---|---|---|---|
| ||||||
{ "$schema": "http://json-schema.org/draft-04/schema#", "type": "object", "properties": { "verification_code": { "type": "string" } }, "required": [ "verification_code" ], "additionalProperties": false } |
Authorize user
- Verify the validity of access token
- Return 401 in case validation fails
- Check
...
- scopes in order to perform this action
- In case error - generate 401 response
...
- (scope = 'patient_request:write')
- Return 403 in case invalid scope(s)
Get patient request details
Get declaration request from IL_DB.personpatient_request
Determine authorization method
Get authorization_method from IL_DB.personpatient_request
Code Block | ||
---|---|---|
| ||
SELECT IL_DB.personpatient_request.authentication_method FROM IL_DB.personpatient_request WHERE IL_DB.personpatient_request.id = :id |
If authentication_method is NULL - return Error
...
Invoke verification module to verify OTP
Change
...
patient request
...
- Change entity status in IL_DB.personpatient_request to APPROVED
Set updated_at - now() (Get current date-time)
Set updated_by - user_id (Extract user from token)