Versions Compared

Key

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

Purpose

This WS serves for receiving approval from person on action of merge with preperson.

Specification

TBD

Service logic

  1. Only authenticated and authorized OWNER, ADMIN, RECEPTIONIST, DOCTOR employees can use this WS.

  2. Usage of this WS allowed in EMERGENCY, MSP, MSP_PHARMACY, OUTPATIENT, PRIMARY_CARE legal entities.

  3. Person should confirm merge with preperson by auth method chosen on create patient request or create declaration request processes.

Authentication

  1. Verify the validity of access token

    1. Return 401 in case validation fails

  2. Check user scopes in order to perform this action (scope = 'preperson_merge_request:write')

    1. Return 403 in case invalid scope(s)

Validate request

Validate request using schema (TBD)

Validate legal entity

Check that legal entity is active (status = ACTIVE, SUSPENDED)

  1. Extract client_id from token (token.client_id == legal_entity_id)

  2. Check legal entity status (status = ACTIVE, SUSPENDED)

    1. In case of error - return 409 (Legal entity must be ACTIVE or SUSPENDED)

Determine authorization method

Get authorization_method from MPI.person_authentication_methods.

Next steps is similar to determine authorization method process on approve patient request

Update object in DB

mpi.merge_person_preperson_request table

Parameter

Source

Description

status

Request: status

Status of the request, required. Set APPROVED

updated_by

uuid

Extract user from token

updated_at

timestamp

Get current date-time