use of model.banking.Account in project amos-ss17-alexa by c-i-ber.
the class AccountFactory method createDemo.
/**
* 7 transactions
* 3 standing orders - with categories
* 3 stocks
* 5 categories with 3 keywords
* 3 contacts with easy names
*/
public Account createDemo() {
// Uncomment the following line to create and use NEW demo accounts
// removeDemoAccounts();
Account existingDemoAccount = getDemoAccount();
if (existingDemoAccount != null) {
return existingDemoAccount;
}
// user - needed for authenticating all following API calls
createDemoUser();
// account + savings account
Account newDemoAccount = createDemoAccount();
Account newDemoSavingsAccount = createSavingsAccount();
saveAccount(newDemoAccount.getNumber(), newDemoSavingsAccount.getNumber(), true);
// contact accounts
List<Account> contactAccounts = createContactsAccount();
saveContactAccounts(contactAccounts);
// categories
createCategories(newDemoAccount);
// standing orders
createStandingOrders(newDemoAccount, contactAccounts);
// periodic transactions
createPeriodicTransactions(newDemoAccount);
return newDemoAccount;
}
use of model.banking.Account in project amos-ss17-alexa by c-i-ber.
the class ContactTransferService method confirm.
private SpeechletResponse confirm(Session session) {
Object contactsFoundObj = SESSION_STORAGE.getObject(session.getSessionId(), SESSION_PREFIX + ".contactsFound");
if (contactsFoundObj == null || !(contactsFoundObj instanceof List)) {
return getResponse(CONTACT_TRANSFER_CARD, "Da ist etwas schiefgegangen. Tut mir Leid.");
}
Object choiceObj = session.getAttribute(SESSION_PREFIX + ".choice");
if (choiceObj == null || !(choiceObj instanceof Integer)) {
return getResponse(CONTACT_TRANSFER_CARD, "Da ist etwas schiefgegangen. Tut mir Leid.");
}
Object amountObj = session.getAttribute(SESSION_PREFIX + ".amount");
if (amountObj == null || !(amountObj instanceof Double || amountObj instanceof Integer)) {
return getResponse(CONTACT_TRANSFER_CARD, "Da ist etwas schiefgegangen. Tut mir Leid.");
}
Contact contact = ((List<Contact>) contactsFoundObj).get((int) choiceObj - 1);
double amount;
if (amountObj instanceof Double) {
amount = (double) amountObj;
} else {
amount = (int) amountObj;
}
session.setAttribute(DIALOG_CONTEXT, CONTACT_CHOICE_INTENT);
Account account = AccountAPI.getAccount(ACCOUNT_NUMBER);
String balanceBeforeTransation = String.valueOf(account.getBalance());
return getAskResponse(CONTACT_TRANSFER_CARD, "Dein aktueller Kontostand beträgt " + balanceBeforeTransation + " Euro. Möchtest du " + amount + " Euro an " + contact.getName() + " überweisen?");
}
Aggregations