-
Notifications
You must be signed in to change notification settings - Fork 0
/
sandbox.ts
33 lines (27 loc) · 963 Bytes
/
sandbox.ts
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
/* eslint-disable */
import dotenv from 'dotenv'
import { SBanken, ClientParamOptions, TransactionParamOptions } from './src'
dotenv.config()
const options: ClientParamOptions = {
applicationId: process.env.SB_APPLICATION_ID!,
applicationSecret: process.env.SB_APPLICATION_SECRET!,
customerId: process.env.SB_CUSTOMER_ID!
}
const client = new SBanken(options)
;(async () => {
console.log('##### Accounts')
const accounts = await client.getAccounts()
console.log(accounts[0].balance)
console.log('##### Customer')
const customer = await client.getCustomer()
console.log(`${customer.firstName} ${customer.lastName}`)
console.log('##### Transactions')
const transactionsOptions: TransactionParamOptions = {
startDate: '2020-04-01',
endDate: '2020-06-14',
index: '20',
length: '30'
}
const transactions = await client.getTransactions(accounts[0].accountId!, transactionsOptions)
console.log(transactions.length)
})()