use of model.banking.StandingOrder in project amos-ss17-alexa by c-i-ber.
the class AccountAPI method createStandingOrderForAccount.
/**
* Create standing order.
*
* @param accountNumber the account number
* @param payee the payee
* @param amount the amount
* @param destinationAccount the destination account
* @param firstExecution the first execution
* @param executionRate the execution rate
* @param description the description
* @return the standing order
*/
public static StandingOrder createStandingOrderForAccount(String accountNumber, String payee, Number amount, String destinationAccount, String firstExecution, StandingOrder.ExecutionRate executionRate, String description) {
StandingOrder newStandingOrder = new StandingOrder();
newStandingOrder.setPayee(payee);
newStandingOrder.setAmount(amount);
newStandingOrder.setDestinationAccount(destinationAccount);
newStandingOrder.setFirstExecution(firstExecution);
newStandingOrder.setExecutionRate(executionRate);
newStandingOrder.setDescription(description);
return createStandingOrderForAccount(accountNumber, newStandingOrder);
}
use of model.banking.StandingOrder in project amos-ss17-alexa by c-i-ber.
the class AmosAlexaSimpleTestImpl method standingOrderCreateSmartIntentTest.
@Test
public void standingOrderCreateSmartIntentTest() throws IllegalAccessException, NoSuchFieldException, IOException {
newSession();
Collection<StandingOrder> standingOrdersCollection = AccountAPI.getStandingOrdersForAccount("9999999999");
List<StandingOrder> standingOrders = new ArrayList<>(standingOrdersCollection);
for (StandingOrder standingOrder : standingOrders) {
if (standingOrder.getPayee().toLowerCase().equals("max mustermann")) {
String orderAmount = standingOrder.getAmount().toString();
testIntent("StandingOrderSmartIntent", "Payee:max", "PayeeSecondName:mustermann", "orderAmount:10", "Der Dauerauftrag für max mustermann über " + orderAmount + " Euro existiert schon. Möchtest du diesen aktualisieren");
testIntent("StandingOrderSmartIntent", "Der neue Dauerauftrag für max mustermann über 10 Euro wurde erfolgreich eingerichtet");
break;
}
}
}
use of model.banking.StandingOrder in project amos-ss17-alexa by c-i-ber.
the class AmosAlexaSimpleTestImpl method standingOrderUpdateSmartIntentTest.
@Test
public void standingOrderUpdateSmartIntentTest() throws IllegalAccessException, NoSuchFieldException, IOException {
newSession();
Collection<StandingOrder> standingOrdersCollection = AccountAPI.getStandingOrdersForAccount("9999999999");
List<StandingOrder> standingOrders = new ArrayList<>(standingOrdersCollection);
for (StandingOrder standingOrder : standingOrders) {
if (standingOrder.getPayee().toLowerCase().equals("max mustermann")) {
String orderAmount = standingOrder.getAmount().toString();
testIntent("StandingOrderSmartIntent", "Payee:max", "PayeeSecondName:mustermann", "orderAmount:10", "Der Dauerauftrag für max mustermann über " + orderAmount + " Euro existiert schon. Möchtest du diesen aktualisieren");
// "Der Dauerauftrag Nummer " + standingOrder.getStandingOrderId() + " für Max Mustermann über 10 euro wurde erfolgreich aktualisiert");
break;
}
}
}
use of model.banking.StandingOrder in project amos-ss17-alexa by c-i-ber.
the class AccountTest method testCreateAndGetStandingOrder.
@Test
public void testCreateAndGetStandingOrder() {
String firstExecution = new DateTime(2018, 5, 1, 12, 0).toLocalDate().toString();
StandingOrder standingOrder = AccountAPI.createStandingOrderForAccount(ACCOUNT_NUMBER, "Test", 123, ACCOUNT_NUMBER2, firstExecution, StandingOrder.ExecutionRate.MONTHLY, "Description");
assertEquals(standingOrder.getPayee(), "Test");
assertEquals(standingOrder.getAmount(), 123);
assertEquals(standingOrder.getDestinationAccount(), ACCOUNT_NUMBER2);
assertEquals(standingOrder.getFirstExecution(), firstExecution);
assertEquals(standingOrder.getExecutionRate(), StandingOrder.ExecutionRate.MONTHLY);
assertEquals(standingOrder.getDescription(), "Description");
// Get standing orders
Collection<StandingOrder> standingOrders = AccountAPI.getStandingOrdersForAccount(ACCOUNT_NUMBER);
boolean foundStandingOrder = false;
for (StandingOrder standingOrder1 : standingOrders) {
if (standingOrder1.getStandingOrderId().equals(standingOrder.getStandingOrderId())) {
foundStandingOrder = true;
break;
}
}
assertTrue(foundStandingOrder);
}
use of model.banking.StandingOrder 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