...
Validate request
if action = delete deactivate
Code Block | ||
---|---|---|
| ||
{ "$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
if action =
delete
deactivate
Field
type
must beTHIRD_PERSON
. (where person_auth_method.id = $aythentication$authentication_method.id)If person < 14, validate check that count(auth_method, where person.auth_methods.person_id = $.person_id) >=1
If delete auth_method where field
default
= True, then the method that was last added has a flagdefault
= Trueleft
if action =
insert
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 fieldalias
is optional.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;}
update
if action =
update
validate authentication_methods.id belong to this person. Search auth method of this person where MPI.person_authentication_method.person_id = $.person.id
in case error return 422, "such authentication method does not belong to this person"
if the transferred method is the main one (
default
= TRUE), method that had this flagdefault = TRUE
now hasdefault = FALSE
if person>18 , can’t set
default
= TRUE where and auth_method.type=THIRD_PERSON
can’t setdefault
= TRUE
Generate verification code
...