Versions Compared

Key

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

Purpose

This WS is designed to change status of contract request to DECLINED by NHS ADMIN SIGNER. NHS employee can change status of contract request through Admin portal. If NHS Admin wants to decline contract request he/she need to enter a reason.

...

  • status_reason

Validation

Validate token

  • Verify the validity of access token
    • Return 401 in case validation fails
  • Check if token is not expired
    • in case error return 401 - "Token is expired"

...

  • Check if user is active
    • in case error return 403 - (user is not active)
  • check nhs_legal_entity is active
    • in case error return 403 - (Client is not active)
  • Check user role = "NHS ADMIN SIGNER"
    • in case error return 403 "User is not allowed to perform this action"

Validate scopes

  • Check user scopes in order to perform this action (scope = 'contract_requests:update')
    • Return 403 in case invalid scope(s) "Your scope does not allow to access this resource. Missing allowances: contract_requests:update"

Digital signature

Decode content that is encrypted in an electronic digital signature.
Use Digital signature WS. Method checks digital signature and returns result.

Validate EDRPOU

  1. Check that EDRPOU in Certificate details exists and not empty
    1. in case of error return 422 error ('Invalid EDRPOU in DS')
  2. Check that EDRPOU in Certificate details is equal to EDPOU in legal entity
    1. Get client_id from token.
    2. Find prm.legal_entities id by client_id
    3. Compare EDRPOU in Certificate with legal_entities.edrpou
    4. In case validation fails - generate 422 error
  3. Check that SURNAME in Certificate details is equal to LAST_NAME in Party
    1. Get user_id → user_parties.party_id → parties.last_name and compare to surname from DS
      1. Convert prm.parties.LAST_NAME and Certificate details.SURNAME to uppercase
      2. Compare prm.parties.LAST_NAME and Certificate details.SURNAME as Cyrillic letters
      3. In case validation fails - generate 422 error

Validate DRFO

  1. Get parties.tax_id using party_users.party_id by user_id.
  2. Compare DRFO in Certificate with party.tax_id
    1. Convert DRFO and TAX_ID to uppercase
    2. Compare DRFO and TAX_ID as Cyrillic letters
    3. Convert DRFO to Cyrillic and compare as Cyrillic letters
  3. In case validation fails - generate 422 error

Validate request

  1. Check that all fields are present in signed content
    1. "id"
    2. "contractor_legal_entity":
      1. "id"
      2. "name"
      3. "edrpou"
    3. "next_status"
    4. "status_reason"
    5.  "text"
  2. Check next_status='DECLINED'
  3. Validate contract request id.
    1. Check contract_requests.id = $.id
      1. in case error return 404 ("Contract request with id=$id doesn't exist")
  4. Validate contractor_legal_entity_id
    1. Legal_entities.id = $.contractor_legal_entity.id and Legal_entities.status='ACTIVE' and is_active=true,
      1. in case error return 422 ("Legal entity in contract request should be active")
    2. $contractor_legal_entity.edrpou in request=prm.legal_entities.edrpou
    3. $contractor_legal_entity.name in request=prm.legal_entities.name

Validate contract request status

...

fieldvalue
statusDECLINED
status_reason$.status_reason
updated_atnow()
updated_by$.user_id
nhs_signer_id$.user_id
nhs_legal_entity_id$.client_id

Save signed contract request to media storage

  1. Get url for contract request upload.


    Parameter
    Source
    action'GET'
    bucket'CONTRACT_REQUEST'
    resource_id: CONTRACT_REQUEST_ID
    resource_name: CONTRACT_REQUEST_DECLINED
    timestamp:TIMESTAMP


  2. Upload signed declaration to media storage

...