Versions Compared

Key

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

...

Invoke Global parameters to get following parameter:

  • phone_number_auth_limit - Check if in table person_authentication_methods  with type = OTP > N, then error 422, such a phone already exists more N times

  • confidantthird_person_limit - In table person_auth_methods with type =

...

  •  THIRD_

...

  • PERSON > N, then error 422

  • third_person_term

cURL example

Code Block
curl -X GET \
  {:host}/prm/api/global_parameters

...

Code Block
{
  "$schema": "http://json-schema.org/draft-04/schema#",
  "type": "object",
  "properties": {
  "action": "insert",
  "authentication_methods": {
    "type": "thirdTHIRD_personPERSON",
    "value": "d12888c0-1159-4296-8f03-a592c136f673",
    "alias": "roksolana"
    }
  }
}

...

  1. if action = delete

    1. Field type must be thirdTHIRD_personPERSON. (where person_auth_method.id = $aythentication_method.id)

    2. If person < 14, validate that count(auth_method, where person.auth_methods.person_id = $.person_id) >=1

    3. If delete auth_method where field default = True, then the method that was last added has a flag default = True

  2. if action = insert

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

    2. if type = THIRD_PERSON, set default=false and Calculate term of person_authentication_method

      Start date: start_date = Current_date()

      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;}

  3. if action = update

    1. if the transferred method is the main one (default = TRUE), method that had this flag default = TRUE now has default = FALSE

    2. if person>18, can’t set default= TRUE where auth_method.type=thirdTHIRD_personPERSON

Generate verification code

If action = insert

Invoke Initialize OTP to generate one time password and send it to third_person number (that is added as a new auth method). At this stage, the patients receive an SMS message.

...

Code Block
curl -X POST \
  http://localhost:4000/verifications \
  -H 'content-type: application/json' \
  -d '{
  "phone_number": "+380936235985"
}'

Generate upload URL

If action = insert

  1. Validate authentication_method. If authentication method.type = third_person (and this third_person.auth_method = OFFLINE) - 

    1. Generate URL's with type person.{$.person_request.person.documents.[:].type} (or Generate URL's with type third_person.{$.third_person.documents.[:].type})