Table of Contents | ||||
---|---|---|---|---|
|
Purpose
...
The process is initiated by Legal Entity's side and involves the signature previously signed contract request.
Contract must be 2 time signed: from legal_entity and NHS sides. There is a particular order who must signed first - NHS side. After that legal entity owner or admin can either sign contract request (will be created contract) or terminate contract request.
Specification
...
Page Properties | ||||||||||||||||||
---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|
|
Logic
...
This WS is designed to sign contract request from MSP side. Contract request's status must be in status ='NHS_SIGNED'. EDRPOU in DS certeficate = contractor_owner_id.lega_entity.edrpou and suranme in DS=contractor_owner_id.party_id.last_name Method receives signed message (pkcs7) including signed content, digital signature of first signer, digital stamp of first signer, digital signature of second signer and signer public key in signed_content property. All signature fields will be validated (including signer certificate authority). This service will store signed copy of Contract Request in Media Content Storage (will update previous version of file),created contract records and linked employees_divisions if signature is all checks is passed. Object that need to be signed is returned by Get Contract request by ID, urgent, type='signed_content'. In response will be receive a link to download a file in pkcs7 format (signed by NHS side). This data must be signed.
...
This PKCS7 file must be signed and decode in base64.
Request structure
...
See on Apiary
Example:
Expand | ||
---|---|---|
| ||
|
Authorize
...
Verify the validity of access token
Check user scopes in order to perform this action
In case error - generate 401 response
Request to process the request using a token in the headers
Headers
...
Наприклад:
Content-Type:application/json
Authorization:Bearer c2778f3064753ea70de870a53795f5c9
Request data validation
...
Check employee
Contract_request can be signed by owner or admin with necessary scopes in equal legal_entity_id and same id as was perviously input in contract_request.
...
Validate request using JSON schema
In case validation fails - generate 422 error
Check contract request status
If status is not APPROVED - returned error 'Incorrect status'
Capitation only: 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')
Validate start_date
start_date>now()
in case of error return 422 error $start_date ('Start date must be greater than create date')
Check whether all id is resolved and valid. For
- contractor_legal_entity_id and nhs_legal_entity_id in status='active' and nhs_verified = true (prm.legal_entities)
- contractor_owner_id and nhs_signer_id in status = 'APPROVED' (prm.employees)Search contract_number in contracts.contract_number. if found none or one contract in status='VERIFIED' - validation passed.
In case found contract(s), but in status='TERMINATED' show an error 422 ('There is no active contract with such contract_number')
Reimbursement only: validate that medical_program_id is a valid ID of an ACTIVE medical_program with type 'medication'
in case of error return "Medical program is not active"
Processing
...
Save signed contract to media storage
...
define medical programs that are not present in the new contract.
deactivate all active medical program provision for defined programs within contract number and current legal entity:
set is_active = false
set deactivate_reason = AUTO_CONTRACT_TERMINATION
set updated_at, updated by
Note: Status of medical program provision entities for the programs remained in the new contract should not be changed.
Response structure
...
See on Apiary
Example:
Expand | ||
---|---|---|
| ||
|
Expand | ||
---|---|---|
| ||
|
Post-processing processes
...
API paragraph not found
HTTP status codes
...