Versions Compared

Key

  • This line was added.
  • This line was removed.
  • Formatting was changed.
Comment: Восстановить из v. 4

IL.Sign declaration request

Specification

Apiary

The process is initiated by any employee with necessary scopes in this legal entity and involves the transfer of a signed person with electronic digital signature. 

...

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

    1. Return 403 in case invalid scope(s)

...

  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)

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

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

Mapping:


Update declaration request status

Update declaration request:

Code Block
UPDATE declaration_requests
SET status = 'SIGNED'
WHERE id = {:id}