@startuml
title  setOrUpdatePinManagement Request
autonumber "<color:red><b>00 "
skinparam backgroundColor #FFFFFF
skinparam sequence {
    TitleFontSize 20
    ActorFontSize 12
    ParticipantFontSize 12
    ParticipantPadding 40
    ArrowFontSize 12
}
box "<size:16>Secure ID" #Beige
participant "EUI App / EUI App Profile / ASDK" as EUI_APP
participant "EUI App Services" as SVR
end box
participant "IAM" as IAM

EUI_APP -> SVR: Request coming from EUI-APP/EUI-PROFILE to setOrUpdatePinManagement in profile.\n (/setOrUpdatePinManagement)
SVR -> SVR: Middleware checks for valid CSRF-TOKEN.
alt Invalid or missing CSRF-TOKEN
      SVR -> EUI_APP:     <b> 403 Forbidden</b>
      note right of EUI_APP: { \n "error": "Invalid request, cannot complete processing." \n }
end
SVR -> SVR: Middleware checks for valid validateAuthSession.
alt Invalid or missing validateAuthSession
      SVR -> EUI_APP:     <b> 403 Forbidden</b>
      note right of EUI_APP: { \n "error": "Invalid request, cannot complete processing." \n }
end
SVR -> SVR: Checks whether request is having mandatory parameters.
alt Invalid Request
      SVR -> EUI_APP:     <b> 400 Forbidden</b>
      note right of EUI_APP: { \n "error": "Invalid request." \n }
end
alt If Request is valid then check pin in present in the redis
      SVR -> EUI_APP: <b> Set PIN Object  Received from REDIS for setOrUpdate functionality and response value is</b>"
end
alt If Request is valid then check pin in not present in the redis
      SVR -> EUI_APP: <b> error occurred while retrieving REDIS object  for setPIN cookie value</b>"
end
alt invoking pin 
      SVR -> IAM:     <b> 200 </b>
      note right of EUI_APP: {\n "status": "OK", \n "urlParameters": { "redirect_uri": "https://reg5.eservice.t-mobile.com&", \n "scope': 'TMO_ID_profile billing_information associated_lines", \n "client_id": "A-9A00mpqSOr_", \n  "access_type": "ONLINE", \n "response_type": "code", \n "approval_prompt": "auto", \n "device_type": "desktop", \n "requireAuthorization": true, \n "user_id": "uid:U-e253e52e-18b4-4087-8f61-61c699220f65", \n  "state": 'false'} \n}
end



@enduml