From 9a12d10cbb8ec11ccae4baf8b0443b793401cb4b Mon Sep 17 00:00:00 2001 From: Michael Date: Thu, 27 Mar 2025 10:05:08 +0100 Subject: [PATCH] Update FinTs.php Extract login action creation into single function to make it accessible for own login interaction --- lib/Fhp/FinTs.php | 18 +++++++++++++----- 1 file changed, 13 insertions(+), 5 deletions(-) diff --git a/lib/Fhp/FinTs.php b/lib/Fhp/FinTs.php index 426ff10..455bb1d 100644 --- a/lib/Fhp/FinTs.php +++ b/lib/Fhp/FinTs.php @@ -242,6 +242,16 @@ public function setTimeouts(int $connectTimeout, int $responseTimeout) $this->options->timeoutResponse = $responseTimeout; } + public function createLoginAction(): DialogInitialization + { + $this->requireTanMode(); + $this->ensureSynchronized(); + $this->messageNumber = 1; + + return new DialogInitialization($this->options, $this->requireCredentials(), $this->getSelectedTanMode(), + $this->selectedTanMedium, $this->kundensystemId); + } + /** * Executes a strongly authenticated login action and returns it. With some banks, this requires a TAN. * @return DialogInitialization A {@link BaseAction} for the outcome of the login. You should check whether a TAN is @@ -254,12 +264,10 @@ public function setTimeouts(int $connectTimeout, int $responseTimeout) */ public function login(): DialogInitialization { - $this->requireTanMode(); - $this->ensureSynchronized(); - $this->messageNumber = 1; - $login = new DialogInitialization($this->options, $this->requireCredentials(), $this->getSelectedTanMode(), - $this->selectedTanMedium, $this->kundensystemId); + $login = $this->createLoginAction(); + $this->execute($login); + return $login; }