ЕСОЗ - публічна документація

RC_(GraphQL) Update Person DMS passport verification status (DMS)

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

  1. This graphQl method is used in Administration panel only

  2. Only authenticated and authorized NHS employee with appropriate scope can verify persons.

  3. It is allowed to set VERIFICATION_NEEDED status only

  4. Person could have any previous verification status to be changed on VERIFICATION_NEEDED by the mutation. That is, no status transitions there.

Specification

"Updates DMS passport verification status for a single `Person` by NHS using its globally unique ID." updatePersonDmsPassportVerificationStatus( input: UpdatePersonDmsPassportVerificationStatusInput! ): UpdatePersonDmsPassportVerificationStatusPayload
""" Input for `updatePersonDmsPassportVerificationStatus` mutation. """ input UpdatePersonDmsPassportVerificationStatusInput { "Person unique identifier." personId: ID! "Person verification status" dmsPassportVerificationStatus: PersonVerificationStatus! "Person DMS passport verification reason" dmsPassportVerificationReason: PersonDmsPassportVerificationReason! } """ Return type for `updatePersonDmsPassportVerificationStatus` mutation. In order to verify person user must have a scope `person:verify`. """ type UpdatePersonDmsPassportVerificationStatusPayload { "Payload for person." person: Person }

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

  1. Set fields in person_verifications table (mpi database) for a $.personId :

    1. dms_passport_verification_status = $.dmsPassportVerificationStatus

    2. dms_passport_verification_reason = $.dmsPassportVerificationReason

    3. updated_by = user_id (from token)

    4. updated_at = current timestamp

    5. dms_passport_data_id = null

    6. dms_passport_data_status = null

    7. dms_passport_synced_at = null

    8. dms_passport_unverified_at = null

  2. Recalculate cumulative verification status according to logic described at Person verification status model_EN | Cumulative verification status

  3. Create StatusChangeEvent in event manager with the cumulative verification status if such was changed

ЕСОЗ - публічна документація