Table of Contents |
---|
...
Link | |
Resource | /api/v3/declaration_requests/{{id}}/actions/sign |
Scope | declaration_request:sign |
Components | Declarations |
Using Microservices | il/api ops/api |
Protocol type | REST |
Request type | PATCH |
Sync/Async | AsyncSync |
Public/Private/Internal | Public |
...
Check that DRFO in Certificate details exists and not empty
Check that DRFO in Certificate details is equal to DRFO in Party
Get party.tax_id using employee_id in declaration payload
Compare DRFO in Certificate with party.tax_id
Convert DRFO and TAX_ID to uppercase
Compare DRFO and TAX_ID as Cyrillic letters
Convert DRFO to Cyrillic and compare as Cyrillic letters
In case validation fails - generate 422 error
...
Validate request using JSON schema
In case validation fails - generate 422 error
Check declaration request status
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"
Validate Parent declaration
Get parent_declaration_id from IL_DB.declaration_requests.parent_declaration_id.
If parent_declaration_id is not null, check that parent declaration exists and in status 'active'
In case of error - return 404 ("Active parent declaration was not found")
Check signed content
Check decoded signed content with previously created on IL.db.
...
If "patient_signed" is not present in request, return 422 ("required property patient_signed was not present")
If "patient_signed"=false in request, return 422 ("Patient must sign declaration form")
If “patient_signed”=null, check that parent_declaration_id is not null,
in case of error, return 422 ("Patient must sign declaration form")
Validate human readable declaration number
...
In case active declarations found - terminate all by changing status to INACTIVE.
In case parent_declaration_id of declaration request is not null - terminate parent_declaration with reason reason = 'auto_reorganization'.
Create declaration
Check authentication_method_current
Code Block SELECT authentication_method_current FROM declaration_requests WHERE id = {:id}
If "type" = "OFFLINE"
set declaration status to "PENDING_VERIFICATION"
set reason to 'offline'
if "type" = "OTP" - set declaration status to "ACTIVE"
if "type" = "NA" - check parent_declaration_id, if not null than set declaration status to "ACTIVE"
Check persons 'no_tax_id' flag
if 'no_tax_id'=true and parent_declaration_id is null
set declaration status to "PENDING_VERIFICATION"
set reason to 'no_tax_id'
if ‘no_tax_id’=true and parent_declaration_id is not null - set declaration status to "ACTIVE"
Create a new declaration by adding a new entity to the declarations table ops_db without declaration_id.
if there is existing record in the declarations table with the same id and declaration_request_id, return ok to IL
...