Validate request
Validate request using JSON schema
In case validation failed - generate 422 error
...
Verify the validity of access token
Check user scopes declaration_request:writeapprove in order to perform this action
In case error - generate 401 response
...
Get declaration request from IL_DB.declaration_request
Determine authorization method
Get authorization_method from IL_DB.declaration_request
|
If authentication_method_current is NULL - return Error
If authentication_method_current == OFFLINE - check uploaded document
If authentication_method = OTP - verify SMS code, check uploaded documents for patient request form and add phone to db.verification.verified_phones
If authentication_method = CONFIDANT and confidant has auth.method = OTP - verify SMS code, check uploaded documents for patient request form and the document which confirms the guardianship.
If authentication_method = CONFIDANT and confidant has auth.method = OFFLINE - check uploaded documents for patient request form,a person's document, the confidant person's document and the document which confirms the guardianship._current = OTP - verify SMS code
Verify code
Invoke verification module to verify OTP
...