Versions Compared

Key

  • This line was added.
  • This line was removed.
  • Formatting was changed.

...

  1. Verify the validity of access token

    1. Return 401 in case validation fails

  2. Check scopes in order to perform this action (scope = 'append_auth_method:write')

    1. Return 403 in case invalid scope(s)

Logic

action = deactivate

If IL_DB.authentication_method_request.status = NEW:

...

  1. validate auth_method_request.auth_method_current:

    1. If auth_method_request.auth_method_current = OTP - Verificate sms (Invoke verification module to verify OTP (OTP Verification))

    2. If auth_method_request.auth_method_current = OFFLINE - verificate download documents

  2. Update authentication method request

    1. Change entity status in IL_DB.authentication_method_request to COMPLETED

    2. Set updated_at - now() (Get current date-time)

    3. Set updated_by - user_id (Extract user from token)

  3. Update mpi.person_authentication_method:

    1. set ended_at = now() (Get current date-time)

action = update

If IL_DB.authentication_method_request.status = NEW:

  1. validate auth_method_request.auth_method_current:

    • If auth_method_request.auth_method_current = OTP - Verificate sms (Invoke verification module to verify OTP (OTP Verification))

    • If auth_method_request.auth_method_current = OFFLINE - verificate download documents

  2. Update authentication method request

    1. Change entity status in IL_DB.authentication_method_request to COMPLETED

    2. Set updated_at - now() (Get current date-time)

    3. Set updated_by - user_id (Extract user from token)

  3. Update mpi.person_authentication_method:

...

  • set ended_at = now() (Get current date-time)

  • If deactivated auth_method where field default = True, then the method that was last added set a flag default = True

action = insert

  1. If IL_DB.authentication_method_request.status = NEW:

    1. set alias (if it passed in request)

    2. set default (if it passed in request)

action = insert

If IL_DB.authentication_method_request.status = NEW:

  1. validate auth_method_request.auth_method_current:

    1. If auth_method_request.auth_method_current = OTP - Verificate sms (Invoke verification module to verify OTP (OTP Verification))

    2. If auth_method_request.auth_method_current = OFFLINE - verificate download documents

  2. Generate code or upload URL

    1. If third_person.auth_method = OTP (Use function in mpi, that returm default auth method) - Invoke Initialize OTP to generate one time password and send it where auth_method_requests.third_person_auth_method_current = OTP.

    2. If third_person.auth_method = OFFLINE (Use function in mpi, that returm default auth method) - Generate URL's with type person.{$.person_request.person.documents.[:].type} (or Generate URL's with type third_person.{$.third_person.documents.[:].type})

  3. if type = OTP or OFFLINE, person’s auth method that was before (off or offline) becomes inactive

  4. if type = THIRD_PERSON,

    1. set default=false

    and Calculate term of person_authentication_method
    1. Start date: start_date = Current_date()

    2. End date:

      Code Block
      if (person.age < 18) {  end_date = min(birth_date + 18y - 1d, start_date + third_person_term);} else {  end_date = start_date + third_person_term;}

    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.

  5. If IL_DB.authentication_method_request.status = APPROVED:

action = update

  • If IL_DB.authentication_method_request.status = NEW:

...

If IL_DB.authentication_method_request.status = APPROVED:

  1. validate auth_method_request.auth_method_current:

    1. If auth_method_request.auth_method_current = OTP - Verificate sms (Invoke verification module to verify OTP (OTP Verification

    ) or verificate documents, if third_person.auth_method.type = OFFLINE
  2. 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.

  3. Update authentication method request

    1. Change entity status in IL_DB.authentication_method_request to APPROVED

    2. Set updated_at - now() (Get current date-time)

    3. Set updated_by - user_id (Extract user from token)

  • If IL_DB.authentication_method_request.status = APPROVED:

  1. Verificate sms - from person. Invoke verification module to verify OTP (OTP Verification)
    1. ))

    2. If auth_method_request.auth_method_current = OFFLINE - verificate download documents

  2. Update mpi

    1. Add to table person_auth_methods row with type = third_person

...