Table of Contents |
---|
...
- Extract legal_entity_id (client_id) from token. Take contract_request_id.
- Check client_id=nhs_legal_entity_id (nhs_side) - in case of error return 403 Error ('Invalid client id')
- Validate that contract_request hasn't been signed by nhs_side already
- Check if status= 'PENDING_NHS_SIGNED'
- In case of error return 422 error ('The contract can't be signed by status')
...
Decode content that is encrypted in an electronic digital signature.
Use Digital signature WS. Method checks digital signature and returns result.
Validations
Validate
...
EDRPOU
- Check that
...
- EDRPOU in Certificate details exists and not empty
- in case of error return 422 error ('Invalid
...
- EDRPOU in DS')
- Check that
...
- EDRPOU in Certificate details is equal to
...
- EDRPOU in legal entity
- Get client_id from token.
- Find prm.legal_entities id by client_id
- Compare EDRPOU in Certificate with legal_entities.edrpou
- In case validation fails - generate 422 error
- Get party.
...
- last_
...
- name using nhs_signer_id from contract_request
...
- employees.employee_id=nhs_signer_id and client_id=employee.legal_entity_
...
- id → party.last_name
- Convert
- id → party.last_name
...
- prm.parties.LAST_NAME and Certificate details.SURNAME to uppercase
- Compare
...
- prm.parties.LAST_NAME and Certificate details.SURNAME as Cyrillic letters
- In case validation fails - generate 422 error
Check signed content
Check decoded signed content with previously created on IL.db.
...
- Validate request using JSON schema
- In case validation fails - generate 422 error
- Check contract request status
- If status is not PENDING_NHS_SIGN - return error 422 'Incorrect status'
- Validate contractor_divisions
- Check divisions belongs to legal_entity and divisions.status='active'
- in case of error return 422 error view $divisions ('Division must be active and within current legal_entity')
- Check divisions belongs to legal_entity and divisions.status='active'
- Validate contractor_employee_divisions
- Employees from employee_divisions has employee_type='DOCTOR', status='APPROVED'
- in case of error return 422 error view $employee ('Employee must be an active DOCTOR')
- Check contractor_employee_divisions.division_id is present in contractor_divisions.id
- in case of error return 422 error $divisions ('The division is not belong to contractor_divisions')
- Check contract_number is null
- in case of error return 422 error view $employee ('Employee can't be updated via Contract Request')
- Employees from employee_divisions has employee_type='DOCTOR', status='APPROVED'
- Validate start_date
- start_date>now()
- in case of error return 422 error $start_date ('Start date must be greater than create date')
- start_date>now()
- Check whether all id is resolved and valid. For
- contractor_legal_entity_id and nhs_legal_entity_id in status='active' (prm.legal_entities)
- contractor_owner_id and nhs_signer_id in status = 'APPROVED' (prm.employees) - Invoke service Get Printout Form by Contract Request ID and compare to $printout_content from request
- in case of error return 422 error $printout_content ('Invalid printout content')
Save signed contract to media storage
...
After status is changed to NHS_SIGNED save printout_content to db.contract_requests.printout_content by $contract_id
Update contract request
- Change contract_request.status='NHS_SIGNED'
- set nhs_signed_date=now()::date
Add status to event manager
After status was changed (status = NHS_SIGNED) - add new status to event_manager
field | value |
---|---|
event_type | StatusChangeEvent |
entity_type | Contract_request |
entity_id | $.id |
properties.status. | $.status |
event_time | $.update_at |
changed_by | $.changed_by |
...