Skip to content

Commit 47b12af

Browse files
authored
Merge pull request #200 from Bur0k/camt/array
Import: Read every CAMT statement from the array
2 parents ceecb81 + dd0bd2d commit 47b12af

File tree

1 file changed

+5
-4
lines changed

1 file changed

+5
-4
lines changed

app/GetImportData.php

Lines changed: 5 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -71,16 +71,16 @@ function () use ($statement_format) {
7171
} else {
7272
Logger::info("Parsing CAMT XML format");
7373
$camt_xml_array = $finished_action->getBookedXML();
74+
Logger::trace("CAMT XML raw data received from bank:" . print_r($camt_xml_array, true));
7475

7576
Logger::trace("CAMT XML array count: " . count($camt_xml_array));
7677
if (!empty($camt_xml_array) && isset($camt_xml_array[0])) {
7778
Logger::trace("First CAMT XML length: " . strlen($camt_xml_array[0]));
7879
}
7980

80-
$camt_xml = $camt_xml_array[0] ?? '';
81-
82-
if (!empty(trim($camt_xml))) {
83-
$transactions = \App\StatementOfAccountHelper::parse_camt_xml($camt_xml);
81+
foreach ($camt_xml_array as $camt_xml) {
82+
$camt_transactions = \App\StatementOfAccountHelper::parse_camt_xml($camt_xml);
83+
$transactions = array_merge($transactions, $camt_transactions);
8484
}
8585
}
8686

@@ -117,6 +117,7 @@ function () use ($statement_format) {
117117
} catch (UnexpectedResponseException $e) {
118118
// Check if this is a "format not supported" error
119119
$message = $e->getMessage();
120+
Logger::debug("Caught UnexpectedResponseException: " . $message);
120121

121122
if (strpos($message, 'HICAZS') !== false && !$use_mt940_fallback) {
122123
// CAMT not supported, try MT940

0 commit comments

Comments
 (0)