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

RC._Resend SMS on Service request_EN

Purpose

This WS is designed to resend sms with OTP-code to the person’s verified phone on service request in case OTP wasn’t delivered in first time.

Specification

Apiary

Key points

  1. Only authenticated and authorized user with appropriate scope can resend SMS on Service Request.

  2. SMS with OTP-code can be resend only to person with verification_type = OTP.

  3. SMS with OTP-code can be resend only for Service Request in ‘ACTIVE' and program processing status ‘NEW’, ‘IN QUEUE’, ’IN_PROGRESS’.

Logic

  1. Search for service_request by patient_id + service_request_id

  2. Validate Legal Entity

  3. Check status of service_request

  4. Send SMS to the person’s verified phone

Authorization

  1. Verify the validity of access token

    1. in case of error - return 401 (“Invalid access token”) in case of validation fails

  2. Verify that token is not expired

    1. in case of error - return 401 (“Invalid access token”)

  3. Check user scopes in order to perform this action (scope = 'service_request:use')

    1. return 403 (“Your scope does not allow to access this resource. Missing allowances: service_request:write”) in case of invalid scope(s)

Input parameters

  • patient_id - identifier of person

  • service_request_id - identifier of service_request

Validate transition

  1. Check if service request with service_request_id from request is exist

    1. in case of error - return 404 (“Not found”) in case of validation fails

  2. Validate person

    1. Check if person with patient_id from request is exist

      1. in case of error - return 404 (“Not found”) in case of validation fails

    2. Check if person with patient_id from request is not preperson

      1. in case of validation fails skip all steps below

  3. Validate legal entity

    1. Check that legal_entity_type is included in chart variables ME_ALLOWED_TRANSACTIONS_LE_TYPES config parameter

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

    2. Check that legal_entity has status = active

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

  4. Validate service_request

    1. Check that status = ‘active' and ProgramProcessinStatus in (’new', ‘in_queue', ‘in_progress’)

      1. in case of error - return 409 error ('You can not resend SMS for service request in status %status%')

      2. in case of error - return 409 error ('You can not resend SMS for service request in program processing status %program_processing_status%')

Processing

  1. Get person's authentication_method of MPI

  2. If authentication_method == OTP - send SMS:

    1. Generate text SMS (call Man method- templates rendering service with template SERVICE_REQUEST_CREATE_SMS.

  3. Send SMS

  4. Save internal information to corresponding DB

 

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