ЕСОЗ - публічна документація
Approve or Reject employee Request
- 1 Purpose
- 2 Specification
- 3 Logic
- 3.1 Sample Request
- 4 Input parameters
- 5 Authorize
- 6 Headers
- 7 Request data validation
- 8 Processing
- 8.1 Update employee request status to REJECTED
- 8.1.1 Sample Request
- 8.2 Get Employee Request Details
- 8.2.1 Sample Request
- 8.3 Create user in Auth
- 8.4 Create/Update employee
- 8.5 Create related entity party-user
- 8.6 Add role
- 8.6.1 Sample Request
- 8.7 Update employee request status to APPROVED
- 8.7.1 Sample Request
- 8.8 Send Email
- 8.1 Update employee request status to REJECTED
- 9 Submit party on verification
- 10 Calculate cumulative verification status
- 11 Response structure
- 12 Post-processing processes
- 13 HTTP status codes
Purpose
The method is used to approve or reject employee request
Specification
Link | Посилання на Apiary або Swagger | |
Resource | /employee_requests/{{id}}/actions/{{action}} | Посилання на ресурс, наприклад: /api/persons/create |
Scope | employee_request:update | Scope для доступу |
Components | Employees | Зазначається перелік бізнес компонентів, які використовують цей метод, наприклад: ePrescription |
Microservices | il/api | Перелік мікросервісів, які використовує метод API, наприклад: Auth, ABAC |
Protocol type | REST | Тип протоколу, який використовується запитом, наприклад: SOAP | REST |
Request type | POST | Тип запиту API, наприклад: GET, POST, PATCH… |
Sync/Async | Sync | Метод є синхронним чи асинхронним? |
Public/Private/Internal | Internal | Потрібно зазначити тип методу за ступенем доступності |
Logic
Sample Request
curl -X POST -H 'Content-Type: application/json' -H 'Authorization:Bearer YW5WcFkyVnFkV2xqWldwMWFXTmxDZzpjY1hwWTR0cWRZbGVjNHAxYUdsMXVJ' 'http://ehealth.nebo15.com/employee_requests/d290f1ee-6c54-4b01-90e6-d701748f0851/actions/approve'
Input parameters
Input parameter | Values | Type | Description | Example |
---|---|---|---|---|
id |
| String | Required | d290f1ee-6c54-4b01-90e6-d701748f0851 |
action |
| String | Required | APPROVE |
Authorize
Verify the validity of access token
Check user scope employee_request:update in order to perform this action
In case error - return 401 error
Headers
Наприклад:
Content-Type:application/json
Authorization:Bearer YW5WcFkyVnFkV2xqWldwMWFXTmxDZzpjY1hwWTR0cWRZbGVjNHAxYUdsMXVJ
Request data validation
Check action in request
if action = APPROVE, add user new role
if action - REJECT, update employee request status on REJECTED
Processing
Update employee request status to REJECTED
Invoke WS to update employee request status with parameter 'action'='reject'
See service specification
Sample Request
curl -X PATCH -H 'Content-Type: application/json' 'http://ehealth.nebo15.com/employee_requests/d290f1ee-6c54-4b01-90e6-d701748f0851/actions/reject'
Get Employee Request Details
Invoke WS Get Employee Request by ID for further employee creation
See service specification
Sample Request
curl -X GET -H 'Content-Type: application/json' 'http://ehealth.nebo15.com/employee_requests/d290f1ee-6c54-4b01-90e6-d701748f0851'
Create user in Auth
Create user in Auth
Create/Update employee
Search party_id by tax_id (tax_id or passport_number) and birth_date for deduplication Party
If found, update object party - Update party WS
If not found, - Create object party
Update Party. See specification
The following fields can't be changed:
tax_id (tax_id or passport_number)
birth_date
If doctor object in ER is null, don't update party.eductions/party.qualifications/party.specialities/party.science_degree. Otherwise update those objects.
if about_myself/working_experience is null or empty string - don't update correspondent fields in parties.
Create party WS. See specification
create related entity party-user in PRM
Chech employee_id in request
if employee_id is exist in request, Update employee.
if employee_id is not exist, Create employee.
Update employee. See specification
The following fields can't be changed:
employee_type
legal_entity_id
start_date
if employee_type = 'DOCTOR', 'SPECIALIST' or 'ASSISTANT' update doctor object
if one of next fields were changed:
first_name
second_name
last_name
find contracts with contractor_owner_id=$owner_id and status='VERIFIED'. Set ops.contracts.is_suspended=true
Create new employee. See specification
If (employee_type = OWNER || employee_type = PHARMACY_OWNER) : deactivate all other records with the employee_type = OWNER
or employee_type = PHARMACY_OWNER for the legal_entity,
where new owner is creating:
In case new OWNER was added find contracts with contractor_owner_id=$old_owner_id and status='VERIFIED'.
Set ops.contracts.is_suspended=true
Create related entity party-user
Create related entity party-user
It can be only one pair user_id-party_id.
party_id cannot be updated for the user_id.
Check that there is no records in party_users for the stated in employee_request user_id
If not - return 422 error: "Email is already used by another person"
Add role
Add user role by invoke service - название метода
Role is assigned according to employee_type
See service logic
See service specification
Sample Request
Update employee request status to APPROVED
Invoke WS to update employee request status with parameter 'action'='approve'
See service specification
Sample Request
Send Email
Send email with successful registration using WS - Send Message (TBD)
Temporarily use Postmark
Submit party on verification
Create or update existing record in party_verifications table for a party according to logic in sections below. Also, set:
updated_at = now()
updated_by = user uuid
inserted_at = now() (for new records)
inserted_by = user uuid (for new records)
DRFO registry verification
Set to party verification record as ready for online verification with DRFO registry:
drfo_data_id = NULL
drfo_data_result = NULL
drfo_synced_at = NULL
drfo_verification_status = VERIFICATION_NEEDED
drfo_verification_reason = ONLINE_TRIGGERED
Then party will be verified online with DRFO registry via separate process: DRFO data synchronization for Parties_EN
DRACS death acts registry verification
Set to party verification record as ready for online verification with DRACS death acts registry:
dracs_death_verification_status = VERIFICATION_NEEDED
dracs_death_verification_reason = ONLINE_TRIGGERED
dracs_death_online_status = READY
Then party will be verified online with DRACS death acts registry via separate process: Online verification of Parties with DRACS death acts registry_EN
Calculate cumulative verification status
Calculate parties cumulative verification status based on parties verification status in each stream: DRFO registry verification, DRACS death acts registry verification according to logic described at Party verification status model:
Set calculated status to parties.verification_status field
Create StatusChangeEvent for each active employee related to a party in event manager with new verification status if it was changed
Response structure
Example:
Post-processing processes
API paragraph not found
HTTP status codes
HTTP status code | Message | What caused the error |
---|---|---|
200 | Response |
|
401 |
| Invalid scope |
422 | Email is already used by another person |
|
ЕСОЗ - публічна документація