...
Business logic
Search person
Calculate patient age
age = MONTHS_BETWEEN (now(), $.declaration_request.person.birth_date) / 12 |
...
- check if tax_id exists
- check if "no_tax_id" = false, in case error return error 422 "Persons who refused the tax_id should be without tax_id"
- Search by tax_id+birth_date
- if tax_id does not exists or person was nor found by previous step
- if tax_id does not exist do not check "no_tax_id" flag
- find all numbers in persons birth_certificate
- last_name on search should be case insensitive, without extra spaces
- Search person by numbers in birth_certificate + last_name + birth_date
...
- check if tax_id exists
- check if "no_tax_id" = false, in case error return error 422 "Persons who refused the tax_id should be without tax_id"
- Search by tax_id+birth_date
- if tax_id does not exists
- check if "no_tax_id" = true, in case error return error 422 "Only persons who refused the tax_id could be without tax_id"
- document number on search should be case insensitiveConvert document number to Cyrillic and compare as Cyrillic letters%{"A" => "А", "B" => "В", "C" => "С", "E" => "Е", "H" => "Н", "I" => "І", "K" => "К", "M" => "М", "O" => "О", "P" => "Р", "T" => "Т", "X" => "Х"}, without extra spaces
- Search person by document number
Response
Return empty array if no data found
Return only requested params, id, first_name, second_name, last_name, birth_place and merged_ids if data found