Versions Compared

Key

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

...

Validate request

if action = delete deactivate

Code Block
languagejson
{
  "$schema": "http://json-schema.org/draft-04/schema#",
  "type": "object",
  "properties": {
  "action": "deactivate",
  "authentication_methods": {
    "id": "057413fb-2c2e-4f33-b2d6-433469212744"
    }
  }
}

...

Code Block
{
  "$schema": "http://json-schema.org/draft-04/schema#",
  "type": "object",
  "properties": {
  "action": "insert",
  "authentication_methods": {
    "type": "THIRD_PERSON",
    "value": "d12888c0-1159-4296-8f03-a592c136f673",
    "phone_number` : "f6d9a852-a339-44ac-a682-8f7a8da9cca0",
    "alias": "roksolana"
    }
  }
}

if action = update

Code Block
{
  "$schema": "http://json-schema.org/draft-04/schema#",
  "type": "object",
  "properties": {
  "action": "update",
  "authentication_methods": {
    "id": "057413fb-2c2e-4f33-b2d6-433469212744",
    "alias": "roksolana",
    "default": "true"
    }
  }
}

...

Use GET persom/{id}/ authentication_method to find authentication method' id of person

  1. if action = delete deactivate

    1. Field type must be THIRD_PERSON. (where person_auth_method.id = $aythentication$authentication_method.id)

    2. If person < 14, validate check 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

    4. left

  2. if action = insert

    1. if type = OTP or OFFLINE, person’s auth method that was before (off or offline) becomes inactivephone_number is required and don’t set value . And field alias is optional.

    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;}
    if action = update
    1. value is required and don’t set phone_number. And field alias is required.

    2. validate value:

      1. validate person.id is UUID

        • in case error return 422

      2. search person by person.id in MPI 

        • in case error return 422, "such person doesn't exist"

  3. if action = update

    1. validate authentication_methods.id belong to this person. Search auth method of this person where  MPI.person_authentication_method.person_id = $.person.id

      1. in case error return 422, "such authentication method does not belong to this person"

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

    3. if person>18 , can’t set default= TRUE where and auth_method.type=THIRD_PERSON can’t set default= TRUE

Generate verification code

...