ЕСОЗ - публічна документація
RC_(CSI-2483,CR-441)_Resend SMS on Service request
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
Key points
Only authenticated and authorized user with appropriate scope can resend SMS on Service Request.
SMS with OTP-code can be resend only to person with verification_type = OTP.
SMS with OTP-code can be resend only for Service Request in ‘ACTIVE' and program processing status ‘NEW’, ‘IN QUEUE’, ’IN_PROGRESS’.
It is possible to send an SMS using this API even if it wasn’t sent on Create Service request due to the performer being set or a technical error.
Logic
Search for service_request by patient_id + service_request_id
Validate Legal Entity
Check status of service_request
Send SMS to the person’s verified phone
Authorization
Verify the validity of access token
in case of error - return 401 (“Invalid access token”) in case of validation fails
Verify that token is not expired
in case of error - return 401 (“Invalid access token”)
Check user scopes in order to perform this action (scope = 'service_request:use')
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
Check if service request with service_request_id from request is exist
in case of error - return 404 (“Not found”) in case of validation fails
Validate person
Check if person with patient_id from request is exist
in case of error - return 404 (“Not found”) in case of validation fails
Check if person with patient_id from request is not preperson
in case of validation fails skip all steps below
Validate legal entity
Check that legal_entity_type is included in chart variables
ME_ALLOWED_TRANSACTIONS_LE_TYPES
config parameterin case of error return 409 "Action is not allowed for the legal entity"
Check that legal_entity has status = active
in case of error return 409 "Action is not allowed for the legal entity"
Validate service_request
Check that status = ‘active' and ProgramProcessinStatus in (’new', ‘in_queue', ‘in_progress’)
in case of error - return 409 error ('You can not resend SMS for service request in status %status%')
in case of error - return 409 error ('You can not resend SMS for service request in program processing status %program_processing_status%')
Processing
If inform_with exists in service request and is not empty, check:
Authentication method exists in person_authentication_methods table in MPI DB (with is_active=true), is active (ended_at > now() or null)
Get value of
THIRD_PERSON_CONFIDANT_PERSON_RELATIONSHIP_CHECK
config parameter, if it is set totrue
- for authentication method with type = THIRD_PERSON check that person from value is an approved confidant for a person from service request – exists active and approved confidant person relationship between person from request and confidant_person_id from authentication method value (using following logic: https://e-health-ua.atlassian.net/wiki/spaces/CSI/pages/17667883028 withperson_id
= person from request andconfidant_person_id
= value from auth method - expected:ok, :approved
response)in case any validation failed - return 409 ('Authentication method doesn't exist or is inactive')
else - get authentication_method from inform_with
If inform_with does not exist in service request or is empty - get person's authentication_method of MPI
If authentication_method == OTP - send SMS:
Generate text SMS (call Man method- templates rendering service with template
SERVICE_REQUEST_CREATE_SMS
.
Send SMS
Save internal information to corresponding DB
ЕСОЗ - публічна документація