fix(transactions): enter a starting transaction

This commit is contained in:
Philipp Kunz 2019-12-15 23:07:46 +00:00
parent 3cec57e3e7
commit 270d1406c5

View File

@ -91,8 +91,19 @@ export class MonetaryAccount {
/** /**
* gets all transactions no this account * gets all transactions no this account
*/ */
public async getTransactions() { public async getTransactions(startingIdArg: number | false = false) {
const apiTransactions = await this.bunqAccountRef.bunqJSClient.api.payment.list(this.bunqAccountRef.userId, this.id); const paginationOptions: {
count?: number;
newer_id?: number | false;
older_id?: number | false;
} = {
count: 200,
newer_id: startingIdArg
};
const apiTransactions = await this.bunqAccountRef.bunqJSClient.api.payment.list(this.bunqAccountRef.userId, this.id, paginationOptions);
const transactionsArray: Transaction[] = []; const transactionsArray: Transaction[] = [];
for (const apiTransaction of apiTransactions) { for (const apiTransaction of apiTransactions) {
transactionsArray.push(Transaction.fromApiObject(this, apiTransaction)); transactionsArray.push(Transaction.fromApiObject(this, apiTransaction));