...
Search person
Calculate patient age
age = MONTHS_BETWEEN (now(), $.declaration_request.person.birth_date) / 12 |
1. if person age < 14
- 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
2. If person age >= 14
- 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 insensitive, without extra spaces
- Search person by document number
...