fix(core): update

This commit is contained in:
Philipp Kunz 2022-10-29 17:16:44 +02:00
parent 62537fffe2
commit 068198a02f
4 changed files with 24 additions and 9 deletions

View File

@ -50,7 +50,6 @@ tap.test('get bankaccounts', async (toolsArg) => {
for (const transaction of transactions) {
console.log(`=======================`)
console.log(JSON.stringify(transaction));
}
await toolsArg.delayFor(10000);
}

View File

@ -3,6 +3,6 @@
*/
export const commitinfo = {
name: '@mojoio/tink',
version: '3.1.1',
version: '3.1.2',
description: 'an unofficial api abstraction for tink.com'
}

View File

@ -4,7 +4,7 @@ import * as plugins from './tink.plugins.js';
import * as tinkHelpers from './helpers/index.js';
export interface IBankAccountData {
export interface ITinkBankAccountData {
balances: {
booked: {
amount: {
@ -85,8 +85,8 @@ export class BankAccount {
// INSTANCE
tinkUserRef: TinkUser;
data: IBankAccountData;
constructor(tinkUserRefArg: TinkUser, dataArg: IBankAccountData) {
data: ITinkBankAccountData;
constructor(tinkUserRefArg: TinkUser, dataArg: ITinkBankAccountData) {
this.tinkUserRef = tinkUserRefArg;
this.data = dataArg;
}
@ -109,6 +109,7 @@ export class BankAccount {
*/
public getNormalizedData() {
return {
id: this.data.id,
name: this.data.name,
accountNumber:
this.data.identifiers.iban?.iban ||

View File

@ -1,7 +1,10 @@
import { BankAccount } from './tink.classes.bankaccount.js';
import * as plugins from './tink.plugins.js';
export interface IBankTransactiondata {
import * as tinkHelpers from './helpers/index.js';
export interface ITinkBankTransactiondata {
id: string;
accountId:string;
amount: {
currencyCode: string;
@ -24,7 +27,6 @@ export interface IBankTransactiondata {
display: string;
original: string;
};
id: string;
identifiers: {
providerTransactionId: string;
};
@ -87,10 +89,23 @@ export class BankTransaction {
// INSTANCE
bankAccountRef: BankAccount;
data: IBankTransactiondata;
data: ITinkBankTransactiondata;
constructor(bankAccountRefArg: BankAccount, dataArg: IBankTransactiondata) {
constructor(bankAccountRefArg: BankAccount, dataArg: ITinkBankTransactiondata) {
this.bankAccountRef = bankAccountRefArg;
this.data = dataArg;
}
/**
* gets normalized data
*/
public getNormalizedData() {
return {
id: this.data.id,
amount: tinkHelpers.getNormalizedAmount(this.data.amount),
name: this.data.descriptions.display,
description: this.data.descriptions.original
}
}
}