Specification
Authorize user
Verify the validity of access token
Return 401 in case validation fails
Check scopes in order to perform this action (scope = 'append_auth_method:write')
Return 403 in case invalid scope(s)
Logic
If IL_DB.authentication_method_request.status =
NEW
:
Verificate sms - from third_person. Invoke verification module to verify OTP (OTP Verification) or verificate documents, if third_person.auth_method.type = OFFLINE
Invoke Initialize OTP to generate one time password and send it to person number( Phone_number: mpi.person_auth_method.phone_number, where person_id = $.person_id and default=True). At this stage, the patients receive an SMS message.
At response return massive of person’s auth_method
Update authentication method request
Change entity status in IL_DB.authentication_method_request to APPROVED
Set updated_at - now() (Get current date-time)
Set updated_by - user_id (Extract user from token)
If IL_DB.authentication_method_request.status =
APPROVED
:
Verificate sms - from person. Invoke verification module to verify OTP (OTP Verification)
Update mpi
Add to table
person_auth_methods
row with type =third_person