Skip to content

Missing field Fhp\Segment\Common\Sdo.datum #575

Description

@nQk2

As of today, DKB sends balance without a date in C:123,45:EUR format.

So make $datum nullable.

Change Sdo.php:

/** JJJJMMTT gemäß ISO 8601 */
public string $datum;

to:

/** JJJJMMTT gemäß ISO 8601; some banks omit this field */
public ?string $datum = null;

Since getTimestamp() currently assumes a date exists, also change it from:

public function getTimestamp(): \DateTime
{
    return \DateTime::createFromFormat(
        'Ymd His',
        $this->datum . ' ' . ($this->uhrzeit ?? '000000')
    );
}

to:

public function getTimestamp(): ?\DateTime
{
    if ($this->datum === null || $this->datum === '') {
        return null;
    }

    $timestamp = \DateTime::createFromFormat(
        'Ymd His',
        $this->datum . ' ' . ($this->uhrzeit ?? '000000')
    );

    return $timestamp ?: null;
}

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions