Repository navigation
feat(hdfc): add HDFC Bank credit card statements - #366
Merged
Merged
Conversation
The README tells users to put PDF_PASSWORDS in .env, but the file was not ignored, so a broad git add could stage statement passwords. Co-Authored-By: Claude Fable 5.2 <[email protected]>
Parses the HDFC Bank (India) credit card layout in use since about Aug 2025, covering domestic and international sections, debit/credit direction, INR currency, statement date, billing period start and card last-4. Refs benjamin-awd#223. Three things differ from existing banks: - Amounts use lakh grouping (1,23,456.78), which the shared comma pattern reads as 23,456.78, so the config carries its own amount pattern. - Reward points ("+ 30") sit next to the credit marker ("+" directly before the rupee glyph), so the two are matched separately. - Fee and tax rows print their description on the lines above and below the date/amount line. multiline_descriptions cannot express this: the line above would also attach to the previous row. A new opt-in MultilineConfig.straddled_descriptions merges those neighbours into the row before matching, in the same spirit as multiline_amount. The fixture is a redacted dump of a real statement. Add-on cards, EMI conversion rows and older layouts are not covered. Co-Authored-By: Claude Fable 5.2 <[email protected]>
Owner
|
Thanks @anandghegde! |
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.
Adds a parser for HDFC Bank (India) credit card statements. Refs #223.
What it covers
Quadient~Inspire)Before this change the generic parser fails on these statements with
GenericParserError: Could not find any transactions.Things that differ from existing banks
1,23,456.78; the shared comma patternreads that as
23,456.78, so the config has its own amount pattern.+ 30 ₹978.00is a debit thatearned 30 points;
+ ₹114.50is a credit. They are matched separately.description on the lines above and below the date/amount line.
multiline_descriptionscan't express this (the line above would also attachto the previous row), so there is a new opt-in
MultilineConfig.straddled_descriptionsand a smallmerge_straddled_descriptionshelper next tomerge_wrapped_amounts. Noother bank enables it.
Testing
tests/integration/banks/hdfc/credit/, built withmonopoly-fixturefrom a redacted statement (30 transactions; safety check passes)ruff,mypy src, full test suite passNot covered
Add-on cards, EMI conversion rows, older layouts, and HDFC savings/current
accounts. I only have one card type (Diners) to test with; I'd expect other
HDFC cards to share the layout but haven't confirmed it.
The
.gitignorecommit is unrelated housekeeping (.envwasn't ignored); happyto split it out.