Versions Compared

Key

  • This line was added.
  • This line was removed.
  • Formatting was changed.
Table of Contents
minLevel1
maxLevel7

...

This WS allows to update current verification status of specified party. Now updating of DRACS death and name change streams verification status are allowed.

Specification

Apiary

Authorization

  • Verify the validity of access token

    • 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 = 'party_verification:write')

    • Return (403, 'Your scope does not allow to access this resource. Missing allowances: party_verification:write') in case of invalid scope(s)

  • Ensure that requested party has Employee that relate to the legal entity from token:

    • Return 403 ('Access denied') in case of error

...

  • Get Party identifier from the URL

  • Check it exists in prm.parties table

    • Return 404 ('not found') in case of error

  • Check its party verification record exists in prm.party_verifications table

    • Return 404 ('not found') in case of error

  • Check if party.dracs_death.verification_status is equal to “NOT_VERIFIED”

    • in case of error - return 422 (“verification status for employee in <party.dracs_death.verification_status> status can not be updated“)

Validate schema

  1. Validate request according to JSON Schema

    • Check presence of extra parameters

      • In case of error - return 422 ('schema does not allow additional properties')

    • Check presence of required parameters

      • In case of error - return 422 ('required property %{property} was not present')

    • Check only one of objects is submitted: dracs_death or dracs_name_change

      • In case of error - return 422 ('Only one of the parameters must be present')

Validate DRACS death fields

Validate DRACS death verification status

  1. Check current status (dracs_death_verification_status) is equal to “NOT_VERIFIED”

    • in case not equal - return 422 (“verification status for employee in <party_verifications.dracs_death_verification_status> status can not be updated“)

  2. Validate $.dracs_death.verification_status

    • Check if $.dracs_death.verification_status value is "VERIFIED" (from PARTY_VERIFICATION_STATUSESdictionary)

      • In case of error - return 422 error ("value is not allowed in enum")

Validate DRACS death verification reason

  1. Validate $.dracs_death.verification_reason

    • Check if $.dracs_death.verification_reason value is MANUAL_CONFIRMED” or “MANUAL_NOT_CONFIRMED” from PARTY_VERIFICATION_STATUS_REASONS dictionary

      • in case of error - return 422 ("verification reason (<$.dracs_death.verification_reason>) is not allowed for party DRACS death status")

Validate DRACS name change fields

Validate DRACS name change verification status

  1. Check current status (dracs_name_change_verification_status) is equal to “VERIFICATION_NEEDED”

    • in case not equal - return 422 (“verification status for employee in <party_verifications.dracs_name_change_verification_status> status can not be updated“)

  2. Validate $.dracs_name_change.verification_status

    • Check if $.dracs_name_change.verification_status value is "VERIFIED" (from PARTY_VERIFICATION_STATUSES dictionary)

      • In case of error - return 422 error ("value is not allowed in enum")

Validate DRACS change name verification reason

  1. Validate $.dracs_name_change.verification_reason

    • Check if $.dracs_name_change.verification_reason value is “MANUAL” from PARTY_VERIFICATION_STATUS_REASONS dictionary

      • in case of error - return 422 ("verification reason (<$.dracs_name_change.verification_reason>) is not allowed for party DRACS death status")

Service logic

  • For DRACS death verification stream:

    • Set party DRACS verification status to prm.party_verifications table:

      • party.dracs_death_verification_status = $.dracs_death.verification_status

      • party..dracs_death_verification_reason = $.dracs_death.verification_reason

      • party.dracs_death_verification_comment = $.dracs_death.verification_comment

  • For DRACS name change verification stream:

    • Set party DRACS name change verification status to prm.party_verifications table:

      • party.dracs_name_change_verification_status = $.dracs_name_change.verification_status

      • party.dracs_name_change_verification_reason = $.dracs_name_change.verification_reason

      • party.dracs_name_change_verification_comment = $.dracs_name_change.verification_comment

    • If party.dracs_name_change_verification_status = 'VERIFIED':

      • Deactivate active party verification candidates in party_verification_candidates table in PRM db with party_id = party_id from URL, status = NEW and entity_type in (dracs_marriage_act, dracs_divorce_act, dracs_change_name_act):

        • status = ‘DEACTIVATED’

        • status_reason = ‘PARTY_UPDATED’

        • updated_at = now()

  • Calculate cumulative verification status based on party verification status according to logic described at https://e-health-ua.atlassian.net/wiki/spaces/DRACS2EH/pages/1786196877417820254221/UPD+Party+verification+status+model#Cumulative-verification-statusstatu :

    • Set calculated status to prm.party_verifications field

    • Create StatusChangeEvent in event manager with new verification status if it was changed

  • Render a response according to specification