Table of Contents | ||||
---|---|---|---|---|
|
Required parameters are marked with "*"
...
Purpose
...
This WS allows to update end_date for contracts in case legal entity was merged and can't sign new contract.
Specification
...
Page Properties | ||||||||||||||||
---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|
|
...
|
Logic
This WS allows to update end_date for contracts in case legal entity was merged and can't sign new contract. Contract must be in status 'VERIFIED'
Input parameters
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:update 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=nhs_legal_entity_id
in case of error return 403 "User is not allowed to perform this action"
Validate contract ID
Check contract.id exists
in case error return 404 - "Contract is not found"
Validate contract status
Check contract.status='VERIFIED'
in case error return 409 - "Incorrect contract status to modify it"
Validate contractor_legal_entity_id
Check there is a record contract.contractor_legal_entity_id=prm.related_legaLentities.merged_from_id and is_active=true
in case error return 422 - "Contract for this legal entity must be resign with standard procedure"
Check contractor_legal_entity status = 'active'
in case of error return 422 error 'Legal entity is not active'
Validate end_date
Check end_date>contract.end_date and end_date>now()
in case error return 422 - "Invalid end_date"
Processing*
API paragraph not found
...
.end_date and end_date>now()
in case error return 422 - "Invalid end_date"
Processing
WS sets data at DB from reuest
field | value |
---|---|
end_date | $end_date |
updated_at | now() |
updated_by | $.user_id |
Response structure
See on Apiary
Example:
Expand | ||
---|---|---|
| ||
|
Expand | ||
---|---|---|
| ||
|
Response mapping
...
field
...
value
...
end_date
...
$end_date
...
updated_at
...
now()
...
updated_by
...
$.user_id
Post-processing processes*
API paragraph not found
HTTP status codes*
HTTP status code | Message | What caused the error |
---|---|---|
200 |
|
|
...