Table of Contents | ||||||
---|---|---|---|---|---|---|
|
...
Expand | ||||||
---|---|---|---|---|---|---|
| ||||||
|
Request structure
See on Apiary
Expand | ||
---|---|---|
| ||
|
Authorize
...
Verify the validity of access token
in case of error - return 401 (“Invalid access token”) in case of validation fails.
...
Verify that token is not expired
in case of error - return 401 (“Invalid access token”).
...
|
Authorize
Verify the validity of access token
in case of error - return 401 (“Invalid access token”) in case of validation fails.
Verify that token is not expired
in case of error - return 401 (“Invalid access token”).
Check user scopes in order to perform this action (scope = 'program_medication:write')
return 403 (“Your scope does not allow to access this resource. Missing allowances: program_medication:read”) in case of invalid scope(s).
Request to process the request using a token in the headers
Headers
Content-Type:application/json
Authorization:Bearer c2778f3064753ea70de870a53795f5c9
Request data validation
Validate legal entity
Extract client_id from token.
Check client scopes in order to perform this action (scope = 'program_medication:write')
in case of error - return 403 (“Your scope does not allow to access this resource. Missing allowances: program_medication:read”) in case of invalid scope(s).
Request to process the request using a token in the headers
Headers
Content-Type:application/json
Authorization:Bearer c2778f3064753ea70de870a53795f5c9
Request data validation
Validate legal entity
Extract client_id from token.
- Check client scopes in order to perform this action (scope = 'program_medication:write')
write”).
Validate request
Check medicalProgramId:
exists in DB
in case of error - return 404 ('not_found')
has type = MEDICATION
in case of error - return 409 ('MedicalProgram type should be MEDICATION')
is_active = true
in case of error - return
...
Validate request
Check medicalProgramId:
exists in DB
in 409 ('Medical program is not active')
Check start_date < end_date
in case of error - return
404422 ('
not_found')has type = MEDICATIONmust be earlier than the end date')
Validate reimbursement:
If reimbursement type = FIXED, than reimbursementAmount field required
If reimbursement type = PERCENTAGE, percentageDiscount field required
in case of error - return 409 422 ('MedicalProgram type should be MEDICATIONcan't be blank')
is_active = true
in case of error - return 409 ('Medical program is not active')
Check start_date < end_dateIf percentageDiscount submitted in the reimbursement structure:
Check it’s value in range from 0 to 100
in case of error - return 422 ('
expected the value to be <= 100')
Validate reimbursementmedicationId:
If reimbursement type = FIXED, than reimbursementAmount field required
If reimbursement type = PERCENTAGE, percentageDiscount field required
Check it is active and it’s type is BRAND
in case of error - return 422 409 ('can't be blank')
If percentageDiscount submitted in the reimbursement structure:
- Check it’s value in range from 0 to 100
Medication is not active')
Validate compliance of INNM_DOSAGE.mr_blank_type:
in case when $.medication.type is BRAND:
Check itCheck INNM_DOSAGE
There is link of a BRAND to INNM_DOSAGE (in prm.ingredients table) and INNM_DOSAGE exists
in case of error - return
404 ('INNM_DOSAGE of a BRAND not_found')
Validate medicationId:
is
_active = true
in case of error - return 409 ('
INNM_DOSAGE of a BRAND is not active')
in case when $.medication.type is INNM_DOSAGE
:
Check INNM_DOSAGEThere is link of a BRAND to INNM_DOSAGE (in prm.ingredients table) and
INNM_DOSAGE exists
in case of error - return 404 ('INNM_DOSAGE
not_found')
is_active = true
in case of error - return 409 ('INNM_DOSAGE
is not active')
Check compliance of INNM_DOSAGE
of a BRANDto medicalProgramif INNM_DOSAGE.mr_blank_type = medicalProgram.mr_blank_type
(i.eprm.medications.mr_blank_type = prm.medical_programs.mr_blank_type
)in case of error - return 422 ('Dosage form of selected Medication does not comply with mr_blank_type requirement of Medical Program')
Processing
...
Response structure
See on Apiary
...