mschindler83/fints-hbci-php

No available TAN mechanisms leads to error

chrisribal opened this issue · 1 comments

In my case, the bank account at the Volksbank Wolfenbüttel had no active TAN mechanisms due to security reasons, which leads to an error in the INIT Message saying the message is missing one of the mandatory fields.

I found the error to be in building the message:

if (isset($options[static::OPT_PINTAN_MECH])) {
    if (!in_array('999', $this->options[static::OPT_PINTAN_MECH])) {
        $this->profileVersion = SecurityProfile::PROFILE_VERSION_2;
        $this->securityFunction = $this->options[static::OPT_PINTAN_MECH][0];
    }
}

In my case, the $options[static::OPT_PINTAN_MECH] array was empty, so there is no $this->options[static::OPT_PINTAN_MECH][0] to use instead. I just had to check additionally for an empty array and my script worked:

if (isset($options[static::OPT_PINTAN_MECH]) && !empty($this->options[static::OPT_PINTAN_MECH])) {
    if (!in_array('999', $this->options[static::OPT_PINTAN_MECH])) {
        $this->profileVersion = SecurityProfile::PROFILE_VERSION_2;
        $this->securityFunction = $this->options[static::OPT_PINTAN_MECH][0];
    }
}

Hope this helps somebody with the same problem.

Thanks for your PR. Its merged in master.