Purpose
This WS allows to submit person on repeat verification to DMS passport stream for persons using Admin panel immediately without awaiting it’s data update or verification schedule.
Key points
This graphQl method is used in Administration panel only
Only authenticated and authorized NHS employee with appropriate scope can verify persons.
It is allowed to set VERIFICATION_NEEDED status only
Person could have any previous verification status to be changed on VERIFICATION_NEEDED by the mutation. That is, no status transitions there.
Specification
Authorization
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)
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) and is_active=true
In case of error - return 409 ('client_id refers to legal entity that is not active')
Validate request
Validate input of the mutation for the following fields:
1. Person
Validate value in the field personId
, identifier (ID), required
Check it is submitted
in case of error - return 422 ('required property <property name> was not present')
Check person exists in the DB
in case of error - return 404 ('Person not found')
Validate person has status=active and is_active=true
in case of error - return 409 ('Person is not active')
2. Verification status
Validate value in the field dmsPassportVerificationStatus
, enum, required
Check it is submitted
in case of error - return 422 ('required property <property name> was not present')
Check value is VERIFICATION_NEEDED according to
PERSON_VERIFICATION_STATUSES
dictionary.in case of error - return 422 ('value is not allowed in enum')
3. Verification reason
Validate value in the field dmsPassportVerificationReason
, enum, required
Check it is submitted
in case of error - return 422 ('required property <property name> was not present')
Check value is MANUAL according to
PERSON_VERIFICATION_STATUS_REASONS
dictionary.in case of error - return 422 ('value is not allowed in enum')
Service logic
Set fields in person_verifications table (mpi database) for a $.
personId
:dms_passport_verification_status = $.
dmsPassportVerificationStatus
dms_passport_verification_reason = $.
dmsPassportVerificationReason
updated_by = user_id (from token)
updated_at = current timestamp
dms_passport_data_id = null
dms_passport_data_status = null
dms_passport_synced_at = null
dms_passport_unverified_at = null
Recalculate cumulative verification status according to logic described at https://e-health-ua.atlassian.net/wiki/spaces/EDDR/pages/18048483391/Person+verification+status+model#Cumulative-verification-status
Create StatusChangeEvent in event manager with the cumulative verification status if such was changed