getTanMedia not returning anything
Same problem, as some had with "Sparkasse" before in here.
But for me it is not even showing "Alle Geräte" in tanMedia.
Executing this $tanMedia = $fints->getTanMedia($tanMode); is not returning anything. The code is not getting past this.
If I set this manually to "Alle Geräte", the code won't work ($tanMedium = "Alle Geräte"; ).
Hi CasparKrog,
this is how my code works:
$tanModes = $this->fints->getTanModes();
$tanModeNumber = $tanMode; //EG 923 PushTan
if (is_array($tanModeNumber) && isset($tanModeNumber['sicherheitsfunktion'])) $tanModeNumber = $tanModeNumber['sicherheitsfunktion'];
$tanModeObject = (isset($tanModes[$tanModeNumber])) ? $tanModes[$tanModeNumber] : null;
if ($tanModeObject && $tanModeObject->needsTanMedium()) {
$tanMedias = $this->fints->getTanMedia($tanModeObject);
if (!empty($tanMedias)) {
$this->fints->close();
return 'tan_medium_selection';
}
}
Do you have the $tanModeObject->needsTanMedium() in your code?
Do you have the
$tanModeObject->needsTanMedium()in your code?
Yes I have that in my code.
Is it possible that you will have a closer look at my code?
Can you compare your code with my code snippet above? Post your code snippet here
`<?php
/** @noinspection PhpUnhandledExceptionInspection */
/**
- SAMPLE - Creates a new FinTs instance (init.php) and lets the user select the TAN mode they want to use. */
/** @var \Fhp\FinTs $fints */ $fints = require_once 'init.php';
// First, the user has to decide which TAN mode they want to use. // NOTE: There is a special case for banks that do not support PSD2, use NoPsd2TanMode for those. $tanModes = $fints->getTanModes(); if (empty($tanModes)) { echo 'Your bank does not support any TAN modes!'; return; }
echo "Here are the available TAN modes:\n"; $tanModeNames = array_map(function (\Fhp\Model\TanMode $tanMode) { return $tanMode->getName(); }, $tanModes); print_r($tanModeNames);
echo "Which one do you want to use? Index:\n"; $tanModeIndex = "923"; if (!is_numeric($tanModeIndex) || !array_key_exists(intval($tanModeIndex), $tanModes)) { echo 'Invalid index!'; return; } $tanMode = $tanModes[intval($tanModeIndex)]; echo 'You selected ' . $tanMode->getName() . "\n";
// In case the selected TAN mode requires a TAN medium (e.g. if the user picked mTAN, they may have to pick the mobile // device on which they want to receive TANs), let the user pick that too. if ($tanMode->needsTanMedium()) { $tanMedia = $fints->getTanMedia($tanMode); if (empty($tanMedia)) { echo 'Your bank did not provide any TAN media, even though it requires selecting one!'; return; }
echo "Here are the available TAN media:\n";
$tanMediaNames = array_map(function (\Fhp\Model\TanMedium $tanMedium) {
return $tanMedium->getName();
}, $tanMedia);
print_r($tanMediaNames);
echo "Which one do you want to use? Index:\n";
$tanMediumIndex = trim(fgets(STDIN));
if (!is_numeric($tanMediumIndex) || !array_key_exists(intval($tanMediumIndex), $tanMedia)) {
echo 'Invalid index!';
return;
}
$tanMedium = $tanMedia[intval($tanMediumIndex)];
echo 'You selected ' . $tanMedium->getName() . "\n";
} else { $tanMedium = null; }
// Announce the selection to the FinTS library. $fints->selectTanMode($tanMode, $tanMedium);
// Within your application, you should persist these choices somewhere (e.g. database), so that the user does not have // to select them again the future. Note that it is sufficient to persist the ID/name, i.e. this is equivalent: $fints->selectTanMode($tanMode->getId(), $tanMedium->getName());
// Now you could do $fints->login(), see login.php for that. For this example, we'll just close the connection. $fints->close(); echo 'Done'; `
The Output:
https://erp.trimix-baustoffe.de/plugins/phpFinTS/Samples/tanModesAndMedia.php
Okay, but it seems to be correct? "Here are the available TAN modes: Array ( [923] => pushTAN 2.0 ) Which one do you want to use? Index: You selected pushTAN 2.0"
after that is no more output set in your code? Looks like, that if ($tanMode->needsTanMedium()) { is false...
Hi @CasparKrog you need to delete or stop this line in init.php file:
//$fints->setLogger(new \Tests\Fhp\CLILogger());
then you can see a clear page.
best wishes
again , if you want to know exactly how your tanMeduim is saved in the bank , you need to visit the browser.php and then sign in with your account .
Hi @CasparKrog you need to delete or stop this line in init.php file:
//$fints->setLogger(new \Tests\Fhp\CLILogger());then you can see a clear page.
best wishes
Sure, I just did it, to get the debugging Info.
again , if you want to know exactly how your tanMeduim is saved in the bank , you need to visit the browser.php and then sign in with your account .
Good idea, tried it, but it won't give me the balance? It stops without giving me the balance. It works with a different back though. Just not with Sparkasse.