Compare commits
14 Commits
Author | SHA1 | Date | |
---|---|---|---|
c5406dcfa6 | |||
0db4d790ac | |||
d208b83fce | |||
585876eacf | |||
0512630a59 | |||
bc5846751a | |||
ab1ac03993 | |||
3ee4a1677e | |||
29bd68f57d | |||
5227cebc98 | |||
4301a0337c | |||
723833d9bb | |||
cb28b55617 | |||
12614ff011 |
@ -1,6 +1,6 @@
|
||||
{
|
||||
"name": "@mojoio/tink",
|
||||
"version": "3.1.2",
|
||||
"name": "@apiclient.xyz/tink",
|
||||
"version": "3.1.9",
|
||||
"private": false,
|
||||
"description": "an unofficial api abstraction for tink.com",
|
||||
"main": "dist_ts/index.js",
|
||||
|
@ -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);
|
||||
}
|
||||
|
@ -2,7 +2,7 @@
|
||||
* autocreated commitinfo by @pushrocks/commitinfo
|
||||
*/
|
||||
export const commitinfo = {
|
||||
name: '@mojoio/tink',
|
||||
version: '3.1.2',
|
||||
name: '@apiclient.xyz/tink',
|
||||
version: '3.1.9',
|
||||
description: 'an unofficial api abstraction for tink.com'
|
||||
}
|
||||
|
@ -16,7 +16,7 @@ export const getNormalizedAmount = (scaledArg?: ITinkScaledAmount) => {
|
||||
return null;
|
||||
}
|
||||
return {
|
||||
amount: parseInt(scaledArg.value.unscaledValue) / (10 ^ parseInt(scaledArg.value.scale)),
|
||||
value: parseInt(scaledArg.value.unscaledValue) * Math.pow(10, -(parseInt(scaledArg.value.scale))),
|
||||
currency: 'EUR'
|
||||
};
|
||||
};
|
||||
|
@ -111,10 +111,8 @@ export class BankAccount {
|
||||
return {
|
||||
id: this.data.id,
|
||||
name: this.data.name,
|
||||
accountNumber:
|
||||
this.data.identifiers.iban?.iban ||
|
||||
this.data.identifiers?.financialInstitution?.accountNumber ||
|
||||
null,
|
||||
accountNumber: this.data.identifiers?.financialInstitution?.accountNumber || null,
|
||||
iban: this.data.identifiers.iban?.iban || null,
|
||||
bookedValue: tinkHelpers.getNormalizedAmount(this.data.balances.booked?.amount),
|
||||
availableValue: tinkHelpers.getNormalizedAmount(this.data.balances.available?.amount),
|
||||
};
|
||||
|
@ -102,9 +102,15 @@ export class BankTransaction {
|
||||
public getNormalizedData() {
|
||||
return {
|
||||
id: this.data.id,
|
||||
date: new Date(this.data.dates.booked).getTime(),
|
||||
amount: tinkHelpers.getNormalizedAmount(this.data.amount),
|
||||
name: this.data.descriptions.display,
|
||||
description: this.data.descriptions.original
|
||||
description: this.data.descriptions.original,
|
||||
originAccountId: this.data.accountId,
|
||||
justForLooks: {
|
||||
originalScaledAmount: this.data.amount,
|
||||
dateIso: new Date(this.data.dates.booked).toISOString()
|
||||
}
|
||||
}
|
||||
|
||||
}
|
||||
|
Reference in New Issue
Block a user