Table of Contents | ||||
---|---|---|---|---|
|
Required parameters are marked with "*"
...
Purpose*
This WS allows to create medical program provision by divisions of user’s legal entity. It shows what divisions provides medical program according to legal entity contract.
...
This method allows to create medical program provision by divisions of user’s legal entity. It shows what divisions provide medical program according to legal entity contract. Method receives signed message (pkcs7) that consists of signed content, digital signature and signer public key. All signature fields will be validated (including signer certificate authority). Service will store signed copy of the request in Media Content Storage if all checks is passed.
Key points
This is a REST method.
Only authenticated and authorized legal entity owner with appropriate scope can create a Medical program provision.
Request should be signed with DS.
User can add multiple divisions at once to provide a medical program.
Request structure*
See on Apiary
...
Request to process the request using a token in the headers
Headers*
Наприклад:
Content-Type:application/json
Authorization:Bearer F3GF124Df565FDS234SDF34
api-key:aDGFDFGT46S5gFGD
...
Extract client_id from token.
Check client scopes in order to perform this action (scope = 'medical_program_provision:write')
in case of error - return 403 “Your scope does not allow to access this resource. Missing allowances: medical_program_provision:write”
Check legal entity status (status = ACTIVE, SUSPENDED)
In case of error - return 422 “Legal entity is not active”
Validate request
Validate
contract_number
:Select contract_number from contracts where:
type = REIMBURSEMENT
is_active=true
status = VERIFIED
contractor_legal_entity = client_id (from token)
in case of error - return 422 “Your legal entity has no reimbursement contract with number <contract_number> or it is not active”
Validate
medical_program_id
:Сheck program exists and active
in case of error - return 422 “Medical program not found”
Check medical program belongs to the contract
in case of error - return 422 “Medical program does not belong to contract”
Validate
divisions
:Check divisions are not duplicated in the array
in case of error - return 422 “Division list has duplicated identifiers in the request”
For each division in the array:
Validate it exists and active (is_active = true and status = ACTIVE):
in case of error - return 422 “Division with id <id> does not exist or not active”
If chart parameter
DISPENSE_DIVISION_DLS_VERIFY
is on, then validate it DLS verified (dls_verified=true)in case of error - return 422 “Division with id <id> is not verified in DLS”
Validate it belongs to the legal entity (client_id from token)
in case of error - return 422 “Division with id <id> does not belong to legal entity”
Validate there is no existing active records with the same division, medical program and contract number
in case of error - return 422 “The medical program has already been provided by division with id <id> according to the contract“
Processing*
Save signed content to media storage. Look at Bucket structure for details.
Save records to the database according to Data model
Response structure*
See on Apiary
...