use of com.amazon.speech.ui.PlainTextOutputSpeech in project amos-ss17-alexa by c-i-ber.
the class SavingsPlanDialog method cancelAction.
private SpeechletResponse cancelAction() {
PlainTextOutputSpeech speech = new PlainTextOutputSpeech();
speech.setText("OK tschuess!");
return SpeechletResponse.newTellResponse(speech);
}
use of com.amazon.speech.ui.PlainTextOutputSpeech in project amos-ss17-alexa by c-i-ber.
the class StandingOrderService method getStandingOrderKeywordResultsInfo.
private SpeechletResponse getStandingOrderKeywordResultsInfo(Session session) {
session.setAttribute(DIALOG_CONTEXT, "StandingOrderInfo");
StringBuilder builder = new StringBuilder();
for (int i = 0; i <= 1; i++) {
builder.append(standingOrders.get(i).getSpeechOutput());
}
if (standingOrders.size() > 2) {
return askForFurtherStandingOrderEntry(session, builder, 2);
} else {
builder.append("Das waren alle vorhandenen Dauerauftraege. ");
PlainTextOutputSpeech speech = new PlainTextOutputSpeech();
speech.setText(builder.toString());
return SpeechletResponse.newTellResponse(speech);
}
}
use of com.amazon.speech.ui.PlainTextOutputSpeech in project amos-ss17-alexa by c-i-ber.
the class StandingOrderService method getStandingOrdersModifyResponse.
private SpeechletResponse getStandingOrdersModifyResponse(Intent intent, Session session) {
String standingOrderToModify = (String) session.getAttribute("StandingOrderToModify");
String newAmount = (String) session.getAttribute("NewAmount");
// TODO never used
String newExecutionRate = (String) session.getAttribute("NewExecutionRate");
String newFirstExecution = (String) session.getAttribute("NewFirstExecution");
ObjectMapper mapper = new ObjectMapper();
// Create the Simple card content.
SimpleCard card = new SimpleCard();
card.setTitle("Ändere Dauerauftrag");
// Create the plain text output.
PlainTextOutputSpeech speech = new PlainTextOutputSpeech();
Number standingOrderNum = Integer.parseInt(standingOrderToModify);
StandingOrder standingOrder = AccountAPI.getStandingOrder(ACCOUNT_NUMBER, standingOrderNum);
// TODO: Actually update the StandingOrder
standingOrder.setAmount(Integer.parseInt(newAmount));
AccountAPI.updateStandingOrder(ACCOUNT_NUMBER, standingOrder);
card.setContent("Dauerauftrag Nummer " + standingOrderToModify + " wurde geändert.");
speech.setText("Dauerauftrag Nummer " + standingOrderToModify + " wurde geaendert.");
return SpeechletResponse.newTellResponse(speech, card);
}
use of com.amazon.speech.ui.PlainTextOutputSpeech in project amos-ss17-alexa by c-i-ber.
the class StandingOrderService method askForModificationConfirmation.
private SpeechletResponse askForModificationConfirmation(Intent intent, Session session) {
Map<String, Slot> slots = intent.getSlots();
Slot numberSlot = slots.get("Number");
Slot amountSlot = slots.get("Amount");
Slot executionRateSlot = slots.get("ExecutionRate");
Slot firstExecutionSlot = slots.get("FirstExecution");
if (numberSlot.getValue() == null || (amountSlot.getValue() == null && executionRateSlot.getValue() == null && firstExecutionSlot.getValue() == null)) {
String text = "Das habe ich nicht ganz verstanden. Bitte wiederhole deine Eingabe.";
return getAskResponse(STANDING_ORDERS, text);
}
session.setAttribute("StandingOrderToModify", numberSlot.getValue());
session.setAttribute("NewAmount", amountSlot.getValue());
session.setAttribute("NewExecutionRate", executionRateSlot.getValue());
session.setAttribute("NewFirstExecution", firstExecutionSlot.getValue());
// Create the plain text output
PlainTextOutputSpeech speech = new PlainTextOutputSpeech();
speech.setText("Soll ich den Betrag von Dauerauftrag Nummer " + numberSlot.getValue() + " wirklich auf " + amountSlot.getValue() + " Euro aendern?");
// Create reprompt
Reprompt reprompt = new Reprompt();
reprompt.setOutputSpeech(speech);
return SpeechletResponse.newAskResponse(speech, reprompt);
}
use of com.amazon.speech.ui.PlainTextOutputSpeech in project amos-ss17-alexa by c-i-ber.
the class ReplacementCardService method askForCardNumber.
private SpeechletResponse askForCardNumber(Session session, boolean errored) {
// TODO: Load account from session
Collection<Card> cards = AccountAPI.getCardsForAccount(ACCOUNT_NUMBER);
if (cards.size() == 0) {
// This user does not have any cards, ordering a replacement card is impossible.
PlainTextOutputSpeech speech = new PlainTextOutputSpeech();
speech.setText("Es wurden keine Kredit- oder EC-Karten gefunden.");
return SpeechletResponse.newTellResponse(speech);
} else {
SsmlOutputSpeech speech = new SsmlOutputSpeech();
StringBuilder stringBuilder = new StringBuilder();
stringBuilder.append("<speak>");
if (errored) {
stringBuilder.append("Entschuldigung, das habe ich nicht verstanden. ");
}
stringBuilder.append("Bestellung einer Ersatzkarte. Es wurden folgende Karten gefunden: ");
List<Card> userCards = new ArrayList<>();
for (Card card : cards) {
// Check if this card is active
if (card.getStatus() != Card.Status.ACTIVE) {
continue;
}
userCards.add(card);
String prefix = (card.getCardType() == Card.CardType.CREDIT ? "Kredit" : "EC-");
stringBuilder.append(prefix + "karte mit den Endziffern <say-as interpret-as=\"digits\">" + card.getCardNumber().substring(card.getCardNumber().length() - 4) + "</say-as>. ");
}
// Store all card numbers in the session
SessionStorage.getInstance().getStorage(session.getSessionId()).put(STORAGE_VALID_CARDS, userCards);
stringBuilder.append("Bitte gib die Endziffern der Karte an, für die du Ersatz benötigst.");
stringBuilder.append("</speak>");
speech.setSsml(stringBuilder.toString());
// Create reprompt
Reprompt reprompt = new Reprompt();
reprompt.setOutputSpeech(speech);
return SpeechletResponse.newAskResponse(speech, reprompt);
}
}
Aggregations