This repository has been archived by the owner on Jun 10, 2022. It is now read-only.
-
Notifications
You must be signed in to change notification settings - Fork 3
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge pull request #2 from riasvdv/master
Add Belfius (Belgium)
- Loading branch information
Showing
2 changed files
with
40 additions
and
0 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
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, | ||
}; |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
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, | ||
}; | ||
}); | ||
} | ||
|
||
} |