Skip to content

Commit

Permalink
cleanup
Browse files Browse the repository at this point in the history
  • Loading branch information
nemiah committed Jan 2, 2020
1 parent 4e0aad5 commit bb10a1e
Showing 1 changed file with 13 additions and 50 deletions.
63 changes: 13 additions & 50 deletions lib/Fhp/FinTs.php
Original file line number Diff line number Diff line change
Expand Up @@ -467,38 +467,26 @@ public function finishSEPATAN(GetTANRequest $tanRequest, $tan)

/**
* Executes SEPA transfer
* You have to call finishSEPATAN(), if $tanCallback is not set
* You have to call finishSEPATAN()
*
* @param SEPAAccount $account
* @param string $painMessage
* @param \Closure $tanCallback
*/
public function executeSEPATransfer(SEPAAccount $account, $painMessage, \Closure $tanCallback = null)
public function executeSEPATransfer(SEPAAccount $account, $painMessage)
{
$this->logger->debug(__CLASS__ . ':' . __FUNCTION__ . ' called');

$response = $this->startSEPATransfer($account, $painMessage);

if ($tanCallback === null) {
return $response;
}

echo "Waiting max. 120 seconds for TAN from callback\n";
for ($i = 0; $i < 120; ++$i) {
sleep(1);

$tan = trim($tanCallback());
if ($tan == '') {
echo 'No TAN found, waiting '.(120 - $i)."!\n";
continue;
}

break;
}

$this->finishSEPATAN($response, $tan);
return $this->startSEPATransfer($account, $painMessage);
}

public function executeSEPADirectDebit(SEPAAccount $account, $painMessage, \Closure $tanCallback, $interval = 1)
/**
* Executes SEPA direct debit
* You have to call finishSEPATAN()
*
* @param SEPAAccount $account
* @param string $painMessage
*/
public function executeSEPADirectDebit(SEPAAccount $account, $painMessage)
{
$this->logger->debug(__CLASS__ . ':' . __FUNCTION__ . ' called');

Expand Down Expand Up @@ -528,33 +516,8 @@ public function executeSEPADirectDebit(SEPAAccount $account, $painMessage, \Clos
$class = explode('\\', get_class($hkdsx));
$this->logger->info('');
$this->logger->info($class[count($class) - 1].' (SEPA direct debit) initialize');
$response = $dialog->sendMessage($message, $this->tanMechanism, $tanCallback);
$dialog->sendMessage($message, $this->tanMechanism);
$this->logger->info($class[count($class) - 1].' end');

//$response = new GetTANRequest($response->rawResponse);
//print_r($response);

//var_dump($response->get()->getProcessID());
//$this->logger->info("Waiting max. 120 seconds for TAN from callback. Checking every $interval second(s)...");
//echo "Waiting max. 120 seconds for TAN from callback. Checking every $interval second(s)…\n";
/*for ($i = 0; $i < 120; $i += $interval) {
sleep($interval);
$tan = trim($tanCallback());
if ($tan == '') {
$this->logger->info('No TAN found, waiting '.(120 - $i).'!');
continue;
}
break;
}
if ($tan == '') {
throw new TANException('No TAN received!');
}
$dialog->submitTAN($response, $this->getUsedPinTanMechanism($dialog), $tan);*/
}

/**
Expand Down

0 comments on commit bb10a1e

Please sign in to comment.