Versions Compared

Key

  • This line was added.
  • This line was removed.
  • Formatting was changed.
Table of Contents
minLevel1
maxLevel3

...

Request to process the request using a token in the headers

Headers*

Наприклад:

  • Content-Type:application/json

  • api-key:c2778f3064753ea70de870a53795f5c9

...

  1. Validate id

    1. Check that contract with id from URL exist and is_active = true

      1. in case of error return 404 error ('Contract with such id is not found')

    2. Check that contract with such id have type = 'GB_CBP'

      1. in case of error return 409 error ('Only contracts with type GB_CBP can be updated')

  2. Validate status

    1. Check that status is one of ('VERIFIED', 'TERMINATED')

      1. in case of error return 422 error $.status ('Invalid contract status')

  3. Validate contractor_legal_entity_id

    1. Check that legal entity exist and is_active = true

      1. in case of error return 409 error $.contractor_legal_entity_id ('Invalid contractor legal entity id')

  4. Validate contractor_owner_id

    1. Check that employee exist

      1. in case of error return 404 error $.contractor_owner_id ('Employee is not found')

    2. Check that contractor_owner_id correspond to contractor_legal_entity_id and employee_type = OWNER and status = APPROVED and is_active = true

      1. in case of error return 422 error $.contractor_owner_id ('Contractor owner must be an active and within current legal entity')

  5. Validate contractor_base

    1. Check that the contractor_base string and maximum length is 255 characters

      1. in case of error return 422 error $.contractor_base ('expected value to have a maximum length of 255 but was %{actual}')

  6. Validate nhs_signer_id

    1. Check that employee exist

      1. in case of error return 404 error $.contractor_owner_id ('Employee is not found')

    2. Check that nhs_signer_id correspond to nhs_legal_entity_id and nhs_legal_entity_id = legal_entities.type = NHS and status = APPROVED and is_active = true

      1. in case of error return 422 error $.contractor_owner_id ('Contractor signer must be an active and within NHS legal entity')

  7. Validate nhs_signer_base

    1. Check that the nhs_signer_base string and maximum length is 255 characters

      1. in case of error return 422 error $.nhs_signer_base ('expected value to have a maximum length of 255 but was %{actual}')

  8. Validate nhs_legal_entity_id

    1. check that legal entity exist and is_active = true and nhs_legal_entity_id=legal_entities.type = NHS

      1. in case of error return 409 error $.contractor_legal_entity_id ('Invalid nhs signer id')

  9. Validate nhs_payment_method

    1. check that nhs_payment_method one of ('BACKWARD', 'FORWARD')

      1. in case of error return 422 error $.nhs_payment_method ('Invalid nhs payment method')

  10. Validate is_suspended

    1. Check that the is_suspended boolean

      1. in case of error return 422 error $.is_suspended ('type mismatch. Expected boolean but got %{actual}')

  11. Validate issue_city

    1. Check that the issue_city string and maximum length is 255 characters

      1. in case of error return 422 error $.issue_city ('expected value to have a maximum length of 255 but was %{actual}')

  12. Validate contract_number

    1. Сheck format contract_number: contract number structure XXXX-1234-5678-C , where:
      XXXX - series: numbers + only some letters (A, E, H, K, M, P, T, X)
      1234-5678 - randomly generated numbers and letters A, E, H, K, M, P, T, X

      1. in case of error return 422 error $.contract_number ('string does not match pattern \"^\\d{4}-[\\dAEHKMPTX]{4}-[\\dAEHKMPTX]{4}$\"')

    2. check there is a contract with such contract_number already exist

      1. in case of error return 422 error $.contract_number ('Verified contract with such number already exists')

  13. Validate nhs_signer_base

    1. Check that nhs_signer_base string and maximum length is 255 characters

      1. in case of error return 422 error $.nhs_signer_base ('expected value to have a maximum length of 255 but was %{actual}')

  14. Validate type

    1. Check that type is 'GB_CBP'

      1. in case of return 409 error $.type ('Invalid contract type')

  15. Validate contractor_payment_details

    1. Check that MFO in the ^[0-9]{6}$ format

      1. in case of error return error 422 $.contractor_payment_details.MFO ('string does not match pattern \"^[0-9]{6}$\')

    2. Check that payer_account in the ^(UA[0-9]{22}|UA[0-9]{27}|[0-9]+)$ format

      1. in case of error return error 422 $.contractor_payment_details.payer_account ('string does not match pattern \"^(UA[0-9]{22}|UA[0-9]{27}|[0-9]+)$')

  16. Validate id_form

    1. Сheck that value exists in the CONTRACT_TYPE dictionary

      1. in case of error return error 422 $.id_form ('value is not allowed in enum')

  17. Validate parent_contract_id

    1. Check that parent_contract_id exist in contracts.id and correspond to contractor_legal_entity_id

      1. in case of error return error 422 $.parent_contract_id ('Parent contract id should be correspond to contractor legal entity')

    2. Check that id from parent_contract_id is Terminated

      1. in case of error return 409 $.parent_contract_id ("Parent contract should be in Terminated status")

  18. Validate medical_programs

    1. Check that medical_programs exist and medical_programs.type = 'SERVICE'

      1. in case of error return 404 $.medical_program_id ('Medical program is not found')

    2. Validate that list of medical programs in array doesn't contain duplicates ids:

      1. in case of error return 409 error view $medical_programs ('The list of medical programs contains duplicates')

...