use of model.banking.account.Account in project amos-ss17-alexa by c-i-ber.
the class BankAccountService method onIntent.
@Override
public SpeechletResponse onIntent(SpeechletRequestEnvelope<IntentRequest> requestEnvelope) {
IntentRequest request = requestEnvelope.getRequest();
Account account = AccountFactory.getInstance().getAccount(number);
String speechText = "Was möchtest du über dein Konto erfahren?";
String repromptText = "Was möchtest du über dein Konto erfahren? Frage mich etwas!";
String slotValue = request.getIntent().getSlot(SLOT_NAME).getValue();
if (slotValue != null) {
String slot = "Kontostand";
if (slot.equals(slotValue)) {
speechText = "Dein " + slot + " beträgt " + account.getBalance();
}
slot = "Kontonummer";
if (slot.equals(slotValue)) {
speechText = "Deine " + slot + " lautet " + account.getNumber();
}
slot = "IBAN";
if (slot.equals(slotValue)) {
speechText = "Deine " + slot + " lautet " + account.getIban();
}
slot = "Eröffnungsdatum";
if (slot.equals(slotValue)) {
speechText = "Dein " + slot + " war " + account.getOpeningDate();
}
slot = "Abhebegebühr";
if (slot.equals(slotValue)) {
speechText = "Deine " + slot + " beträgt " + account.getWithdrawalFee();
}
slot = "Zinssatz";
if (slot.equals(slotValue)) {
speechText = "Dein " + slot + " ist aktuell " + account.getInterestRate();
}
slot = "Kreditlimit";
if (slot.equals(slotValue)) {
speechText = "Dein " + slot + " ist " + account.getCreditLimit();
}
slot = "Kreditkartenlimit";
if (slot.equals(slotValue)) {
speechText = "Dein " + slot + " beträgt " + account.getCreditcardLimit();
}
return getSpeechletResponse(speechText);
} else {
return getSpeechletResponse(repromptText);
}
}
use of model.banking.account.Account in project amos-ss17-alexa by c-i-ber.
the class BlockCardService method onIntent.
@Override
public SpeechletResponse onIntent(SpeechletRequestEnvelope<IntentRequest> requestEnvelope) {
IntentRequest request = requestEnvelope.getRequest();
Session session = requestEnvelope.getSession();
// TODO: Use account later to actually block a card
Account account = AccountFactory.getInstance().getAccount(number);
if (request.getIntent().getName().equals("AMAZON.YesIntent")) {
String cardNumberObj = (String) session.getAttribute("BlockCardService.CardNumber");
if (cardNumberObj != null) {
long cardNumber = Long.parseLong(cardNumberObj);
return getSpeechletResponse("Karte " + cardNumberObj + " wurde gesperrt.", "", false);
}
return null;
} else if (request.getIntent().getName().equals("AMAZON.NoIntent")) {
session.setAttribute("BlockCardService.CardNumber", null);
return getSpeechletResponse("Okay, tschüss.", "", false);
} else {
String bankCardNumber = request.getIntent().getSlot("BankCardNumber").getValue();
if (bankCardNumber == null) {
String speechText = "Wie lautet die Nummber der Karte?";
String repromptText = "Sagen Sie auch die Nummer der Karte. Zum Beispiel: Sperre Karte 12345.";
return getSpeechletResponse(speechText, repromptText, false);
} else {
session.setAttribute("BlockCardService.CardNumber", bankCardNumber);
String speechText = "Möchten Sie die Karte " + bankCardNumber + " wirklich sperren?";
String repromptText = "Bitte bestätigen Sie, indem Sie 'ja' sagen.";
return getSpeechletResponse(speechText, repromptText, true);
}
}
}
use of model.banking.account.Account in project amos-ss17-alexa by c-i-ber.
the class AccountTest method testAccountObjectModel.
/**
* Account Information
*
* object path /api/v1_0/accounts/{accountnumber}
*
* https://s3.eu-central-1.amazonaws.com/amos-bank/api-guide.html#_konto_informationen
*/
@Test
public void testAccountObjectModel() {
Account account = accountFactory.getAccount(dummyAccount.getNumber());
assertEquals(account.getOpeningDate(), dummyAccount.getOpeningDate());
}
use of model.banking.account.Account in project amos-ss17-alexa by c-i-ber.
the class AccountTest method testCreateAccount.
@Test
public void testCreateAccount() throws JSONException {
DummyAccount acc = new DummyAccount();
// create account
Account account = accountFactory.createAccount(acc.getNumber(), acc.getBalance(), acc.getOpeningDate());
// check value
assertEquals(account.getBalance(), acc.getBalance(), 0.0);
assertEquals(account.getNumber(), acc.getNumber());
assertEquals(account.getOpeningDate(), acc.getOpeningDate());
}
use of model.banking.account.Account in project amos-ss17-alexa by c-i-ber.
the class AccountFactory method createAccount.
public Account createAccount(String number, Double balance, String openingDate) throws JSONException {
JSONObject jsonObject = new JSONObject();
jsonObject.put("number", number);
jsonObject.put("balance", balance);
jsonObject.put("openingDate", openingDate);
BankingRESTClient bankingRESTClient = BankingRESTClient.getInstance();
return (Account) bankingRESTClient.postBankingModelObject("/api/v1_0/accounts/generate", jsonObject.toString(), Account.class);
}
Aggregations