Add CAMT XML parser with automatic MT940 fallback#533
Open
ticktoo wants to merge 1 commit intonemiah:masterfrom
Open
Add CAMT XML parser with automatic MT940 fallback#533ticktoo wants to merge 1 commit intonemiah:masterfrom
ticktoo wants to merge 1 commit intonemiah:masterfrom
Conversation
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.
Owner
|
Thank you for your PR! I'll let it "hang" for a while to see if there are comments 😌 |
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.
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
Automatic fallback in GetStatementOfAccount
Add StatementOfAccount::fromCAMTArray() method
Add example: Samples/statementOfAccountXML.php
Backward compatible - no breaking changes. Existing code using GetStatementOfAccount will automatically benefit from XML fallback.
Fixes: #527