Compare commits

..

18 Commits

Author SHA1 Message Date
9122fe372d 3.1.10 2023-06-03 22:22:21 +02:00
367637a541 fix(core): update 2023-06-03 22:22:20 +02:00
c5406dcfa6 3.1.9 2023-05-25 20:24:19 +02:00
0db4d790ac fix(core): update 2023-05-25 20:24:18 +02:00
d208b83fce 3.1.8 2023-05-25 20:23:37 +02:00
585876eacf fix(core): update 2023-05-25 20:23:36 +02:00
0512630a59 3.1.7 2022-10-30 17:40:16 +01:00
bc5846751a fix(core): update 2022-10-30 17:40:16 +01:00
ab1ac03993 3.1.6 2022-10-30 17:27:13 +01:00
3ee4a1677e fix(core): update 2022-10-30 17:27:13 +01:00
29bd68f57d 3.1.5 2022-10-30 15:22:13 +01:00
5227cebc98 fix(core): update 2022-10-30 15:22:13 +01:00
4301a0337c 3.1.4 2022-10-29 19:15:30 +02:00
723833d9bb fix(core): use correct pow 2022-10-29 19:15:30 +02:00
cb28b55617 3.1.3 2022-10-29 17:46:18 +02:00
12614ff011 fix(core): update 2022-10-29 17:46:17 +02:00
7274f7859a 3.1.2 2022-10-29 17:16:44 +02:00
068198a02f fix(core): update 2022-10-29 17:16:44 +02:00
7 changed files with 1406 additions and 1122 deletions

View File

@ -1,6 +1,6 @@
{ {
"name": "@mojoio/tink", "name": "@apiclient.xyz/tink",
"version": "3.1.1", "version": "3.1.10",
"private": false, "private": false,
"description": "an unofficial api abstraction for tink.com", "description": "an unofficial api abstraction for tink.com",
"main": "dist_ts/index.js", "main": "dist_ts/index.js",
@ -13,19 +13,19 @@
"build": "(tsbuild --web)" "build": "(tsbuild --web)"
}, },
"devDependencies": { "devDependencies": {
"@gitzone/tsbuild": "^2.1.65", "@gitzone/tsbuild": "^2.1.66",
"@gitzone/tsbundle": "^2.0.7", "@gitzone/tsbundle": "^2.0.8",
"@gitzone/tsrun": "^1.2.39", "@gitzone/tsrun": "^1.2.42",
"@gitzone/tstest": "^1.0.73", "@gitzone/tstest": "^1.0.74",
"@pushrocks/qenv": "^5.0.2", "@pushrocks/qenv": "^5.0.2",
"@pushrocks/tapbundle": "^5.0.4", "@pushrocks/tapbundle": "^5.0.4",
"@types/node": "^18.11.7" "@types/node": "^20.2.5"
}, },
"dependencies": { "dependencies": {
"@pushrocks/smartdelay": "^2.0.13", "@pushrocks/smartdelay": "^3.0.1",
"@pushrocks/smartpromise": "^3.1.7", "@pushrocks/smartpromise": "^4.0.2",
"@pushrocks/smartrequest": "^2.0.10", "@pushrocks/smartrequest": "^2.0.15",
"@pushrocks/smarturl": "^3.0.5" "@pushrocks/smarturl": "^3.0.6"
}, },
"browserslist": [ "browserslist": [
"last 1 chrome versions" "last 1 chrome versions"

2455
pnpm-lock.yaml generated

File diff suppressed because it is too large Load Diff

View File

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

View File

@ -2,7 +2,7 @@
* autocreated commitinfo by @pushrocks/commitinfo * autocreated commitinfo by @pushrocks/commitinfo
*/ */
export const commitinfo = { export const commitinfo = {
name: '@mojoio/tink', name: '@apiclient.xyz/tink',
version: '3.1.1', version: '3.1.10',
description: 'an unofficial api abstraction for tink.com' description: 'an unofficial api abstraction for tink.com'
} }

View File

@ -16,7 +16,7 @@ export const getNormalizedAmount = (scaledArg?: ITinkScaledAmount) => {
return null; return null;
} }
return { 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' currency: 'EUR'
}; };
}; };

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,11 +109,10 @@ 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?.financialInstitution?.accountNumber || null,
this.data.identifiers.iban?.iban || iban: this.data.identifiers.iban?.iban || null,
this.data.identifiers?.financialInstitution?.accountNumber ||
null,
bookedValue: tinkHelpers.getNormalizedAmount(this.data.balances.booked?.amount), bookedValue: tinkHelpers.getNormalizedAmount(this.data.balances.booked?.amount),
availableValue: tinkHelpers.getNormalizedAmount(this.data.balances.available?.amount), availableValue: tinkHelpers.getNormalizedAmount(this.data.balances.available?.amount),
}; };

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,29 @@ 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,
date: new Date(this.data.dates.booked).getTime(),
amount: tinkHelpers.getNormalizedAmount(this.data.amount),
name: this.data.descriptions.display,
description: this.data.descriptions.original,
originAccountId: this.data.accountId,
justForLooks: {
originalScaledAmount: this.data.amount,
dateIso: new Date(this.data.dates.booked).toISOString()
}
}
}
} }