Search in sources :

Example 6 with Account

use of model.banking.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 = AccountAPI.getAccount(ACCOUNT_ID);
    if (request.getIntent().getName().equals(YES_INTENT)) {
        String cardNumberObj = (String) session.getAttribute("BlockCardService.CardNumber");
        if (cardNumberObj != null) {
            long cardNumber = Long.parseLong(cardNumberObj);
            return getResponse(BLOCK_CARD, "Karte " + cardNumberObj + " wurde gesperrt.");
        }
        return null;
    } else if (request.getIntent().getName().equals(NO_INTENT)) {
        session.setAttribute("BlockCardService.CardNumber", null);
        return getResponse(BLOCK_CARD, "Okay, tschüss.");
    } else if (request.getIntent().getName().equals(BLOCK_CARD_INTENT)) {
        String bankCardNumber = request.getIntent().getSlot("BankCardNumber").getValue();
        if (bankCardNumber == null) {
            return getAskResponse(BLOCK_CARD, "Wie lautet die Nummber der Karte?");
        } else {
            session.setAttribute("BlockCardService.CardNumber", bankCardNumber);
            return getAskResponse(BLOCK_CARD, "Möchten Sie die Karte " + bankCardNumber + " wirklich sperren?");
        }
    }
    return null;
}
Also used : Account(model.banking.Account) IntentRequest(com.amazon.speech.speechlet.IntentRequest) Session(com.amazon.speech.speechlet.Session)

Example 7 with Account

use of model.banking.Account in project amos-ss17-alexa by c-i-ber.

the class AccountFactory method createSavingsAccount.

private Account createSavingsAccount() {
    String accountNumber = getRandomAccountNumber();
    Account newDemoSavingsAccount = null;
    if (!existAccount(accountNumber)) {
        newDemoSavingsAccount = AccountAPI.createAccount(accountNumber, ACCOUNT_BALANCE_DEMO, ACCOUNT_OPENING_DATE_DEMO);
    }
    return newDemoSavingsAccount;
}
Also used : Account(model.banking.Account)

Example 8 with Account

use of model.banking.Account in project amos-ss17-alexa by c-i-ber.

the class AccountFactory method saveContactAccounts.

private void saveContactAccounts(List<Account> contactAccounts) {
    String[] names = { "bob", "sandra", "lucas" };
    int i = 0;
    for (Account contactAccount : contactAccounts) {
        Contact c = new Contact();
        c.setAccountNumber(contactAccount.getNumber());
        c.setName(names[i]);
        c.setIban(contactAccount.getIban());
        dynamoDbMapper.save(c);
        i++;
    }
}
Also used : Account(model.banking.Account)

Example 9 with Account

use of model.banking.Account in project amos-ss17-alexa by c-i-ber.

the class AccountFactory method createContactsAccount.

private List<Account> createContactsAccount() {
    List<Account> contactAccounts = new ArrayList<>();
    for (int i = 0; i < 3; i++) {
        String accountNumber = getRandomAccountNumber();
        Account contactAccount = AccountAPI.createAccount(accountNumber, ACCOUNT_BALANCE_DEMO, ACCOUNT_OPENING_DATE_DEMO);
        contactAccounts.add(contactAccount);
    }
    return contactAccounts;
}
Also used : Account(model.banking.Account) ArrayList(java.util.ArrayList)

Example 10 with Account

use of model.banking.Account in project amos-ss17-alexa by c-i-ber.

the class AccountFactory method createDemoAccount.

private Account createDemoAccount() {
    String accountNumber = getRandomAccountNumber();
    Account newDemoAccount = null;
    if (!existAccount(accountNumber)) {
        newDemoAccount = AccountAPI.createAccount(accountNumber, ACCOUNT_BALANCE_DEMO, ACCOUNT_OPENING_DATE_DEMO);
    }
    return newDemoAccount;
}
Also used : Account(model.banking.Account)

Aggregations

Account (model.banking.Account)12 LinkedList (java.util.LinkedList)2 List (java.util.List)2 Contact (model.db.Contact)2 IntentRequest (com.amazon.speech.speechlet.IntentRequest)1 Session (com.amazon.speech.speechlet.Session)1 ArrayList (java.util.ArrayList)1 StandingOrder (model.banking.StandingOrder)1 Transaction (model.banking.Transaction)1 DateTimeFormatter (org.joda.time.format.DateTimeFormatter)1 Test (org.junit.Test)1