forked from nemiah/phpFinTS
-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathPostbankMT940.php
More file actions
38 lines (30 loc) · 1.2 KB
/
Copy pathPostbankMT940.php
File metadata and controls
38 lines (30 loc) · 1.2 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
<?php
namespace Fhp\MT940\Dialect;
use Fhp\MT940\MT940;
class PostbankMT940 extends MT940
{
public const DIALECT_ID = 'https://hbci.postbank.de/banking/hbci.do';
public function extractStructuredDataFromRemittanceLines($descriptionLines, string &$gvc, array &$rawLines, array $transaction): array
{
// z.B bei Zinsen o.ä. ist alles leer
if (!isset($descriptionLines[0])) {
return [];
}
$structuredStartFound = preg_match('/^[A-Z]{4}\+/', $descriptionLines[0]) === 1;
if ($structuredStartFound) {
return parent::extractStructuredDataFromRemittanceLines($descriptionLines, $gvc, $rawLines, $transaction);
}
// Bie Auslandsüberweisungen (=210)
// Der Empfänger name steht als erstes im Verwendungszweck und teile des Verwendungszwecks stehen im Namen
if ($gvc == '210') {
$name = array_shift($descriptionLines);
array_unshift($descriptionLines, $rawLines[33]);
array_unshift($descriptionLines, $rawLines[32]);
$rawLines[32] = $name;
$rawLines[33] = '';
}
return [
'SVWZ' => implode("\n", $descriptionLines),
];
}
}