ЕСОЗ - публічна документація

Skip to end of metadata
Go to start of metadata

You are viewing an old version of this page. View the current version.

Compare with Current View Page History

Version 1 Next »

Requirements

Перевірка та взяття в обробку направлення за програмою медичним закладом

Validations

Authorization

  • Verify the validity of access token

    • Return (401, 'unauthorized') in case of validation fails

  • Verify that token is not expired

    • in case of error - return (401, 'unauthorized')

  • Check user scopes in order to perform this action (scope = 'service_request:write')

    1. Return (403, 'invalid scopes') in case of invalid scope(s)

Validate request using JSON Schema

Return 422 with the list of validation errors in case validation fails

Validate request

  1. legal entity

    1. Check legal_entity.type in me_allowed_transactions_le_types config parameter and legal_entity.status = ACTIVE 

      1. in case of error return 409 "Action is not allowed for the legal entity"

  2. service request

    1. validate SR.status in (new,In Queue,In Progress)

      1. in case error return 409, “service request has wrong status“

  3. contract

    1. check legal_entity (from token) has active contract with type = '________'(TBD)

      1. in case error return 409, “Legal entity does not have a proper contract“

    2. validate dates start_date <= now <=end_date

      1. in case error return 409, “contract is not active“

    3. validate contract.status = 'VERIFIED' and is_active=true

      1. in case error return 409, “contract is not active“

    4. validate contract.is_suspended = false

      1. in case error return 409, “Contract is suspended and should be updated“

  4. program

    1. For each program validate it is an existing service program with type=service

      1. in case not found or is_active==false write result in Data collection according to apiary

      2. in case type!= service write result in Data collection according to apiary - "Invalid program type"

    2. For each program validate that service(or service_group) is an active member of the program

      1. Select is_active from PRM.program_services where service_id(or group_id) == $.signed_content.code.identifier.value and program_id=$.program.identifier.value

        1. if not found or is_active==false write result in Data collection according to apiary - "Service is not included in the program"

Prepare & return response data structure

  1. Fill response WS data structure 

  2. Validate response using JSON schemas

    1. Return 422 with list of validation errors in case validation fails (422 EView)

  • No labels