use of com.amazon.speech.ui.SimpleCard in project amos-ss17-alexa by c-i-ber.
the class AmosAlexaSpeechlet method bankTransfer.
/**
* Transfers money and returns response with
*
* @return SpeechletResponse spoken and visual response for the given intent
*/
private SpeechletResponse bankTransfer(Map<String, Slot> slots) {
Slot amountSlot = slots.get("amount");
Slot nameSlot = slots.get("name");
String amount = amountSlot.getValue();
String name = nameSlot.getValue();
//getting response regarding account balance
this.getAccountBalanceResponse();
//transfering money
String url = "http://amos-bank-lb-723794096.eu-central-1.elb.amazonaws.com/api/v1_0/transactions";
String urlParams = "{\n" + " \"amount\" : " + amount + ",\n" + " \"sourceAccount\" : \"DE23100000001234567890\",\n" + " \"destinationAccount\" : \"DE60643995205405578292\",\n" + " \"valueDate\" : \"2017-05-16\",\n" + " \"description\" : \"Beschreibung\"\n" + "}";
ApiHelper.sendPost(url, urlParams);
//reply message
String speechText = "Die " + amount + " wurden zu " + name + " überwiesen";
// Create the Simple card content.
SimpleCard card = new SimpleCard();
card.setTitle("CreditLimit");
card.setContent(speechText);
// Create the plain text output.
PlainTextOutputSpeech speech = new PlainTextOutputSpeech();
speech.setText(speechText);
// Create reprompt
Reprompt reprompt = new Reprompt();
reprompt.setOutputSpeech(speech);
return SpeechletResponse.newAskResponse(speech, reprompt, card);
}
use of com.amazon.speech.ui.SimpleCard in project amos-ss17-alexa by c-i-ber.
the class AmosAlexaSpeechlet method getHelpResponse.
/**
* Creates a {@code SpeechletResponse} for the help intent.
*
* @return SpeechletResponse spoken and visual response for the given intent
*/
private SpeechletResponse getHelpResponse() {
String speechText = "You can say hello to me!";
// Create the Simple card content.
SimpleCard card = new SimpleCard();
card.setTitle("HelloWorld");
card.setContent(speechText);
// Create the plain text output.
PlainTextOutputSpeech speech = new PlainTextOutputSpeech();
speech.setText(speechText);
// Create reprompt
Reprompt reprompt = new Reprompt();
reprompt.setOutputSpeech(speech);
return SpeechletResponse.newAskResponse(speech, reprompt, card);
}
use of com.amazon.speech.ui.SimpleCard in project amos-ss17-alexa by c-i-ber.
the class AmosAlexaSpeechlet method getWelcomeResponse.
/**
* Creates and returns a {@code SpeechletResponse} with a welcome message.
*
* @return SpeechletResponse spoken and visual response for the given intent
*/
private SpeechletResponse getWelcomeResponse() {
String speechText = "Welcome to the Alexa Skills Kit, you can say hello";
// Create the Simple card content.
SimpleCard card = new SimpleCard();
card.setTitle("HelloWorld");
card.setContent(speechText);
// Create the plain text output.
PlainTextOutputSpeech speech = new PlainTextOutputSpeech();
speech.setText(speechText);
// Create reprompt
Reprompt reprompt = new Reprompt();
reprompt.setOutputSpeech(speech);
return SpeechletResponse.newAskResponse(speech, reprompt, card);
}
use of com.amazon.speech.ui.SimpleCard in project amos-ss17-alexa by c-i-ber.
the class AmosAlexaSpeechlet method getCreditLimitResponse.
/**
* Creates and returns a {@code SpeechletResponse} with the current account balance.
*
* @return SpeechletResponse spoken and visual response for the given intent
*/
private SpeechletResponse getCreditLimitResponse() {
double creditLimit = 2000.91;
String speechText = "Your credit limit is " + Double.toString(creditLimit);
// Create the Simple card content.
SimpleCard card = new SimpleCard();
card.setTitle("CreditLimit");
card.setContent(speechText);
// Create the plain text output.
PlainTextOutputSpeech speech = new PlainTextOutputSpeech();
speech.setText(speechText);
// Create reprompt
Reprompt reprompt = new Reprompt();
reprompt.setOutputSpeech(speech);
return SpeechletResponse.newAskResponse(speech, reprompt, card);
}
use of com.amazon.speech.ui.SimpleCard in project amos-ss17-alexa by c-i-ber.
the class StandingOrderService method smartCreateStandingOrderResponse.
/**
* Creates a {@code SpeechletResponse} for the standing orders intent.
*
* @return SpeechletResponse spoken and visual response for the given intent
*/
private SpeechletResponse smartCreateStandingOrderResponse(Session session) {
SimpleCard card = new SimpleCard();
card.setTitle("Daueraufträge");
LOGGER.info("SmartStandingOrders create called.");
int standingOrderToModify = (int) session.getAttribute("StandingOrderToModify");
String newAmount = (String) session.getAttribute("NewAmount");
StandingOrder oldStandingOrder = AccountAPI.getStandingOrder(ACCOUNT_NUMBER, standingOrderToModify);
StandingOrder standingOrder = new StandingOrder();
standingOrder.setAmount(Integer.parseInt(newAmount));
standingOrder.setDescription("description");
standingOrder.setDestinationAccount(oldStandingOrder.getDestinationAccount());
standingOrder.setExecutionRate(oldStandingOrder.getExecutionRate());
standingOrder.setFirstExecution(oldStandingOrder.getFirstExecution());
standingOrder.setPayee(oldStandingOrder.getPayee());
standingOrder.setSourceAccount(oldStandingOrder.getSourceAccount());
standingOrder.setStatus(oldStandingOrder.getStatus());
AccountAPI.createStandingOrderForAccount(ACCOUNT_NUMBER, standingOrder);
// Create the plain text output
PlainTextOutputSpeech speech = new PlainTextOutputSpeech();
speech.setText("Der neue Dauerauftrag für " + oldStandingOrder.getPayee().toLowerCase() + " über " + newAmount + " Euro wurde erfolgreich eingerichtet");
// delete session attributes
session.removeAttribute("SmartCreateStandingOrderIntent");
session.removeAttribute("StandingOrderToModify");
session.removeAttribute("NewAmount");
// Create reprompt
Reprompt reprompt = new Reprompt();
reprompt.setOutputSpeech(speech);
return SpeechletResponse.newTellResponse(speech, card);
}
Aggregations