Versions Compared

Key

  • This line was added.
  • This line was removed.
  • Formatting was changed.

...

...

...

...

...

...

...

...

...

...

...

...

...

...

Table of Contents

...

minLevel1
maxLevel3

Required parameters are marked with "*"

Якщо інформації по відповідному параметру немає, потрібно зазначити: “APIparagraph not found”.

Purpose

This WS allows to terminate contract request by legal entity.

Request

  • status_reason

Authorize

  1. Verify the validity of access token

    1. in case of error return 401 ('Access denied')

  2. Check user scope contract_request:termiante in order to perform this action

    1. in case of error generate 401 response ('Invalid scopes')

Validate User

  1. Extract legal_entity_Extract party_id (clientassociated with user_id) from token.

    1. Check client

      Check party_id=

      contractor_legal_entity_id  
      1. in case of error return 403 "User is not allowed to perform this action"
    Extract token →  users.id →
    1. party

    _users
    1. .

    party_id → employee_id
    1. Check employees.employee_id=

      contractor_owner_id

      and client_id=employee.legal_entity_id

      1. in case of error return 403 "User is not allowed to perform this action"

Validate contract request status

  • Check contract_request.status<>SIGNED

    • in case error return 422 - "Incorrect status of contract_request to modify it"

Response

mapping


field

value

status

TERMINATED

status_reason

$.status_reason

updated_at

now()

updated_by

$.user_id


Auto termination

  • Fetch all contract_request with start_date<now().

  • for REIMBURSEMENT contracts

    • - find contracts in status NHS_SIGNED and nhs_signed < today -`REIMBURSEMENT_CONTRACT_REQUEST_AUTOTERMINATION_PERIOD_DAYS`

  • for CAPITATION contracts

    • - find contracts in status NHS_SIGNED and nhs_signed < today -`CAPITATION_CONTRACT_REQUEST_AUTOTERMINATION_PERIOD_DAYS`

Set status and status reason for such contract request as below:


field

value

status

TERMINATED

status_reason

$.auto_expired

updated_at

now()

updated_by

$.user_id


Add status to event manager

After status was changed (status = TERMINATED) - add new status to event_manager


field

value

event_type

StatusChangeEvent

entity_type

Contract_request

entity_id

$.id

properties.status.new_value

$.status

event_time

$.update_at

changed_by

$.changed_by