Purpose
This WS allows to verify person using Admin panel.
Key points
This is a graphQl method used in Administration panel only
Only authenticated and authorized NHS employee with appropriate scope can verify persons.
If person becomes not verified, then it’s declaration should be terminated immediately. And after a while, person should also become inactive.
When a person becomes not verified, there should be a comment from NHS why
Specification
Logic
Set fields in persons table (mpi database):
verification_status = $.verification_status
verification_comment = $.verification_comment, in case of NOT_VERIFIED. And verification_comment = NULL, in case of VERIFIED
verification_reason = MANUAL
updated_by = user_id (from token)
updated_at = current timestamp
Create StateChangeEvent in event manager with verification_status
Add record to audit_log with changed fields
Request structure
API paragraph not found
Authorize
Verify the validity of access token
in case of error - return 401 (“Invalid access token”) in case of validation fails
Verify that token is not expired
in case of error - return 401 (“Invalid access token”)
Check user scopes in order to perform this action (scope = 'person:verify')
return 403 (“Your scope does not allow to access this resource. Missing allowances: person:verify”) in case of invalid scope(s)
Headers
API paragraph not found
Request data validation
Validate legal entity
Extract client_id from token.
Check client scopes in order to perform this action (scope = 'person:verify')
in case of error - return 403 (“Your scope does not allow to access this resource. Missing allowances: person:verify”)
Check legal entity status (status = ACTIVE)
In case of error - return 409 ('client_id refers to legal entity that is not active')
Validate request
Field personId, required
Check $.personId
is ID from MPI.person.id
validate
$.personId
is UUID and UUID is version 4in case of error, return
422
search person
$.personId
inMPI.person.(id = $.personId)
andMPI.person.(id = $.personId).is_active = true then ok
in case of error, return
404
, "Such person doesn't exist"
validate that person is active
MPI.person.(id = $.personId).status = ‘active’
in case of error, return
409
, "Such person isn't active"
Field verificationStatus, required
Check it is submitted
in case of error - return 422 ('required property <name/creation_reason> was not present')
Check value is allowed according to https://e-health-ua.atlassian.net/wiki/spaces/EH/pages/16755458061/Person+verification+status+model+EN.
in case of error - return 422 ('value is not allowed in enum')
Check status transition allowed according to https://e-health-ua.atlassian.net/wiki/spaces/EH/pages/16755458061/Person+verification+status+model+EN. For transition VERIFICATION_NEEDED to IN_REVIEW it is required to have verification reason = RULES_TRIGGERED, if there are other reasons - an error should be returned.
If transition is allowed then
(if (initial
verificationStatus
=VERIFICATION_NEEDED
and (verificationReason
=RULES_PASSED
or verificationReason =INITIAL
)) thenreturn error, 409 ('Such person can't be transferred into manual verification process')
else
Ok)
else show error
return 409 ('Can\'t update verification status from <old status value> to <new status value>')
Field verificationComment , required at specific case
if verification_status = NOT_VERIFIED
in case of error - return 409 ('verification status comment is required')
Processing
API paragraph not found
Response structure
API paragraph not found
Post-processing processes
API paragraph not found
HTTP status codes
API paragraph not found