From 12614ff011c2ee2a6573038770230d95af53f8fe Mon Sep 17 00:00:00 2001 From: Philipp Kunz Date: Sat, 29 Oct 2022 17:46:17 +0200 Subject: [PATCH] fix(core): update --- test/test.nonci.ts | 2 +- ts/00_commitinfo_data.ts | 2 +- ts/helpers/tinkmath.ts | 2 +- ts/tink.classes.banktransaction.ts | 5 ++++- 4 files changed, 7 insertions(+), 4 deletions(-) diff --git a/test/test.nonci.ts b/test/test.nonci.ts index 28243fe..4ef35f8 100644 --- a/test/test.nonci.ts +++ b/test/test.nonci.ts @@ -49,7 +49,7 @@ tap.test('get bankaccounts', async (toolsArg) => { const transactions = await bankAccount.getTransactions(); for (const transaction of transactions) { console.log(`=======================`) - console.log(JSON.stringify(transaction)); + console.log(JSON.stringify(transaction.getNormalizedData())); } await toolsArg.delayFor(10000); } diff --git a/ts/00_commitinfo_data.ts b/ts/00_commitinfo_data.ts index ae44465..870fa82 100644 --- a/ts/00_commitinfo_data.ts +++ b/ts/00_commitinfo_data.ts @@ -3,6 +3,6 @@ */ export const commitinfo = { name: '@mojoio/tink', - version: '3.1.2', + version: '3.1.3', description: 'an unofficial api abstraction for tink.com' } diff --git a/ts/helpers/tinkmath.ts b/ts/helpers/tinkmath.ts index ad59b0a..3bea9da 100644 --- a/ts/helpers/tinkmath.ts +++ b/ts/helpers/tinkmath.ts @@ -16,7 +16,7 @@ export const getNormalizedAmount = (scaledArg?: ITinkScaledAmount) => { return null; } return { - amount: parseInt(scaledArg.value.unscaledValue) / (10 ^ parseInt(scaledArg.value.scale)), + amount: parseInt(scaledArg.value.unscaledValue) * Math.pow(10, -(parseInt(scaledArg.value.scale))), currency: 'EUR' }; }; diff --git a/ts/tink.classes.banktransaction.ts b/ts/tink.classes.banktransaction.ts index 5625acd..7bdc2f6 100644 --- a/ts/tink.classes.banktransaction.ts +++ b/ts/tink.classes.banktransaction.ts @@ -104,7 +104,10 @@ export class BankTransaction { id: this.data.id, amount: tinkHelpers.getNormalizedAmount(this.data.amount), name: this.data.descriptions.display, - description: this.data.descriptions.original + description: this.data.descriptions.original, + justForLooks: { + originalScaledAmount: this.data.amount + } } }