Skip to content

Commit

Permalink
Merge pull request #6 from iMi-digital/patch-1
Browse files Browse the repository at this point in the history
Various Fixes and Improvements
  • Loading branch information
janunger authored Jan 24, 2017
2 parents b0ebffd + 9efcc8e commit 75d0c4e
Show file tree
Hide file tree
Showing 6 changed files with 15 additions and 4 deletions.
4 changes: 4 additions & 0 deletions src/AqBanking/Command/AddUserCommand.php
Original file line number Diff line number Diff line change
Expand Up @@ -27,6 +27,10 @@ public function execute(User $user)
. ' --tokentype=pintan'
. ' --server=' . escapeshellcmd($user->getBank()->getHbciUrl());

if ($user->getBank()->getHbciVersion()) {
$shellCommand .= ' --hbciversion=' . escapeshellarg($user->getBank()->getHbciVersion()->getVersionNumber());
}

$result = $this->getShellCommandExecutor()->execute($shellCommand);

if (self::RETURN_VAR_USER_ALREADY_EXISTS === $result->getReturnVar()) {
Expand Down
1 change: 1 addition & 0 deletions src/AqBanking/Command/ShellCommandExecutor.php
Original file line number Diff line number Diff line change
Expand Up @@ -8,6 +8,7 @@ class ShellCommandExecutor
{
public function execute($shellCommand)
{
$shellCommand = "LANG=C " . $shellCommand;
$output = array();
$returnVar = null;
$tempFile = tempnam(sys_get_temp_dir(), 'aqb-');
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -16,7 +16,7 @@ class DefectiveResultException extends \Exception

public function __construct($message = '', $code = 0, \Exception $previous = null, Result $result = null, $shellCommand = '')
{
parent::__construct($message, $code, $previous);
parent::__construct($message . " - Result: " . var_export($result, true) , $code, $previous);

$this->result = $result;
$this->shellCommand = $shellCommand;
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -5,9 +5,9 @@
class ResultAnalyzer
{
private $expectedOutputRegexes = array(
'/Aufträge werden ausgeführt: Started\./',
'/Automatically accepting valid new certificate/',
'/Automatically accepting certificate/',
'/The TLS connection was non-properly terminated./', // it usually automatically restarts, so no error
'/Unexpected tag/',
'/To debug set environment variable/',
'/Your bank does not send an opening saldo/',
Expand Down
8 changes: 8 additions & 0 deletions src/AqBanking/HbciVersion.php
Original file line number Diff line number Diff line change
Expand Up @@ -44,4 +44,12 @@ public function getMethodCode()
{
return $this->methodCode;
}

/**
* @return string
*/
public function getVersionNumber()
{
return $this->versionNumber;
}
}
Original file line number Diff line number Diff line change
Expand Up @@ -25,7 +25,6 @@ public function testRecognizesErrorByResultVar()
public function testCanTellCorrectPollResult()
{
$errors = array(
'Aufträge werden ausgeführt: Started.',
'5:2013/07/22 11-32-32:aqbanking(39873):abgui.c: 182: Automatically accepting valid new certificate [40:BD:81:8B:76:27:1A:58:5C:B7:68:46:1E:CB:F2:FD]',
'5:2013/07/22 11-32-33:aqbanking(39873):abgui.c: 182: Automatically accepting valid new certificate [40:BD:81:8B:76:27:1A:58:5C:B7:68:46:1E:CB:F2:FD]',
'5:2013/07/22 11-32-33:aqbanking(39873):abgui.c: 182: Automatically accepting valid new certificate [40:BD:81:8B:76:27:1A:58:5C:B7:68:46:1E:CB:F2:FD]',
Expand All @@ -43,7 +42,6 @@ public function testCanTellCorrectPollResult()
public function testCanTellDefectivePollResult()
{
$errors = array(
'Aufträge werden ausgeführt: Started.',
'5:2013/07/22 11-31-44:aqbanking(39859):abgui.c: 182: Automatically accepting valid new certificate [40:BD:81:8B:76:27:1A:58:5C:B7:68:46:1E:CB:F2:FD]',
'3:2013/07/22 11-31-44:aqhbci(39859):outbox.c: 1390: Error performing queue (-2)',
'5:2013/07/22 11-31-44:aqbanking(39859):./banking_online.c: 119: Error executing backend\'s queue',
Expand Down

0 comments on commit 75d0c4e

Please sign in to comment.