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) { for (const transaction of transactions) {
console.log(`=======================`) console.log(`=======================`)
console.log(JSON.stringify(transaction)); console.log(JSON.stringify(transaction));
} }
await toolsArg.delayFor(10000); await toolsArg.delayFor(10000);
} }

View File

@ -3,6 +3,6 @@
*/ */
export const commitinfo = { export const commitinfo = {
name: '@mojoio/tink', name: '@mojoio/tink',
version: '3.1.1', version: '3.1.2',
description: 'an unofficial api abstraction for tink.com' 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'; import * as tinkHelpers from './helpers/index.js';
export interface IBankAccountData { export interface ITinkBankAccountData {
balances: { balances: {
booked: { booked: {
amount: { amount: {
@ -85,8 +85,8 @@ export class BankAccount {
// INSTANCE // INSTANCE
tinkUserRef: TinkUser; tinkUserRef: TinkUser;
data: IBankAccountData; data: ITinkBankAccountData;
constructor(tinkUserRefArg: TinkUser, dataArg: IBankAccountData) { constructor(tinkUserRefArg: TinkUser, dataArg: ITinkBankAccountData) {
this.tinkUserRef = tinkUserRefArg; this.tinkUserRef = tinkUserRefArg;
this.data = dataArg; this.data = dataArg;
} }
@ -109,6 +109,7 @@ export class BankAccount {
*/ */
public getNormalizedData() { public getNormalizedData() {
return { return {
id: this.data.id,
name: this.data.name, name: this.data.name,
accountNumber: accountNumber:
this.data.identifiers.iban?.iban || this.data.identifiers.iban?.iban ||

View File

@ -1,7 +1,10 @@
import { BankAccount } from './tink.classes.bankaccount.js'; import { BankAccount } from './tink.classes.bankaccount.js';
import * as plugins from './tink.plugins.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; accountId:string;
amount: { amount: {
currencyCode: string; currencyCode: string;
@ -24,7 +27,6 @@ export interface IBankTransactiondata {
display: string; display: string;
original: string; original: string;
}; };
id: string;
identifiers: { identifiers: {
providerTransactionId: string; providerTransactionId: string;
}; };
@ -87,10 +89,23 @@ export class BankTransaction {
// INSTANCE // INSTANCE
bankAccountRef: BankAccount; bankAccountRef: BankAccount;
data: IBankTransactiondata; data: ITinkBankTransactiondata;
constructor(bankAccountRefArg: BankAccount, dataArg: IBankTransactiondata) { constructor(bankAccountRefArg: BankAccount, dataArg: ITinkBankTransactiondata) {
this.bankAccountRef = bankAccountRefArg; this.bankAccountRef = bankAccountRefArg;
this.data = dataArg; 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
}
}
} }