Table of Contents |
---|
Related information
...
Verify the validity of access token
Return 401 in case validation fails
Check scopes in order to perform this action (scope = 'declaration_request:sign')
Return 403 in case invalid scope(s)
Digital signature
Digital signature validation is different depending on channel
for channel
PIS
and statusAPPROVED
there must be 2 signatures - one for patient and one for doctorfor channel
MIS
and statusAPPROVED
there must be only 1 doctor’s signature
Decode content that is encrypted in an electronic digital signature.
Use Digital signature WS. Method checks digital signature(s) and returns result.
See service specification
Validate patient’s signature
This validation must be done in different ways depending on context:
if request is done by person itself (There is no confidant person in data_to_be_signed
data_to_be_signed.person.confidant_person
(or is nil)) - we must check that signer DRFO matches with person tax_id or documentif request is done by confidant person (There is confidant person in data_to_be_signed
data_to_be_signed.person.confidant_person
) - we must check that signer DRFO matches with confidant person tax_id or document
Request is done by person
Check that DRFO in Certificate details exists and not empty
Check that DRFO in Certificate details is equal to Person’s tax_id
Get
person_id
from tokenGet Person details using
person_id
Compare DRFO in Certificate with person.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
Request is done by confidant person
Check that DRFO in Certificate details exists and not empty
Check that DRFO in Certificate details is equal to Confidant Person’s tax_id
Get
confidant_person
fromdata_to_be_signed.person
Compare DRFO in Certificate with person.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 doctor’s signature
...
Change entity status in IL_DB.declaration_request to SIGNED
Set status_reason:
If
channel
= MIS - setstatus_reason
to doctor_signedIf
channel
= PIS - setstatus_reason
to doctor_approved_over_limit
Set updated_at - now() (Get current date-time)
Set updated_by - user_id (Extract user from token)
...