Versions Compared

Key

  • This line was added.
  • This line was removed.
  • Formatting was changed.
Comment: Оновлено згідно 14.12.2021 PreProd 8.3.0
Table of Contents

Related information

IL.Sign declaration request

...

  1. Verify the validity of access token

    1. Return 401 in case validation fails

  2. Check scopes in order to perform this action (scope = 'declaration_request:sign')

    1. Return 403 in case invalid scope(s)

...

Latin to Cyrillic mapping

Code Block
%{"A" => "А", "B" => "В", "C" => "С", "E" => "Е", "H" => "Н", "I" => "І", "K" => "К", "M" => "М", "O" => "О", "P" => "Р", "T" => "Т", "X" => "Х"}

Validate request

  1. Validate request using JSON schema (See specification)

    1. In case validation fails - generate 422 error

  2. Check declaration request status

    1. If status is not APPROVED, - returned error 'Incorrect status'

Validate person verification status

  • validate patient's verification_status is not equal to NOT_VERIFIED.

    • in case of error return 409, "Patient is not verified"

Check signed content

Check decoded signed content with previously created on IL.db.

Code Block
SELECT data.data_to_be_signed
FROM declaration_requests
WHERE id = {:id}

In case if they are not equal - generate 422 error (message: "Signed content does not match the previously created content")

...

  • if exists return 422 - message 'Declaration with the same declaration_number is already exist in DB' 

Processing

Save signed declaration to media storage

  1. Get url for declaration upload.
    Use Request a Secret WS

    Parameter

    Source

    action'GET'bucket'DECLARATIONS'resource_id: DECLARATION_IDresource_name: DECLARATION_NAME

  2. Upload signed declaration to media storage

Update declaration request:

  1. Change entity status in IL_DB.declaration_request to SIGNED

  2. Set updated_at - now() (Get current date-time)

  3. Set updated_by - user_id (Extract user from token)

Get active declarations

Search for active declarations using MPI ID

  1. If found, - terminate them and create new declaration.

    • If not found - create new declaration.

Terminate declaration

In case active declarations found - terminate all by changing status to INACTIVE.

Create declaration

  1. Check authentication_method_current

    Code Block
    SELECT authentication_method_current
    FROM declaration_requests
    WHERE id = {:id}
    
    1. If "type" = "OFFLINE"

      1.  set declaration status to "PENDING_VERIFICATION"

      2. set reason to 'offline'

    2. if "type" = "OTP" - set declaration status to "ACTIVE" 

  2. Check persons 'no_tax_id' flag

    1. if 'no_tax_id'=true 

      1. set declaration status to "PENDING_VERIFICATION"

      2. set reason to 'no_tax_id'

  3. Create a new declaration by adding a new entity to the declarations table ops_db without declaration_id.

    1. if there is existing record in the declarations table with the same id and declaration_request_id, return ok to IL