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

PIS. Reject Declaration request

Purpose

This WS is designed to reject previously created Declaration Request by patient

Key points

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

  2. Declaration Request can be rejected only from ‘NEW' or ‘APPROVED’ status.

Specification

Apiary

Authorization

  1. Verify the validity of access token

    • in case of error - return 401 (“Invalid access token”) in case of validation fails

  2. Verify that token is not expired

    • in case of error - return 401 (“Invalid access token”)

  3. Check user scopes in order to perform this action (scope = 'declaration_request:reject_pis')

    • return 403 (“Your scope does not allow to access this resource. Missing allowances: declaration_request:reject_pis”) in case of invalid scope(s)

Validation

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 verification status of person not NOT_VERIFIED

    • in case of error - return return 403 ("Access denied. Person is not verified")

Validate confidant person and relationship (optional)

If person is not legally capable - system must ensure that declaration 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 Declaration request

  • Check that declaration request:

    • exists in il DB

    • belongs to patient

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

  • Check that declaration request status = NEW and channel PIS or APPROVED

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

Service logic

  1. Update declaration request in il.declaration_requests table:

    1. set status = 'REJECTED'

    2. set status_reason patient_reject (value of DECLARATION_REQUEST_STATUS_REASON) according to status model (where the channel of action PIS and status REJECTED)

    3. updated_at: current date time

    4. updated_by: user from token

  2. Add new status to event manager

field

value

field

value

event_type

StatusChangeEvent

entity_type

DeclarationRequest

entity_id

$.id

properties.status.new_value

$.status

event_time

$.update_at

changed_by

$.changed_by

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