ensureDone(); return $this->accounts; } /** {@inheritdoc} */ protected function createRequest(BPD $bpd, ?UPD $upd) { /** @var BaseSegment $hispas */ $hispas = $bpd->requireLatestSupportedParameters('HISPAS'); switch ($hispas->getVersion()) { case 1: return HKSPAv1::createEmpty(); case 2: return HKSPAv2::createEmpty(); case 3: return HKSPAv3::createEmpty(); default: throw new UnsupportedException('Unsupported HKSPA version: ' . $hispas->getVersion()); } } /** {@inheritdoc} */ public function processResponse(Message $response) { parent::processResponse($response); // Banks send just 3010 and no HISPA in case there are no accounts (or at least none that the bank is able to // report through HISPA). if ($response->findRueckmeldung(Rueckmeldungscode::NICHT_VERFUEGBAR) !== null) { $this->accounts = []; return; } /** @var HISPA $hispa */ $hispa = $response->requireSegment(HISPA::class); $this->accounts = array_map(function ($ktz) { /** @var Ktz $ktz */ $account = new SEPAAccount(); $account->setIban($ktz->iban); $account->setBic($ktz->bic); $account->setAccountNumber($ktz->kontonummer); $account->setSubAccount($ktz->unterkontomerkmal); $account->setBlz($ktz->kreditinstitutskennung->kreditinstitutscode); return $account; }, $hispa->getSepaKontoverbindung()); } }