test with external bank
by afrankel
HTML
<script src="https://cdnjs.cloudflare.com/ajax/libs/axios/0.18.0/axios.js"></script>
<script src="https://getfirebug.com/firebug-lite-debug.js"></script>
<script src="http://www.solutionstreet.com/solutionstreetbank.js"></script>
<script src=" https://cdnjs.cloudflare.com/ajax/libs/require.js/2.3.2/require.min.js"></script>
<div id="console-log"></div>
CSS
.console-line {
font-family: monospace;
margin: 2px;
}
JavaScript 1.7
const SolutionStreetBank = require(['SolutionStreetBank']);
async function getAllDataAsync() {
const bank = new SolutionStreetBank()
console.log("getting customer...");
const cust = await bank.getCustomer(1)
console.log("getting accounts...");
const accounts = await bank.getAccounts(cust.id)
console.log("getting transactions...");
// to simplify we'll just get transactions based on the first account
const transactions = await bank.getTransactions(accounts[0].id)
console.log('getAllDataAsync\n',
{ cust, accounts, transactions })
return; // normally returns a Promise
}
getAllDataAsync();