Skip to content

fix(#131,#132): CC amount CR-suffix rerouting + yearless date sorting#135

Merged
longieirl merged 1 commit intomainfrom
fix/132-cc-yearless-date-sorting
Apr 9, 2026
Merged

fix(#131,#132): CC amount CR-suffix rerouting + yearless date sorting#135
longieirl merged 1 commit intomainfrom
fix/132-cc-yearless-date-sorting

Conversation

@longieirl
Copy link
Copy Markdown
Owner

Summary

Fixes two AIB Credit Card statement bugs:

Changes

  • currency.pyreroute_cr_suffix(row): detects CR suffix on Debit, strips it, moves value to Credit, clears Debit
  • row_post_processor.py_reroute_cr_amounts(): calls reroute_cr_suffix immediately after column alias mapping, before row classification
  • page_header_analyser.py — extend _PAYMENT_DUE_PATTERNS to match ordinal date suffixes (17th April, 2026) for more robust year extraction
  • test_currency.py — 5 unit tests for reroute_cr_suffix
  • test_row_post_processor.py — 2 end-to-end tests through process() for CR rerouting
  • Integration snapshot re-baselined: pdf_count 4→5, pdfs_extracted 3→4, pages_read 24→26 (CC PDF added to fixture set)

Type

  • Bug fix

Testing

  • Tests pass (coverage ≥ 91%)
  • Manually tested
  • make docker-integration passed locally (required when touching Dockerfile, entrypoint.sh, docker-compose.yml, or packages/parser-core/)

Checklist

  • Code follows project style
  • Self-reviewed
  • Documentation updated (if needed)
  • No new warnings

Downstream impact

  • This PR changes a public interface in bankstatements_core (exported class, function, or exception)

AIB CC statements encode payments/refunds as amounts suffixed with 'CR'
(e.g. '300.00CR') in a single Amount column, aliased to Debit.

- currency.reroute_cr_suffix(): strips CR suffix, moves value to Credit, clears Debit
- RowPostProcessor._reroute_cr_amounts(): calls reroute_cr_suffix after alias mapping
- page_header_analyser: extend _PAYMENT_DUE_PATTERNS to match ordinal suffixes
  (e.g. '17th April, 2026') to improve year extraction robustness
- Re-baseline integration snapshot: pdf_count 4→5, pdfs_extracted 3→4, pages_read 24→26
  (reflects CC PDF added to fixture set in earlier branch work)

Closes #131
@longieirl longieirl self-assigned this Apr 9, 2026
@github-actions github-actions bot added the bug Something isn't working label Apr 9, 2026
@longieirl longieirl merged commit 43cc213 into main Apr 9, 2026
11 checks passed
@longieirl longieirl deleted the fix/132-cc-yearless-date-sorting branch April 9, 2026 15:32
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

bug Something isn't working

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants