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

Skip to end of metadata
Go to start of metadata

You are viewing an old version of this page. View the current version.

Compare with Current View Version History

Version 1 Current »

/wiki/spaces/EN/pages/17591304241 (remove the link block before publishing the document)

Properties of a REST API method document

Document type

Метод REST API

Document title

[DRAFT] PIS. Reject Declaration request [API-005-011-001-0467]

Guideline ID

GUI-0011

Author

@

Document version

1

Document status

DRAFT

Date of creation

ХХ.ХХ.ХХХХ (дата фінальної версії документа – RC або PROD)

Date of update

ХХ.ХХ.ХХХХ (дата зміни версії)

Method API ID

API-005-011-001-0467

Microservices (namespace)

IL

Component

Bulk export

Component ID

COM-005-012

Link на API-специфікацію

https://pisapi1.docs.apiary.io/#reference/public.-patient-information-system/bulk-data-export/reject-declaration-request

Resource

{{host}}/api/pis/declaration_requests/{{id}}/actions/reject

Scope

declaration_request:reject_pis

Protocol type

REST

Request type

PATCH

Sync/Async

Sync

Public/Private

Public

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.

Logic

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 /wiki/spaces/PCAB/pages/17513775491 (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

event_type

StatusChangeEvent

entity_type

DeclarationRequest

entity_id

$.id

properties.status.new_value

$.status

event_time

$.update_at

changed_by

$.changed_by

Configuration parameters

N/A

Dictionaries

N/A

Input parameters

Input parameter

Mandatory

Type

Description

Example

1

 

 

 

 

 

2

 

 

 

 

 

Request structure

See on API-specification

 Example
 

Headers

Headers

Request data validation

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:

  • If equals - check that person must not be authorized by confidant person, so it doesn’t correspond to following rules:

    • persons age < no_self_registration_age global parameter;

    • persons age between no_self_registration_age and person_full_legal_capacity_age global parameters and person does not have document with type from PIS_PERSON_LEGAL_CAPACITY_DOCUMENT_TYPES config parameter;

    • persons age > person_full_legal_capacity_age global parameter and exists at least one active and approved confidant person relationship for person (using following process /wiki/spaces/PCAB/pages/17415995422 with person_id = person from request - expected :ok, :approved response)

      • In case of error - return 409 (‘Request must be authorized by confidant person’)

  • If not equal - validate relationship with following steps:

    • Check that there is registered relationship between person_id and applicant_person_id(MPI.confidant_person_relationships)

    • Check that relationship is VERIFIED

      • In case of error - return 409 (‘Can’t confirm relationship’)

    • Check that applicant_person_id exists (status = 'active' & is_active = 'true') and has verification_status any but NOT_VERIFIED

      • In case of error - return 409 (‘Confidant person not found or is not verified’)

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')

Processing

N/A

Response structure examples

See on API-specification

 Example
 

HTTP status codes

Response code

HTTP Status code

Message

Internal name

Description

1

Базові

2

 

 

 

 

 

3

 

 

 

 

 

4

Специфічні

5

 

 

 

 

 

Post-processing processes

N/A

Technical modules where the method is used

Название

  • No labels