@startuml
start

if (Query NM DB) then (Success)
 : Transform DB Record;
 -> HTTP Response 200;
 stop
else if (No Data in DB or NM DB down) then (yes)

if (SOR master) then (Yes)
 : Call SA GetNumberDetails;
 if (SA Unavailable) then (Yes)
 -> HTTP Response 503;
 stop
 else (No)
 -> HTTP Response from SA;
 stop
 endif
 else (No)
 split
 : Hystrix fallback for DB Down;
 -> HTTP Response 503;
 stop
 split again
 : No Data Exception;
 -> HTTP Response 404;
 stop
 end split
 endif

else (No)
 -> Other Exception - HTTP Response 500;
 stop
 endif

@enduml