Table of Contents | ||
---|---|---|
|
...
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 = 'composition:resend_sms')
return 403 (“Your scope does not allow to access this resource. Missing allowances: composition:resend_sms”) in case of invalid scope(s)
...
Call SMS timeout procedure to check if resending is allowed using:
COMPOSITION_MAX_ATTEMPTS_COUNT as MAX_ATTEMPTS_COUNT
COMPOSITION_SEND_TIMEOUT as SEND_TIMEOUT
"composition" as entity_name
composition_id as entity_id
in case of error - return 429 ("Sending SMS timeout. Try later. Next attempt will be available at <attempts.oldest.value + SEND_TIMEOUT>")
Get person's authentication_method according to logic:
If
authorize_withinform_with exists in Composition 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 parameterif it is set to
true
- for authentication method with type = THIRD_PERSON check that person from value is an approved confidant for a person from Composition:exists active and approved confidant person relationship between patient from the Composition and confidant_person_id from authentication method value (using following logic: Check confidant person relationship with
person_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
authorize_withinform_with
If authentication_method == OTP or THIRD_PERSON (with OTP)
Generate text SMS with template
CREATE_{{COMPOSITION_TYPE}}_COMPOSITION_SMS_TEMPLATE
.Send SMS
else, if authentication_method is not OTP or THIRD_PERSON (with OTP) return an error
return 409 ('Authentication method doesn't exist or is inactive')