Skip to content

Conversation

@ticktoo
Copy link

@ticktoo ticktoo commented Jan 21, 2026

Fixes #527 - German banks disabled MT940 format (HIKAZS) in November 2025.

This commit adds the missing CAMT XML parser implementation. While CAMT protocol segment definitions existed (lib/Fhp/Segment/CAZ/*), there was no parser to convert the actual CAMT XML data into usable Transaction objects.

Changes:

  • Add complete ISO 20022 CAMT parser (lib/Fhp/CAMT/CAMT.php) - NEW

    • Parses camt.052 (Account Report) format
    • Extracts all transaction fields: name, IBAN, BIC, booking codes
    • Supports structured SEPA fields (EREF, MREF, CRED, KREF)
    • Cleans descriptions by removing structured field markers
    • Namespace-agnostic (works with and without namespace prefix)
    • Handles element variations across different banks
  • Automatic fallback in GetStatementOfAccount

    • Tries MT940 first, falls back to CAMT XML if unavailable
    • Catches both UnexpectedResponseException and UnsupportedException
    • Transparent - existing code works without modifications
  • Add StatementOfAccount::fromCAMTArray() method

    • Reuses existing fromMT940Array() logic for compatibility
  • Add example: Samples/statementOfAccountXML.php

    • Demonstrates both automatic and manual XML usage

Backward compatible - no breaking changes. Existing code using GetStatementOfAccount will automatically benefit from XML fallback.

Fixes: #527

Fixes nemiah#527 - German banks disabled MT940 format (HIKAZS) in November 2025.

This commit adds the missing CAMT XML parser implementation. While CAMT
protocol segment definitions existed (lib/Fhp/Segment/CAZ/*), there was no
parser to convert the actual CAMT XML data into usable Transaction objects.

Changes:
- Add complete ISO 20022 CAMT parser (lib/Fhp/CAMT/CAMT.php) - NEW
  * Parses camt.052 (Account Report) format
  * Extracts all transaction fields: name, IBAN, BIC, booking codes
  * Supports structured SEPA fields (EREF, MREF, CRED, KREF)
  * Cleans descriptions by removing structured field markers
  * Namespace-agnostic (works with and without namespace prefix)
  * Handles <Pty> element variations across different banks

- Automatic fallback in GetStatementOfAccount
  * Tries MT940 first, falls back to CAMT XML if unavailable
  * Catches both UnexpectedResponseException and UnsupportedException
  * Transparent - existing code works without modifications

- Add StatementOfAccount::fromCAMTArray() method
  * Reuses existing fromMT940Array() logic for compatibility

- Add example: Samples/statementOfAccountXML.php
  * Demonstrates both automatic and manual XML usage

Backward compatible - no breaking changes. Existing code using
GetStatementOfAccount will automatically benefit from XML fallback.
@nemiah
Copy link
Owner

nemiah commented Jan 21, 2026

Thank you for your PR! I'll let it "hang" for a while to see if there are comments 😌

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.

The server does not support any HIKAZS versions implemented in this library

2 participants