Jczaja/revolut v2#194
Merged
Merged
Conversation
Contributor
There was a problem hiding this comment.
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 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(",", ".") | ||
| }; |
| return Ok((crate::Currency::EUR(cost), crate::Currency::EUR(income))); | ||
| } | ||
| Err(format!( | ||
| "Error extracing income and cost from cashline: {cashline_string}" |
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 on lines
+1048
to
+1051
| } | ||
| } | ||
| Ok(()) | ||
| } |
Collaborator
Author
There was a problem hiding this comment.
@copilot apply changes based on this feedback
| }) { | ||
| 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),,,,,,, |
Copilot stopped work on behalf of
jczaja due to an error
May 9, 2026 15:24
This file contains hidden or 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
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
This PR is adding support for v2 consolidated document format as introduced by revolut in 2026