コード例 #1
0
  /*
  Send out and confirm it has been sent
   */
  @RequestMapping(value = path + "send")
  @ResponseBody
  public Request voteSend(
      @RequestParam(value = phoneNumber) String inputNumber,
      @RequestParam(value = entityUidParam) String requestUid)
      throws URISyntaxException {

    User user = userManager.findByInputNumber(inputNumber, null);
    USSDMenu menu;

    try {
      String createdUid = eventRequestBroker.finish(user.getUid(), requestUid, true);
      Event vote = eventBroker.load(createdUid);
      log.info(
          "Vote details confirmed! Closing date and time: "
              + vote.getEventDateTimeAtSAST().format(dateTimeFormat));
      menu = new USSDMenu(getMessage(thisSection, "send", promptKey, user), optionsHomeExit(user));
      return menuBuilder(menu);
    } catch (EventStartTimeNotInFutureException e) {
      final String messageKey = USSDSection.VOTES.toKey() + "send.err.past.";
      menu = new USSDMenu(getMessage(messageKey + promptKey, user));
      menu.setFreeText(false);
      menu.addMenuOption(
          voteMenus + "send-reset" + entityUidUrlSuffix + requestUid,
          getMessage(messageKey + "yes", user));
      menu.addMenuOption(backVoteUrl("time", requestUid), getMessage(messageKey + "no", user));
      return menuBuilder(menu);
    }
  }
コード例 #2
0
 @RequestMapping(value = path + "send-reset")
 public Request voteSendResetTime(
     @RequestParam(value = phoneNumber) String inputNumber,
     @RequestParam(value = entityUidParam) String requestUid)
     throws URISyntaxException {
   User user = userManager.findByInputNumber(inputNumber, null);
   setStandardTime(requestUid, "instant", user);
   eventRequestBroker.finish(user.getUid(), requestUid, true);
   return menuBuilder(
       new USSDMenu(getMessage(thisSection, "send", promptKey, user), optionsHomeExit(user)));
 }