Skip to content
This repository has been archived by the owner on Jun 10, 2022. It is now read-only.

Commit

Permalink
Merge pull request #2 from riasvdv/master
Browse files Browse the repository at this point in the history
Add Belfius (Belgium)
  • Loading branch information
jorisnoo authored Dec 31, 2019
2 parents 278b600 + a011ff3 commit 9b41e1f
Show file tree
Hide file tree
Showing 2 changed files with 40 additions and 0 deletions.
2 changes: 2 additions & 0 deletions src/banks.ts
Original file line number Diff line number Diff line change
@@ -1,7 +1,9 @@
import {BelfiusBe} from './banks/belfius-be';
import {SparkasseGerman} from './banks/sparkasse-german';
import {ZkbGerman} from './banks/zkb-german';

export const supportedBanks = {
'sparkasse-german': SparkasseGerman,
'zkb-german': ZkbGerman,
'belfius-be': BelfiusBe,
};
38 changes: 38 additions & 0 deletions src/banks/belfius-be.ts
Original file line number Diff line number Diff line change
@@ -0,0 +1,38 @@
import * as moment from 'moment';

import {Bank} from './base';

export class BelfiusBe extends Bank {
static description = 'Belfius (Belgium)';

static requiredHeaders = [
'transactie', 'boekingsdatum', 'bedrag',
];

static transformTransactions(transactions) {
return transactions
// Remove (epmpty) transactions without a date
.filter(transaction => transaction.boekingsdatum)
.map(obj => {
// Calculate amount
const amount = parseFloat(obj.bedrag.replace(',', '.')) * 100;
const reference = obj.transactie.match(/(REF)(?!.*\1)\. : (.*) VAL\. \d{2}-\d{2}/)[2].trim();
let payee = obj['naam-tegenpartij-bevat'].trim();
if (!payee) {
payee = obj.mededelingen;
}
// Read date as utc (w/out timezone) and convert to js date
const date = moment.utc(obj.boekingsdatum, 'DD/MM/YYYY').toDate();

return {
imported_id: reference,
imported_payee: obj.transactie,
notes: obj.mededelingen,
date,
amount,
payee,
};
});
}

}

0 comments on commit 9b41e1f

Please sign in to comment.