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

PIS. Reject Person request_EN

Purpose

This WS designed to reject person requests previously created by patient.

Key points

  1. Only authenticated and authorized user with appropriate scope can reject Person Request.

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 = 'person_request:reject_pis')

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

  • Check that token contains person_id

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

Validate person

  • Get person_id from token (x-person-id header)

  • Validate patient status is active (status = ‘active' & is_active = 'true’)

    • in case of error - return 404 ('not found')

Validate confidant person and relationship (optional)

If person is not legally capable - system must ensure that person request is rejected by confidant person and there is registered and verified their relationship

Get applicant_person_id from token, compare it to person_id from token:

Validate Person request

  • Check that person request:

    • exists in il DB

    • belongs to patient

      • in case of error - return 404 ('not found')

  • Check that person request status = NEW, APPROVED

    • in case of error - return 403 (' Only person request with NEW or APPROVED statuses can be rejected')

Service logic

  1. Update person request in il.person_requests table:

    1. set status = 'REJECTED'

  2. Add new status to event manager

field

value

field

value

event_type

StatusChangeEvent

entity_type

PersonRequest

entity_id

$.id

properties.status.new_value

$.status

event_time

$.updated_at

changed_by

$.changed_by

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