Skip to content

Jczaja/revolut v2#194

Merged
jczaja merged 13 commits into
mainfrom
jczaja/revolut-v2
May 9, 2026
Merged

Jczaja/revolut v2#194
jczaja merged 13 commits into
mainfrom
jczaja/revolut-v2

Conversation

@jczaja
Copy link
Copy Markdown
Collaborator

@jczaja jczaja commented May 9, 2026

This PR is adding support for v2 consolidated document format as introduced by revolut in 2026

Copy link
Copy Markdown
Contributor

Copilot AI left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Pull request overview

This PR adds parsing support for Revolut’s 2026 “consolidated statement v2” CSV format, extending the existing Revolut CSV parser to handle the new document structure and localized (EN/PL) headers/date formats.

Changes:

  • Added v2 state-machine parsing flow (process_tax_consolidated_statement_v2 + process_tax_consolidated_data_v2) and supporting helpers for v2-specific fields (paired sale/purchase dates, sale value parsing).
  • Expanded column/header handling to support v2 English/Polish column names for dividends, sold units, and interest statements.
  • Added v2 fixtures and tests covering both English and Polish v2 statements.

Reviewed changes

Copilot reviewed 3 out of 3 changed files in this pull request and generated 7 comments.

File Description
src/csvparser.rs Adds v2 parsing pipeline, new parsers/helpers, and v2-focused tests.
revolut_data/consolidated-statement-v2-eng.csv Adds an English v2 statement fixture used by tests.
revolut_data/consolidated-statement-v2-pol.csv Adds a Polish v2 statement fixture used by tests.

💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.

Comment thread src/csvparser.rs
Comment on lines +101 to +109
fn extract_income_and_cost(cashline: &str) -> Result<(crate::Currency, crate::Currency), String> {
log::info!("Entry moneyin/total amount line: {cashline}");
// replace "," to "." only if there are is no "." already
// otherwise remove ','
let cashline_string: String = if cashline.contains(',') && cashline.contains(".") {
cashline.to_string().replace(",", "")
} else {
cashline.to_string().replace(",", ".")
};
Comment thread src/csvparser.rs
return Ok((crate::Currency::EUR(cost), crate::Currency::EUR(income)));
}
Err(format!(
"Error extracing income and cost from cashline: {cashline_string}"
Comment thread src/csvparser.rs
Comment on lines +563 to +574
let parts = d.split(",").collect::<Vec<_>>();

// english document is having 3 commas so we have four parts parts
// polish document is having only 1 comma so we have two parts
let (sell_date, acquire_date) = if parts.len() == 4 {
(
format!("{}, {}", parts[0], parts[1]),
format!("{}, {}", parts[2], parts[3]),
)
} else {
(parts[0].to_string(), parts[1].to_string())
};
Comment thread src/csvparser.rs
Comment on lines +1048 to +1051
}
}
Ok(())
}
Copy link
Copy Markdown
Collaborator Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

@copilot apply changes based on this feedback

Comment thread src/csvparser.rs
}) {
process_tax_consolidated_statement_v2(&mut rdr, &mut ta)?;
} else {
return Err("ERROR: Unsupported CSV type of document: {csvtoparse}".to_string());
Comment on lines +5 to +14
"Dane rachunku bieżącego",,,,,,,,,,
"Numer konta (LT IBAN)",LT2832500392550890,"Data otwarcia","6 lis 2022",,,,,,,
"Numer konta (PL IBAN)","PL572910000000000003698351","Data zamknięcia",,,,,,,,
"Rodzaj własności","Osoba fizyczna","Liczba dni posiadania (w wybranym okresie)",116,,,,,,,
"Wykorzystanie konta",Osobiste,,,,,,,,,
"Rodzaj konta",Bieżące,,,,,,,,,
,,,,,,,,,,
"Informacje o instytucji finansowej",,,,,,,,,,
"Nazwa instytucji finansowej","Revolut Bank UAB","Numer rejestracyjny",LT1000706713,,,,,,,
"Adres i kraj","Konstitucijos ave. 21B, LT-08130, Vilnius",,,,,,,,,
Comment on lines +6 to +40
Account Number (LT IBAN),LT2832500392550890,Opening date,"Nov 6, 2022",,,,,,,
Account Number (PL IBAN),PL672910000000000038323,Closing date,,,,,,,,
Holding modalities,Individual,Days owned (in selected period),116,,,,,,,
Purpose of account,Personal,,,,,,,,,
Nature of account,Current,,,,,,,,,
,,,,,,,,,,
Financial institution information,,,,,,,,,,
Financial institution name,Revolut Bank UAB,Registration number,LT1000106713,,,,,,,
Address & country,"Konstitucijos ave. 21B, LT-08130, Vilnius",,,,,,,,,
,,,,,,,,,,
Deposit value,,,,,,,,,,
Average balance Q1 2026,188.40 PLN,Opening balance,0.00 PLN,,,,,,,
,,Closing balance,225.16 PLN,,,,,,,
,,Maximum balance,"32,100.00 PLN",,,,,,,
,,Average balance full period,192.11 PLN,,,,,,,
,,,,,,,,,,
---------,,,,,,,,,,
,,,,,,,,,,
Personal Account (USD),,,,,,,,,,
,,,,,,,,,,
Current account details,,,,,,,,,,
Account Number (IBAN),LT2832500396020893,Opening date,"Sep 1, 2023",,,,,,,
Holding modalities,Individual,Closing date,,,,,,,,
Purpose of account,Personal,Days owned (in selected period),116,,,,,,,
Nature of account,Current,,,,,,,,,
,,,,,,,,,,
Financial institution information,,,,,,,,,,
Financial institution name,Revolut Bank UAB,Registration number,LT1000106713,,,,,,,
Address & country,"Konstitucijos ave. 21B, LT-08130, Vilnius",,,,,,,,,
,,,,,,,,,,
Deposit value,,,,,,,,,,
Average balance Q1 2026,$5.96 (21.51 PLN),Opening balance,$0.00 (0.00 PLN),,,,,,,
,,Closing balance,$0.00 (0.00 PLN),,,,,,,
,,Maximum balance,"$7,607.70 (27,254.49 PLN)",,,,,,,
,,Average balance full period,$4.63 (16.69 PLN),,,,,,,
@jczaja jczaja merged commit 1991c58 into main May 9, 2026
12 of 13 checks passed
Copilot stopped work on behalf of jczaja due to an error May 9, 2026 15:24
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants