public String render(Window window, USSDResponse response)
        {
            StringBuilder builder = new StringBuilder();

            foreach (Message message in window.getMessages())
            {
                builder.Append(message.getContent());
                builder.Append("\n");
            }

            foreach (MenuItem menuItem in window.getMenuItems())
            {
                builder.Append(menuItem.Index + "." + menuItem.Description + "\n");
            }

            String final = builder.ToString();
            USSDSession <Object> session = response.getSession();

            foreach (Object key in session.Keys)
            {
                Object value = session[(String)key];
                final = final.Replace("\\{\\{" + (String)key + "\\}\\}", value.ToString()); //ToDo: Fix this!
            }

            return(final);
        }
Exemple #2
0
        protected void delegateRequest(USSDRequest request, USSDSession <Object> session, USSDResponse response)
        {
            USSDResponse ussdResponse = BantU.executeRequest(application, request, session);

            response.setWindow(ussdResponse.getWindow());
            response.setResponseType(ussdResponse.getResponseType());
            response.setSession(ussdResponse.getSession());
        }