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')
- Extract token → users.id → party_users.party_id → employee_id.
- Check employees.employee_id=nhs_signer_id and client_id=employee.legal_entity_id
- In case of error return 422 Error ('Employee is not allowed to sign')
- Validate that contract_request hasn't been signed by nhs_side already
- Check if signed_nhs=false.status= 'APPROVED'
- In case of error return 422 error ('The contract was already can't be signed by NHSstatus')
- Extract token → users.id → party_users.party_id → employee_id.
Digital signature
Decode content that is encrypted in an electronic digital signature.
Use Digital signature WS. Method checks digital signature and returns result.
Validations
Validate DRFO
- Check that DRFO in Certificate details exists and not empty
- in case of error return 422 error ('Invalid DRFO in DS')
- Check that DRFO in Certificate details is equal to DRFO in Party
- Get party.tax_id using user_id from token (user.id→ party_users.party_id → parties.id.tax_id)
- 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 422 'Incorrect status'
- Validate contractor_employee_divisions
- Employees from employee_divisions has employee_type='DOCTOR', status='APPROVED', division is not null
- in case of error return 422 error view $employee ('Employee must be an active DOCTOR with linked division')
- 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 employee belongs to division
- in case of error return 422 error view $employee ('Employee must be within current division')
- Employees from employee_divisions has employee_type='DOCTOR', status='APPROVED', division is not null
- 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)
Save signed contract to media storage
Get url for declaration upload
Parameter Source action 'GET' bucket 'CONTRACT_REQUESTS' resource_id : CONTRACT_REQUEST_ID resource_name : CONTRACT_NAME timestamp :TIMESTAMP - Upload signed contract to media storage.
Update contract request
...
contract
...
request
...
- Change contract_request.statuastatus='NHS_SIGNED'
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 |