forked from nemiah/phpFinTS
-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathKik.php
More file actions
37 lines (31 loc) · 1.23 KB
/
Kik.php
File metadata and controls
37 lines (31 loc) · 1.23 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
<?php
namespace Fhp\Segment\Common;
use Fhp\Segment\BaseDeg;
/**
* Mehrfach verwendetes Element: Kreditinstitutskennung (Version 1)
*
* @link https://www.hbci-zka.de/dokumente/spezifikation_deutsch/fintsv3/FinTS_3.0_Messages_Geschaeftsvorfaelle_2015-08-07_final_version.pdf
* Section: B.2
*/
class Kik extends BaseDeg
{
public const DEFAULT_COUNTRY_CODE = '280'; // Germany
/** (ISO 3166-1; has leading zeros; Germany is 280, see also chapter E.4 */
public ?string $laenderkennzeichen; // Officially it's mandatory, but in practice it can be missing.
/** Max length: 30 (Mandatory/absent depending on the country) */
public ?string $kreditinstitutscode = null;
public function validate()
{
parent::validate();
if ($this->laenderkennzeichen === self::DEFAULT_COUNTRY_CODE && $this->kreditinstitutscode === null) {
throw new \InvalidArgumentException('Kik.kreditinstitutscode is mandatory for German banks (BLZ)');
}
}
public static function create(string $kreditinstitutscode): Kik
{
$result = new Kik();
$result->laenderkennzeichen = static::DEFAULT_COUNTRY_CODE;
$result->kreditinstitutscode = $kreditinstitutscode;
return $result;
}
}