ЕСОЗ - публічна документація
RC_(GraphQL) Update Party DRACS death verification status (DMS)
Purpose
This WS allows to set party verification status for DRACS death stream using Admin panel.
Key points
This graphQl method is used in Administration panel only.
Only authenticated and authorized NHS employee with appropriate scope can verify parties.
This graphQl method can be used to verify employees with NHS client type only.
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 = 'employee:verify')
return 403 (“Your scope does not allow to access this resource. Missing allowances: employee: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 = 'employee:verify')
in case of error - return 403 (“Your scope does not allow to access this resource. Missing allowances: employee: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 Id, required.
Check it is submitted
in case of error - return 422 ('required property <name/creation_reason> was not present')
Check that party exists in
prm.parties
in case of error - return 404 “Party does not exist“
Find employee in
prm.employees
where employee.party_id = $.partyIdin case of error - return 404 "Such employee doesn't exist"
Select at least one employee of employees that have been found at previous step whose legal entity is NHS
in case of error - return 422 "DRACS Death verification is allowed for NHS employees only"
Check if this employee is active: employee.status = 'APPROVED' and employee.is_active = true
in case of error - return 409 "Such employee 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 schema.
in case of error - return 422 ('value is not allowed in enum')
Field verificationReason, 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 schema.
in case of error - return 422 ('value is not allowed in enum')
Status transition
Check status transition allowed according to schema.
For transition NOT_VERIFIED to IN_REVIEW it is required to have verification reason = MANUAL, if there are other reasons - an error should be returned.
For transition IN_REVIEW to VERIFIED it is required to have verification reason in (MANUAL_CONFIRM, MANUAL_NOT_CONFIRM), if there are other reasons - an error should be returned.
For transition NOT_VERIFIED to VERIFIED it is required to have verification reason in (MANUAL_CONFIRMED, MANUAL_NOT_CONFIRMED), if there are other reasons - an error should be returned.
in case of error - return 422 ('Can\'t update verification status from <old status value> with <old verification reason> verification reason to <new status value> with <new verification reason> verification reason')
Service logic
Set fields in party_verifications table (prm database):
dracs_death_verification_status = $.verification_status
dracs_death_verification_comment = $.verification_comment
dracs_death_verification_reason = $.verification_reason
dracs_death_act_id= $.verification_death_act_id
updated_by = user_id (from token)
updated_at = current timestamp
Calculate cumulative verification status based on persons verification status in each stream:
DRFO registry verification, DRACS death acts registry verification according to logic described at Party verification status model | Cumulative verification status:Set calculated status to prm.party_verifications field
Create StatusChangeEvent in event manager with new verification status if it was changed
ЕСОЗ - публічна документація