Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Missing field Fhp\Segment\SAL\HISALv7.buchungszeitpunkt #304

Closed
Hunzlifuz opened this issue Aug 14, 2020 · 9 comments · Fixed by #305
Closed

Missing field Fhp\Segment\SAL\HISALv7.buchungszeitpunkt #304

Hunzlifuz opened this issue Aug 14, 2020 · 9 comments · Fixed by #305

Comments

@Hunzlifuz
Copy link

Hi,
i don't know if i am doing anything wrong but if I just want to test the samples I am getting an error when I want do download the saldo of my account.
Everything else works fine but the saldo always returns with error.
I am using the latest version and testet the old sample-File "saldo.php" with my banking credentials. I testet it with two different banks (Raiffeisenbank Bayern Mitte 72160818 and DKB 12030000) with the same result.
Also with the FinTsNew and the new approach in SamplesNew i get this error.

Uncaught InvalidArgumentException: Missing field Fhp\Segment\SAL\HISALv7.buchungszeitpunkt in \FinTS\vendor\nemiah\php-fints\lib\Fhp\Syntax\Parser.php:322 Stack trace: #0 \FinTS\vendor\nemiah\php-fints\lib\Fhp\Syntax\Parser.php(438): Fhp\Syntax\Parser::parseSegment('HISAL:5:7:3+DE6...', 'Fhp\Segment\SAL...') #1 [internal function]: Fhp\Syntax\Parser::detectAndParseSegment('HISAL:5:7:3+DE6...') #2 \FinTS\vendor\nemiah\php-fints\lib\Fhp\Syntax\Parser.php(455): array_map(Array, Array) #3 \FinTS\vendor\nemiah\php-fints\lib\Fhp\Protocol\Message.php(319): Fhp\Syntax\Parser::parseSegments(Array) #4 \FinTS\vendor\nemiah\php-fints\lib\Fhp\FinTsNew.php(875): Fhp\Protocol\Message::parse('HNHBK:1:3+00000...') #5 \FinTS\vendor\nemiah\php-fints\lib\Fhp\FinTsNew.php(339): Fhp\FinTsNew->sendMessage(Object(Fhp\Protocol\Message)) #6 \FinTS\vendor\nemiah\php-fints\lib\Fhp\FinTsNew.php(298): Fhp\FinTsNew->sendRequestForAction(Object(Fhp\Action\ in \FinTS\vendor\nemiah\php-fints\lib\Fhp\FinTsNew.php on line 877

@Hunzlifuz
Copy link
Author

Short Update.
I did further testing and it is working for bank DKB.
But for Raiffeisenbank Bayern Mitte (72160818) and norisbank (10077777) the exception above is thrown.

@Hunzlifuz
Copy link
Author

Short Update.
For Raiffeisenbank it is enough to comment out the variable $buchungszeitpunkt in File Fhp\Segment\SAL\HISALv7
then it works for this bank
But for norisbank it seems the wrong version of HISAL. It also throws an error for kontoverbindungInternational and kontoproduktbezeichnung. Then i stopped testing.

@Philipp91
Copy link
Contributor

This was fixed already. Please use code from the master branch for now (dev-master in Composer). @nemiah I think it would be helpful if we could release a new version, so that people can use the latest code more easily and don't spend their time debugging issues that have been fixed already.

@nemiah
Copy link
Owner

nemiah commented Aug 14, 2020

Sure, shall I use the current state or do you have something to add?

@Philipp91
Copy link
Contributor

Philipp91 commented Aug 14, 2020

I don't have any outstanding commits on my side and I couldn't find any open issues that would block a release. There is an open draft pull request that would add a new feature, but that can always be added in a subsequent (non-breaking) release. Also there's a bunch of open issues that can be closed, I had commented under them a couple months back, but I don't have permissions to close them myself.

@Hunzlifuz
Copy link
Author

Hi, thanks for the quick response. For Raiffeisenbank and DKB its now working fine.
But with norisbank i am still getting the error:

Uncaught InvalidArgumentException: Missing field Fhp\Segment\SAL\HISALv7.kontoverbindungInternational in D:\workspace\openui5.hunzlifuz.de\vendor\nemiah\php-fints\lib\Fhp\Syntax\Parser.php:322\nStack trace:\n#0 D:\workspace\openui5.hunzlifuz.de\vendor\nemiah\php-fints\lib\Fhp\Syntax\Parser.php(438): Fhp\Syntax\Parser::parseSegment('HISAL:4:7:3++no...', 'Fhp\\Segment\\SAL...')\n#1 [internal function]: Fhp\Syntax\Parser::detectAndParseSegment('HISAL:4:7:3++no...')\n#2 D:\workspace\openui5.hunzlifuz.de\vendor\nemiah\php-fints\lib\Fhp\Syntax\Parser.php(455): array_map(Array, Array)\n#3 D:\workspace\openui5.hunzlifuz.de\vendor\nemiah\php-fints\lib\Fhp\Protocol\Message.php(319): Fhp\Syntax\Parser::parseSegments(Array)\n#4 D:\workspace\openui5.hunzlifuz.de\vendor\nemiah\php-fints\lib\Fhp\FinTs.php(851): Fhp\Protocol\Message::parse('HNHBK:1:3+00000...')\n#5 D:\workspace\openui5.hunzlifuz.de\vendor\nemiah\php-fints\lib\Fhp\FinTs.php(306): Fhp\FinTs->sendMessage(Object(Fhp\Protocol\Message))\n#6 D:\workspace\openui5.hunzlifuz. in D:\workspace\openui5.hunzlifuz.de\vendor\nemiah\php-fints\lib\Fhp\FinTs.php

@Hunzlifuz
Copy link
Author

For my testing i downloaded the dev-master via composer

@Philipp91
Copy link
Contributor

Oh okay, that's another, more subtle bug. As can be seen from your error message, the HISAL segment has an empty second group (HISAL:4:7:3++no... -- between the two pluses). The Kti field itself is mandatory, but all of the fields within the Kti type are optional, so an empty group is technically allowed. This will have to be fixed in the parser itself, for which I prefer strong unit tests. Could you please somehow log (with SanitizingLogger) or otherwise intercept (e.g. echo or a breakpoint in your IDE) the segment contents as they go over the wire, i.e. filling in the ... above? Feel free to change the balance itself to 1234 or so.

Philipp91 added a commit to Philipp91/phpFinTS that referenced this issue Aug 16, 2020
… all subfields are optional

Not sure if a similar fix is necessary for the DEG parsing function, though probably not because DEG field delimiters need to be present even for empty subfields for the indices of subsequent fields to match. So probably the existing $allowEmpy logic in the DEG parsing function handles the same case there, and thus this fix is only necessary on the segment level.
@Hunzlifuz
Copy link
Author

I hope the attached file contains the relevant information for you.
HISAL_err.txt

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
3 participants