phpFinTS icon indicating copy to clipboard operation
phpFinTS copied to clipboard

easy Laravel Implementation possible?

Open seem2810 opened this issue 2 years ago • 13 comments

Hi there,

I'm coming over https://github.com/abiturma/laravel-fints to https://github.com/abiturma/php-fints and from this https://github.com/mschindler83/fints-hbci-php to finally this project.

I've got the big problem, that my bank needs a Tan to receive the statements. However I didn't find a solution.

Maybe some other has a possible migration? (Gerne auf Englisch oder Deutsch)

use Abiturma\PhpFints\Fints;

class HBCI
{
    public static function init(Bank $bank, $username = null, $pin = null)
    {
        $host = $bank->server;
        $account_number = $bank->account_number;
        $bank_code = $bank->bank_code;

        $fints = Fints::host($host)->username($username)->bankCode($bank_code)->pin($pin);
        dump($fints);
        dump($fints->getAccounts());
        $account = false;
        foreach ($fints->getAccounts() as $ac) {
            if ($ac->account_number == $account_number) $account = $ac;
        }

        if ($account) {
           $statements = $fints->getStatementOfAccount($account, $startDate);
           dd($statements);

seem2810 avatar Jul 07 '22 14:07 seem2810

Have you had a look into Samples/statementOfAccount.php? You will need way more User Interaction for TAN Cases than you showed here. Your provided code will only work if there is no tan needed (and I think you also forgot the $fints->login() method, which might need a seperate tan every 30(?) days as well :/ )

I did it like this in another project - in the Samples directory in this project you find some example code as well. You will need different Reqests (which sometimes will and sometimes will not be needed - depending on your bank) - therefore you need the $fints->persist() to reinitiate the $fints object in your (then new) Laravel request.

lukas-staab avatar Jul 07 '22 17:07 lukas-staab

Thanks. I'll try.

seem2810 avatar Jul 17 '22 17:07 seem2810

I've implemented your repo and it worked well. But If i choose pushTAN 2.0 my app ask for confirmation. After I receive an error:

Protocol
 \ 
UnexpectedResponseException
PHP 8.1.7
9.20.0
Got neither 3956 nor HITAN with tanProzess=2

In:

if ($this->fints->checkDecoupledSubmission($action)) {

                    echo "Bestätigt.<br />";

                }

This validate the request for a few minutes and everything is fine. But I don't know how to handle this error.

seem2810 avatar Jul 22 '22 19:07 seem2810

any ideas?

seem2810 avatar Aug 08 '22 09:08 seem2810

I am not sure right now. Seems either like a bank issue or a wrong api call. Maybe @Philipp91 or @nemiah has an idea.

lukas-staab avatar Aug 08 '22 10:08 lukas-staab

This validate the request for a few minutes and everything is fine.

What do you mean by "everything is fine"? That you can receive the bank statements as expected as long as you just ignore that exception?

Philipp91 avatar Aug 13 '22 20:08 Philipp91

Got neither 3956 nor HITAN with tanProzess=2

Please log the traffic and send us the last response received from the server. That's the one to which the error message refers. Please make sure it doesn't contain any sensitive information before posting it.


The library currently only supports those two aforementioned cases (3956 code to mean "still waiting for the user's confirmation" or HITAN segment to mean "confirmation successful"). But perhaps there are more cases. I suspect that this could be the issue:

Note that we only support the (B) variant here.

Which refers to section B.4.2.2.1 of the specification. So I guess based on the response you post and the further specification sections, we'd have to implement some more functionality to support this bank's login procedure.

Philipp91 avatar Aug 13 '22 20:08 Philipp91

This validate the request for a few minutes and everything is fine.

What do you mean by "everything is fine"? That you can receive the bank statements as expected as long as you just ignore that exception?

Yes. I can receive the statements when I ignore the error.

Got neither 3956 nor HITAN with tanProzess=2

Please log the traffic and send us the last response received from the server. That's the one to which the error message refers. Please make sure it doesn't contain any sensitive information before posting it.

The library currently only supports those two aforementioned cases (3956 code to mean "still waiting for the user's confirmation" or HITAN segment to mean "confirmation successful"). But perhaps there are more cases. I suspect that this could be the issue:

Note that we only support the (B) variant here.

Which refers to section B.4.2.2.1 of the specification. So I guess based on the response you post and the further specification sections, we'd have to implement some more functionality to support this bank's login procedure.

I'll check it this week.

seem2810 avatar Aug 15 '22 14:08 seem2810

@Philipp91 @nemiah short information after days of working on this implementation: success in all cases except decoupled authentication request. There is a method called "isProzessvariante2" on TanMode model. This returns true in my case but throw an error on "checkDecoupledSubmission" with message "Got neither 3956 nor HITAN with tanProzess=2". I think thats not a right behaviour. Can you check this?

timrasche avatar Nov 16 '22 11:11 timrasche

Please log the traffic and send us the last response received from the server. That's the one to which the error message refers. Please make sure it doesn't contain any sensitive information before posting it.

Philipp91 avatar Nov 16 '22 20:11 Philipp91

any new news about this issue?

Handman280 avatar Feb 15 '23 08:02 Handman280

I can't test it... My customer has changed his tan mode .. I think we can close it

any new news about this issue?

seem2810 avatar Mar 09 '23 08:03 seem2810

Please log the traffic and send us the last response received from the server. That's the one to which the error message refers. Please make sure it doesn't contain any sensitive information before posting it.

Hi everybody...I've got the same issue "Got neither 3956 nor HITAN with tanProzess=2". The message for the getStatementOfAccount() returns the statements as it seems.

I have attached a log file with the request and a response where you can find "Freigabe erfolgreich" and the positions. But it nevertheless shows this error. fints.log

witschko avatar Jul 19 '23 14:07 witschko