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

(GraphQL) Update Legal Entity status

Purpose

This WS is designed to allow NHS employee with assigned appropriate scopes to verify for new Legal Entities or if the Legal Entity data or its license was changes.

Key points 

  1. This is a graphQl query method used in Administration panel only.

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

Specification

""" Input for `updateLegalEntityStatus` mutation. """ input UpdateLegalEntityStatusInput { "Legal entity database unique identifier." id: ID! "Legal entity status" status: LegalEntityUpdateableStatus! "Why `LegalEntity` status is changing?" reason: String } """ List of legal entities statuses allowed to update by NHS. """ enum LegalEntityUpdateableStatus { "Denotes that legal entity is active." ACTIVE "Denotes that legal entity is suspended and has limited rights for actions in ehealth system." SUSPENDED } """ Return type for `UpdateLegalEntityStatus` mutation. In order to update the legal entity status user must have a scope `legal_entity:update`. """ type UpdateLegalEntityStatusPayload { "Payload for legalEntity." legalEntity: LegalEntity }

Authorize

  1. Verify the validity of access token

    1. Return 401 in case validation fails

  2. Verify that token is not expired

    1. in case of error - return (401, 'Invalid access token')

  3. Check user scopes

    1. legal_entity:update in order to search person

      1. In case of invalid scope, return: "You don't have permission to access this resource

Validate request

  1. Check Legal entity status ("ACTIVE" or "SUSPENDED")

    1. in case of error - return ("Incorrect status transition.")

  2. If new le.status = "ACTIVE" check license expiry date where expiry_date>today_date or expiry_date = null

    1. in case of error - return ("Legal entity license should not be expired.")

  3. Check contracts legal entity where 

    1. contract. status = allowed_statuses_for_termination [new, in_process, approved, nhs_signed, pending_nhs_sign]

Processing

Update LE nhs_verified

  1. Update LE (PRM)

    1. set status

    2. set reason

    3. set status_reason

      1. for le.status = "SUSPENDED" status_reason: "MANUAL_LEGAL_ENTITY_STATUS_UPDATE"

      2. for le.status = "ACTIVE" status_reason: null

  2. For le.status = "SUSPENDED"set contract.is_suspended = true and update updated_by, updated_at

  3. Return LE details include new status

Related content

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