Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
10 changes: 9 additions & 1 deletion converters/velobankConverter.js
Original file line number Diff line number Diff line change
Expand Up @@ -8,11 +8,19 @@ const columns = ['date', 'realDate', 'description', 'amount', 'balance']
const parseAmount = amount => parseFloat(amount.replace(' ', '').replace(',', '.'))

const parseDescription = description => {
// If transfer details include a title line, use it as payer
// Example (multiline description):
// Przelew z rachunku: ...\nNadawca: ...\nTytu?: BLIK: P?atno?? BLIK w sklepie
const titleMatch = description.match(/Tytu\?:\s*([^\n\r]+)/i)
if (titleMatch) {
return titleMatch[1].trim()
}
const descriptionParts = description.split(',')
if (descriptionParts.length === 1) {
return descriptionParts[0]
}
const payerPart = descriptionParts[1]
const numberOfCartParts = (description.match(/Operacja kart/gi) || []).length
const payerPart = descriptionParts[numberOfCartParts]
return payerPart.replace('w ', '').replace(/\d+ PLN/, '').trim()
}

Expand Down
12 changes: 10 additions & 2 deletions converters/velobankConverter.spec.js
Original file line number Diff line number Diff line change
Expand Up @@ -3,14 +3,22 @@ const citiConverter = require('./velobankConverter')
const categoriesMapping = {
'Play': { category: 'Utilities', subCategory: 'Telephone' },
'Employer': { category: 'Income', subCategory: 'Salary' },
'Deposit': { category: 'Income', subCategory: 'Deposit' }
'Deposit': { category: 'Income', subCategory: 'Deposit' },
'FHU GREGOR': { category: 'Groceries', subCategory: 'Supermarket' }
};

test('should be able to convert Velobank manually created CSV files format', (done) => {
const input = `30.10.2019,24.11.2023,Employer,"9 839,29 PLN","1 574,59 PLN"
28.10.2019,24.11.2023,"Operacja kartą na kwotę 17,99 PLN w Play, GDANSK, PL","-10,00 PLN","2 374,59 PLN"`
28.10.2019,24.11.2023,"Operacja kartą na kwotę 17,99 PLN w Play, GDANSK, PL","-10,00 PLN","2 374,59 PLN"
22.12.2025,29.12.2025,"Operacja kart? 1111 **** **** 1111 na kwot? 9,00 PLN w Operacja kart? 1111 xxxx xxxx
1111 na kwot? 9,00 PLN w FHU GREGOR, GDANSK, POL","-9,00 PLN",""
20.12.2025,20.12.2025,"Przelew z rachunku: 12 1560 0013 2015 4742 6000 0001,
Nadawca: HUZAR VOLODYMYR,
Tytu?: BLIK: P?atno?? BLIK w sklepie","-27,83 PLN",""`
const expected = `30.10.2019,9839.29,Income,Salary,Credit Card,,,Employer,,,GetIn
28.10.2019,-10,Utilities,Telephone,Credit Card,,,Play,,,GetIn
22.12.2025,-9,Groceries,Supermarket,Credit Card,,,FHU GREGOR,,,GetIn
20.12.2025,-27.83,,,Credit Card,,,BLIK: P?atno?? BLIK w sklepie,,,GetIn
`
let transformedData = '';

Expand Down
4 changes: 2 additions & 2 deletions package-lock.json

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.