use of api.BankingRESTClient in project amos-ss17-alexa by c-i-ber.
the class SavingsPlanDialog method createSavingsPlanOneOffPayment.
private void createSavingsPlanOneOffPayment(String betrag) {
JSONObject jsonObject = new JSONObject();
try {
jsonObject.put("amount", betrag);
//TODO Hard coded savings account?
jsonObject.put("sourceAccount", "DE42100000009999999999");
jsonObject.put("destinationAccount", "DE39100000007777777777");
jsonObject.put("valueDate", "2017-05-24");
jsonObject.put("description", "Savings Plan");
} catch (JSONException e) {
LOGGER.error(e.getMessage());
}
BankingRESTClient bankingRESTClient = BankingRESTClient.getInstance();
//TODO Post mapped to Object.class
bankingRESTClient.postBankingModelObject("/api/v1_0/transactions", jsonObject.toString(), Object.class);
}
use of api.BankingRESTClient 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);
}
use of api.BankingRESTClient in project amos-ss17-alexa by c-i-ber.
the class SavingsPlanDialog method createSavingsPlanStandingOrder.
private void createSavingsPlanStandingOrder(String monatlicheZahlung) {
JSONObject jsonObject = new JSONObject();
try {
jsonObject.put("payee", "Max Mustermann");
jsonObject.put("amount", monatlicheZahlung);
//TODO Hard coded savings account?
jsonObject.put("destinationAccount", "DE39100000007777777777");
jsonObject.put("firstExecution", "2017-06-01");
jsonObject.put("executionRate", "MONTHLY");
jsonObject.put("description", "Savings Plan");
} catch (JSONException e) {
LOGGER.error(e.getMessage());
}
BankingRESTClient bankingRESTClient = BankingRESTClient.getInstance();
bankingRESTClient.postBankingModelObject("/api/v1_0/accounts/9999999999/standingorders", jsonObject.toString(), StandingOrder.class);
}
use of api.BankingRESTClient in project amos-ss17-alexa by c-i-ber.
the class StandingOrderDialog method getStandingOrdersModifyResponse.
private SpeechletResponse getStandingOrdersModifyResponse(Intent intent, SessionStorage.Storage storage) {
String standingOrderToModify = (String) storage.get("StandingOrderToModify");
String newAmount = (String) storage.get("NewAmount");
String newExecutionRate = (String) storage.get("NewExecutionRate");
String newFirstExecution = (String) storage.get("NewFirstExecution");
ObjectMapper mapper = new ObjectMapper();
// Create the Simple card content.
SimpleCard card = new SimpleCard();
card.setTitle("Ändere Dauerauftrag");
// Create the plain text output.
PlainTextOutputSpeech speech = new PlainTextOutputSpeech();
JSONObject jsonObject = new JSONObject();
try {
//TODO
jsonObject.put("payee", "Max Mustermann");
jsonObject.put("amount", newAmount);
jsonObject.put("destinationAccount", "DE39100000007777777777");
jsonObject.put("firstExecution", "2017-06-01");
jsonObject.put("executionRate", "MONTHLY");
jsonObject.put("description", "Updated standing Order");
} catch (JSONException e) {
LOGGER.error(e.getMessage());
}
BankingRESTClient bankingRESTClient = BankingRESTClient.getInstance();
bankingRESTClient.putBankingModelObject("/api/v1_0/accounts/9999999999/standingorders/" + standingOrderToModify, jsonObject.toString(), StandingOrder.class);
card.setContent("Dauerauftrag Nummer " + standingOrderToModify + " wurde geändert.");
speech.setText("Dauerauftrag Nummer " + standingOrderToModify + " wurde geaendert.");
return SpeechletResponse.newTellResponse(speech, card);
}
Aggregations