Table of Contents | ||||
---|---|---|---|---|
|
Required parameters are marked with "*"
...
Purpose
...
This WS allows to terminate contract either by NHS or Legal Entity Side (if scope was allowed).
Specification
...
Page Properties | ||||||||||||||||||
---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|
|
Logic
...
This WS is designed to terminate contract. Contract must be in status 'VERIFIED'
...
Input parameter | Values | Type | Description | Example |
---|---|---|---|---|
id | String |
|
Request structure
...
See on Apiary
Example:
Expand | ||
---|---|---|
| ||
|
Authorize
...
Verify the validity of access token
in case of error return 401 ('Access denied')
Check user scope contract:terminate in order to perform this action
in case of error generate 401 response ('Invalid scopes')
Request to process the request using a token in the headers
Headers
...
Наприклад:
Content-Type:application/json
Authorization:Bearer c2778f3064753ea70de870a53795f5c9
Request data validation
...
Validate User
Extract legal_entity_id (client_id) from token.
Check client_id=contractor_legal_entity_id or client_id=nhs_legal_entity_id
in case of error return 403 "User is not allowed to perform this action"
Validate contract request status
Check contract_request.status='VERIFIED'
in case error return 409 - "Incorrect status of contract_request to modify it"
Processing
...
Auto termination
Fetch all contract with end_date<now(). Set status and status reason for such contract as below:
...
set is_active = false
set deactivate_reason = AUTO_CONTRACT_TERMINATION
set updated_at, updated bby
Response structure
...
See on Apiary
Example:
Expand | ||
---|---|---|
| ||
|
...
field | value |
---|---|
status | TERMINATED |
status_reason | $.status_reason |
updated_at | now() |
updated_by | $.user_id |
Post-processing processes*
...
HTTP status codes
HTTP status code | Message | What caused the error |
---|---|---|
200 |
|
|
...