mirror of
https://github.com/OpenXE-org/OpenXE.git
synced 2024-11-14 12:07:15 +01:00
removed fints-hbci, white-cup-filled-by-coffee.jpg
This commit is contained in:
parent
a43ac720b6
commit
c4eaaa966a
@ -1,7 +0,0 @@
|
||||
<?php
|
||||
|
||||
// autoload.php @generated by Composer
|
||||
|
||||
require_once __DIR__ . '/composer/autoload_real.php';
|
||||
|
||||
return ComposerAutoloaderInitbdcab6487556631ed3c158e0e8422e44::getLoader();
|
@ -1,445 +0,0 @@
|
||||
<?php
|
||||
|
||||
/*
|
||||
* This file is part of Composer.
|
||||
*
|
||||
* (c) Nils Adermann <naderman@naderman.de>
|
||||
* Jordi Boggiano <j.boggiano@seld.be>
|
||||
*
|
||||
* For the full copyright and license information, please view the LICENSE
|
||||
* file that was distributed with this source code.
|
||||
*/
|
||||
|
||||
namespace Composer\Autoload;
|
||||
|
||||
/**
|
||||
* ClassLoader implements a PSR-0, PSR-4 and classmap class loader.
|
||||
*
|
||||
* $loader = new \Composer\Autoload\ClassLoader();
|
||||
*
|
||||
* // register classes with namespaces
|
||||
* $loader->add('Symfony\Component', __DIR__.'/component');
|
||||
* $loader->add('Symfony', __DIR__.'/framework');
|
||||
*
|
||||
* // activate the autoloader
|
||||
* $loader->register();
|
||||
*
|
||||
* // to enable searching the include path (eg. for PEAR packages)
|
||||
* $loader->setUseIncludePath(true);
|
||||
*
|
||||
* In this example, if you try to use a class in the Symfony\Component
|
||||
* namespace or one of its children (Symfony\Component\Console for instance),
|
||||
* the autoloader will first look for the class under the component/
|
||||
* directory, and it will then fallback to the framework/ directory if not
|
||||
* found before giving up.
|
||||
*
|
||||
* This class is loosely based on the Symfony UniversalClassLoader.
|
||||
*
|
||||
* @author Fabien Potencier <fabien@symfony.com>
|
||||
* @author Jordi Boggiano <j.boggiano@seld.be>
|
||||
* @see http://www.php-fig.org/psr/psr-0/
|
||||
* @see http://www.php-fig.org/psr/psr-4/
|
||||
*/
|
||||
class ClassLoader
|
||||
{
|
||||
// PSR-4
|
||||
private $prefixLengthsPsr4 = array();
|
||||
private $prefixDirsPsr4 = array();
|
||||
private $fallbackDirsPsr4 = array();
|
||||
|
||||
// PSR-0
|
||||
private $prefixesPsr0 = array();
|
||||
private $fallbackDirsPsr0 = array();
|
||||
|
||||
private $useIncludePath = false;
|
||||
private $classMap = array();
|
||||
private $classMapAuthoritative = false;
|
||||
private $missingClasses = array();
|
||||
private $apcuPrefix;
|
||||
|
||||
public function getPrefixes()
|
||||
{
|
||||
if (!empty($this->prefixesPsr0)) {
|
||||
return call_user_func_array('array_merge', $this->prefixesPsr0);
|
||||
}
|
||||
|
||||
return array();
|
||||
}
|
||||
|
||||
public function getPrefixesPsr4()
|
||||
{
|
||||
return $this->prefixDirsPsr4;
|
||||
}
|
||||
|
||||
public function getFallbackDirs()
|
||||
{
|
||||
return $this->fallbackDirsPsr0;
|
||||
}
|
||||
|
||||
public function getFallbackDirsPsr4()
|
||||
{
|
||||
return $this->fallbackDirsPsr4;
|
||||
}
|
||||
|
||||
public function getClassMap()
|
||||
{
|
||||
return $this->classMap;
|
||||
}
|
||||
|
||||
/**
|
||||
* @param array $classMap Class to filename map
|
||||
*/
|
||||
public function addClassMap(array $classMap)
|
||||
{
|
||||
if ($this->classMap) {
|
||||
$this->classMap = array_merge($this->classMap, $classMap);
|
||||
} else {
|
||||
$this->classMap = $classMap;
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* Registers a set of PSR-0 directories for a given prefix, either
|
||||
* appending or prepending to the ones previously set for this prefix.
|
||||
*
|
||||
* @param string $prefix The prefix
|
||||
* @param array|string $paths The PSR-0 root directories
|
||||
* @param bool $prepend Whether to prepend the directories
|
||||
*/
|
||||
public function add($prefix, $paths, $prepend = false)
|
||||
{
|
||||
if (!$prefix) {
|
||||
if ($prepend) {
|
||||
$this->fallbackDirsPsr0 = array_merge(
|
||||
(array) $paths,
|
||||
$this->fallbackDirsPsr0
|
||||
);
|
||||
} else {
|
||||
$this->fallbackDirsPsr0 = array_merge(
|
||||
$this->fallbackDirsPsr0,
|
||||
(array) $paths
|
||||
);
|
||||
}
|
||||
|
||||
return;
|
||||
}
|
||||
|
||||
$first = $prefix[0];
|
||||
if (!isset($this->prefixesPsr0[$first][$prefix])) {
|
||||
$this->prefixesPsr0[$first][$prefix] = (array) $paths;
|
||||
|
||||
return;
|
||||
}
|
||||
if ($prepend) {
|
||||
$this->prefixesPsr0[$first][$prefix] = array_merge(
|
||||
(array) $paths,
|
||||
$this->prefixesPsr0[$first][$prefix]
|
||||
);
|
||||
} else {
|
||||
$this->prefixesPsr0[$first][$prefix] = array_merge(
|
||||
$this->prefixesPsr0[$first][$prefix],
|
||||
(array) $paths
|
||||
);
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* Registers a set of PSR-4 directories for a given namespace, either
|
||||
* appending or prepending to the ones previously set for this namespace.
|
||||
*
|
||||
* @param string $prefix The prefix/namespace, with trailing '\\'
|
||||
* @param array|string $paths The PSR-4 base directories
|
||||
* @param bool $prepend Whether to prepend the directories
|
||||
*
|
||||
* @throws \InvalidArgumentException
|
||||
*/
|
||||
public function addPsr4($prefix, $paths, $prepend = false)
|
||||
{
|
||||
if (!$prefix) {
|
||||
// Register directories for the root namespace.
|
||||
if ($prepend) {
|
||||
$this->fallbackDirsPsr4 = array_merge(
|
||||
(array) $paths,
|
||||
$this->fallbackDirsPsr4
|
||||
);
|
||||
} else {
|
||||
$this->fallbackDirsPsr4 = array_merge(
|
||||
$this->fallbackDirsPsr4,
|
||||
(array) $paths
|
||||
);
|
||||
}
|
||||
} elseif (!isset($this->prefixDirsPsr4[$prefix])) {
|
||||
// Register directories for a new namespace.
|
||||
$length = strlen($prefix);
|
||||
if ('\\' !== $prefix[$length - 1]) {
|
||||
throw new \InvalidArgumentException("A non-empty PSR-4 prefix must end with a namespace separator.");
|
||||
}
|
||||
$this->prefixLengthsPsr4[$prefix[0]][$prefix] = $length;
|
||||
$this->prefixDirsPsr4[$prefix] = (array) $paths;
|
||||
} elseif ($prepend) {
|
||||
// Prepend directories for an already registered namespace.
|
||||
$this->prefixDirsPsr4[$prefix] = array_merge(
|
||||
(array) $paths,
|
||||
$this->prefixDirsPsr4[$prefix]
|
||||
);
|
||||
} else {
|
||||
// Append directories for an already registered namespace.
|
||||
$this->prefixDirsPsr4[$prefix] = array_merge(
|
||||
$this->prefixDirsPsr4[$prefix],
|
||||
(array) $paths
|
||||
);
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* Registers a set of PSR-0 directories for a given prefix,
|
||||
* replacing any others previously set for this prefix.
|
||||
*
|
||||
* @param string $prefix The prefix
|
||||
* @param array|string $paths The PSR-0 base directories
|
||||
*/
|
||||
public function set($prefix, $paths)
|
||||
{
|
||||
if (!$prefix) {
|
||||
$this->fallbackDirsPsr0 = (array) $paths;
|
||||
} else {
|
||||
$this->prefixesPsr0[$prefix[0]][$prefix] = (array) $paths;
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* Registers a set of PSR-4 directories for a given namespace,
|
||||
* replacing any others previously set for this namespace.
|
||||
*
|
||||
* @param string $prefix The prefix/namespace, with trailing '\\'
|
||||
* @param array|string $paths The PSR-4 base directories
|
||||
*
|
||||
* @throws \InvalidArgumentException
|
||||
*/
|
||||
public function setPsr4($prefix, $paths)
|
||||
{
|
||||
if (!$prefix) {
|
||||
$this->fallbackDirsPsr4 = (array) $paths;
|
||||
} else {
|
||||
$length = strlen($prefix);
|
||||
if ('\\' !== $prefix[$length - 1]) {
|
||||
throw new \InvalidArgumentException("A non-empty PSR-4 prefix must end with a namespace separator.");
|
||||
}
|
||||
$this->prefixLengthsPsr4[$prefix[0]][$prefix] = $length;
|
||||
$this->prefixDirsPsr4[$prefix] = (array) $paths;
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* Turns on searching the include path for class files.
|
||||
*
|
||||
* @param bool $useIncludePath
|
||||
*/
|
||||
public function setUseIncludePath($useIncludePath)
|
||||
{
|
||||
$this->useIncludePath = $useIncludePath;
|
||||
}
|
||||
|
||||
/**
|
||||
* Can be used to check if the autoloader uses the include path to check
|
||||
* for classes.
|
||||
*
|
||||
* @return bool
|
||||
*/
|
||||
public function getUseIncludePath()
|
||||
{
|
||||
return $this->useIncludePath;
|
||||
}
|
||||
|
||||
/**
|
||||
* Turns off searching the prefix and fallback directories for classes
|
||||
* that have not been registered with the class map.
|
||||
*
|
||||
* @param bool $classMapAuthoritative
|
||||
*/
|
||||
public function setClassMapAuthoritative($classMapAuthoritative)
|
||||
{
|
||||
$this->classMapAuthoritative = $classMapAuthoritative;
|
||||
}
|
||||
|
||||
/**
|
||||
* Should class lookup fail if not found in the current class map?
|
||||
*
|
||||
* @return bool
|
||||
*/
|
||||
public function isClassMapAuthoritative()
|
||||
{
|
||||
return $this->classMapAuthoritative;
|
||||
}
|
||||
|
||||
/**
|
||||
* APCu prefix to use to cache found/not-found classes, if the extension is enabled.
|
||||
*
|
||||
* @param string|null $apcuPrefix
|
||||
*/
|
||||
public function setApcuPrefix($apcuPrefix)
|
||||
{
|
||||
$this->apcuPrefix = function_exists('apcu_fetch') && ini_get('apc.enabled') ? $apcuPrefix : null;
|
||||
}
|
||||
|
||||
/**
|
||||
* The APCu prefix in use, or null if APCu caching is not enabled.
|
||||
*
|
||||
* @return string|null
|
||||
*/
|
||||
public function getApcuPrefix()
|
||||
{
|
||||
return $this->apcuPrefix;
|
||||
}
|
||||
|
||||
/**
|
||||
* Registers this instance as an autoloader.
|
||||
*
|
||||
* @param bool $prepend Whether to prepend the autoloader or not
|
||||
*/
|
||||
public function register($prepend = false)
|
||||
{
|
||||
spl_autoload_register(array($this, 'loadClass'), true, $prepend);
|
||||
}
|
||||
|
||||
/**
|
||||
* Unregisters this instance as an autoloader.
|
||||
*/
|
||||
public function unregister()
|
||||
{
|
||||
spl_autoload_unregister(array($this, 'loadClass'));
|
||||
}
|
||||
|
||||
/**
|
||||
* Loads the given class or interface.
|
||||
*
|
||||
* @param string $class The name of the class
|
||||
* @return bool|null True if loaded, null otherwise
|
||||
*/
|
||||
public function loadClass($class)
|
||||
{
|
||||
if ($file = $this->findFile($class)) {
|
||||
includeFile($file);
|
||||
|
||||
return true;
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* Finds the path to the file where the class is defined.
|
||||
*
|
||||
* @param string $class The name of the class
|
||||
*
|
||||
* @return string|false The path if found, false otherwise
|
||||
*/
|
||||
public function findFile($class)
|
||||
{
|
||||
// class map lookup
|
||||
if (isset($this->classMap[$class])) {
|
||||
return $this->classMap[$class];
|
||||
}
|
||||
if ($this->classMapAuthoritative || isset($this->missingClasses[$class])) {
|
||||
return false;
|
||||
}
|
||||
if (null !== $this->apcuPrefix) {
|
||||
$file = apcu_fetch($this->apcuPrefix.$class, $hit);
|
||||
if ($hit) {
|
||||
return $file;
|
||||
}
|
||||
}
|
||||
|
||||
$file = $this->findFileWithExtension($class, '.php');
|
||||
|
||||
// Search for Hack files if we are running on HHVM
|
||||
if (false === $file && defined('HHVM_VERSION')) {
|
||||
$file = $this->findFileWithExtension($class, '.hh');
|
||||
}
|
||||
|
||||
if (null !== $this->apcuPrefix) {
|
||||
apcu_add($this->apcuPrefix.$class, $file);
|
||||
}
|
||||
|
||||
if (false === $file) {
|
||||
// Remember that this class does not exist.
|
||||
$this->missingClasses[$class] = true;
|
||||
}
|
||||
|
||||
return $file;
|
||||
}
|
||||
|
||||
private function findFileWithExtension($class, $ext)
|
||||
{
|
||||
// PSR-4 lookup
|
||||
$logicalPathPsr4 = strtr($class, '\\', DIRECTORY_SEPARATOR) . $ext;
|
||||
|
||||
$first = $class[0];
|
||||
if (isset($this->prefixLengthsPsr4[$first])) {
|
||||
$subPath = $class;
|
||||
while (false !== $lastPos = strrpos($subPath, '\\')) {
|
||||
$subPath = substr($subPath, 0, $lastPos);
|
||||
$search = $subPath.'\\';
|
||||
if (isset($this->prefixDirsPsr4[$search])) {
|
||||
foreach ($this->prefixDirsPsr4[$search] as $dir) {
|
||||
$length = $this->prefixLengthsPsr4[$first][$search];
|
||||
if (file_exists($file = $dir . DIRECTORY_SEPARATOR . substr($logicalPathPsr4, $length))) {
|
||||
return $file;
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
// PSR-4 fallback dirs
|
||||
foreach ($this->fallbackDirsPsr4 as $dir) {
|
||||
if (file_exists($file = $dir . DIRECTORY_SEPARATOR . $logicalPathPsr4)) {
|
||||
return $file;
|
||||
}
|
||||
}
|
||||
|
||||
// PSR-0 lookup
|
||||
if (false !== $pos = strrpos($class, '\\')) {
|
||||
// namespaced class name
|
||||
$logicalPathPsr0 = substr($logicalPathPsr4, 0, $pos + 1)
|
||||
. strtr(substr($logicalPathPsr4, $pos + 1), '_', DIRECTORY_SEPARATOR);
|
||||
} else {
|
||||
// PEAR-like class name
|
||||
$logicalPathPsr0 = strtr($class, '_', DIRECTORY_SEPARATOR) . $ext;
|
||||
}
|
||||
|
||||
if (isset($this->prefixesPsr0[$first])) {
|
||||
foreach ($this->prefixesPsr0[$first] as $prefix => $dirs) {
|
||||
if (0 === strpos($class, $prefix)) {
|
||||
foreach ($dirs as $dir) {
|
||||
if (file_exists($file = $dir . DIRECTORY_SEPARATOR . $logicalPathPsr0)) {
|
||||
return $file;
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
// PSR-0 fallback dirs
|
||||
foreach ($this->fallbackDirsPsr0 as $dir) {
|
||||
if (file_exists($file = $dir . DIRECTORY_SEPARATOR . $logicalPathPsr0)) {
|
||||
return $file;
|
||||
}
|
||||
}
|
||||
|
||||
// PSR-0 include paths.
|
||||
if ($this->useIncludePath && $file = stream_resolve_include_path($logicalPathPsr0)) {
|
||||
return $file;
|
||||
}
|
||||
|
||||
return false;
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* Scope isolated include.
|
||||
*
|
||||
* Prevents access to $this/self from included files.
|
||||
*/
|
||||
function includeFile($file)
|
||||
{
|
||||
include $file;
|
||||
}
|
@ -1,21 +0,0 @@
|
||||
|
||||
Copyright (c) Nils Adermann, Jordi Boggiano
|
||||
|
||||
Permission is hereby granted, free of charge, to any person obtaining a copy
|
||||
of this software and associated documentation files (the "Software"), to deal
|
||||
in the Software without restriction, including without limitation the rights
|
||||
to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
|
||||
copies of the Software, and to permit persons to whom the Software is furnished
|
||||
to do so, subject to the following conditions:
|
||||
|
||||
The above copyright notice and this permission notice shall be included in all
|
||||
copies or substantial portions of the Software.
|
||||
|
||||
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
|
||||
IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
|
||||
FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
|
||||
AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
|
||||
LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
|
||||
OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
|
||||
THE SOFTWARE.
|
||||
|
@ -1,9 +0,0 @@
|
||||
<?php
|
||||
|
||||
// autoload_classmap.php @generated by Composer
|
||||
|
||||
$vendorDir = dirname(dirname(__FILE__));
|
||||
$baseDir = dirname($vendorDir);
|
||||
|
||||
return array(
|
||||
);
|
@ -1,10 +0,0 @@
|
||||
<?php
|
||||
|
||||
// autoload_namespaces.php @generated by Composer
|
||||
|
||||
$vendorDir = dirname(dirname(__FILE__));
|
||||
$baseDir = dirname($vendorDir);
|
||||
|
||||
return array(
|
||||
'Fhp' => array($vendorDir . '/mschindler83/fints-hbci-php/lib'),
|
||||
);
|
@ -1,47 +0,0 @@
|
||||
<?php
|
||||
|
||||
// autoload_real.php @generated by Composer
|
||||
|
||||
class ComposerAutoloaderInitbdcab6487556631ed3c158e0e8422e44
|
||||
{
|
||||
private static $loader;
|
||||
|
||||
public static function loadClassLoader($class)
|
||||
{
|
||||
if ('Composer\Autoload\ClassLoader' === $class) {
|
||||
require __DIR__ . '/ClassLoader.php';
|
||||
}
|
||||
}
|
||||
|
||||
public static function getLoader()
|
||||
{
|
||||
if (null !== self::$loader) {
|
||||
return self::$loader;
|
||||
}
|
||||
|
||||
spl_autoload_register(array('ComposerAutoloaderInitbdcab6487556631ed3c158e0e8422e44', 'loadClassLoader'), true, true);
|
||||
self::$loader = $loader = new \Composer\Autoload\ClassLoader();
|
||||
spl_autoload_unregister(array('ComposerAutoloaderInitbdcab6487556631ed3c158e0e8422e44', 'loadClassLoader'));
|
||||
|
||||
$useStaticLoader = PHP_VERSION_ID >= 50600 && !defined('HHVM_VERSION') && (!function_exists('zend_loader_file_encoded') || !zend_loader_file_encoded());
|
||||
if ($useStaticLoader) {
|
||||
require_once __DIR__ . '/autoload_static.php';
|
||||
|
||||
call_user_func(\Composer\Autoload\ComposerStaticInitbdcab6487556631ed3c158e0e8422e44::getInitializer($loader));
|
||||
} else {
|
||||
$map = require __DIR__ . '/autoload_namespaces.php';
|
||||
foreach ($map as $namespace => $path) {
|
||||
$loader->set($namespace, $path);
|
||||
}
|
||||
|
||||
$classMap = require __DIR__ . '/autoload_classmap.php';
|
||||
if ($classMap) {
|
||||
$loader->addClassMap($classMap);
|
||||
}
|
||||
}
|
||||
|
||||
$loader->register(true);
|
||||
|
||||
return $loader;
|
||||
}
|
||||
}
|
@ -1,26 +0,0 @@
|
||||
<?php
|
||||
|
||||
// autoload_static.php @generated by Composer
|
||||
|
||||
namespace Composer\Autoload;
|
||||
class ComposerStaticInitbdcab6487556631ed3c158e0e8422e44
|
||||
{
|
||||
|
||||
public static $prefixesPsr0 = array (
|
||||
'F' =>
|
||||
array (
|
||||
'Fhp' =>
|
||||
array (
|
||||
0 => 'plugins/fints-hbci-php/vendor/mschindler83/fints-hbci-php/lib'
|
||||
)
|
||||
),
|
||||
);
|
||||
|
||||
public static function getInitializer(ClassLoader $loader)
|
||||
{
|
||||
return \Closure::bind(function () use ($loader) {
|
||||
$loader->prefixesPsr0 = ComposerStaticInitbdcab6487556631ed3c158e0e8422e44::$prefixesPsr0;
|
||||
|
||||
}, null, ClassLoader::class);
|
||||
}
|
||||
}
|
@ -1,88 +0,0 @@
|
||||
[
|
||||
{
|
||||
"name": "psr/log",
|
||||
"version": "1.0.2",
|
||||
"version_normalized": "1.0.2.0",
|
||||
"source": {
|
||||
"type": "git",
|
||||
"url": "https://github.com/php-fig/log.git",
|
||||
"reference": "4ebe3a8bf773a19edfe0a84b6585ba3d401b724d"
|
||||
},
|
||||
"dist": {
|
||||
"type": "zip",
|
||||
"url": "https://api.github.com/repos/php-fig/log/zipball/4ebe3a8bf773a19edfe0a84b6585ba3d401b724d",
|
||||
"reference": "4ebe3a8bf773a19edfe0a84b6585ba3d401b724d",
|
||||
"shasum": ""
|
||||
},
|
||||
"require": {
|
||||
"php": ">=5.3.0"
|
||||
},
|
||||
"time": "2016-10-10T12:19:37+00:00",
|
||||
"type": "library",
|
||||
"extra": {
|
||||
"branch-alias": {
|
||||
"dev-master": "1.0.x-dev"
|
||||
}
|
||||
},
|
||||
"installation-source": "dist",
|
||||
"autoload": {
|
||||
"psr-4": {
|
||||
"Psr\\Log\\": "Psr/Log/"
|
||||
}
|
||||
},
|
||||
"notification-url": "https://packagist.org/downloads/",
|
||||
"license": [
|
||||
"MIT"
|
||||
],
|
||||
"authors": [
|
||||
{
|
||||
"name": "PHP-FIG",
|
||||
"homepage": "http://www.php-fig.org/"
|
||||
}
|
||||
],
|
||||
"description": "Common interface for logging libraries",
|
||||
"homepage": "https://github.com/php-fig/log",
|
||||
"keywords": [
|
||||
"log",
|
||||
"psr",
|
||||
"psr-3"
|
||||
]
|
||||
},
|
||||
{
|
||||
"name": "mschindler83/fints-hbci-php",
|
||||
"version": "1.0.4",
|
||||
"version_normalized": "1.0.4.0",
|
||||
"source": {
|
||||
"type": "git",
|
||||
"url": "https://github.com/mschindler83/fints-hbci-php.git",
|
||||
"reference": "e58cb825c178d4c39a8974a9dd93abbc8094551f"
|
||||
},
|
||||
"dist": {
|
||||
"type": "zip",
|
||||
"url": "https://api.github.com/repos/mschindler83/fints-hbci-php/zipball/e58cb825c178d4c39a8974a9dd93abbc8094551f",
|
||||
"reference": "e58cb825c178d4c39a8974a9dd93abbc8094551f",
|
||||
"shasum": ""
|
||||
},
|
||||
"require": {
|
||||
"php": ">=5.3.2",
|
||||
"psr/log": "~1.0"
|
||||
},
|
||||
"suggest": {
|
||||
"monolog/monolog": "Allow sending log messages to a variety of different handlers"
|
||||
},
|
||||
"time": "2017-02-15T13:48:21+00:00",
|
||||
"type": "library",
|
||||
"installation-source": "dist",
|
||||
"autoload": {
|
||||
"psr-0": {
|
||||
"Fhp": "lib/"
|
||||
}
|
||||
},
|
||||
"notification-url": "https://packagist.org/downloads/",
|
||||
"license": [
|
||||
"MIT"
|
||||
],
|
||||
"description": "PHP Library for the protocols fints and hbci",
|
||||
"homepage": "http://fints-hbci-php.markus-schindler.de"
|
||||
}
|
||||
]
|
File diff suppressed because it is too large
Load Diff
@ -1,21 +0,0 @@
|
||||
MIT License
|
||||
|
||||
Copyright (c) 2016 Markus Schindler <mail@markus-schindler.de>
|
||||
|
||||
Permission is hereby granted, free of charge, to any person obtaining a copy
|
||||
of this software and associated documentation files (the "Software"), to deal
|
||||
in the Software without restriction, including without limitation the rights
|
||||
to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
|
||||
copies of the Software, and to permit persons to whom the Software is
|
||||
furnished to do so, subject to the following conditions:
|
||||
|
||||
The above copyright notice and this permission notice shall be included in all
|
||||
copies or substantial portions of the Software.
|
||||
|
||||
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
|
||||
IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
|
||||
FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
|
||||
AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
|
||||
LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
|
||||
OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
|
||||
SOFTWARE.
|
@ -1,40 +0,0 @@
|
||||
# FinTS HBCI PHP
|
||||
|
||||
[![Build Status](https://travis-ci.org/mschindler83/fints-hbci-php.svg?branch=master)](https://travis-ci.org/mschindler83/fints-hbci-php)
|
||||
[![Latest Stable Version](https://poser.pugx.org/mschindler83/fints-hbci-php/v/stable)](https://packagist.org/packages/mschindler83/fints-hbci-php)
|
||||
[![Scrutinizer Code Quality](https://scrutinizer-ci.com/g/mschindler83/fints-hbci-php/badges/quality-score.png?b=master)](https://scrutinizer-ci.com/g/mschindler83/fints-hbci-php/?branch=master)
|
||||
[![Monthly Downloads](https://poser.pugx.org/mschindler83/fints-hbci-php/d/monthly)](https://packagist.org/packages/mschindler83/fints-hbci-php)
|
||||
[![License](https://poser.pugx.org/mschindler83/fints-hbci-php/license)](https://packagist.org/packages/mschindler83/fints-hbci-php)
|
||||
|
||||
A PHP library implementing the basics of the FinTS / HBCI protocol.
|
||||
It can be used to fetch the balance of connected bank accounts and for fetching bank statements of accounts.
|
||||
|
||||
## Getting Started
|
||||
|
||||
Install via composer:
|
||||
|
||||
composer require mschindler83/fints-hbci-php
|
||||
|
||||
|
||||
## How to use it
|
||||
|
||||
You can have a look at the "Samples" folder in this repository.
|
||||
Just fill in the required data beginning from line 13 to 17 and run the script.
|
||||
|
||||
You can find the server information of your bank here:
|
||||
https://www.hbci-zka.de/institute/institut_auswahl.htm
|
||||
|
||||
## Contribute
|
||||
|
||||
### Bank compatibility
|
||||
|
||||
This library can only work stable with *YOUR* help!
|
||||
As I'm very limited in testing different banks it would be good to get some feedback from you all.
|
||||
Feel free to create PR's for the [COMPATIBILITY.md](COMPATIBILITY.md) file where you can update the list of working banks.
|
||||
|
||||
### Code Style
|
||||
|
||||
If you plan to contribute to this library, please ensure that you stick with the PSR coding rules as close as you can (At least PSR-0 to PSR-4).
|
||||
You can find the PHP Standard Recommendations [here](http://www.php-fig.org/psr/)
|
||||
|
||||
### Have fun!
|
@ -1,18 +0,0 @@
|
||||
<?php
|
||||
|
||||
namespace Fhp\Adapter;
|
||||
|
||||
use Fhp\Message\AbstractMessage;
|
||||
|
||||
/**
|
||||
* Interface AdapterInterface
|
||||
* @package Fhp\Adapter
|
||||
*/
|
||||
interface AdapterInterface
|
||||
{
|
||||
/**
|
||||
* @param AbstractMessage $message
|
||||
* @return string
|
||||
*/
|
||||
public function send(AbstractMessage $message);
|
||||
}
|
@ -1,106 +0,0 @@
|
||||
<?php
|
||||
|
||||
namespace Fhp\Adapter;
|
||||
|
||||
use Fhp\Adapter\Exception\AdapterException;
|
||||
use Fhp\Adapter\Exception\CurlException;
|
||||
use Fhp\Message\AbstractMessage;
|
||||
|
||||
/**
|
||||
* Class Curl
|
||||
* @package Fhp\Adapter
|
||||
*/
|
||||
class Curl implements AdapterInterface
|
||||
{
|
||||
/**
|
||||
* @var string
|
||||
*/
|
||||
protected $host;
|
||||
|
||||
/**
|
||||
* @var int
|
||||
*/
|
||||
protected $port;
|
||||
|
||||
/**
|
||||
* @var resource
|
||||
*/
|
||||
protected $curlHandle;
|
||||
|
||||
/**
|
||||
* @var mixed
|
||||
*/
|
||||
protected $lastResponseInfo;
|
||||
|
||||
/**
|
||||
* Curl constructor.
|
||||
*
|
||||
* @param string $host
|
||||
* @param int $port
|
||||
* @throws AdapterException
|
||||
* @throws CurlException
|
||||
*/
|
||||
public function __construct($host, $port)
|
||||
{
|
||||
if (!is_integer($port) || (int) $port <= 0) {
|
||||
throw new AdapterException('Invalid port number');
|
||||
}
|
||||
|
||||
$this->host = (string) $host;
|
||||
$this->port = (int) $port;
|
||||
$this->curlHandle = curl_init();
|
||||
|
||||
curl_setopt($this->curlHandle, CURLOPT_SSLVERSION, 1);
|
||||
curl_setopt($this->curlHandle, CURLOPT_SSL_VERIFYPEER, true);
|
||||
curl_setopt($this->curlHandle, CURLOPT_SSL_VERIFYHOST, 2);
|
||||
curl_setopt($this->curlHandle, CURLOPT_USERAGENT, "FHP-lib");
|
||||
curl_setopt($this->curlHandle, CURLOPT_RETURNTRANSFER, true);
|
||||
curl_setopt($this->curlHandle, CURLOPT_URL, $this->host);
|
||||
curl_setopt($this->curlHandle, CURLOPT_CONNECTTIMEOUT, 15);
|
||||
curl_setopt($this->curlHandle, CURLOPT_CUSTOMREQUEST, 'POST');
|
||||
curl_setopt($this->curlHandle, CURLOPT_HTTP_VERSION, CURL_HTTP_VERSION_1_1);
|
||||
curl_setopt($this->curlHandle, CURLOPT_ENCODING, '');
|
||||
curl_setopt($this->curlHandle, CURLOPT_MAXREDIRS, 0);
|
||||
curl_setopt($this->curlHandle, CURLOPT_TIMEOUT, 30);
|
||||
curl_setopt($this->curlHandle, CURLOPT_HTTPHEADER, array("cache-control: no-cache", 'Content-Type: text/plain'));
|
||||
}
|
||||
|
||||
/**
|
||||
* @param AbstractMessage $message
|
||||
* @return string
|
||||
* @throws CurlException
|
||||
*/
|
||||
public function send(AbstractMessage $message)
|
||||
{
|
||||
curl_setopt($this->curlHandle, CURLOPT_POSTFIELDS, base64_encode($message->toString()));
|
||||
$response = curl_exec($this->curlHandle);
|
||||
$this->lastResponseInfo = curl_getinfo($this->curlHandle);
|
||||
|
||||
if (false === $response) {
|
||||
throw new CurlException(
|
||||
'Failed connection to ' . $this->host . ': ' . curl_error($this->curlHandle),
|
||||
curl_errno($this->curlHandle),
|
||||
null,
|
||||
$this->lastResponseInfo
|
||||
);
|
||||
}
|
||||
|
||||
$statusCode = curl_getinfo($this->curlHandle, CURLINFO_HTTP_CODE);
|
||||
|
||||
if ($statusCode < 200 || $statusCode > 299) {
|
||||
throw new CurlException('Bad response with status code ' . $statusCode, 0, null, $this->lastResponseInfo);
|
||||
}
|
||||
|
||||
return base64_decode($response);
|
||||
}
|
||||
|
||||
/**
|
||||
* Gets curl info for last request / response.
|
||||
*
|
||||
* @return mixed
|
||||
*/
|
||||
public function getLastResponseInfo()
|
||||
{
|
||||
return $this->lastResponseInfo;
|
||||
}
|
||||
}
|
@ -1,56 +0,0 @@
|
||||
<?php
|
||||
|
||||
namespace Fhp\Adapter;
|
||||
|
||||
use Fhp\Adapter\Exception\AdapterException;
|
||||
use Fhp\Message\AbstractMessage;
|
||||
|
||||
/**
|
||||
* Class Debug Adapter.
|
||||
*
|
||||
* Use it to debug requests.
|
||||
*
|
||||
* @package Fhp\Adapter
|
||||
*/
|
||||
class Debug implements AdapterInterface
|
||||
{
|
||||
/**
|
||||
* @var string
|
||||
*/
|
||||
protected $host;
|
||||
|
||||
/**
|
||||
* @var int
|
||||
*/
|
||||
protected $port;
|
||||
|
||||
/**
|
||||
* Debug constructor.
|
||||
*
|
||||
* @param $host
|
||||
* @param $port
|
||||
* @throws AdapterException
|
||||
*/
|
||||
public function __construct($host, $port)
|
||||
{
|
||||
if (!is_integer($port) || (int) $port <= 0) {
|
||||
throw new AdapterException('Invalid port number');
|
||||
}
|
||||
|
||||
$this->host = (string) $host;
|
||||
$this->port = (int) $port;
|
||||
}
|
||||
|
||||
/**
|
||||
* Should return a dummy response body.
|
||||
*
|
||||
* @param AbstractMessage $message
|
||||
* @return string
|
||||
*/
|
||||
public function send(AbstractMessage $message)
|
||||
{
|
||||
/* @todo Implement me
|
||||
* return file_get_contents(__DIR__ . '/../../../develop/accounts_response.txt');
|
||||
*/
|
||||
}
|
||||
}
|
@ -1,12 +0,0 @@
|
||||
<?php
|
||||
|
||||
namespace Fhp\Adapter\Exception;
|
||||
|
||||
/**
|
||||
* Class AdapterException
|
||||
* @package Fhp\Adapter\Exception
|
||||
*/
|
||||
class AdapterException extends \Exception
|
||||
{
|
||||
|
||||
}
|
@ -1,40 +0,0 @@
|
||||
<?php
|
||||
|
||||
namespace Fhp\Adapter\Exception;
|
||||
|
||||
/**
|
||||
* Class CurlException
|
||||
* @package Fhp\Adapter\Exception
|
||||
*/
|
||||
class CurlException extends AdapterException
|
||||
{
|
||||
/**
|
||||
* @var mixed
|
||||
*/
|
||||
protected $curlInfo;
|
||||
|
||||
/**
|
||||
* CurlException constructor.
|
||||
*
|
||||
* @param string $message
|
||||
* @param int $code
|
||||
* @param \Exception|null $previous
|
||||
* @param mixed $curlInfo
|
||||
*/
|
||||
public function __construct($message, $code = 0, \Exception $previous = null, $curlInfo)
|
||||
{
|
||||
parent::__construct($message, $code, $previous);
|
||||
|
||||
$this->curlInfo = $curlInfo;
|
||||
}
|
||||
|
||||
/**
|
||||
* Gets the curl info from request / response.
|
||||
*
|
||||
* @return mixed
|
||||
*/
|
||||
public function getCurlInfo()
|
||||
{
|
||||
return $this->curlInfo;
|
||||
}
|
||||
}
|
@ -1,46 +0,0 @@
|
||||
<?php
|
||||
|
||||
namespace Fhp;
|
||||
|
||||
use Fhp\Adapter\AdapterInterface;
|
||||
use Fhp\Message\AbstractMessage;
|
||||
|
||||
/**
|
||||
* Class Connection
|
||||
* @package Fhp
|
||||
*/
|
||||
class Connection
|
||||
{
|
||||
/**
|
||||
* @var AdapterInterface
|
||||
*/
|
||||
protected $adapter;
|
||||
|
||||
/**
|
||||
* Connection constructor.
|
||||
* @param AdapterInterface $adapter
|
||||
*/
|
||||
public function __construct(AdapterInterface $adapter)
|
||||
{
|
||||
$this->adapter = $adapter;
|
||||
}
|
||||
|
||||
/**
|
||||
* Uses the configured adapter to send a message.
|
||||
*
|
||||
* @param AbstractMessage $message
|
||||
* @return string
|
||||
*/
|
||||
public function send(AbstractMessage $message)
|
||||
{
|
||||
return iconv('ISO-8859-1', 'UTF-8', $this->adapter->send($message));
|
||||
}
|
||||
|
||||
/**
|
||||
* @return AdapterInterface
|
||||
*/
|
||||
public function getAdapter()
|
||||
{
|
||||
return $this->adapter;
|
||||
}
|
||||
}
|
@ -1,56 +0,0 @@
|
||||
<?php
|
||||
|
||||
namespace Fhp\DataElementGroups;
|
||||
|
||||
use Fhp\Deg;
|
||||
|
||||
/**
|
||||
* Class EncryptionAlgorithm.
|
||||
*
|
||||
* @package Fhp\DataElementGroups
|
||||
*/
|
||||
class EncryptionAlgorithm extends Deg
|
||||
{
|
||||
const TYPE_OSY = 2;
|
||||
|
||||
const OPERATION_MODE_CBC = 2;
|
||||
const OPERATION_MODE_ISO_9796_1 = 16;
|
||||
const OPERATION_MODE_ISO_9796_2 = 17;
|
||||
const OPERATION_MODE_RSASSA_PKCS_RSAES_PKCS = 18;
|
||||
const OPERATION_MODE_RSASSA_PSS = 19;
|
||||
const OPERATION_MODE_999 = 999;
|
||||
|
||||
const ALGORITHM_2_KEY_TRIPLE_DES = 13;
|
||||
const ALGORITHM_AES_256 = 14;
|
||||
const DEFAULT_ALGORITHM_IV = '@8@00000000';
|
||||
|
||||
const ALGORITHM_KEY_TYPE_SYM_SYM = 5;
|
||||
const ALGORITHM_KEY_TYPE_SYM_PUB = 6;
|
||||
const ALGORITHM_IV_DESCRIPTION_IVC = 1;
|
||||
|
||||
/**
|
||||
* EncryptionAlgorithm constructor.
|
||||
*
|
||||
* @param int $type
|
||||
* @param int $operationMode
|
||||
* @param int $algorithm
|
||||
* @param string $algorithmIv
|
||||
* @param int $algorithmKeyType
|
||||
* @param int $algorithmIvDescription
|
||||
*/
|
||||
public function __construct(
|
||||
$type = self::TYPE_OSY,
|
||||
$operationMode = self::OPERATION_MODE_CBC,
|
||||
$algorithm = self::ALGORITHM_2_KEY_TRIPLE_DES,
|
||||
$algorithmIv = self::DEFAULT_ALGORITHM_IV,
|
||||
$algorithmKeyType = self::ALGORITHM_KEY_TYPE_SYM_SYM,
|
||||
$algorithmIvDescription = self::ALGORITHM_IV_DESCRIPTION_IVC
|
||||
) {
|
||||
$this->addDataElement($type);
|
||||
$this->addDataElement($operationMode);
|
||||
$this->addDataElement($algorithm);
|
||||
$this->addDataElement($algorithmIv);
|
||||
$this->addDataElement($algorithmKeyType);
|
||||
$this->addDataElement($algorithmIvDescription);
|
||||
}
|
||||
}
|
@ -1,42 +0,0 @@
|
||||
<?php
|
||||
|
||||
namespace Fhp\DataElementGroups;
|
||||
|
||||
use Fhp\Deg;
|
||||
|
||||
/**
|
||||
* Class HashAlgorithm.
|
||||
*
|
||||
* @package Fhp\DataElementGroups
|
||||
*/
|
||||
class HashAlgorithm extends Deg
|
||||
{
|
||||
const HASH_ALGORITHM_USAGE_OHA = 1; // Owner Hashing (OHA)
|
||||
|
||||
const HASH_ALGORITHM_SHA_1 = 1;
|
||||
const HASH_ALGORITHM_X = 2;
|
||||
const HASH_ALGORITHM_SHA_256 = 3;
|
||||
const HASH_ALGORITHM_SHA_384 = 4;
|
||||
const HASH_ALGORITHM_SHA_512 = 5;
|
||||
const HASH_ALGORITHM_SHA_256_256 = 6;
|
||||
const HASH_ALGORITHM_NEGOTIATE = 999;
|
||||
|
||||
const HASH_ALGORITHM_PARAM_DESCRIPTION_IVC = 1;
|
||||
|
||||
/**
|
||||
* HashAlgorithm constructor.
|
||||
*
|
||||
* @param int $hashAlgorithmUsage
|
||||
* @param int $hashAlgorithm
|
||||
* @param int $hashAlgorithmParamDescription
|
||||
*/
|
||||
public function __construct(
|
||||
$hashAlgorithmUsage = self::HASH_ALGORITHM_USAGE_OHA,
|
||||
$hashAlgorithm = self::HASH_ALGORITHM_NEGOTIATE,
|
||||
$hashAlgorithmParamDescription = self::HASH_ALGORITHM_PARAM_DESCRIPTION_IVC
|
||||
) {
|
||||
$this->addDataElement($hashAlgorithmUsage);
|
||||
$this->addDataElement($hashAlgorithm);
|
||||
$this->addDataElement($hashAlgorithmParamDescription);
|
||||
}
|
||||
}
|
@ -1,35 +0,0 @@
|
||||
<?php
|
||||
|
||||
namespace Fhp\DataElementGroups;
|
||||
|
||||
use Fhp\DataTypes\Kik;
|
||||
use Fhp\Deg;
|
||||
|
||||
/**
|
||||
* Class KeyName.
|
||||
* @package Fhp\DataElementGroups
|
||||
*/
|
||||
class KeyName extends Deg
|
||||
{
|
||||
const KEY_TYPE_DS_KEY = 'D';
|
||||
const KEY_TYPE_SIGNATURE = 'S';
|
||||
const KEY_TYPE_CHIFFRE = 'V';
|
||||
|
||||
/**
|
||||
* KeyName constructor.
|
||||
*
|
||||
* @param string $countryCode
|
||||
* @param string $bankCode
|
||||
* @param string $userName
|
||||
* @param string $keyType
|
||||
*/
|
||||
public function __construct($countryCode, $bankCode, $userName, $keyType = self::KEY_TYPE_CHIFFRE)
|
||||
{
|
||||
$kik = new Kik($countryCode, $bankCode);
|
||||
$this->addDataElement($kik->toString());
|
||||
$this->addDataElement($userName);
|
||||
$this->addDataElement($keyType);
|
||||
$this->addDataElement(0);
|
||||
$this->addDataElement(0);
|
||||
}
|
||||
}
|
@ -1,36 +0,0 @@
|
||||
<?php
|
||||
|
||||
namespace Fhp\DataElementGroups;
|
||||
|
||||
use Fhp\Deg;
|
||||
|
||||
/**
|
||||
* Class SecurityDateTime.
|
||||
* @package Fhp\DataElementGroups
|
||||
*/
|
||||
class SecurityDateTime extends Deg
|
||||
{
|
||||
/**
|
||||
* Sicherheitszeitstempel (STS)
|
||||
*/
|
||||
const DATETIME_TYPE_STS = 1;
|
||||
|
||||
/**
|
||||
* Certificate Revocation Time (CRT)
|
||||
*/
|
||||
const DATETIME_TYPE_CRT = 6;
|
||||
|
||||
/**
|
||||
* SecurityDateTime constructor.
|
||||
*
|
||||
* @param int $type
|
||||
* @param \DateTime|null $dateTime
|
||||
*/
|
||||
public function __construct($type = self::DATETIME_TYPE_STS, \DateTime $dateTime = null)
|
||||
{
|
||||
$date = null == $dateTime ? new \DateTime() : $dateTime;
|
||||
$this->addDataElement($type);
|
||||
$this->addDataElement($date->format('Ymd'));
|
||||
$this->addDataElement($date->format('His'));
|
||||
}
|
||||
}
|
@ -1,28 +0,0 @@
|
||||
<?php
|
||||
|
||||
namespace Fhp\DataElementGroups;
|
||||
|
||||
use Fhp\Deg;
|
||||
|
||||
/**
|
||||
* Class SecurityIdentificationDetails
|
||||
* @package Fhp\DataElementGroups
|
||||
*/
|
||||
class SecurityIdentificationDetails extends Deg
|
||||
{
|
||||
const PARTY_MS = 1; // sender
|
||||
const CID_NONE = '';
|
||||
|
||||
/**
|
||||
* SecurityIdentificationDetails constructor.
|
||||
*
|
||||
* @param string $cid
|
||||
* @param int $systemId
|
||||
*/
|
||||
public function __construct($cid = self::CID_NONE, $systemId = 0)
|
||||
{
|
||||
$this->addDataElement(static::PARTY_MS);
|
||||
$this->addDataElement($cid);
|
||||
$this->addDataElement($systemId);
|
||||
}
|
||||
}
|
@ -1,28 +0,0 @@
|
||||
<?php
|
||||
|
||||
namespace Fhp\DataElementGroups;
|
||||
|
||||
use Fhp\Deg;
|
||||
|
||||
/**
|
||||
* Class SecurityProfile.
|
||||
* @package Fhp\DataElementGroups
|
||||
*/
|
||||
class SecurityProfile extends Deg
|
||||
{
|
||||
const PROFILE_PIN = 'PIN';
|
||||
const PROFILE_VERSION_1 = 1; // Ein-Schritt Tanverfahren
|
||||
const PROFILE_VERSION_2 = 2; // Zwei-Schritt Tanverfahren
|
||||
|
||||
/**
|
||||
* SecurityProfile constructor.
|
||||
*
|
||||
* @param $securityProceduresCode
|
||||
* @param $securityProceduresVersion
|
||||
*/
|
||||
public function __construct($securityProceduresCode, $securityProceduresVersion)
|
||||
{
|
||||
$this->addDataElement($securityProceduresCode);
|
||||
$this->addDataElement($securityProceduresVersion);
|
||||
}
|
||||
}
|
@ -1,41 +0,0 @@
|
||||
<?php
|
||||
|
||||
namespace Fhp\DataElementGroups;
|
||||
|
||||
use Fhp\Deg;
|
||||
|
||||
/**
|
||||
* Class SignatureAlgorithm.
|
||||
* @package Fhp\DataElementGroups
|
||||
*/
|
||||
class SignatureAlgorithm extends Deg
|
||||
{
|
||||
const SIG_ALGO_USAGE_OSG = 6; // Owner Signing (OSG)
|
||||
|
||||
const SIG_ALGO_DES = 1;
|
||||
const SIG_ALGO_RSA = 10;
|
||||
|
||||
const OPERATION_MODE_CBC = 2;
|
||||
const OPERATION_MODE_ISO_9796_1 = 16;
|
||||
const OPERATION_MODE_ISO_9796_2 = 17;
|
||||
const OPERATION_MODE_RSASSA_PKCS_RSAES_PKCS = 18;
|
||||
const OPERATION_MODE_RSASSA_PSS = 19;
|
||||
const OPERATION_MODE_999 = 999;
|
||||
|
||||
/**
|
||||
* SignatureAlgorithm constructor.
|
||||
*
|
||||
* @param int $sigAlgoUsage
|
||||
* @param int $sigAlgo
|
||||
* @param int $operationMode
|
||||
*/
|
||||
public function __construct(
|
||||
$sigAlgoUsage = self::SIG_ALGO_USAGE_OSG,
|
||||
$sigAlgo = self::SIG_ALGO_RSA,
|
||||
$operationMode = self::OPERATION_MODE_ISO_9796_1
|
||||
) {
|
||||
$this->addDataElement($sigAlgoUsage);
|
||||
$this->addDataElement($sigAlgo);
|
||||
$this->addDataElement($operationMode);
|
||||
}
|
||||
}
|
@ -1,66 +0,0 @@
|
||||
<?php
|
||||
|
||||
namespace Fhp\DataTypes;
|
||||
|
||||
/**
|
||||
* Class Bin
|
||||
* @package Fhp\DataTypes
|
||||
*/
|
||||
class Bin
|
||||
{
|
||||
/**
|
||||
* @var string
|
||||
*/
|
||||
protected $string;
|
||||
|
||||
/**
|
||||
* Bin constructor.
|
||||
*
|
||||
* @param string $string
|
||||
*/
|
||||
public function __construct($string)
|
||||
{
|
||||
$this->string = $string;
|
||||
}
|
||||
|
||||
/**
|
||||
* Sets the binary data.
|
||||
*
|
||||
* @param string $data
|
||||
* @return $this
|
||||
*/
|
||||
public function setData($data)
|
||||
{
|
||||
$this->string = $data;
|
||||
|
||||
return $this;
|
||||
}
|
||||
|
||||
/**
|
||||
* Gets the binary data.
|
||||
*
|
||||
* @return string
|
||||
*/
|
||||
public function getData()
|
||||
{
|
||||
return $this->string;
|
||||
}
|
||||
|
||||
/**
|
||||
* Convert to string.
|
||||
*
|
||||
* @return string
|
||||
*/
|
||||
public function toString()
|
||||
{
|
||||
return '@' . strlen($this->string) . '@' . $this->string;
|
||||
}
|
||||
|
||||
/**
|
||||
* @return string
|
||||
*/
|
||||
public function __toString()
|
||||
{
|
||||
return $this->toString();
|
||||
}
|
||||
}
|
@ -1,56 +0,0 @@
|
||||
<?php
|
||||
|
||||
namespace Fhp\DataTypes;
|
||||
|
||||
/**
|
||||
* Class Dat
|
||||
* @package Fhp\DataTypes
|
||||
*/
|
||||
class Dat
|
||||
{
|
||||
/**
|
||||
* @var \DateTime
|
||||
*/
|
||||
protected $value;
|
||||
|
||||
/**
|
||||
* Dat constructor.
|
||||
* @param \DateTime $dateTime
|
||||
*/
|
||||
public function __construct(\DateTime $dateTime)
|
||||
{
|
||||
$this->value = $dateTime;
|
||||
}
|
||||
|
||||
/**
|
||||
* @param \DateTime $date
|
||||
*/
|
||||
public function setDate(\DateTime $date)
|
||||
{
|
||||
$this->value = $date;
|
||||
}
|
||||
|
||||
/**
|
||||
* @return \DateTime
|
||||
*/
|
||||
public function getDate()
|
||||
{
|
||||
return $this->value;
|
||||
}
|
||||
|
||||
/**
|
||||
* @return string
|
||||
*/
|
||||
public function toString()
|
||||
{
|
||||
return $this->value->format('Ymd');
|
||||
}
|
||||
|
||||
/**
|
||||
* @return string
|
||||
*/
|
||||
public function __toString()
|
||||
{
|
||||
return $this->toString();
|
||||
}
|
||||
}
|
@ -1,48 +0,0 @@
|
||||
<?php
|
||||
|
||||
namespace Fhp\DataTypes;
|
||||
|
||||
/**
|
||||
* Class Kik
|
||||
* @package Fhp\DataTypes
|
||||
*/
|
||||
class Kik
|
||||
{
|
||||
/**
|
||||
* @var string
|
||||
*/
|
||||
protected $countryCode;
|
||||
|
||||
/**
|
||||
* @var string
|
||||
*/
|
||||
protected $bankCode;
|
||||
|
||||
/**
|
||||
* Kik constructor.
|
||||
*
|
||||
* @param string $countryCode
|
||||
* @param string $bankCode
|
||||
*/
|
||||
public function __construct($countryCode, $bankCode)
|
||||
{
|
||||
$this->countryCode = (string) $countryCode;
|
||||
$this->bankCode = (string) $bankCode;
|
||||
}
|
||||
|
||||
/**
|
||||
* @return string
|
||||
*/
|
||||
public function toString()
|
||||
{
|
||||
return $this->countryCode . ':' . $this->bankCode;
|
||||
}
|
||||
|
||||
/**
|
||||
* @return string
|
||||
*/
|
||||
public function __toString()
|
||||
{
|
||||
return $this->toString();
|
||||
}
|
||||
}
|
@ -1,76 +0,0 @@
|
||||
<?php
|
||||
|
||||
namespace Fhp\DataTypes;
|
||||
|
||||
/**
|
||||
* Class Kti (Kontoverbindung International)
|
||||
*
|
||||
* @link http://www.hbci-zka.de/dokumente/spezifikation_deutsch/fintsv3/FinTS_3.0_Messages_Geschaeftsvorfaelle_2015-08-07_final_version.pdf
|
||||
* Section: B.3.2
|
||||
* @package Fhp\DataTypes
|
||||
*/
|
||||
class Kti
|
||||
{
|
||||
/**
|
||||
* @var string
|
||||
*/
|
||||
protected $iban;
|
||||
|
||||
/**
|
||||
* @var string
|
||||
*/
|
||||
protected $bic;
|
||||
|
||||
/**
|
||||
* @var string
|
||||
*/
|
||||
protected $accountNumber;
|
||||
|
||||
/**
|
||||
* @var string
|
||||
*/
|
||||
protected $subAccountFeature;
|
||||
|
||||
/**
|
||||
* @var Kik
|
||||
*/
|
||||
protected $kik;
|
||||
|
||||
/**
|
||||
* Kti constructor.
|
||||
*
|
||||
* @param string $iban
|
||||
* @param string $bic
|
||||
* @param string $accountNumber
|
||||
* @param string $subAccountFeature
|
||||
* @param Kik $kik
|
||||
*/
|
||||
public function __construct($iban, $bic, $accountNumber, $subAccountFeature, Kik $kik)
|
||||
{
|
||||
$this->iban = $iban;
|
||||
$this->bic = $bic;
|
||||
$this->accountNumber = $accountNumber;
|
||||
$this->subAccountFeature = $subAccountFeature;
|
||||
$this->kik = $kik;
|
||||
}
|
||||
|
||||
/**
|
||||
* @return string
|
||||
*/
|
||||
public function toString()
|
||||
{
|
||||
return $this->iban . ':'
|
||||
. $this->bic . ':'
|
||||
. $this->accountNumber . ':'
|
||||
. $this->subAccountFeature . ':'
|
||||
. (string) $this->kik;
|
||||
}
|
||||
|
||||
/**
|
||||
* @return string
|
||||
*/
|
||||
public function __toString()
|
||||
{
|
||||
return $this->toString();
|
||||
}
|
||||
}
|
@ -1,58 +0,0 @@
|
||||
<?php
|
||||
|
||||
namespace Fhp\DataTypes;
|
||||
|
||||
/**
|
||||
* Class Ktv (Kontoverbindung)
|
||||
*
|
||||
* @link http://www.hbci-zka.de/dokumente/spezifikation_deutsch/fintsv3/FinTS_3.0_Messages_Geschaeftsvorfaelle_2015-08-07_final_version.pdf
|
||||
* Section: B.3.1
|
||||
* @package Fhp\DataTypes
|
||||
*/
|
||||
class Ktv
|
||||
{
|
||||
/**
|
||||
* @var string
|
||||
*/
|
||||
protected $accountNumber;
|
||||
|
||||
/**
|
||||
* @var string
|
||||
*/
|
||||
protected $subAccountFeature;
|
||||
|
||||
/**
|
||||
* @var Kik
|
||||
*/
|
||||
protected $kik;
|
||||
|
||||
/**
|
||||
* Ktv constructor.
|
||||
*
|
||||
* @param string $accountNumber
|
||||
* @param string $subAccountFeature
|
||||
* @param Kik $kik
|
||||
*/
|
||||
public function __construct($accountNumber, $subAccountFeature, Kik $kik)
|
||||
{
|
||||
$this->accountNumber = $accountNumber;
|
||||
$this->subAccountFeature = $subAccountFeature;
|
||||
$this->kik = $kik;
|
||||
}
|
||||
|
||||
/**
|
||||
* @return string
|
||||
*/
|
||||
public function toString()
|
||||
{
|
||||
return $this->accountNumber . ':' . $this->subAccountFeature . ':' . (string) $this->kik;
|
||||
}
|
||||
|
||||
/**
|
||||
* @return string
|
||||
*/
|
||||
public function __toString()
|
||||
{
|
||||
return $this->toString();
|
||||
}
|
||||
}
|
@ -1,36 +0,0 @@
|
||||
<?php
|
||||
|
||||
namespace Fhp;
|
||||
|
||||
/**
|
||||
* Class Deg (Data Element Group)
|
||||
* @package Fhp
|
||||
*/
|
||||
class Deg
|
||||
{
|
||||
/** @var array */
|
||||
protected $dataElements = array();
|
||||
|
||||
/**
|
||||
* Adds a data element to the data element group.
|
||||
*
|
||||
* @param mixed $value
|
||||
*/
|
||||
public function addDataElement($value)
|
||||
{
|
||||
$this->dataElements[] = $value;
|
||||
}
|
||||
|
||||
public function toString()
|
||||
{
|
||||
return (string) implode(':', $this->dataElements);
|
||||
}
|
||||
|
||||
/**
|
||||
* @return string
|
||||
*/
|
||||
public function __toString()
|
||||
{
|
||||
return $this->toString();
|
||||
}
|
||||
}
|
@ -1,339 +0,0 @@
|
||||
<?php
|
||||
namespace Fhp\Dialog;
|
||||
|
||||
use Fhp\Adapter\Exception\AdapterException;
|
||||
use Fhp\Adapter\Exception\CurlException;
|
||||
use Fhp\Connection;
|
||||
use Fhp\Dialog\Exception\FailedRequestException;
|
||||
use Fhp\Message\AbstractMessage;
|
||||
use Fhp\Message\Message;
|
||||
use Fhp\Response\Initialization;
|
||||
use Fhp\Response\Response;
|
||||
use Fhp\Segment\HKEND;
|
||||
use Fhp\Segment\HKIDN;
|
||||
use Fhp\Segment\HKSYN;
|
||||
use Fhp\Segment\HKVVB;
|
||||
|
||||
/**
|
||||
* Class Dialog
|
||||
* @package Fhp\Dialog
|
||||
*/
|
||||
class Dialog
|
||||
{
|
||||
const DEFAULT_COUNTRY_CODE = 280;
|
||||
|
||||
/**
|
||||
* @var Connection
|
||||
*/
|
||||
protected $connection;
|
||||
|
||||
/**
|
||||
* @var int
|
||||
*/
|
||||
protected $messageNumber = 1;
|
||||
|
||||
/**
|
||||
* @var int
|
||||
*/
|
||||
protected $dialogId = 0;
|
||||
|
||||
/**
|
||||
* @var int|string
|
||||
*/
|
||||
protected $systemId = 0;
|
||||
|
||||
/**
|
||||
* @var string
|
||||
*/
|
||||
protected $bankCode;
|
||||
|
||||
/**
|
||||
* @var string
|
||||
*/
|
||||
protected $username;
|
||||
|
||||
/**
|
||||
* @var string
|
||||
*/
|
||||
protected $pin;
|
||||
|
||||
/**
|
||||
* @var string
|
||||
*/
|
||||
protected $bankName;
|
||||
|
||||
/**
|
||||
* @var array
|
||||
*/
|
||||
protected $supportedTanMechanisms = array();
|
||||
|
||||
/**
|
||||
* @var int
|
||||
*/
|
||||
protected $hksalVersion = 6;
|
||||
|
||||
/**
|
||||
* @var int
|
||||
*/
|
||||
protected $hkkazVersion = 6;
|
||||
|
||||
/**
|
||||
* Dialog constructor.
|
||||
*
|
||||
* @param Connection $connection
|
||||
* @param string $bankCode
|
||||
* @param string $username
|
||||
* @param string $pin
|
||||
* @param string $systemId
|
||||
*/
|
||||
public function __construct(Connection $connection, $bankCode, $username, $pin, $systemId)
|
||||
{
|
||||
$this->connection = $connection;
|
||||
$this->bankCode = $bankCode;
|
||||
$this->username = $username;
|
||||
$this->pin = $pin;
|
||||
$this->systemId = $systemId;
|
||||
}
|
||||
|
||||
/**
|
||||
* @param AbstractMessage $message
|
||||
* @return Response
|
||||
* @throws AdapterException
|
||||
* @throws CurlException
|
||||
* @throws FailedRequestException
|
||||
*/
|
||||
public function sendMessage(AbstractMessage $message)
|
||||
{
|
||||
try {
|
||||
$message->setMessageNumber($this->messageNumber);
|
||||
$message->setDialogId($this->dialogId);
|
||||
|
||||
$result = $this->connection->send($message);
|
||||
$this->messageNumber++;
|
||||
$response = new Response($result);
|
||||
|
||||
$this->handleResponse($response);
|
||||
|
||||
if (!$response->isSuccess()) {
|
||||
$summary = $response->getMessageSummary();
|
||||
$ex = new FailedRequestException($summary);
|
||||
throw $ex;
|
||||
}
|
||||
|
||||
return $response;
|
||||
} catch (AdapterException $e) {
|
||||
if ($e instanceof CurlException) {
|
||||
}
|
||||
|
||||
throw $e;
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* @param Response $response
|
||||
*/
|
||||
protected function handleResponse(Response $response)
|
||||
{
|
||||
$summary = $response->getMessageSummary();
|
||||
$segSum = $response->getSegmentSummary();
|
||||
|
||||
foreach ($summary as $code => $message) {
|
||||
$this->logMessage('HIRMG', $code, $message);
|
||||
}
|
||||
|
||||
foreach ($segSum as $code => $message) {
|
||||
$this->logMessage('HIRMS', $code, $message);
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* @param string $type
|
||||
* @param string $code
|
||||
* @param $message
|
||||
*/
|
||||
protected function logMessage($type, $code, $message)
|
||||
{
|
||||
}
|
||||
|
||||
/**
|
||||
* Gets the dialog ID.
|
||||
*
|
||||
* @return integer
|
||||
*/
|
||||
public function getDialogId()
|
||||
{
|
||||
return $this->dialogId;
|
||||
}
|
||||
|
||||
/**
|
||||
* Gets the current message number.
|
||||
*
|
||||
* @return int
|
||||
*/
|
||||
public function getMessageNumber()
|
||||
{
|
||||
return $this->messageNumber;
|
||||
}
|
||||
|
||||
/**
|
||||
* Gets the system ID.
|
||||
*
|
||||
* @return int|string
|
||||
*/
|
||||
public function getSystemId()
|
||||
{
|
||||
return $this->systemId;
|
||||
}
|
||||
|
||||
/**
|
||||
* Gets all supported TAN mechanisms.
|
||||
*
|
||||
* @return array
|
||||
*/
|
||||
public function getSupportedPinTanMechanisms()
|
||||
{
|
||||
return $this->supportedTanMechanisms;
|
||||
}
|
||||
|
||||
/**
|
||||
* Gets the max possible HKSAL version.
|
||||
*
|
||||
* @return int
|
||||
*/
|
||||
public function getHksalMaxVersion()
|
||||
{
|
||||
return $this->hksalVersion;
|
||||
}
|
||||
|
||||
/**
|
||||
* Gets the max possible HKKAZ version.
|
||||
*
|
||||
* @return int
|
||||
*/
|
||||
public function getHkkazMaxVersion()
|
||||
{
|
||||
return $this->hkkazVersion;
|
||||
}
|
||||
|
||||
/**
|
||||
* Gets the bank name.
|
||||
*
|
||||
* @return string
|
||||
*/
|
||||
public function getBankName()
|
||||
{
|
||||
return $this->bankName;
|
||||
}
|
||||
|
||||
/**
|
||||
* Initializes a dialog.
|
||||
*
|
||||
* @return string|null
|
||||
* @throws AdapterException
|
||||
* @throws CurlException
|
||||
* @throws FailedRequestException
|
||||
* @throws \Exception
|
||||
*/
|
||||
public function initDialog()
|
||||
{
|
||||
$identification = new HKIDN(3, $this->bankCode, $this->username, $this->systemId);
|
||||
$prepare = new HKVVB(4, HKVVB::DEFAULT_BPD_VERSION, HKVVB::DEFAULT_UPD_VERSION, HKVVB::LANG_DEFAULT);
|
||||
|
||||
$message = new Message(
|
||||
$this->bankCode,
|
||||
$this->username,
|
||||
$this->pin,
|
||||
$this->systemId,
|
||||
0,
|
||||
1,
|
||||
array($identification, $prepare),
|
||||
array(AbstractMessage::OPT_PINTAN_MECH => $this->supportedTanMechanisms)
|
||||
);
|
||||
|
||||
|
||||
$response = $this->sendMessage($message)->rawResponse;
|
||||
|
||||
$result = new Initialization($response);
|
||||
$this->dialogId = $result->getDialogId();
|
||||
|
||||
return $this->dialogId;
|
||||
}
|
||||
|
||||
/**
|
||||
* Sends sync request.
|
||||
*
|
||||
* @return string
|
||||
* @throws AdapterException
|
||||
* @throws CurlException
|
||||
* @throws FailedRequestException
|
||||
* @throws \Exception
|
||||
*/
|
||||
public function syncDialog()
|
||||
{
|
||||
$this->messageNumber = 1;
|
||||
$this->systemId = 0;
|
||||
$this->dialogId = 0;
|
||||
|
||||
$identification = new HKIDN(3, $this->bankCode, $this->username, 0);
|
||||
$prepare = new HKVVB(4, HKVVB::DEFAULT_BPD_VERSION, HKVVB::DEFAULT_UPD_VERSION, HKVVB::LANG_DEFAULT);
|
||||
$sync = new HKSYN(5);
|
||||
|
||||
$syncMsg = new Message(
|
||||
$this->bankCode,
|
||||
$this->username,
|
||||
$this->pin,
|
||||
$this->systemId,
|
||||
$this->dialogId,
|
||||
$this->messageNumber,
|
||||
array($identification, $prepare, $sync)
|
||||
);
|
||||
|
||||
$response = $this->sendMessage($syncMsg);
|
||||
|
||||
// save BPD (Bank Parameter Daten)
|
||||
$this->systemId = $response->getSystemId();
|
||||
$this->dialogId = $response->getDialogId();
|
||||
$this->bankName = $response->getBankName();
|
||||
|
||||
// max version for segment HKSAL (Saldo abfragen)
|
||||
$this->hksalVersion = $response->getHksalMaxVersion();
|
||||
$this->supportedTanMechanisms = $response->getSupportedTanMechanisms();
|
||||
|
||||
// max version for segment HKKAZ (Kontoumsätze anfordern / Zeitraum)
|
||||
$this->hkkazVersion = $response->getHkkazMaxVersion();
|
||||
|
||||
$this->endDialog();
|
||||
|
||||
return $response->rawResponse;
|
||||
}
|
||||
|
||||
/**
|
||||
* Ends a previous started dialog.
|
||||
*
|
||||
* @return string
|
||||
* @throws AdapterException
|
||||
* @throws CurlException
|
||||
* @throws FailedRequestException
|
||||
*/
|
||||
public function endDialog()
|
||||
{
|
||||
$endMsg = new Message(
|
||||
$this->bankCode,
|
||||
$this->username,
|
||||
$this->pin,
|
||||
$this->systemId,
|
||||
$this->dialogId,
|
||||
$this->messageNumber,
|
||||
array(
|
||||
new HKEND(3, $this->dialogId)
|
||||
)
|
||||
);
|
||||
|
||||
$response = $this->sendMessage($endMsg);
|
||||
|
||||
$this->dialogId = 0;
|
||||
$this->messageNumber = 1;
|
||||
|
||||
return $response->rawResponse;
|
||||
}
|
||||
}
|
@ -1,96 +0,0 @@
|
||||
<?php
|
||||
|
||||
namespace Fhp\Dialog\Exception;
|
||||
|
||||
/**
|
||||
* Class FailedRequestException.
|
||||
*
|
||||
* Transforms HBCI error to exception.
|
||||
*
|
||||
* @package Fhp\Dialog\Exception
|
||||
*/
|
||||
class FailedRequestException extends \Exception
|
||||
{
|
||||
/**
|
||||
* @var array
|
||||
*/
|
||||
protected $summary = array();
|
||||
|
||||
/**
|
||||
* @var int
|
||||
*/
|
||||
protected $responseCode = 0;
|
||||
|
||||
/**
|
||||
* @var string
|
||||
*/
|
||||
protected $responseMessage;
|
||||
|
||||
/**
|
||||
* FailedRequestException constructor.
|
||||
*
|
||||
* @param array $summary
|
||||
*/
|
||||
public function __construct(array $summary)
|
||||
{
|
||||
$this->summary = $summary;
|
||||
$keys = array_keys($summary);
|
||||
|
||||
$this->responseCode = 0;
|
||||
$this->responseMessage = 'Unknown error';
|
||||
|
||||
if (count($summary) == 1) {
|
||||
$this->responseCode = (int) $keys[0];
|
||||
$this->responseMessage = array_shift($summary);
|
||||
} elseif (count($summary) > 1) {
|
||||
foreach ($summary as $scode => $smsg) {
|
||||
if (0 === strpos($smsg, '*')) {
|
||||
$this->responseCode = (int) $scode;
|
||||
$this->responseMessage = substr($smsg, 1);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
parent::__construct('Request Failed: ' . $this->responseMessage, $this->responseCode);
|
||||
}
|
||||
|
||||
/**
|
||||
* @return array
|
||||
*/
|
||||
public function getCodes()
|
||||
{
|
||||
return array_keys($this->summary);
|
||||
}
|
||||
|
||||
/**
|
||||
* @return array
|
||||
*/
|
||||
public function getSummary()
|
||||
{
|
||||
return $this->summary;
|
||||
}
|
||||
|
||||
/**
|
||||
* @return int
|
||||
*/
|
||||
public function getResponseCode()
|
||||
{
|
||||
return $this->responseCode;
|
||||
}
|
||||
|
||||
/**
|
||||
* @return string
|
||||
*/
|
||||
public function getResponseMessage()
|
||||
{
|
||||
return $this->responseMessage;
|
||||
}
|
||||
|
||||
/**
|
||||
* @return string
|
||||
*/
|
||||
public function getResponseMessages()
|
||||
{
|
||||
return implode(', ', $this->summary);
|
||||
}
|
||||
}
|
@ -1,418 +0,0 @@
|
||||
<?php
|
||||
|
||||
namespace Fhp;
|
||||
|
||||
use Fhp\Adapter\AdapterInterface;
|
||||
use Fhp\Adapter\Curl;
|
||||
use Fhp\DataTypes\Kik;
|
||||
use Fhp\DataTypes\Kti;
|
||||
use Fhp\DataTypes\Ktv;
|
||||
use Fhp\Dialog\Dialog;
|
||||
use Fhp\Message\AbstractMessage;
|
||||
use Fhp\Message\Message;
|
||||
use Fhp\Model\SEPAAccount;
|
||||
use Fhp\Response\GetAccounts;
|
||||
use Fhp\Response\GetSaldo;
|
||||
use Fhp\Response\GetSEPAAccounts;
|
||||
use Fhp\Response\GetStatementOfAccount;
|
||||
use Fhp\Segment\HKKAZ;
|
||||
use Fhp\Segment\HKSAL;
|
||||
use Fhp\Segment\HKSPA;
|
||||
|
||||
/**
|
||||
* Class FinTs.
|
||||
*
|
||||
* @package Fhp
|
||||
*/
|
||||
class FinTs
|
||||
{
|
||||
const DEFAULT_COUNTRY_CODE = 280;
|
||||
|
||||
/** @var string */
|
||||
protected $server;
|
||||
/** @var int */
|
||||
protected $port;
|
||||
/** @var string */
|
||||
protected $bankCode;
|
||||
/** @var string */
|
||||
protected $username;
|
||||
/** @var string */
|
||||
protected $pin;
|
||||
/** @var Connection */
|
||||
protected $connection;
|
||||
/** @var AdapterInterface */
|
||||
protected $adapter;
|
||||
/** @var int */
|
||||
protected $systemId = 0;
|
||||
/** @var string */
|
||||
protected $bankName;
|
||||
|
||||
/**
|
||||
* FinTs constructor.
|
||||
* @param string $server
|
||||
* @param int $port
|
||||
* @param string $bankCode
|
||||
* @param string $username
|
||||
* @param string $pin
|
||||
*/
|
||||
public function __construct(
|
||||
$server,
|
||||
$port,
|
||||
$bankCode,
|
||||
$username,
|
||||
$pin
|
||||
) {
|
||||
$this->server = $server;
|
||||
$this->port = $port;
|
||||
|
||||
// escaping of bank code not really needed here as it should
|
||||
// never have special chars. But we just do it to ensure
|
||||
// that the request will not get messed up and the user
|
||||
// can receive a valid error response from the HBCI server.
|
||||
$this->bankCode = $this->escapeString($bankCode);
|
||||
|
||||
// Here, escaping is needed for usernames or pins with
|
||||
// HBCI special chars.
|
||||
$this->username = $this->escapeString($username);
|
||||
$this->pin = $this->escapeString($pin);
|
||||
|
||||
$this->adapter = new Curl($this->server, $this->port);
|
||||
$this->connection = new Connection($this->adapter);
|
||||
}
|
||||
|
||||
/**
|
||||
* Sets the adapter to use.
|
||||
*
|
||||
* @param AdapterInterface $adapter
|
||||
*/
|
||||
public function setAdapter(AdapterInterface $adapter)
|
||||
{
|
||||
$this->adapter = $adapter;
|
||||
$this->connection = new Connection($this->adapter);
|
||||
}
|
||||
|
||||
/**
|
||||
* Gets array of all accounts.
|
||||
*
|
||||
* @return Model\Account[]
|
||||
*/
|
||||
public function getAccounts()
|
||||
{
|
||||
$dialog = $this->getDialog();
|
||||
$result = $dialog->syncDialog();
|
||||
$this->bankName = $dialog->getBankName();
|
||||
$accounts = new GetAccounts($result);
|
||||
|
||||
return $accounts->getAccountsArray();
|
||||
}
|
||||
|
||||
/**
|
||||
* Gets array of all SEPA Accounts.
|
||||
*
|
||||
* @return Model\SEPAAccount[]
|
||||
* @throws Adapter\Exception\AdapterException
|
||||
* @throws Adapter\Exception\CurlException
|
||||
*/
|
||||
public function getSEPAAccounts()
|
||||
{
|
||||
$dialog = $this->getDialog();
|
||||
$dialog->syncDialog();
|
||||
$dialog->initDialog();
|
||||
|
||||
$message = $this->getNewMessage(
|
||||
$dialog,
|
||||
array(new HKSPA(3)),
|
||||
array(AbstractMessage::OPT_PINTAN_MECH => $dialog->getSupportedPinTanMechanisms())
|
||||
);
|
||||
|
||||
$result = $dialog->sendMessage($message);
|
||||
$dialog->endDialog();
|
||||
$sepaAccounts = new GetSEPAAccounts($result->rawResponse);
|
||||
|
||||
return $sepaAccounts->getSEPAAccountsArray();
|
||||
}
|
||||
|
||||
/**
|
||||
* Gets the bank name.
|
||||
*
|
||||
* @return string
|
||||
*/
|
||||
public function getBankName()
|
||||
{
|
||||
if (null == $this->bankName) {
|
||||
$this->getDialog()->syncDialog();
|
||||
}
|
||||
|
||||
return $this->bankName;
|
||||
}
|
||||
|
||||
/**
|
||||
* Gets statement of account.
|
||||
*
|
||||
* @param SEPAAccount $account
|
||||
* @param \DateTime $from
|
||||
* @param \DateTime $to
|
||||
* @return Model\StatementOfAccount\StatementOfAccount|null
|
||||
* @throws \Exception
|
||||
*/
|
||||
public function getStatementOfAccount(SEPAAccount $account, \DateTime $from, \DateTime $to)
|
||||
{
|
||||
$responses = array();
|
||||
|
||||
$dialog = $this->getDialog();
|
||||
$dialog->syncDialog();
|
||||
$dialog->initDialog();
|
||||
|
||||
$message = $this->createStateOfAccountMessage($dialog, $account, $from, $to, null);
|
||||
$response = $dialog->sendMessage($message);
|
||||
$touchdowns = $response->getTouchdowns($message);
|
||||
$soaResponse = new GetStatementOfAccount($response->rawResponse);
|
||||
$responses[] = $soaResponse->getRawMt940();
|
||||
|
||||
$touchdownCounter = 1;
|
||||
while (isset($touchdowns[HKKAZ::NAME])) {
|
||||
$message = $this->createStateOfAccountMessage(
|
||||
$dialog,
|
||||
$account,
|
||||
$from,
|
||||
$to,
|
||||
$touchdowns[HKKAZ::NAME]
|
||||
);
|
||||
|
||||
$r = $dialog->sendMessage($message);
|
||||
$touchdowns = $r->getTouchDowns($message);
|
||||
$soaResponse = new GetStatementOfAccount($r->rawResponse);
|
||||
$responses[] = $soaResponse->getRawMt940();
|
||||
}
|
||||
|
||||
$dialog->endDialog();
|
||||
|
||||
return GetStatementOfAccount::createModelFromRawMt940(implode('', $responses));
|
||||
}
|
||||
|
||||
/**
|
||||
* Helper method to create a "Statement of Account Message".
|
||||
*
|
||||
* @param Dialog $dialog
|
||||
* @param SEPAAccount $account
|
||||
* @param \DateTime $from
|
||||
* @param \DateTime $to
|
||||
* @param string|null $touchdown
|
||||
* @return Message
|
||||
* @throws \Exception
|
||||
*/
|
||||
protected function createStateOfAccountMessage(
|
||||
Dialog $dialog,
|
||||
SepaAccount $account,
|
||||
\DateTime $from,
|
||||
\DateTime $to,
|
||||
$touchdown = null
|
||||
) {
|
||||
// version 4, 5, 6, 7
|
||||
|
||||
// version 5
|
||||
/*
|
||||
1 Segmentkopf DEG M 1
|
||||
2 Kontoverbindung Auftraggeber DEG ktv # M 1
|
||||
3 Alle Konten DE jn # M 1
|
||||
4 Von Datum DE dat # K 1
|
||||
5 Bis Datum DE dat # K 1
|
||||
6 Maximale Anzahl Einträge DE num ..4 K 1 >0
|
||||
7 Aufsetzpunkt DE an ..35 K 1
|
||||
*/
|
||||
|
||||
// version 6
|
||||
/*
|
||||
1 Segmentkopf 1 DEG M 1
|
||||
2 Kontoverbindung Auftraggeber 2 DEG ktv # M 1
|
||||
3 Alle Konten 1 DE jn # M 1
|
||||
4 Von Datum 1 DE dat # O 1
|
||||
5 Bis Datum 1 DE dat # O 1
|
||||
6 Maximale Anzahl Einträge 1 DE num ..4 C 1 >0
|
||||
7 Aufsetzpunkt 1 DE an ..35 C 1
|
||||
*/
|
||||
|
||||
// version 7
|
||||
/*
|
||||
1 Segmentkopf 1 DEG M 1
|
||||
2 Kontoverbindung international 1 DEG kti # M 1
|
||||
3 Alle Konten 1 DE jn # M 1
|
||||
4 Von Datum 1 DE dat # O 1
|
||||
5 Bis Datum 1 DE dat # O 1
|
||||
6 Maximale Anzahl Einträge 1 DE num ..4 C 1 >0
|
||||
7 Aufsetzpunkt 1 DE an ..35 C 1
|
||||
*/
|
||||
|
||||
switch ($dialog->getHkkazMaxVersion()) {
|
||||
case 4:
|
||||
case 5:
|
||||
$konto = new Deg();
|
||||
$konto->addDataElement($account->getAccountNumber());
|
||||
$konto->addDataElement($account->getSubAccount());
|
||||
$konto->addDataElement(static::DEFAULT_COUNTRY_CODE);
|
||||
$konto->addDataElement($account->getBlz());
|
||||
break;
|
||||
case 6:
|
||||
$konto = new Ktv(
|
||||
$account->getAccountNumber(),
|
||||
$account->getSubAccount(),
|
||||
new Kik(280, $account->getBlz())
|
||||
);
|
||||
break;
|
||||
case 7:
|
||||
$konto = new Kti(
|
||||
$account->getIban(),
|
||||
$account->getBic(),
|
||||
$account->getAccountNumber(),
|
||||
$account->getSubAccount(),
|
||||
new Kik(280, $account->getBlz())
|
||||
);
|
||||
break;
|
||||
default:
|
||||
throw new \Exception('Unsupported HKKAZ version: ' . $dialog->getHkkazMaxVersion());
|
||||
}
|
||||
|
||||
$message = $this->getNewMessage(
|
||||
$dialog,
|
||||
array(
|
||||
new HKKAZ(
|
||||
$dialog->getHkkazMaxVersion(),
|
||||
3,
|
||||
$konto,
|
||||
HKKAZ::ALL_ACCOUNTS_N,
|
||||
$from,
|
||||
$to,
|
||||
$touchdown
|
||||
)
|
||||
),
|
||||
array(AbstractMessage::OPT_PINTAN_MECH => $dialog->getSupportedPinTanMechanisms())
|
||||
);
|
||||
|
||||
return $message;
|
||||
}
|
||||
|
||||
/**
|
||||
* Gets the saldo of given SEPAAccount.
|
||||
*
|
||||
* @param SEPAAccount $account
|
||||
* @return Model\Saldo|null
|
||||
* @throws Adapter\Exception\AdapterException
|
||||
* @throws Adapter\Exception\CurlException
|
||||
* @throws \Exception
|
||||
*/
|
||||
public function getSaldo(SEPAAccount $account)
|
||||
{
|
||||
$dialog = $this->getDialog();
|
||||
$dialog->syncDialog();
|
||||
$dialog->initDialog();
|
||||
|
||||
switch ((int) $dialog->getHksalMaxVersion()) {
|
||||
case 4:
|
||||
case 5:
|
||||
$hksalAccount = new Deg(
|
||||
$account->getAccountNumber(),
|
||||
$account->getSubAccount(),
|
||||
static::DEFAULT_COUNTRY_CODE, $account->getBlz()
|
||||
);
|
||||
$hksalAccount->addDataElement($account->getAccountNumber());
|
||||
$hksalAccount->addDataElement($account->getSubAccount());
|
||||
$hksalAccount->addDataElement(static::DEFAULT_COUNTRY_CODE);
|
||||
$hksalAccount->addDataElement($account->getBlz());
|
||||
break;
|
||||
case 6:
|
||||
$hksalAccount = new Ktv(
|
||||
$account->getAccountNumber(),
|
||||
$account->getSubAccount(),
|
||||
new Kik(280, $account->getBlz())
|
||||
);
|
||||
break;
|
||||
case 7:
|
||||
$hksalAccount = new Kti(
|
||||
$account->getIban(),
|
||||
$account->getBic(),
|
||||
$account->getAccountNumber(),
|
||||
$account->getSubAccount(),
|
||||
new Kik(280, $account->getBlz())
|
||||
);
|
||||
break;
|
||||
default:
|
||||
throw new \Exception('Unsupported HKSAL version: ' . $dialog->getHksalMaxVersion());
|
||||
}
|
||||
|
||||
$message = new Message(
|
||||
$this->bankCode,
|
||||
$this->username,
|
||||
$this->pin,
|
||||
$dialog->getSystemId(),
|
||||
$dialog->getDialogId(),
|
||||
$dialog->getMessageNumber(),
|
||||
array(
|
||||
new HKSAL($dialog->getHksalMaxVersion(), 3, $hksalAccount, HKSAL::ALL_ACCOUNTS_N)
|
||||
),
|
||||
array(
|
||||
AbstractMessage::OPT_PINTAN_MECH => $dialog->getSupportedPinTanMechanisms()
|
||||
)
|
||||
);
|
||||
|
||||
$response = $dialog->sendMessage($message);
|
||||
$response = new GetSaldo($response->rawResponse);
|
||||
|
||||
return $response->getSaldoModel();
|
||||
}
|
||||
|
||||
/**
|
||||
* Helper method to retrieve a pre configured message object.
|
||||
* Factory for poor people :)
|
||||
*
|
||||
* @param Dialog $dialog
|
||||
* @param array $segments
|
||||
* @param array $options
|
||||
* @return Message
|
||||
*/
|
||||
protected function getNewMessage(Dialog $dialog, array $segments, array $options)
|
||||
{
|
||||
return new Message(
|
||||
$this->bankCode,
|
||||
$this->username,
|
||||
$this->pin,
|
||||
$dialog->getSystemId(),
|
||||
$dialog->getDialogId(),
|
||||
$dialog->getMessageNumber(),
|
||||
$segments,
|
||||
$options
|
||||
);
|
||||
}
|
||||
|
||||
/**
|
||||
* Helper method to retrieve a pre configured dialog object.
|
||||
* Factory for poor people :)
|
||||
*
|
||||
* @return Dialog
|
||||
*/
|
||||
protected function getDialog()
|
||||
{
|
||||
return new Dialog(
|
||||
$this->connection,
|
||||
$this->bankCode,
|
||||
$this->username,
|
||||
$this->pin,
|
||||
$this->systemId
|
||||
);
|
||||
}
|
||||
|
||||
/**
|
||||
* Needed for escaping userdata.
|
||||
* HBCI escape char is "?"
|
||||
*
|
||||
* @param string $string
|
||||
* @return string
|
||||
*/
|
||||
protected function escapeString($string)
|
||||
{
|
||||
return str_replace(
|
||||
array('?', '@', ':', '+', '\''),
|
||||
array('??', '?@', '?:', '?+', '?\''),
|
||||
$string
|
||||
);
|
||||
}
|
||||
}
|
@ -1,134 +0,0 @@
|
||||
<?php
|
||||
|
||||
namespace Fhp\Message;
|
||||
|
||||
use Fhp\Segment\HNHBK;
|
||||
use Fhp\Segment\SegmentInterface;
|
||||
|
||||
/**
|
||||
* Class AbstractMessage
|
||||
* @package Fhp\Message
|
||||
*/
|
||||
class AbstractMessage
|
||||
{
|
||||
const MSG_HEADER_SEGMENT = 'HNHBK';
|
||||
const MSG_HEADER_VERSION = 3;
|
||||
const MSG_HEADER_SEG_NUMBER = 1;
|
||||
const MSG_HBCI_VERSION = '300';
|
||||
|
||||
const OPT_PINTAN_MECH = 'pintan_mechanism';
|
||||
|
||||
/**
|
||||
* @var array
|
||||
*/
|
||||
protected $segments = array();
|
||||
|
||||
/**
|
||||
* @var int
|
||||
*/
|
||||
protected $dialogId = 0;
|
||||
|
||||
/**
|
||||
* @var int
|
||||
*/
|
||||
protected $messageNumber = 1;
|
||||
|
||||
/**
|
||||
* Adds a segment to the message.
|
||||
*
|
||||
* @param SegmentInterface $segment
|
||||
*/
|
||||
protected function addSegment(SegmentInterface $segment)
|
||||
{
|
||||
$this->segments[] = $segment;
|
||||
}
|
||||
|
||||
/**
|
||||
* Gets all segments of a message.
|
||||
*
|
||||
* @return array
|
||||
*/
|
||||
public function getSegments()
|
||||
{
|
||||
return $this->segments;
|
||||
}
|
||||
|
||||
/**
|
||||
* Sets the dialog ID.
|
||||
*
|
||||
* @param $dialogId
|
||||
*/
|
||||
public function setDialogId($dialogId)
|
||||
{
|
||||
$this->dialogId = $dialogId;
|
||||
}
|
||||
|
||||
/**
|
||||
* Gets the dialog ID.
|
||||
*
|
||||
* @return int
|
||||
*/
|
||||
public function getDialogId()
|
||||
{
|
||||
return $this->dialogId;
|
||||
}
|
||||
|
||||
/**
|
||||
* Sets the message number.
|
||||
*
|
||||
* @param int $number
|
||||
*/
|
||||
public function setMessageNumber($number)
|
||||
{
|
||||
$this->messageNumber = (int) $number;
|
||||
}
|
||||
|
||||
/**
|
||||
* Gets the message number.
|
||||
*
|
||||
* @return int
|
||||
*/
|
||||
public function getMessageNumber()
|
||||
{
|
||||
return $this->messageNumber;
|
||||
}
|
||||
|
||||
/**
|
||||
* Transform message to HBCI string.
|
||||
*
|
||||
* @return string
|
||||
*/
|
||||
public function toString()
|
||||
{
|
||||
$string = (string) $this->buildMessageHeader();
|
||||
|
||||
foreach ($this->segments as $segment) {
|
||||
$string .= (string) $segment;
|
||||
}
|
||||
|
||||
return $string;
|
||||
}
|
||||
|
||||
/**
|
||||
* @return string
|
||||
*/
|
||||
public function __toString()
|
||||
{
|
||||
return $this->toString();
|
||||
}
|
||||
|
||||
/**
|
||||
* Builds the message header.
|
||||
*
|
||||
* @return HNHBK
|
||||
*/
|
||||
protected function buildMessageHeader()
|
||||
{
|
||||
$len = 0;
|
||||
foreach ($this->segments as $segment) {
|
||||
$len += strlen($segment);
|
||||
}
|
||||
|
||||
return new HNHBK($len, $this->dialogId, $this->messageNumber);
|
||||
}
|
||||
}
|
@ -1,196 +0,0 @@
|
||||
<?php
|
||||
|
||||
namespace Fhp\Message;
|
||||
|
||||
use Fhp\DataElementGroups\SecurityProfile;
|
||||
use Fhp\Segment\AbstractSegment;
|
||||
use Fhp\Segment\HNHBS;
|
||||
use Fhp\Segment\HNSHA;
|
||||
use Fhp\Segment\HNSHK;
|
||||
use Fhp\Segment\HNVSD;
|
||||
use Fhp\Segment\HNVSK;
|
||||
use Fhp\Segment\SegmentInterface;
|
||||
|
||||
/**
|
||||
* Class Message.
|
||||
*
|
||||
* @package Fhp\Message
|
||||
*/
|
||||
class Message extends AbstractMessage
|
||||
{
|
||||
/**
|
||||
* @var int
|
||||
*/
|
||||
protected $encryptedSegmentsCount = 0;
|
||||
|
||||
/**
|
||||
* @var int
|
||||
*/
|
||||
protected $securityReference;
|
||||
|
||||
/**
|
||||
* @var string
|
||||
*/
|
||||
protected $pin;
|
||||
|
||||
/**
|
||||
* @var string
|
||||
*/
|
||||
protected $bankCode;
|
||||
|
||||
/**
|
||||
* @var string
|
||||
*/
|
||||
protected $username;
|
||||
|
||||
/**
|
||||
* @var string
|
||||
*/
|
||||
protected $systemId;
|
||||
|
||||
/**
|
||||
* @var array
|
||||
*/
|
||||
protected $options;
|
||||
|
||||
/**
|
||||
* @var int
|
||||
*/
|
||||
protected $profileVersion;
|
||||
|
||||
/**
|
||||
* @var string
|
||||
*/
|
||||
protected $securityFunction;
|
||||
|
||||
/**
|
||||
* @var array
|
||||
*/
|
||||
private $encryptedSegments = array();
|
||||
|
||||
/**
|
||||
* @var HNVSD
|
||||
*/
|
||||
protected $encryptionEnvelop;
|
||||
|
||||
/**
|
||||
* Message constructor.
|
||||
* @param string $bankCode
|
||||
* @param string $username
|
||||
* @param string $pin
|
||||
* @param $systemId
|
||||
* @param int $dialogId
|
||||
* @param int $messageNumber
|
||||
* @param array $encryptedSegments
|
||||
* @param array $options
|
||||
*/
|
||||
public function __construct(
|
||||
$bankCode,
|
||||
$username,
|
||||
$pin,
|
||||
$systemId,
|
||||
$dialogId = 0,
|
||||
$messageNumber = 0,
|
||||
array $encryptedSegments = array(),
|
||||
array $options = array()
|
||||
) {
|
||||
$this->securityReference = rand(1000000, 9999999);
|
||||
$this->dialogId = $dialogId;
|
||||
$this->messageNumber = $messageNumber;
|
||||
$this->bankCode = $bankCode;
|
||||
$this->username = $username;
|
||||
$this->pin = $pin;
|
||||
$this->systemId = $systemId;
|
||||
$this->options = $options;
|
||||
$this->profileVersion = SecurityProfile::PROFILE_VERSION_1;
|
||||
$this->securityFunction = HNSHK::SECURITY_FUNC_999;
|
||||
|
||||
if (isset($options[static::OPT_PINTAN_MECH]) && !empty($this->options[static::OPT_PINTAN_MECH])) {
|
||||
if (!in_array('999', $this->options[static::OPT_PINTAN_MECH])) {
|
||||
$this->profileVersion = SecurityProfile::PROFILE_VERSION_2;
|
||||
$this->securityFunction = $this->options[static::OPT_PINTAN_MECH][0];
|
||||
}
|
||||
}
|
||||
|
||||
$signatureHead = $this->buildSignatureHead();
|
||||
$hnvsk = $this->buildEncryptionHead();
|
||||
|
||||
$this->addSegment($hnvsk);
|
||||
|
||||
$this->encryptionEnvelop = new HNVSD(999, '');
|
||||
$this->addSegment($this->encryptionEnvelop);
|
||||
|
||||
$this->addEncryptedSegment($signatureHead);
|
||||
|
||||
foreach ($encryptedSegments as $es) {
|
||||
$this->addEncryptedSegment($es);
|
||||
}
|
||||
|
||||
$curCount = count($encryptedSegments) + 3;
|
||||
|
||||
$signatureEnd = new HNSHA($curCount, $this->securityReference, $this->pin);
|
||||
$this->addEncryptedSegment($signatureEnd);
|
||||
$this->addSegment(new HNHBS($curCount + 1, $this->messageNumber));
|
||||
}
|
||||
|
||||
/**
|
||||
* @return HNVSK
|
||||
* @codeCoverageIgnore
|
||||
*/
|
||||
protected function buildEncryptionHead()
|
||||
{
|
||||
return new HNVSK(
|
||||
998,
|
||||
$this->bankCode,
|
||||
$this->username,
|
||||
$this->systemId,
|
||||
HNVSK::SECURITY_SUPPLIER_ROLE_ISS,
|
||||
HNVSK::DEFAULT_COUNTRY_CODE,
|
||||
HNVSK::COMPRESSION_NONE,
|
||||
$this->profileVersion
|
||||
);
|
||||
}
|
||||
|
||||
/**
|
||||
* @return HNSHK
|
||||
* @codeCoverageIgnore
|
||||
*/
|
||||
protected function buildSignatureHead()
|
||||
{
|
||||
return new HNSHK(
|
||||
2,
|
||||
$this->securityReference,
|
||||
280, // country code
|
||||
$this->bankCode,
|
||||
$this->username,
|
||||
$this->systemId,
|
||||
$this->securityFunction,
|
||||
HNSHK::SECURITY_BOUNDARY_SHM,
|
||||
HNSHK::SECURITY_SUPPLIER_ROLE_ISS,
|
||||
$this->profileVersion
|
||||
);
|
||||
}
|
||||
|
||||
/**
|
||||
* Adds a encrypted segment to the message.
|
||||
*
|
||||
* @param SegmentInterface $segment
|
||||
*/
|
||||
protected function addEncryptedSegment(SegmentInterface $segment)
|
||||
{
|
||||
$this->encryptedSegmentsCount++;
|
||||
$this->encryptedSegments[] = $segment;
|
||||
$encodedData = $this->encryptionEnvelop->getEncodedData()->getData();
|
||||
$encodedData .= (string) $segment;
|
||||
$this->encryptionEnvelop->setEncodedData($encodedData);
|
||||
}
|
||||
|
||||
/**
|
||||
* Only for read-only access.
|
||||
* @return AbstractSegment[]
|
||||
*/
|
||||
public function getEncryptedSegments()
|
||||
{
|
||||
return $this->encryptedSegments;
|
||||
}
|
||||
}
|
@ -1,219 +0,0 @@
|
||||
<?php
|
||||
|
||||
namespace Fhp\Model;
|
||||
|
||||
/**
|
||||
* Class Account
|
||||
* @package Fhp\Model
|
||||
*/
|
||||
class Account
|
||||
{
|
||||
/** @var string */
|
||||
protected $id;
|
||||
/** @var string */
|
||||
protected $accountNumber;
|
||||
/** @var string */
|
||||
protected $bankCode;
|
||||
/** @var string */
|
||||
protected $iban;
|
||||
/** @var string */
|
||||
protected $customerId;
|
||||
/** @var string */
|
||||
protected $currency;
|
||||
/** @var string */
|
||||
protected $accountOwnerName;
|
||||
/** @var string */
|
||||
protected $accountDescription;
|
||||
|
||||
/**
|
||||
* Get id
|
||||
*
|
||||
* @return mixed
|
||||
*/
|
||||
public function getId()
|
||||
{
|
||||
return $this->id;
|
||||
}
|
||||
|
||||
/**
|
||||
* Set id
|
||||
*
|
||||
* @param string $id
|
||||
*
|
||||
* @return $this
|
||||
*/
|
||||
public function setId($id)
|
||||
{
|
||||
$this->id = $id;
|
||||
|
||||
return $this;
|
||||
}
|
||||
|
||||
/**
|
||||
* Get accountNumber
|
||||
*
|
||||
* @return string
|
||||
*/
|
||||
public function getAccountNumber()
|
||||
{
|
||||
return $this->accountNumber;
|
||||
}
|
||||
|
||||
/**
|
||||
* Set accountNumber
|
||||
*
|
||||
* @param string $accountNumber
|
||||
*
|
||||
* @return $this
|
||||
*/
|
||||
public function setAccountNumber($accountNumber)
|
||||
{
|
||||
$this->accountNumber = (string) $accountNumber;
|
||||
|
||||
return $this;
|
||||
}
|
||||
|
||||
/**
|
||||
* Get bankCode
|
||||
*
|
||||
* @return string
|
||||
*/
|
||||
public function getBankCode()
|
||||
{
|
||||
return $this->bankCode;
|
||||
}
|
||||
|
||||
/**
|
||||
* Set bankCode
|
||||
*
|
||||
* @param string $bankCode
|
||||
*
|
||||
* @return $this
|
||||
*/
|
||||
public function setBankCode($bankCode)
|
||||
{
|
||||
$this->bankCode = (string) $bankCode;
|
||||
|
||||
return $this;
|
||||
}
|
||||
|
||||
/**
|
||||
* Get iban
|
||||
*
|
||||
* @return string
|
||||
*/
|
||||
public function getIban()
|
||||
{
|
||||
return $this->iban;
|
||||
}
|
||||
|
||||
/**
|
||||
* Set iban
|
||||
*
|
||||
* @param string $iban
|
||||
*
|
||||
* @return $this
|
||||
*/
|
||||
public function setIban($iban)
|
||||
{
|
||||
$this->iban = (string) $iban;
|
||||
|
||||
return $this;
|
||||
}
|
||||
|
||||
/**
|
||||
* Get customerId
|
||||
*
|
||||
* @return string
|
||||
*/
|
||||
public function getCustomerId()
|
||||
{
|
||||
return $this->customerId;
|
||||
}
|
||||
|
||||
/**
|
||||
* Set customerId
|
||||
*
|
||||
* @param string $customerId
|
||||
*
|
||||
* @return $this
|
||||
*/
|
||||
public function setCustomerId($customerId)
|
||||
{
|
||||
$this->customerId = (string) $customerId;
|
||||
|
||||
return $this;
|
||||
}
|
||||
|
||||
/**
|
||||
* Get currency
|
||||
*
|
||||
* @return string
|
||||
*/
|
||||
public function getCurrency()
|
||||
{
|
||||
return $this->currency;
|
||||
}
|
||||
|
||||
/**
|
||||
* Set currency
|
||||
*
|
||||
* @param string $currency
|
||||
*
|
||||
* @return $this
|
||||
*/
|
||||
public function setCurrency($currency)
|
||||
{
|
||||
$this->currency = (string) $currency;
|
||||
|
||||
return $this;
|
||||
}
|
||||
|
||||
/**
|
||||
* Get accountOwnerName
|
||||
*
|
||||
* @return string
|
||||
*/
|
||||
public function getAccountOwnerName()
|
||||
{
|
||||
return $this->accountOwnerName;
|
||||
}
|
||||
|
||||
/**
|
||||
* Set accountOwnerName
|
||||
*
|
||||
* @param string $accountOwnerName
|
||||
*
|
||||
* @return $this
|
||||
*/
|
||||
public function setAccountOwnerName($accountOwnerName)
|
||||
{
|
||||
$this->accountOwnerName = (string) $accountOwnerName;
|
||||
|
||||
return $this;
|
||||
}
|
||||
|
||||
/**
|
||||
* Get accountDescription
|
||||
*
|
||||
* @return string
|
||||
*/
|
||||
public function getAccountDescription()
|
||||
{
|
||||
return $this->accountDescription;
|
||||
}
|
||||
|
||||
/**
|
||||
* Set accountDescription
|
||||
*
|
||||
* @param string $accountDescription
|
||||
*
|
||||
* @return $this
|
||||
*/
|
||||
public function setAccountDescription($accountDescription)
|
||||
{
|
||||
$this->accountDescription = (string) $accountDescription;
|
||||
|
||||
return $this;
|
||||
}
|
||||
}
|
@ -1,141 +0,0 @@
|
||||
<?php
|
||||
|
||||
namespace Fhp\Model;
|
||||
|
||||
/**
|
||||
* Class SEPAAccount
|
||||
* @package Fhp\Model
|
||||
*/
|
||||
class SEPAAccount
|
||||
{
|
||||
/** @var string */
|
||||
protected $iban;
|
||||
/** @var string */
|
||||
protected $bic;
|
||||
/** @var string */
|
||||
protected $accountNumber;
|
||||
/** @var string */
|
||||
protected $subAccount;
|
||||
/** @var string */
|
||||
protected $blz;
|
||||
|
||||
/**
|
||||
* Get iban
|
||||
*
|
||||
* @return string
|
||||
*/
|
||||
public function getIban()
|
||||
{
|
||||
return $this->iban;
|
||||
}
|
||||
|
||||
/**
|
||||
* Set iban
|
||||
*
|
||||
* @param string $iban
|
||||
*
|
||||
* @return $this
|
||||
*/
|
||||
public function setIban($iban)
|
||||
{
|
||||
$this->iban = (string) $iban;
|
||||
|
||||
return $this;
|
||||
}
|
||||
|
||||
/**
|
||||
* Get bic
|
||||
*
|
||||
* @return string
|
||||
*/
|
||||
public function getBic()
|
||||
{
|
||||
return $this->bic;
|
||||
}
|
||||
|
||||
/**
|
||||
* Set bic
|
||||
*
|
||||
* @param string $bic
|
||||
*
|
||||
* @return $this
|
||||
*/
|
||||
public function setBic($bic)
|
||||
{
|
||||
$this->bic = (string) $bic;
|
||||
|
||||
return $this;
|
||||
}
|
||||
|
||||
/**
|
||||
* Get accountNumber
|
||||
*
|
||||
* @return string
|
||||
*/
|
||||
public function getAccountNumber()
|
||||
{
|
||||
return $this->accountNumber;
|
||||
}
|
||||
|
||||
/**
|
||||
* Set accountNumber
|
||||
*
|
||||
* @param string $accountNumber
|
||||
*
|
||||
* @return $this
|
||||
*/
|
||||
public function setAccountNumber($accountNumber)
|
||||
{
|
||||
$this->accountNumber = (string) $accountNumber;
|
||||
|
||||
return $this;
|
||||
}
|
||||
|
||||
/**
|
||||
* Get subAccount
|
||||
*
|
||||
* @return string
|
||||
*/
|
||||
public function getSubAccount()
|
||||
{
|
||||
return $this->subAccount;
|
||||
}
|
||||
|
||||
/**
|
||||
* Set subAccount
|
||||
*
|
||||
* @param string $subAccount
|
||||
*
|
||||
* @return $this
|
||||
*/
|
||||
public function setSubAccount($subAccount)
|
||||
{
|
||||
$this->subAccount = (string) $subAccount;
|
||||
|
||||
return $this;
|
||||
}
|
||||
|
||||
/**
|
||||
* Get blz
|
||||
*
|
||||
* @return string
|
||||
*/
|
||||
public function getBlz()
|
||||
{
|
||||
return $this->blz;
|
||||
}
|
||||
|
||||
/**
|
||||
* Set blz
|
||||
*
|
||||
* @param string $blz
|
||||
*
|
||||
* @return $this
|
||||
*/
|
||||
public function setBlz($blz)
|
||||
{
|
||||
$this->blz = (string) $blz;
|
||||
|
||||
return $this;
|
||||
}
|
||||
}
|
@ -1,97 +0,0 @@
|
||||
<?php
|
||||
|
||||
namespace Fhp\Model;
|
||||
|
||||
/**
|
||||
* Class Saldo
|
||||
* @package Fhp\Model
|
||||
*/
|
||||
class Saldo
|
||||
{
|
||||
/**
|
||||
* @var string
|
||||
*/
|
||||
protected $currency;
|
||||
|
||||
/**
|
||||
* @var float
|
||||
*/
|
||||
protected $amount;
|
||||
|
||||
/**
|
||||
* @var \DateTime
|
||||
*/
|
||||
protected $valuta;
|
||||
|
||||
/**
|
||||
* Get currency
|
||||
*
|
||||
* @return string
|
||||
*/
|
||||
public function getCurrency()
|
||||
{
|
||||
return $this->currency;
|
||||
}
|
||||
|
||||
/**
|
||||
* Set currency
|
||||
*
|
||||
* @param string $currency
|
||||
*
|
||||
* @return $this
|
||||
*/
|
||||
public function setCurrency($currency)
|
||||
{
|
||||
$this->currency = (string) $currency;
|
||||
|
||||
return $this;
|
||||
}
|
||||
|
||||
/**
|
||||
* Get amount
|
||||
*
|
||||
* @return float
|
||||
*/
|
||||
public function getAmount()
|
||||
{
|
||||
return $this->amount;
|
||||
}
|
||||
|
||||
/**
|
||||
* Set amount
|
||||
*
|
||||
* @param float $amount
|
||||
*
|
||||
* @return $this
|
||||
*/
|
||||
public function setAmount($amount)
|
||||
{
|
||||
$this->amount = (float) $amount;
|
||||
|
||||
return $this;
|
||||
}
|
||||
|
||||
/**
|
||||
* Get valuta
|
||||
*
|
||||
* @return \DateTime
|
||||
*/
|
||||
public function getValuta()
|
||||
{
|
||||
return $this->valuta;
|
||||
}
|
||||
|
||||
/**
|
||||
* Set valuta
|
||||
*
|
||||
* @param \DateTime $valuta
|
||||
*
|
||||
* @return $this
|
||||
*/
|
||||
public function setValuta(\DateTime $valuta)
|
||||
{
|
||||
$this->valuta = $valuta;
|
||||
|
||||
return $this;
|
||||
}
|
||||
}
|
@ -1,134 +0,0 @@
|
||||
<?php
|
||||
|
||||
namespace Fhp\Model\StatementOfAccount;
|
||||
|
||||
/**
|
||||
* Class Statement
|
||||
* @package Fhp\Model\StatementOfAccount
|
||||
*/
|
||||
class Statement
|
||||
{
|
||||
const CD_CREDIT = 'credit';
|
||||
const CD_DEBIT = 'debit';
|
||||
|
||||
/**
|
||||
* @var array of Transaction
|
||||
*/
|
||||
protected $transactions = array();
|
||||
|
||||
/**
|
||||
* @var float
|
||||
*/
|
||||
protected $startBalance = 0.0;
|
||||
|
||||
/**
|
||||
* @var string
|
||||
*/
|
||||
protected $creditDebit;
|
||||
|
||||
/**
|
||||
* @var \DateTime|null
|
||||
*/
|
||||
protected $date;
|
||||
|
||||
/**
|
||||
* Get transactions
|
||||
*
|
||||
* @return Transaction[]
|
||||
*/
|
||||
public function getTransactions()
|
||||
{
|
||||
return $this->transactions;
|
||||
}
|
||||
|
||||
/**
|
||||
* Set transactions
|
||||
*
|
||||
* @param array $transactions
|
||||
*
|
||||
* @return $this
|
||||
*/
|
||||
public function setTransactions(array $transactions = null)
|
||||
{
|
||||
$this->transactions = $transactions;
|
||||
|
||||
return $this;
|
||||
}
|
||||
|
||||
public function addTransaction(Transaction $transaction)
|
||||
{
|
||||
$this->transactions[] = $transaction;
|
||||
}
|
||||
|
||||
/**
|
||||
* Get startBalance
|
||||
*
|
||||
* @return float
|
||||
*/
|
||||
public function getStartBalance()
|
||||
{
|
||||
return $this->startBalance;
|
||||
}
|
||||
|
||||
/**
|
||||
* Set startBalance
|
||||
*
|
||||
* @param float $startBalance
|
||||
*
|
||||
* @return $this
|
||||
*/
|
||||
public function setStartBalance($startBalance)
|
||||
{
|
||||
$this->startBalance = (float) $startBalance;
|
||||
|
||||
return $this;
|
||||
}
|
||||
|
||||
/**
|
||||
* Get creditDebit
|
||||
*
|
||||
* @return string
|
||||
*/
|
||||
public function getCreditDebit()
|
||||
{
|
||||
return $this->creditDebit;
|
||||
}
|
||||
|
||||
/**
|
||||
* Set creditDebit
|
||||
*
|
||||
* @param string|null $creditDebit
|
||||
*
|
||||
* @return $this
|
||||
*/
|
||||
public function setCreditDebit($creditDebit)
|
||||
{
|
||||
$this->creditDebit = $creditDebit;
|
||||
|
||||
return $this;
|
||||
}
|
||||
|
||||
/**
|
||||
* Get date
|
||||
*
|
||||
* @return \DateTime
|
||||
*/
|
||||
public function getDate()
|
||||
{
|
||||
return $this->date;
|
||||
}
|
||||
|
||||
/**
|
||||
* Set date
|
||||
*
|
||||
* @param \DateTime $date
|
||||
*
|
||||
* @return $this
|
||||
*/
|
||||
public function setDate(\DateTime $date)
|
||||
{
|
||||
$this->date = $date;
|
||||
|
||||
return $this;
|
||||
}
|
||||
}
|
@ -1,83 +0,0 @@
|
||||
<?php
|
||||
|
||||
namespace Fhp\Model\StatementOfAccount;
|
||||
|
||||
/**
|
||||
* Class StatementOfAccount
|
||||
* @package Fhp\Model\StatementOfAccount
|
||||
*/
|
||||
class StatementOfAccount
|
||||
{
|
||||
/**
|
||||
* @var Statement[]
|
||||
*/
|
||||
protected $statements = array();
|
||||
|
||||
/**
|
||||
* Get statements
|
||||
*
|
||||
* @return Statement[]
|
||||
*/
|
||||
public function getStatements()
|
||||
{
|
||||
return $this->statements;
|
||||
}
|
||||
|
||||
/**
|
||||
* Set statements
|
||||
*
|
||||
* @param array $statements
|
||||
*
|
||||
* @return $this
|
||||
*/
|
||||
public function setStatements(array $statements = null)
|
||||
{
|
||||
$this->statements = null == $statements ? array() : $statements;
|
||||
|
||||
return $this;
|
||||
}
|
||||
|
||||
/**
|
||||
* @param Statement $statement
|
||||
*/
|
||||
public function addStatement(Statement $statement)
|
||||
{
|
||||
$this->statements[] = $statement;
|
||||
}
|
||||
|
||||
/**
|
||||
* Gets statement for given date.
|
||||
*
|
||||
* @param string|\DateTime $date
|
||||
* @return Statement|null
|
||||
*/
|
||||
public function getStatementForDate($date)
|
||||
{
|
||||
if (is_string($date)) {
|
||||
$date = new \DateTime($date);
|
||||
}
|
||||
|
||||
foreach ($this->statements as $stmt) {
|
||||
if ($stmt->getDate() == $date) {
|
||||
return $stmt;
|
||||
}
|
||||
}
|
||||
|
||||
return null;
|
||||
}
|
||||
|
||||
/**
|
||||
* Checks if a statement with given date exists.
|
||||
*
|
||||
* @param string|\DateTime $date
|
||||
* @return bool
|
||||
*/
|
||||
public function hasStatementForDate($date)
|
||||
{
|
||||
if (is_string($date)) {
|
||||
$date = new \DateTime($date);
|
||||
}
|
||||
|
||||
return null !== $this->getStatementForDate($date);
|
||||
}
|
||||
}
|
@ -1,359 +0,0 @@
|
||||
<?php
|
||||
|
||||
namespace Fhp\Model\StatementOfAccount;
|
||||
|
||||
/**
|
||||
* Class Transaction
|
||||
* @package Fhp\Model\StatementOfAccount
|
||||
*/
|
||||
class Transaction
|
||||
{
|
||||
const CD_CREDIT = 'credit';
|
||||
const CD_DEBIT = 'debit';
|
||||
|
||||
/**
|
||||
* @var \DateTime|null
|
||||
*/
|
||||
protected $bookingDate;
|
||||
|
||||
/**
|
||||
* @var \DateTime|null
|
||||
*/
|
||||
protected $valutaDate;
|
||||
|
||||
/**
|
||||
* @var float
|
||||
*/
|
||||
protected $amount;
|
||||
|
||||
/**
|
||||
* @var string
|
||||
*/
|
||||
protected $creditDebit;
|
||||
|
||||
/**
|
||||
* @var string
|
||||
*/
|
||||
protected $bookingText;
|
||||
|
||||
/**
|
||||
* @var string
|
||||
*/
|
||||
protected $description1;
|
||||
|
||||
/**
|
||||
* @var string
|
||||
*/
|
||||
protected $description2;
|
||||
|
||||
/**
|
||||
* Array keys are identifiers like "SVWZ" for the main description.
|
||||
* @var array
|
||||
*/
|
||||
protected $structuredDescription;
|
||||
|
||||
/**
|
||||
* @var string
|
||||
*/
|
||||
protected $bankCode;
|
||||
|
||||
/**
|
||||
* @var string
|
||||
*/
|
||||
protected $accountNumber;
|
||||
|
||||
/**
|
||||
* @var string
|
||||
*/
|
||||
protected $name;
|
||||
|
||||
/**
|
||||
* Get booking date.
|
||||
*
|
||||
* @deprecated Use getBookingDate() instead
|
||||
* @codeCoverageIgnore
|
||||
* @return \DateTime|null
|
||||
*/
|
||||
public function getDate()
|
||||
{
|
||||
return $this->getBookingDate();
|
||||
}
|
||||
|
||||
/**
|
||||
* Get booking date
|
||||
*
|
||||
* @return \DateTime|null
|
||||
*/
|
||||
public function getBookingDate()
|
||||
{
|
||||
return $this->bookingDate;
|
||||
}
|
||||
|
||||
/**
|
||||
* Get date
|
||||
*
|
||||
* @return \DateTime|null
|
||||
*/
|
||||
public function getValutaDate()
|
||||
{
|
||||
return $this->valutaDate;
|
||||
}
|
||||
|
||||
/**
|
||||
* Set booking date
|
||||
*
|
||||
* @param \DateTime|null $date
|
||||
*
|
||||
* @return $this
|
||||
*/
|
||||
public function setBookingDate(\DateTime $date = null)
|
||||
{
|
||||
$this->bookingDate = $date;
|
||||
|
||||
return $this;
|
||||
}
|
||||
|
||||
/**
|
||||
* Set valuta date
|
||||
*
|
||||
* @param \DateTime|null $date
|
||||
*
|
||||
* @return $this
|
||||
*/
|
||||
public function setValutaDate(\DateTime $date = null)
|
||||
{
|
||||
$this->valutaDate = $date;
|
||||
|
||||
return $this;
|
||||
}
|
||||
|
||||
/**
|
||||
* Get amount
|
||||
*
|
||||
* @return float
|
||||
*/
|
||||
public function getAmount()
|
||||
{
|
||||
return $this->amount;
|
||||
}
|
||||
|
||||
/**
|
||||
* Set amount
|
||||
*
|
||||
* @param float $amount
|
||||
*
|
||||
* @return $this
|
||||
*/
|
||||
public function setAmount($amount)
|
||||
{
|
||||
$this->amount = (float) $amount;
|
||||
|
||||
return $this;
|
||||
}
|
||||
|
||||
/**
|
||||
* Get creditDebit
|
||||
*
|
||||
* @return string
|
||||
*/
|
||||
public function getCreditDebit()
|
||||
{
|
||||
return $this->creditDebit;
|
||||
}
|
||||
|
||||
/**
|
||||
* Set creditDebit
|
||||
*
|
||||
* @param string $creditDebit
|
||||
*
|
||||
* @return $this
|
||||
*/
|
||||
public function setCreditDebit($creditDebit)
|
||||
{
|
||||
$this->creditDebit = $creditDebit;
|
||||
|
||||
return $this;
|
||||
}
|
||||
|
||||
/**
|
||||
* Get bookingText
|
||||
*
|
||||
* @return string
|
||||
*/
|
||||
public function getBookingText()
|
||||
{
|
||||
return $this->bookingText;
|
||||
}
|
||||
|
||||
/**
|
||||
* Set bookingText
|
||||
*
|
||||
* @param string $bookingText
|
||||
*
|
||||
* @return $this
|
||||
*/
|
||||
public function setBookingText($bookingText)
|
||||
{
|
||||
$this->bookingText = (string) $bookingText;
|
||||
|
||||
return $this;
|
||||
}
|
||||
|
||||
/**
|
||||
* Get description1
|
||||
*
|
||||
* @return string
|
||||
*/
|
||||
public function getDescription1()
|
||||
{
|
||||
return $this->description1;
|
||||
}
|
||||
|
||||
/**
|
||||
* Set description1
|
||||
*
|
||||
* @param string $description1
|
||||
*
|
||||
* @return $this
|
||||
*/
|
||||
public function setDescription1($description1)
|
||||
{
|
||||
$this->description1 = (string) $description1;
|
||||
|
||||
return $this;
|
||||
}
|
||||
|
||||
/**
|
||||
* Get description2
|
||||
*
|
||||
* @return string
|
||||
*/
|
||||
public function getDescription2()
|
||||
{
|
||||
return $this->description2;
|
||||
}
|
||||
|
||||
/**
|
||||
* Set description2
|
||||
*
|
||||
* @param string $description2
|
||||
*
|
||||
* @return $this
|
||||
*/
|
||||
public function setDescription2($description2)
|
||||
{
|
||||
$this->description2 = (string) $description2;
|
||||
|
||||
return $this;
|
||||
}
|
||||
|
||||
/**
|
||||
* Get structuredDescription
|
||||
*
|
||||
* @return array
|
||||
*/
|
||||
public function getStructuredDescription()
|
||||
{
|
||||
return $this->structuredDescription;
|
||||
}
|
||||
|
||||
/**
|
||||
* Set structuredDescription
|
||||
*
|
||||
* @param array $structuredDescription
|
||||
*
|
||||
* @return $this
|
||||
*/
|
||||
public function setStructuredDescription($structuredDescription)
|
||||
{
|
||||
$this->structuredDescription = $structuredDescription;
|
||||
|
||||
return $this;
|
||||
}
|
||||
|
||||
/**
|
||||
* Get the main description (SVWZ)
|
||||
*
|
||||
* @return string
|
||||
*/
|
||||
public function getMainDescription()
|
||||
{
|
||||
if (array_key_exists('SVWZ', $this->structuredDescription)) {
|
||||
return $this->structuredDescription['SVWZ'];
|
||||
} else {
|
||||
return "";
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* Get bankCode
|
||||
*
|
||||
* @return string
|
||||
*/
|
||||
public function getBankCode()
|
||||
{
|
||||
return $this->bankCode;
|
||||
}
|
||||
|
||||
/**
|
||||
* Set bankCode
|
||||
*
|
||||
* @param string $bankCode
|
||||
*
|
||||
* @return $this
|
||||
*/
|
||||
public function setBankCode($bankCode)
|
||||
{
|
||||
$this->bankCode = (string) $bankCode;
|
||||
|
||||
return $this;
|
||||
}
|
||||
|
||||
/**
|
||||
* Get accountNumber
|
||||
*
|
||||
* @return string
|
||||
*/
|
||||
public function getAccountNumber()
|
||||
{
|
||||
return $this->accountNumber;
|
||||
}
|
||||
|
||||
/**
|
||||
* Set accountNumber
|
||||
*
|
||||
* @param string $accountNumber
|
||||
*
|
||||
* @return $this
|
||||
*/
|
||||
public function setAccountNumber($accountNumber)
|
||||
{
|
||||
$this->accountNumber = (string) $accountNumber;
|
||||
|
||||
return $this;
|
||||
}
|
||||
|
||||
/**
|
||||
* Get name
|
||||
*
|
||||
* @return string
|
||||
*/
|
||||
public function getName()
|
||||
{
|
||||
return $this->name;
|
||||
}
|
||||
|
||||
/**
|
||||
* Set name
|
||||
*
|
||||
* @param string $name
|
||||
*
|
||||
* @return $this
|
||||
*/
|
||||
public function setName($name)
|
||||
{
|
||||
$this->name = (string) $name;
|
||||
|
||||
return $this;
|
||||
}
|
||||
}
|
@ -1,12 +0,0 @@
|
||||
<?php
|
||||
|
||||
namespace Fhp\Parser\Exception;
|
||||
|
||||
/**
|
||||
* Class MT940Exception
|
||||
* @package Fhp\Parser\Exception
|
||||
*/
|
||||
class MT940Exception extends \Exception
|
||||
{
|
||||
|
||||
}
|
@ -1,229 +0,0 @@
|
||||
<?php
|
||||
|
||||
namespace Fhp\Parser;
|
||||
|
||||
use Fhp\Parser\Exception\MT940Exception;
|
||||
|
||||
/**
|
||||
* Class MT940
|
||||
* @package Fhp\Parser
|
||||
*/
|
||||
class MT940
|
||||
{
|
||||
const TARGET_ARRAY = 0;
|
||||
|
||||
const CD_CREDIT = 'credit';
|
||||
const CD_DEBIT = 'debit';
|
||||
|
||||
/** @var string */
|
||||
protected $rawData;
|
||||
/** @var string */
|
||||
protected $soaDate;
|
||||
|
||||
/**
|
||||
* MT940 constructor.
|
||||
*
|
||||
* @param string $rawData
|
||||
*/
|
||||
public function __construct($rawData)
|
||||
{
|
||||
$this->rawData = (string) $rawData;
|
||||
}
|
||||
|
||||
/**
|
||||
* @param string $target
|
||||
* @return array
|
||||
* @throws MT940Exception
|
||||
*/
|
||||
public function parse($target)
|
||||
{
|
||||
switch ($target) {
|
||||
case static::TARGET_ARRAY:
|
||||
return $this->parseToArray();
|
||||
break;
|
||||
default:
|
||||
throw new MT940Exception('Invalid parse type provided');
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* @return array
|
||||
* @throws MT940Exception
|
||||
*/
|
||||
protected function parseToArray()
|
||||
{
|
||||
// The divider can be either \r\n or @@
|
||||
$divider = substr_count($this->rawData, "\r\n-") > substr_count($this->rawData, '@@-') ? "\r\n" : '@@';
|
||||
|
||||
$result = array();
|
||||
$days = preg_split('%' . $divider . '-$%', $this->rawData);
|
||||
foreach ($days as &$day) {
|
||||
$day = explode($divider . ':', $day);
|
||||
for ($i = 0, $cnt = count($day); $i < $cnt; $i++) {
|
||||
// handle start balance
|
||||
// 60F:C160401EUR1234,56
|
||||
if (preg_match('/^60(F|M):/', $day[$i])) {
|
||||
// remove 60(F|M): for better parsing
|
||||
$day[$i] = substr($day[$i], 4);
|
||||
$this->soaDate = $this->getDate(substr($day[$i], 1, 6));
|
||||
|
||||
if (!isset($result[$this->soaDate])) {
|
||||
$result[$this->soaDate] = array('start_balance' => array());
|
||||
}
|
||||
|
||||
$cdMark = substr($day[$i], 0, 1);
|
||||
if ($cdMark == 'C') {
|
||||
$result[$this->soaDate]['start_balance']['credit_debit'] = static::CD_CREDIT;
|
||||
} elseif ($cdMark == 'D') {
|
||||
$result[$this->soaDate]['start_balance']['credit_debit'] = static::CD_DEBIT;
|
||||
}
|
||||
|
||||
$amount = str_replace(',', '.', substr($day[$i], 10));
|
||||
$result[$this->soaDate]['start_balance']['amount'] = $amount;
|
||||
} elseif (
|
||||
// found transaction
|
||||
// trx:61:1603310331DR637,39N033NONREF
|
||||
0 === strpos($day[$i], '61:')
|
||||
&& isset($day[$i + 1])
|
||||
&& 0 === strpos($day[$i + 1], '86:')
|
||||
) {
|
||||
$transaction = substr($day[$i], 3);
|
||||
$description = substr($day[$i + 1], 3);
|
||||
|
||||
if (!isset($result[$this->soaDate]['transactions'])) {
|
||||
$result[$this->soaDate]['transactions'] = array();
|
||||
}
|
||||
|
||||
// short form for better handling
|
||||
$trx = &$result[$this->soaDate]['transactions'];
|
||||
|
||||
preg_match('/^\d{6}(\d{4})?(C|D|RC|RD)([A-Z]{1})?([^N]+)N/', $transaction, $trxMatch);
|
||||
if ($trxMatch[2] == 'C') {
|
||||
$trx[count($trx)]['credit_debit'] = static::CD_CREDIT;
|
||||
} elseif ($trxMatch[2] == 'D') {
|
||||
$trx[count($trx)]['credit_debit'] = static::CD_DEBIT;
|
||||
} else {
|
||||
throw new MT940Exception('cd mark not found in: ' . $transaction);
|
||||
}
|
||||
|
||||
$amount = $trxMatch[4];
|
||||
$amount = str_replace(',', '.', $amount);
|
||||
$trx[count($trx) - 1]['amount'] = floatval($amount);
|
||||
|
||||
$description = $this->parseDescription($description);
|
||||
$trx[count($trx) - 1]['description'] = $description;
|
||||
|
||||
// :61:1605110509D198,02NMSCNONREF
|
||||
// 16 = year
|
||||
// 0511 = valuta date
|
||||
// 0509 = booking date
|
||||
$year = substr($transaction, 0, 2);
|
||||
$valutaDate = $this->getDate($year . substr($transaction, 2, 4));
|
||||
|
||||
$bookingDate = substr($transaction, 6, 4);
|
||||
if (preg_match('/^\d{4}$/', $bookingDate)) {
|
||||
// if valuta date is earlier than booking date, then it must be in the new year.
|
||||
$year = substr($transaction, 2, 2) < substr($transaction, 6, 2) ? --$year : $year;
|
||||
$bookingDate = $this->getDate($year . $bookingDate);
|
||||
} else {
|
||||
// if booking date not set in :61, then we have to take it from :60F
|
||||
$bookingDate = $this->soaDate;
|
||||
}
|
||||
|
||||
$trx[count($trx) - 1]['booking_date'] = $bookingDate;
|
||||
$trx[count($trx) - 1]['valuta_date'] = $valutaDate;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
return $result;
|
||||
}
|
||||
|
||||
/**
|
||||
* @param string $descr
|
||||
* @return array
|
||||
*/
|
||||
protected function parseDescription($descr)
|
||||
{
|
||||
$prepared = array();
|
||||
$result = array();
|
||||
|
||||
// prefill with empty values
|
||||
for ($i = 0; $i <= 63; $i++) {
|
||||
$prepared[$i] = null;
|
||||
}
|
||||
|
||||
$descr = str_replace("\r\n", '', $descr);
|
||||
$descr = str_replace('? ', '?', $descr);
|
||||
preg_match_all('/\?[\r\n]*(\d{2})([^\?]+)/', $descr, $matches, PREG_SET_ORDER);
|
||||
|
||||
$descriptionLines = array();
|
||||
$description1 = ''; // Legacy, could be removed.
|
||||
$description2 = ''; // Legacy, could be removed.
|
||||
foreach ($matches as $m) {
|
||||
$index = (int) $m[1];
|
||||
if ((20 <= $index && $index <= 29) || (60 <= $index && $index <= 63)) {
|
||||
if (20 <= $index && $index <= 29) {
|
||||
$description1 .= $m[2];
|
||||
} else {
|
||||
$description2 .= $m[2];
|
||||
}
|
||||
$m[2] = trim($m[2]);
|
||||
if (!empty($m[2])) {
|
||||
$descriptionLines[] = $m[2];
|
||||
}
|
||||
} else {
|
||||
$prepared[$index] = $m[2];
|
||||
}
|
||||
}
|
||||
|
||||
$description = array();
|
||||
if (empty($descriptionLines) || strlen($descriptionLines[0]) < 5 || $descriptionLines[0][4] !== '+') {
|
||||
$description['SVWZ'] = implode('', $descriptionLines);
|
||||
} else {
|
||||
$lastType = null;
|
||||
foreach ($descriptionLines as $line) {
|
||||
if (strlen($line) > 5 && $line[4] === '+') {
|
||||
if ($lastType != null) {
|
||||
$description[$lastType] = trim($description[$lastType]);
|
||||
}
|
||||
$lastType = substr($line, 0, 4);
|
||||
$description[$lastType] = substr($line, 5);
|
||||
} else {
|
||||
$description[$lastType] .= $line;
|
||||
}
|
||||
if (strlen($line) < 27) {
|
||||
// Usually, lines are 27 characters long. In case characters are missing, then it's either the end
|
||||
// of the current type or spaces have been trimmed from the end. We want to collapse multiple spaces
|
||||
// into one and we don't want to leave trailing spaces behind. So add a single space here to make up
|
||||
// for possibly missing spaces, and if it's the end of the type, it will be trimmed off later.
|
||||
$description[$lastType] .= ' ';
|
||||
}
|
||||
}
|
||||
$description[$lastType] = trim($description[$lastType]);
|
||||
}
|
||||
|
||||
$result['description'] = $description;
|
||||
$result['booking_text'] = trim($prepared[0]);
|
||||
$result['primanoten_nr'] = trim($prepared[10]);
|
||||
$result['description_1'] = trim($description1);
|
||||
$result['bank_code'] = trim($prepared[30]);
|
||||
$result['account_number'] = trim($prepared[31]);
|
||||
$result['name'] = trim($prepared[32] . $prepared[33]);
|
||||
$result['text_key_addition'] = trim($prepared[34]);
|
||||
$result['description_2'] = trim($description2);
|
||||
|
||||
return $result;
|
||||
}
|
||||
|
||||
/**
|
||||
* @param string $val
|
||||
* @return string
|
||||
*/
|
||||
protected function getDate($val)
|
||||
{
|
||||
$val = '20' . $val;
|
||||
preg_match('/(\d{4})(\d{2})(\d{2})/', $val, $m);
|
||||
return $m[1] . '-' . $m[2] . '-' . $m[3];
|
||||
}
|
||||
}
|
@ -1,60 +0,0 @@
|
||||
<?php
|
||||
|
||||
namespace Fhp\Response;
|
||||
|
||||
use Fhp\Model\Account;
|
||||
|
||||
/**
|
||||
* Class GetAccounts
|
||||
* @package Fhp\Response
|
||||
*/
|
||||
class GetAccounts extends Response
|
||||
{
|
||||
const SEG_ACCOUNT_INFORMATION = 'HIUPD';
|
||||
|
||||
/** @var array */
|
||||
protected $accounts = array();
|
||||
|
||||
/**
|
||||
* @return array
|
||||
*/
|
||||
public function getAccountsArray()
|
||||
{
|
||||
$accounts = $this->findSegments(static::SEG_ACCOUNT_INFORMATION);
|
||||
|
||||
foreach ($accounts as $account) {
|
||||
$accountParts = $this->splitSegment($account);
|
||||
$account = $this->createModelFromArray($accountParts);
|
||||
if ($account !== null) {
|
||||
$this->accounts[] = $account;
|
||||
}
|
||||
}
|
||||
|
||||
return $this->accounts;
|
||||
}
|
||||
|
||||
/**
|
||||
* Creates a Account model from array.
|
||||
*
|
||||
* @param array $array
|
||||
* @return Account
|
||||
*/
|
||||
protected function createModelFromArray(array $array)
|
||||
{
|
||||
if (!$array[1]) {
|
||||
return null;
|
||||
}
|
||||
$account = new Account();
|
||||
list($accountNumber, $x, $countryCode, $bankCode) = explode(':', $array[1]);
|
||||
$account->setId($array[1]);
|
||||
$account->setAccountNumber($accountNumber);
|
||||
$account->setBankCode($bankCode);
|
||||
$account->setIban($array[2]);
|
||||
$account->setCustomerId($array[3]);
|
||||
$account->setCurrency($array[5]);
|
||||
$account->setAccountOwnerName($array[6]);
|
||||
$account->setAccountDescription($array[8]);
|
||||
|
||||
return $account;
|
||||
}
|
||||
}
|
@ -1,56 +0,0 @@
|
||||
<?php
|
||||
|
||||
namespace Fhp\Response;
|
||||
|
||||
use Fhp\Model\SEPAAccount;
|
||||
|
||||
/**
|
||||
* Class GetSEPAAccounts
|
||||
* @package Fhp\Response
|
||||
*/
|
||||
class GetSEPAAccounts extends Response
|
||||
{
|
||||
const SEG_ACCOUNT_INFORMATION = 'HISPA';
|
||||
|
||||
/** @var array */
|
||||
protected $accounts = array();
|
||||
|
||||
/**
|
||||
* Creates SEPA Account array list with SEPAAccount models.
|
||||
*
|
||||
* @return SEPAAccount[]
|
||||
*/
|
||||
public function getSEPAAccountsArray()
|
||||
{
|
||||
$accounts = $this->findSegment(static::SEG_ACCOUNT_INFORMATION);
|
||||
|
||||
if (is_string($accounts)) {
|
||||
$accounts = $this->splitSegment($accounts);
|
||||
array_shift($accounts);
|
||||
foreach ($accounts as $account) {
|
||||
$array = $this->splitDeg($account);
|
||||
$this->accounts[] = $this->createModelFromArray($array);
|
||||
}
|
||||
}
|
||||
|
||||
return $this->accounts;
|
||||
}
|
||||
|
||||
/**
|
||||
* Creates a SEPAAccount model from array.
|
||||
*
|
||||
* @param array $array
|
||||
* @return SEPAAccount
|
||||
*/
|
||||
protected function createModelFromArray(array $array)
|
||||
{
|
||||
$account = new SEPAAccount();
|
||||
$account->setIban($array[1]);
|
||||
$account->setBic($array[2]);
|
||||
$account->setAccountNumber($array[3]);
|
||||
$account->setSubAccount($array[4]);
|
||||
$account->setBlz($array[6]);
|
||||
|
||||
return $account;
|
||||
}
|
||||
}
|
@ -1,70 +0,0 @@
|
||||
<?php
|
||||
|
||||
namespace Fhp\Response;
|
||||
|
||||
use Fhp\Model\Saldo;
|
||||
|
||||
/**
|
||||
* Class GetSaldo
|
||||
* @package Fhp\Response
|
||||
*/
|
||||
class GetSaldo extends Response
|
||||
{
|
||||
const SEG_ACCOUNT_INFORMATION = 'HISAL';
|
||||
const SALDO_DEBIT = 'D';
|
||||
const SALDO_CREDIT = 'C';
|
||||
|
||||
/**
|
||||
* Creates a Saldo object from response body.
|
||||
*
|
||||
* @return Saldo|null
|
||||
* @throws \Exception
|
||||
*/
|
||||
public function getSaldoModel()
|
||||
{
|
||||
$model = null;
|
||||
$saldoSec = $this->findSegment(static::SEG_ACCOUNT_INFORMATION);
|
||||
|
||||
if (is_string($saldoSec)) {
|
||||
$saldoSec = $this->splitSegment($saldoSec);
|
||||
array_shift($saldoSec); // get rid of header
|
||||
$model = $this->createModelFromArray($saldoSec);
|
||||
}
|
||||
|
||||
return $model;
|
||||
}
|
||||
|
||||
/**
|
||||
* Creates a Saldo model from array.
|
||||
*
|
||||
* @param array $array
|
||||
* @return Saldo
|
||||
* @throws \Exception
|
||||
*/
|
||||
protected function createModelFromArray(array $array)
|
||||
{
|
||||
$model = new Saldo();
|
||||
$saldoDeg = $this->splitDeg($array[3]);
|
||||
|
||||
$amount = str_replace(',', '.', $saldoDeg[1]);
|
||||
$creditDebit = trim($saldoDeg[0]);
|
||||
|
||||
if (static::SALDO_DEBIT == $creditDebit) {
|
||||
$amount = - (float) $amount;
|
||||
} elseif (static::SALDO_CREDIT == $creditDebit) {
|
||||
$amount = (float) $amount;
|
||||
} else {
|
||||
throw new \Exception('Invalid Soll-Haben-Kennzeichen: ' . $creditDebit);
|
||||
}
|
||||
|
||||
$model->setAmount($amount);
|
||||
$model->setCurrency($saldoDeg[2]);
|
||||
|
||||
$valutaDate = $saldoDeg[3];
|
||||
preg_match('/(\d{4})(\d{2})(\d{2})/', $valutaDate, $m);
|
||||
$valutaDate = new \DateTime($m[1] . '-' . $m[2] . '-' . $m[3]);
|
||||
$model->setValuta($valutaDate);
|
||||
|
||||
return $model;
|
||||
}
|
||||
}
|
@ -1,102 +0,0 @@
|
||||
<?php
|
||||
|
||||
namespace Fhp\Response;
|
||||
|
||||
use Fhp\Model\StatementOfAccount\Statement;
|
||||
use Fhp\Model\StatementOfAccount\StatementOfAccount;
|
||||
use Fhp\Model\StatementOfAccount\Transaction;
|
||||
use Fhp\Parser\MT940;
|
||||
|
||||
/**
|
||||
* Class GetStatementOfAccount
|
||||
* @package Fhp\Response
|
||||
*/
|
||||
class GetStatementOfAccount extends Response
|
||||
{
|
||||
const SEG_ACCOUNT_INFORMATION = 'HIKAZ';
|
||||
|
||||
/**
|
||||
* Gets the raw MT940 string from response.
|
||||
*
|
||||
* @return string
|
||||
*/
|
||||
public function getRawMt940()
|
||||
{
|
||||
$seg = $this->findSegment(static::SEG_ACCOUNT_INFORMATION);
|
||||
if (is_string($seg)) {
|
||||
if (preg_match('/@(\d+)@(.+)/ms', $seg, $m)) {
|
||||
return $m[2];
|
||||
}
|
||||
}
|
||||
|
||||
return '';
|
||||
}
|
||||
|
||||
/**
|
||||
* Creates StatementOfAccount object from raw MT940 string.
|
||||
*
|
||||
* @param string $rawMt940
|
||||
* @return StatementOfAccount
|
||||
*/
|
||||
public static function createModelFromRawMt940($rawMt940)
|
||||
{
|
||||
$parser = new MT940($rawMt940);
|
||||
|
||||
return static::createModelFromArray($parser->parse(MT940::TARGET_ARRAY));
|
||||
}
|
||||
|
||||
/**
|
||||
* Adds statements to an existing StatementOfAccount object.
|
||||
*
|
||||
* @param array $array
|
||||
* @param StatementOfAccount $statementOfAccount
|
||||
* @return StatementOfAccount
|
||||
*/
|
||||
protected static function addFromArray(array $array, StatementOfAccount $statementOfAccount)
|
||||
{
|
||||
foreach ($array as $date => $statement) {
|
||||
if ($statementOfAccount->hasStatementForDate($date)) {
|
||||
$statementModel = $statementOfAccount->getStatementForDate($date);
|
||||
} else {
|
||||
$statementModel = new Statement();
|
||||
$statementModel->setDate(new \DateTime($date));
|
||||
$statementModel->setStartBalance((float) $statement['start_balance']['amount']);
|
||||
$statementModel->setCreditDebit($statement['start_balance']['credit_debit']);
|
||||
$statementOfAccount->addStatement($statementModel);
|
||||
}
|
||||
|
||||
if (isset($statement['transactions'])) {
|
||||
foreach ($statement['transactions'] as $trx) {
|
||||
$transaction = new Transaction();
|
||||
$transaction->setBookingDate(new \DateTime($trx['booking_date']));
|
||||
$transaction->setValutaDate(new \DateTime($trx['valuta_date']));
|
||||
$transaction->setCreditDebit($trx['credit_debit']);
|
||||
$transaction->setAmount($trx['amount']);
|
||||
$transaction->setBookingText($trx['description']['booking_text']);
|
||||
$transaction->setDescription1($trx['description']['description_1']);
|
||||
$transaction->setDescription2($trx['description']['description_2']);
|
||||
$transaction->setStructuredDescription($trx['description']['description']);
|
||||
$transaction->setBankCode($trx['description']['bank_code']);
|
||||
$transaction->setAccountNumber($trx['description']['account_number']);
|
||||
$transaction->setName($trx['description']['name']);
|
||||
$statementModel->addTransaction($transaction);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
return $statementOfAccount;
|
||||
}
|
||||
|
||||
/**
|
||||
* Creates a StatementOfAccount model from array.
|
||||
*
|
||||
* @param array $array
|
||||
* @return StatementOfAccount
|
||||
*/
|
||||
protected static function createModelFromArray(array $array)
|
||||
{
|
||||
$soa = static::addFromArray($array, new StatementOfAccount());
|
||||
|
||||
return $soa;
|
||||
}
|
||||
}
|
@ -1,12 +0,0 @@
|
||||
<?php
|
||||
|
||||
namespace Fhp\Response;
|
||||
|
||||
/**
|
||||
* Class Initialization
|
||||
* @package Fhp\Response
|
||||
*/
|
||||
class Initialization extends Response
|
||||
{
|
||||
|
||||
}
|
@ -1,377 +0,0 @@
|
||||
<?php
|
||||
|
||||
namespace Fhp\Response;
|
||||
|
||||
use Fhp\Message\AbstractMessage;
|
||||
use Fhp\Segment\AbstractSegment;
|
||||
use Fhp\Segment\NameMapping;
|
||||
|
||||
/**
|
||||
* Class Response
|
||||
*
|
||||
* @package Fhp\Response
|
||||
*/
|
||||
class Response
|
||||
{
|
||||
/** @var string */
|
||||
public $rawResponse;
|
||||
|
||||
/** @var string */
|
||||
protected $response;
|
||||
|
||||
/** @var array */
|
||||
protected $segments = array();
|
||||
|
||||
/** @var string */
|
||||
protected $dialogId;
|
||||
|
||||
/** @var string */
|
||||
protected $systemId;
|
||||
|
||||
/**
|
||||
* Response constructor.
|
||||
*
|
||||
* @param string $rawResponse
|
||||
*/
|
||||
public function __construct($rawResponse)
|
||||
{
|
||||
if ($rawResponse instanceof Initialization) {
|
||||
$rawResponse = $rawResponse->rawResponse;
|
||||
}
|
||||
|
||||
$this->rawResponse = $rawResponse;
|
||||
$this->response = $this->unwrapEncryptedMsg($rawResponse);
|
||||
$this->segments = preg_split("#'(?=[A-Z]{4,}:\d|')#", $rawResponse);
|
||||
}
|
||||
|
||||
/**
|
||||
* Extracts dialog ID from response.
|
||||
*
|
||||
* @return string|null
|
||||
* @throws \Exception
|
||||
*/
|
||||
public function getDialogId()
|
||||
{
|
||||
$segment = $this->findSegment('HNHBK');
|
||||
|
||||
if (null === $segment) {
|
||||
throw new \Exception('Could not find element HNHBK. Invalid response?');
|
||||
}
|
||||
|
||||
return $this->getSegmentIndex(4, $segment);
|
||||
}
|
||||
|
||||
/**
|
||||
* Extracts bank name from response.
|
||||
*
|
||||
* @return string|null
|
||||
*/
|
||||
public function getBankName()
|
||||
{
|
||||
$bankName = null;
|
||||
$segment = $this->findSegment('HIBPA');
|
||||
if (null != $segment) {
|
||||
$split = $this->splitSegment($segment);
|
||||
if (isset($split[3])) {
|
||||
$bankName = $split[3];
|
||||
}
|
||||
}
|
||||
|
||||
return $bankName;
|
||||
}
|
||||
|
||||
/**
|
||||
* Some kind of HBCI pagination.
|
||||
*
|
||||
* @param AbstractMessage $message
|
||||
*
|
||||
* @return array
|
||||
*/
|
||||
public function getTouchDowns(AbstractMessage $message)
|
||||
{
|
||||
$touchdown = array();
|
||||
$messageSegments = $message->getEncryptedSegments();
|
||||
/** @var AbstractSegment $msgSeg */
|
||||
foreach ($messageSegments as $msgSeg) {
|
||||
$segment = $this->findSegmentForReference('HIRMS', $msgSeg);
|
||||
if (null != $segment) {
|
||||
$parts = $this->splitSegment($segment);
|
||||
// remove header
|
||||
array_shift($parts);
|
||||
foreach ($parts as $p) {
|
||||
$pSplit = $this->splitDeg($p);
|
||||
if ($pSplit[0] == 3040) {
|
||||
$td = $pSplit[3];
|
||||
$touchdown[$msgSeg->getName()] = $td;
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
return $touchdown;
|
||||
}
|
||||
|
||||
/**
|
||||
* Extracts supported TAN mechanisms from response.
|
||||
*
|
||||
* @return array
|
||||
*/
|
||||
public function getSupportedTanMechanisms()
|
||||
{
|
||||
$segments = $this->findSegments('HIRMS');
|
||||
// @todo create method to get reference element from request
|
||||
foreach ($segments as $segment) {
|
||||
$segment = $this->splitSegment($segment);
|
||||
array_shift($segment);
|
||||
foreach ($segment as $seg) {
|
||||
list($id, $msg) = explode('::', $seg, 2);
|
||||
if ("3920" == $id) {
|
||||
if (preg_match_all('/\d{3}/', $msg, $matches)) {
|
||||
return $matches[0];
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
return array();
|
||||
}
|
||||
|
||||
/**
|
||||
* @return int
|
||||
*/
|
||||
public function getHksalMaxVersion()
|
||||
{
|
||||
return $this->getSegmentMaxVersion('HISALS');
|
||||
}
|
||||
|
||||
/**
|
||||
* @return int
|
||||
*/
|
||||
public function getHkkazMaxVersion()
|
||||
{
|
||||
return $this->getSegmentMaxVersion('HIKAZS');
|
||||
}
|
||||
|
||||
/**
|
||||
* Checks if request / response was successful.
|
||||
*
|
||||
* @return bool
|
||||
*/
|
||||
public function isSuccess()
|
||||
{
|
||||
$summary = $this->getMessageSummary();
|
||||
|
||||
foreach ($summary as $code => $message) {
|
||||
if ("9" == substr($code, 0, 1)) {
|
||||
return false;
|
||||
}
|
||||
}
|
||||
|
||||
return true;
|
||||
}
|
||||
|
||||
/**
|
||||
* @return array
|
||||
* @throws \Exception
|
||||
*/
|
||||
public function getMessageSummary()
|
||||
{
|
||||
return $this->getSummaryBySegment('HIRMG');
|
||||
}
|
||||
|
||||
/**
|
||||
* @return array
|
||||
* @throws \Exception
|
||||
*/
|
||||
public function getSegmentSummary()
|
||||
{
|
||||
return $this->getSummaryBySegment('HIRMS');
|
||||
}
|
||||
|
||||
/**
|
||||
* @param string $name
|
||||
*
|
||||
* @return array
|
||||
* @throws \Exception
|
||||
*/
|
||||
protected function getSummaryBySegment($name)
|
||||
{
|
||||
if (!in_array($name, array('HIRMS', 'HIRMG'))) {
|
||||
throw new \Exception('Invalid segment for message summary. Only HIRMS and HIRMG supported');
|
||||
}
|
||||
|
||||
$result = array();
|
||||
$segment = $this->findSegment($name);
|
||||
$segment = $this->splitSegment($segment);
|
||||
array_shift($segment);
|
||||
foreach ($segment as $de) {
|
||||
$de = $this->splitDeg($de);
|
||||
$result[$de[0]] = $de[2];
|
||||
}
|
||||
|
||||
return $result;
|
||||
}
|
||||
|
||||
/**
|
||||
* @param string $segmentName
|
||||
*
|
||||
* @return int
|
||||
*/
|
||||
public function getSegmentMaxVersion($segmentName)
|
||||
{
|
||||
$version = 3;
|
||||
$segments = $this->findSegments($segmentName);
|
||||
foreach ($segments as $s) {
|
||||
$parts = $this->splitSegment($s);
|
||||
$segmentHeader = $this->splitDeg($parts[0]);
|
||||
$curVersion = (int) $segmentHeader[2];
|
||||
if ($curVersion > $version) {
|
||||
$version = $curVersion;
|
||||
}
|
||||
}
|
||||
|
||||
return $version;
|
||||
}
|
||||
|
||||
/**
|
||||
* @return string
|
||||
* @throws \Exception
|
||||
*/
|
||||
public function getSystemId()
|
||||
{
|
||||
$segment = $this->findSegment('HISYN');
|
||||
|
||||
if (!preg_match('/HISYN:\d+:\d+:\d+\+(.+)/', $segment, $matches)) {
|
||||
throw new \Exception('Could not determine system id.');
|
||||
}
|
||||
|
||||
return $matches[1];
|
||||
}
|
||||
|
||||
/**
|
||||
* @param bool $translateCodes
|
||||
*
|
||||
* @return string
|
||||
*/
|
||||
public function humanReadable($translateCodes = false)
|
||||
{
|
||||
return str_replace(
|
||||
array("'", '+'),
|
||||
array(PHP_EOL, PHP_EOL . " "),
|
||||
$translateCodes
|
||||
? NameMapping::translateResponse($this->rawResponse)
|
||||
: $this->rawResponse
|
||||
);
|
||||
}
|
||||
|
||||
/**
|
||||
* @param string $name
|
||||
* @param AbstractSegment $reference
|
||||
*
|
||||
* @return string|null
|
||||
*/
|
||||
protected function findSegmentForReference($name, AbstractSegment $reference)
|
||||
{
|
||||
$segments = $this->findSegments($name);
|
||||
foreach ($segments as $seg) {
|
||||
$segSplit = $this->splitSegment($seg);
|
||||
$segSplit = array_shift($segSplit);
|
||||
$segSplit = $this->splitDeg($segSplit);
|
||||
if ($segSplit[3] == $reference->getSegmentNumber()) {
|
||||
return $seg;
|
||||
}
|
||||
}
|
||||
|
||||
return null;
|
||||
}
|
||||
|
||||
/**
|
||||
* @param string $name
|
||||
*
|
||||
* @return string|null
|
||||
*/
|
||||
protected function findSegment($name)
|
||||
{
|
||||
return $this->findSegments($name, true);
|
||||
}
|
||||
|
||||
/**
|
||||
* @param string $name
|
||||
* @param bool $one
|
||||
*
|
||||
* @return array|null|string
|
||||
*/
|
||||
protected function findSegments($name, $one = false)
|
||||
{
|
||||
$found = $one ? null : array();
|
||||
|
||||
foreach ($this->segments as $segment) {
|
||||
$split = explode(':', $segment, 2);
|
||||
|
||||
if ($split[0] == $name) {
|
||||
if ($one) {
|
||||
return $segment;
|
||||
}
|
||||
$found[] = $segment;
|
||||
}
|
||||
}
|
||||
|
||||
return $found;
|
||||
}
|
||||
|
||||
/**
|
||||
* @param $segment
|
||||
*
|
||||
* @return array
|
||||
*/
|
||||
protected function splitSegment($segment)
|
||||
{
|
||||
$parts = preg_split('/\+(?<!\?\+)/', $segment);
|
||||
|
||||
foreach ($parts as &$part) {
|
||||
$part = str_replace('?+', '+', $part);
|
||||
}
|
||||
|
||||
return $parts;
|
||||
}
|
||||
|
||||
/**
|
||||
* @param $deg
|
||||
*
|
||||
* @return array
|
||||
*/
|
||||
protected function splitDeg($deg)
|
||||
{
|
||||
return explode(':', $deg);
|
||||
}
|
||||
|
||||
/**
|
||||
* @param int $idx
|
||||
* @param $segment
|
||||
*
|
||||
* @return string|null
|
||||
*/
|
||||
protected function getSegmentIndex($idx, $segment)
|
||||
{
|
||||
$segment = $this->splitSegment($segment);
|
||||
if (isset($segment[$idx - 1])) {
|
||||
return $segment[$idx - 1];
|
||||
}
|
||||
|
||||
return null;
|
||||
}
|
||||
|
||||
/**
|
||||
* @param string $response
|
||||
*
|
||||
* @return string
|
||||
*/
|
||||
protected function unwrapEncryptedMsg($response)
|
||||
{
|
||||
if (preg_match('/HNVSD:\d+:\d+\+@\d+@(.+)\'\'/', $response, $matches)) {
|
||||
return $matches[1];
|
||||
}
|
||||
|
||||
return $response;
|
||||
}
|
||||
}
|
@ -1,108 +0,0 @@
|
||||
<?php
|
||||
|
||||
namespace Fhp\Segment;
|
||||
|
||||
/**
|
||||
* Abstract Class AbstractSegment.
|
||||
*
|
||||
* @package Fhp\Segment
|
||||
*/
|
||||
abstract class AbstractSegment implements SegmentInterface
|
||||
{
|
||||
const SEGMENT_SEPARATOR = "'";
|
||||
const DEFAULT_COUNTRY_CODE = 280;
|
||||
|
||||
/** @var string */
|
||||
protected $type;
|
||||
/** @var int */
|
||||
protected $segmentNumber;
|
||||
/** @var int */
|
||||
protected $version;
|
||||
/** @var array */
|
||||
protected $dataElements;
|
||||
|
||||
/**
|
||||
* AbstractSegment constructor.
|
||||
*
|
||||
* @param $type
|
||||
* @param $segmentNumber
|
||||
* @param $version
|
||||
* @param array $dataElements
|
||||
*/
|
||||
public function __construct($type, $segmentNumber, $version, array $dataElements = array())
|
||||
{
|
||||
$this->type = strtoupper($type);
|
||||
$this->version = $version;
|
||||
$this->segmentNumber = $segmentNumber;
|
||||
$this->dataElements = $dataElements;
|
||||
}
|
||||
|
||||
/**
|
||||
* @param array $dataElements
|
||||
*/
|
||||
public function setDataElements(array $dataElements = array())
|
||||
{
|
||||
$this->dataElements = $dataElements;
|
||||
}
|
||||
|
||||
/**
|
||||
* @return array
|
||||
*/
|
||||
public function getDataElements()
|
||||
{
|
||||
return $this->dataElements;
|
||||
}
|
||||
|
||||
/**
|
||||
* @return string
|
||||
*/
|
||||
public function toString()
|
||||
{
|
||||
$string = $this->type . ':' . $this->segmentNumber . ':' . $this->version;
|
||||
|
||||
foreach ($this->dataElements as $de) {
|
||||
$string .= '+' . (string) $de;
|
||||
}
|
||||
|
||||
return $string . static::SEGMENT_SEPARATOR;
|
||||
}
|
||||
|
||||
/**
|
||||
* @return string
|
||||
*/
|
||||
public function __toString()
|
||||
{
|
||||
return $this->toString();
|
||||
}
|
||||
|
||||
/**
|
||||
* @param bool $translateCodes
|
||||
* @return string
|
||||
*/
|
||||
public function humanReadable($translateCodes = false)
|
||||
{
|
||||
return str_replace(
|
||||
array("'", '+'),
|
||||
array(PHP_EOL, PHP_EOL . " "),
|
||||
$translateCodes
|
||||
? NameMapping::translateResponse($this->toString())
|
||||
: $this->toString()
|
||||
);
|
||||
}
|
||||
|
||||
/**
|
||||
* @return int
|
||||
*/
|
||||
public function getSegmentNumber()
|
||||
{
|
||||
return $this->segmentNumber;
|
||||
}
|
||||
|
||||
/**
|
||||
* @return int
|
||||
*/
|
||||
public function getVersion()
|
||||
{
|
||||
return $this->version;
|
||||
}
|
||||
}
|
@ -1,41 +0,0 @@
|
||||
<?php
|
||||
|
||||
namespace Fhp\Segment;
|
||||
|
||||
/**
|
||||
* Class HKEND (Dialogende)
|
||||
* Segment type: Administration
|
||||
*
|
||||
* @link: http://www.hbci-zka.de/dokumente/spezifikation_deutsch/fintsv3/FinTS_3.0_Formals_2011-06-14_final_version.pdf
|
||||
* Section: C.4.1.2
|
||||
*
|
||||
* @package Fhp\Segment
|
||||
*/
|
||||
class HKEND extends AbstractSegment
|
||||
{
|
||||
const NAME = 'HKEND';
|
||||
const VERSION = 1;
|
||||
|
||||
/**
|
||||
* HKEND constructor.
|
||||
* @param $segmentNumber
|
||||
* @param $dialogId
|
||||
*/
|
||||
public function __construct($segmentNumber, $dialogId)
|
||||
{
|
||||
parent::__construct(
|
||||
static::NAME,
|
||||
$segmentNumber,
|
||||
static::VERSION,
|
||||
array($dialogId)
|
||||
);
|
||||
}
|
||||
|
||||
/**
|
||||
* @return string
|
||||
*/
|
||||
public function getName()
|
||||
{
|
||||
return static::NAME;
|
||||
}
|
||||
}
|
@ -1,51 +0,0 @@
|
||||
<?php
|
||||
|
||||
namespace Fhp\Segment;
|
||||
|
||||
use Fhp\DataTypes\Kik;
|
||||
|
||||
/**
|
||||
* Class HKIDN (Identifikation)
|
||||
* Segment type: Administration
|
||||
*
|
||||
* @link: http://www.hbci-zka.de/dokumente/spezifikation_deutsch/fintsv3/FinTS_3.0_Formals_2011-06-14_final_version.pdf
|
||||
* Section: C.3.1.2
|
||||
*
|
||||
* @package Fhp\Segment
|
||||
*/
|
||||
class HKIDN extends AbstractSegment
|
||||
{
|
||||
const NAME = 'HKIDN';
|
||||
const VERSION = 2;
|
||||
const COUNTRY_CODE = 280; // Germany
|
||||
|
||||
/**
|
||||
* HKIDN constructor.
|
||||
* @param int $segmentNumber
|
||||
* @param string $bankCode
|
||||
* @param string $userName
|
||||
* @param int $systemId
|
||||
*/
|
||||
public function __construct($segmentNumber, $bankCode, $userName, $systemId = 0)
|
||||
{
|
||||
parent::__construct(
|
||||
static::NAME,
|
||||
$segmentNumber,
|
||||
static::VERSION,
|
||||
array(
|
||||
new Kik(static::COUNTRY_CODE, $bankCode),
|
||||
$userName,
|
||||
$systemId,
|
||||
1 // Kunden-ID
|
||||
)
|
||||
);
|
||||
}
|
||||
|
||||
/**
|
||||
* @return string
|
||||
*/
|
||||
public function getName()
|
||||
{
|
||||
return static::NAME;
|
||||
}
|
||||
}
|
@ -1,63 +0,0 @@
|
||||
<?php
|
||||
|
||||
namespace Fhp\Segment;
|
||||
|
||||
use Fhp\DataTypes\Dat;
|
||||
|
||||
/**
|
||||
* Class HKKAZ (Kontoumsätze anfordern/Zeitraum)
|
||||
* Segment type: Geschäftsvorfall
|
||||
*
|
||||
* @link: http://www.hbci-zka.de/dokumente/spezifikation_deutsch/fintsv3/FinTS_3.0_Messages_Geschaeftsvorfaelle_2015-08-07_final_version.pdf
|
||||
* Section: C.2.1.1.1.2
|
||||
*
|
||||
* @package Fhp\Segment
|
||||
*/
|
||||
class HKKAZ extends AbstractSegment
|
||||
{
|
||||
const NAME = 'HKKAZ';
|
||||
const ALL_ACCOUNTS_N = 'N';
|
||||
const ALL_ACCOUNTS_Y = 'J';
|
||||
|
||||
/**
|
||||
* HKKAZ constructor.
|
||||
* @param int $version
|
||||
* @param int $segmentNumber
|
||||
* @param mixed $ktv
|
||||
* @param array $allAccounts
|
||||
* @param \DateTime $from
|
||||
* @param \DateTime $to
|
||||
* @param string|null $touchdown
|
||||
*/
|
||||
public function __construct(
|
||||
$version,
|
||||
$segmentNumber,
|
||||
$ktv,
|
||||
$allAccounts,
|
||||
\DateTime $from,
|
||||
\DateTime $to,
|
||||
$touchdown = null
|
||||
) {
|
||||
parent::__construct(
|
||||
static::NAME,
|
||||
$segmentNumber,
|
||||
$version,
|
||||
array(
|
||||
$ktv,
|
||||
$allAccounts,
|
||||
new Dat($from),
|
||||
new Dat($to),
|
||||
null,
|
||||
$touchdown
|
||||
)
|
||||
);
|
||||
}
|
||||
|
||||
/**
|
||||
* @return string
|
||||
*/
|
||||
public function getName()
|
||||
{
|
||||
return static::NAME;
|
||||
}
|
||||
}
|
@ -1,48 +0,0 @@
|
||||
<?php
|
||||
|
||||
namespace Fhp\Segment;
|
||||
|
||||
/**
|
||||
* Class HKSAL (Saldenabfrage)
|
||||
* Segment type: Geschäftsvorfall
|
||||
*
|
||||
* @link: http://www.hbci-zka.de/dokumente/spezifikation_deutsch/fintsv3/FinTS_3.0_Messages_Geschaeftsvorfaelle_2015-08-07_final_version.pdf
|
||||
* Section: C.2.1.2
|
||||
*
|
||||
* @package Fhp\Segment
|
||||
*/
|
||||
class HKSAL extends AbstractSegment
|
||||
{
|
||||
const NAME = 'HKSAL';
|
||||
const VERSION = 7;
|
||||
const ALL_ACCOUNTS_N = 'N';
|
||||
const ALL_ACCOUNTS_Y = 'J';
|
||||
|
||||
/**
|
||||
* HKSAL constructor.
|
||||
* @param int $version
|
||||
* @param int $segmentNumber
|
||||
* @param mixed $ktv
|
||||
* @param array $allAccounts
|
||||
*/
|
||||
public function __construct($version, $segmentNumber, $ktv, $allAccounts)
|
||||
{
|
||||
parent::__construct(
|
||||
static::NAME,
|
||||
$segmentNumber,
|
||||
$version,
|
||||
array(
|
||||
$ktv,
|
||||
$allAccounts,
|
||||
)
|
||||
);
|
||||
}
|
||||
|
||||
/**
|
||||
* @return string
|
||||
*/
|
||||
public function getName()
|
||||
{
|
||||
return static::NAME;
|
||||
}
|
||||
}
|
@ -1,43 +0,0 @@
|
||||
<?php
|
||||
|
||||
namespace Fhp\Segment;
|
||||
|
||||
use Fhp\DataTypes\Ktv;
|
||||
|
||||
/**
|
||||
* Class HKSPA (SEPA-Kontoverbindung anfordern)
|
||||
* Segment type: Geschäftsvorfall
|
||||
*
|
||||
* @link: http://www.hbci-zka.de/dokumente/spezifikation_deutsch/fintsv3/FinTS_3.0_Messages_Geschaeftsvorfaelle_2015-08-07_final_version.pdf
|
||||
* Section: C.10.1.3
|
||||
*
|
||||
* @package Fhp\Segment
|
||||
*/
|
||||
class HKSPA extends AbstractSegment
|
||||
{
|
||||
const NAME = 'HKSPA';
|
||||
const VERSION = 1;
|
||||
|
||||
/**
|
||||
* HKSPA constructor.
|
||||
* @param int $segmentNumber
|
||||
* @param Ktv|null $ktv
|
||||
*/
|
||||
public function __construct($segmentNumber, Ktv $ktv = null)
|
||||
{
|
||||
parent::__construct(
|
||||
static::NAME,
|
||||
$segmentNumber,
|
||||
static::VERSION,
|
||||
array($ktv)
|
||||
);
|
||||
}
|
||||
|
||||
/**
|
||||
* @return string
|
||||
*/
|
||||
public function getName()
|
||||
{
|
||||
return static::NAME;
|
||||
}
|
||||
}
|
@ -1,47 +0,0 @@
|
||||
<?php
|
||||
|
||||
namespace Fhp\Segment;
|
||||
|
||||
/**
|
||||
* Class HKSYN (Synchronisation)
|
||||
* Segment type: Administration
|
||||
*
|
||||
* @link: http://www.hbci-zka.de/dokumente/spezifikation_deutsch/fintsv3/FinTS_3.0_Formals_2011-06-14_final_version.pdf
|
||||
* Section: C.8.1.2
|
||||
*
|
||||
* @package Fhp\Segment
|
||||
*/
|
||||
class HKSYN extends AbstractSegment
|
||||
{
|
||||
const NAME = 'HKSYN';
|
||||
const VERSION = 3;
|
||||
|
||||
const SYNC_MODE_NEW_CUSTOMER_ID = 0; // Neue Kundensystem-ID zurückmelden
|
||||
const SYNC_MODE_LAST_MSG_NUMBER = 1; // Letzte verarbeitete Nachrichtennummer zurückmelden
|
||||
const SYNC_MODE_SIGNATURE_ID = 2; // Signatur-ID zurückmelden
|
||||
|
||||
/**
|
||||
* HKSYN constructor.
|
||||
* @param int $segmentNumber
|
||||
* @param int $syncMode
|
||||
*/
|
||||
public function __construct(
|
||||
$segmentNumber,
|
||||
$syncMode = self::SYNC_MODE_NEW_CUSTOMER_ID
|
||||
) {
|
||||
parent::__construct(
|
||||
static::NAME,
|
||||
$segmentNumber,
|
||||
static::VERSION,
|
||||
array($syncMode)
|
||||
);
|
||||
}
|
||||
|
||||
/**
|
||||
* @return string
|
||||
*/
|
||||
public function getName()
|
||||
{
|
||||
return static::NAME;
|
||||
}
|
||||
}
|
@ -1,68 +0,0 @@
|
||||
<?php
|
||||
|
||||
namespace Fhp\Segment;
|
||||
|
||||
/**
|
||||
* Class HKVVB (Verarbeitungsvorbereitung)
|
||||
* Segment type: Administration
|
||||
*
|
||||
* @link: http://www.hbci-zka.de/dokumente/spezifikation_deutsch/fintsv3/FinTS_3.0_Formals_2011-06-14_final_version.pdf
|
||||
* Section: C.3.1.3
|
||||
*
|
||||
* @package Fhp\Segment
|
||||
*/
|
||||
class HKVVB extends AbstractSegment
|
||||
{
|
||||
const NAME = 'HKVVB';
|
||||
const VERSION = 3;
|
||||
|
||||
const DEFAULT_BPD_VERSION = 0;
|
||||
const DEFAULT_UPD_VERSION = 0;
|
||||
|
||||
const LANG_DEFAULT = 0;
|
||||
const LANG_DE = 1;
|
||||
const LANG_EN = 2;
|
||||
const LANG_FR = 3;
|
||||
|
||||
const DEFAULT_PRODUCT_NAME = 'fints-hbci-php';
|
||||
const DEFAULT_PRODUCT_VERSION = '1.0';
|
||||
|
||||
/**
|
||||
* HKVVB constructor.
|
||||
* @param int $segmentNumber
|
||||
* @param int $bpdVersion
|
||||
* @param int $updVersion
|
||||
* @param int $dialogLanguage
|
||||
* @param string $productName
|
||||
* @param string $productVersion
|
||||
*/
|
||||
public function __construct(
|
||||
$segmentNumber,
|
||||
$bpdVersion = self::DEFAULT_BPD_VERSION,
|
||||
$updVersion = self::DEFAULT_UPD_VERSION,
|
||||
$dialogLanguage = self::LANG_DEFAULT,
|
||||
$productName = self::DEFAULT_PRODUCT_NAME,
|
||||
$productVersion = self::DEFAULT_PRODUCT_VERSION
|
||||
) {
|
||||
parent::__construct(
|
||||
static::NAME,
|
||||
$segmentNumber,
|
||||
static::VERSION,
|
||||
array(
|
||||
$bpdVersion,
|
||||
$updVersion,
|
||||
$dialogLanguage,
|
||||
$productName,
|
||||
$productVersion
|
||||
)
|
||||
);
|
||||
}
|
||||
|
||||
/**
|
||||
* @return string
|
||||
*/
|
||||
public function getName()
|
||||
{
|
||||
return static::NAME;
|
||||
}
|
||||
}
|
@ -1,52 +0,0 @@
|
||||
<?php
|
||||
|
||||
namespace Fhp\Segment;
|
||||
|
||||
/**
|
||||
* Class HNHBK (Nachrichtenkopf)
|
||||
* Segment type: Administration
|
||||
*
|
||||
* @link: http://www.hbci-zka.de/dokumente/spezifikation_deutsch/fintsv3/FinTS_3.0_Formals_2011-06-14_final_version.pdf
|
||||
* Section: B.5.2
|
||||
*
|
||||
* @package Fhp\Segment
|
||||
*/
|
||||
class HNHBK extends AbstractSegment
|
||||
{
|
||||
const NAME = 'HNHBK';
|
||||
const VERSION = 3;
|
||||
const HEADER_LENGTH = 29;
|
||||
|
||||
/**
|
||||
* HNHBK constructor.
|
||||
* @param string $messageLength
|
||||
* @param string $dialogId
|
||||
* @param int $messageNumber
|
||||
*/
|
||||
public function __construct($messageLength, $dialogId, $messageNumber)
|
||||
{
|
||||
if (strlen($messageLength) != 12) {
|
||||
$messageLength = str_pad((int) $messageLength + static::HEADER_LENGTH + strlen($dialogId) + strlen($messageNumber), 12, '0', STR_PAD_LEFT);
|
||||
}
|
||||
|
||||
parent::__construct(
|
||||
static::NAME,
|
||||
1, // always the first segment
|
||||
static::VERSION,
|
||||
array(
|
||||
$messageLength,
|
||||
300, // HBCI / FINTS version 3.0,
|
||||
$dialogId,
|
||||
$messageNumber,
|
||||
)
|
||||
);
|
||||
}
|
||||
|
||||
/**
|
||||
* @return string
|
||||
*/
|
||||
public function getName()
|
||||
{
|
||||
return static::NAME;
|
||||
}
|
||||
}
|
@ -1,45 +0,0 @@
|
||||
<?php
|
||||
|
||||
namespace Fhp\Segment;
|
||||
|
||||
use Fhp\DataTypes\Kik;
|
||||
|
||||
/**
|
||||
* Class HNHBS (Nachrichtenabschluss)
|
||||
* Segment type: Administration
|
||||
*
|
||||
* @link: http://www.hbci-zka.de/dokumente/spezifikation_deutsch/fintsv3/FinTS_3.0_Formals_2011-06-14_final_version.pdf
|
||||
* Section: B.5.3
|
||||
*
|
||||
* @package Fhp\Segment
|
||||
*/
|
||||
class HNHBS extends AbstractSegment
|
||||
{
|
||||
const NAME = 'HNHBS';
|
||||
const VERSION = 1;
|
||||
|
||||
/**
|
||||
* HNHBS constructor.
|
||||
* @param int $segmentNumber
|
||||
* @param int $messageNumber
|
||||
*/
|
||||
public function __construct(
|
||||
$segmentNumber,
|
||||
$messageNumber
|
||||
) {
|
||||
parent::__construct(
|
||||
static::NAME,
|
||||
$segmentNumber,
|
||||
static::VERSION,
|
||||
array($messageNumber)
|
||||
);
|
||||
}
|
||||
|
||||
/**
|
||||
* @return string
|
||||
*/
|
||||
public function getName()
|
||||
{
|
||||
return static::NAME;
|
||||
}
|
||||
}
|
@ -1,51 +0,0 @@
|
||||
<?php
|
||||
|
||||
namespace Fhp\Segment;
|
||||
|
||||
use Fhp\DataTypes\Kik;
|
||||
|
||||
/**
|
||||
* Class HNSHA (Signaturabschluss)
|
||||
* Segment type: Administration
|
||||
*
|
||||
* @link: http://www.hbci-zka.de/dokumente/spezifikation_deutsch/fintsv3/FinTS_3.0_Security_Sicherheitsverfahren_HBCI_Rel_20130718_final_version.pdf
|
||||
* Section: B.5.2
|
||||
*
|
||||
* @package Fhp\Segment
|
||||
*/
|
||||
class HNSHA extends AbstractSegment
|
||||
{
|
||||
const NAME = 'HNSHA';
|
||||
const VERSION = 2;
|
||||
|
||||
/**
|
||||
* HNSHA constructor.
|
||||
* @param int $segmentNumber
|
||||
* @param string $securityControlReference
|
||||
* @param string $pin
|
||||
*/
|
||||
public function __construct(
|
||||
$segmentNumber,
|
||||
$securityControlReference,
|
||||
$pin
|
||||
) {
|
||||
parent::__construct(
|
||||
static::NAME,
|
||||
$segmentNumber,
|
||||
static::VERSION,
|
||||
array(
|
||||
$securityControlReference,
|
||||
'',
|
||||
$pin
|
||||
)
|
||||
);
|
||||
}
|
||||
|
||||
/**
|
||||
* @return string
|
||||
*/
|
||||
public function getName()
|
||||
{
|
||||
return static::NAME;
|
||||
}
|
||||
}
|
@ -1,90 +0,0 @@
|
||||
<?php
|
||||
|
||||
namespace Fhp\Segment;
|
||||
|
||||
use Fhp\DataElementGroups\HashAlgorithm;
|
||||
use Fhp\DataElementGroups\KeyName;
|
||||
use Fhp\DataElementGroups\SecurityDateTime;
|
||||
use Fhp\DataElementGroups\SecurityIdentificationDetails;
|
||||
use Fhp\DataElementGroups\SecurityProfile;
|
||||
use Fhp\DataElementGroups\SignatureAlgorithm;
|
||||
|
||||
/**
|
||||
* Class HNSHK (Signaturkopf)
|
||||
* Segment type: Administration
|
||||
*
|
||||
* @link: http://www.hbci-zka.de/dokumente/spezifikation_deutsch/fintsv3/FinTS_3.0_Security_Sicherheitsverfahren_HBCI_Rel_20130718_final_version.pdf
|
||||
* Section: B.5.1
|
||||
*
|
||||
* @package Fhp\Segment
|
||||
*/
|
||||
class HNSHK extends AbstractSegment
|
||||
{
|
||||
const NAME = 'HNSHK';
|
||||
const VERSION = 4;
|
||||
|
||||
const SECURITY_FUNC_NRO = 1; // Non-Repudiation of Origin, für RAH, RDH (NRO)
|
||||
const SECURITY_FUNC_AUT = 2; // Message Origin Authentication, für RAH, RDH und DDV (AUT)
|
||||
const SECURITY_FUNC_ENC = 4; // Encryption, Verschlüsselung und evtl. Komprimierung (ENC)
|
||||
const SECURITY_FUNC_999 = 999;
|
||||
|
||||
const SECURITY_BOUNDARY_SHM = 1; // Signaturkopf und HBCI-Nutzdaten (SHM)
|
||||
const SECURITY_BOUNDARY_SHT = 2; // Von Signaturkopf bis Signaturabschluss (SHT)
|
||||
|
||||
const SECURITY_SUPPLIER_ROLE_ISS = 1; // Der Unterzeichner ist Herausgeber der signierten Nachricht, z.B. Erfasser oder Erstsignatur (ISS)
|
||||
const SECURITY_SUPPLIER_ROLE_CON = 3; // Der Unterzeichner unterstützt den Inhalt der Nachricht, z.B. bei Zweitsignatur (CON)
|
||||
const SECURITY_SUPPLIER_ROLE_WIT = 4; // Der Unterzeichner ist Zeuge, aber für den Inhalt der Nachricht nicht verantwortlich, z.B. Übermittler, welcher nicht Erfasser ist (WIT)
|
||||
|
||||
/**
|
||||
* HNSHK constructor.
|
||||
* @param int $segmentNumber
|
||||
* @param string $securityReference
|
||||
* @param string $countryCode
|
||||
* @param string $bankCode
|
||||
* @param string $userName
|
||||
* @param int $systemId
|
||||
* @param int $securityFunction
|
||||
* @param int $securityBoundary
|
||||
* @param int $securitySupplierRole
|
||||
* @param int $pinTanVersion
|
||||
*/
|
||||
public function __construct(
|
||||
$segmentNumber,
|
||||
$securityReference,
|
||||
$countryCode,
|
||||
$bankCode,
|
||||
$userName,
|
||||
$systemId = 0,
|
||||
$securityFunction = self::SECURITY_FUNC_999,
|
||||
$securityBoundary = self::SECURITY_BOUNDARY_SHM,
|
||||
$securitySupplierRole = self::SECURITY_SUPPLIER_ROLE_ISS,
|
||||
$pinTanVersion = SecurityProfile::PROFILE_VERSION_1
|
||||
) {
|
||||
parent::__construct(
|
||||
static::NAME,
|
||||
$segmentNumber,
|
||||
static::VERSION,
|
||||
array(
|
||||
new SecurityProfile(SecurityProfile::PROFILE_PIN, $pinTanVersion), #2
|
||||
$securityFunction, #3
|
||||
$securityReference, #4
|
||||
$securityBoundary, #5
|
||||
$securitySupplierRole, #6
|
||||
new SecurityIdentificationDetails(SecurityIdentificationDetails::CID_NONE, $systemId), #7
|
||||
1, #8
|
||||
new SecurityDateTime(), #9
|
||||
new HashAlgorithm(), #10
|
||||
new SignatureAlgorithm(), #11
|
||||
new KeyName($countryCode, $bankCode, $userName, KeyName::KEY_TYPE_SIGNATURE) #12
|
||||
)
|
||||
);
|
||||
}
|
||||
|
||||
/**
|
||||
* @return string
|
||||
*/
|
||||
public function getName()
|
||||
{
|
||||
return static::NAME;
|
||||
}
|
||||
}
|
@ -1,61 +0,0 @@
|
||||
<?php
|
||||
|
||||
namespace Fhp\Segment;
|
||||
|
||||
use Fhp\DataTypes\Bin;
|
||||
|
||||
/**
|
||||
* Class HNVSD (Verschlüsselte Daten)
|
||||
* Segment type: Administration
|
||||
*
|
||||
* @link: http://www.hbci-zka.de/dokumente/spezifikation_deutsch/fintsv3/FinTS_3.0_Security_Sicherheitsverfahren_HBCI_Rel_20130718_final_version.pdf
|
||||
* Section: B.5.4
|
||||
*
|
||||
* @package Fhp\Segment
|
||||
*/
|
||||
class HNVSD extends AbstractSegment
|
||||
{
|
||||
const NAME = 'HNVSD';
|
||||
const VERSION = 1;
|
||||
|
||||
/**
|
||||
* HNVSD constructor.
|
||||
* @param int $segmentNumber
|
||||
* @param string $encodedData
|
||||
*/
|
||||
public function __construct($segmentNumber, $encodedData)
|
||||
{
|
||||
parent::__construct(
|
||||
static::NAME,
|
||||
$segmentNumber,
|
||||
static::VERSION,
|
||||
array(new Bin($encodedData))
|
||||
);
|
||||
}
|
||||
|
||||
/**
|
||||
* @return Bin
|
||||
*/
|
||||
public function getEncodedData()
|
||||
{
|
||||
$des = $this->getDataElements();
|
||||
|
||||
return $des[0];
|
||||
}
|
||||
|
||||
/**
|
||||
* @param string $data
|
||||
*/
|
||||
public function setEncodedData($data)
|
||||
{
|
||||
$this->setDataElements(array(new Bin($data)));
|
||||
}
|
||||
|
||||
/**
|
||||
* @return string
|
||||
*/
|
||||
public function getName()
|
||||
{
|
||||
return static::NAME;
|
||||
}
|
||||
}
|
@ -1,84 +0,0 @@
|
||||
<?php
|
||||
|
||||
namespace Fhp\Segment;
|
||||
|
||||
use Fhp\DataElementGroups\EncryptionAlgorithm;
|
||||
use Fhp\DataElementGroups\KeyName;
|
||||
use Fhp\DataElementGroups\SecurityDateTime;
|
||||
use Fhp\DataElementGroups\SecurityIdentificationDetails;
|
||||
use Fhp\DataElementGroups\SecurityProfile;
|
||||
|
||||
/**
|
||||
* Class HNVSK (Verschlüsselungskopf)
|
||||
* Segment type: Administration
|
||||
*
|
||||
* @link: http://www.hbci-zka.de/dokumente/spezifikation_deutsch/fintsv3/FinTS_3.0_Security_Sicherheitsverfahren_HBCI_Rel_20130718_final_version.pdf
|
||||
* Section: B.5.3
|
||||
*
|
||||
* @package Fhp\Segment
|
||||
*/
|
||||
class HNVSK extends AbstractSegment
|
||||
{
|
||||
const NAME = 'HNVSK';
|
||||
const VERSION = 3;
|
||||
|
||||
const SECURITY_SUPPLIER_ROLE_ISS = 1;
|
||||
const SECURITY_SUPPLIER_ROLE_CON = 3;
|
||||
const SECURITY_SUPPLIER_ROLE_WIT = 4;
|
||||
|
||||
const COMPRESSION_NONE = 0;
|
||||
const COMPRESSION_LZW = 1;
|
||||
const COMPRESSION_COM = 2;
|
||||
const COMPRESSION_LZSS = 3;
|
||||
const COMPRESSION_LZHUFF = 4;
|
||||
const COMPRESSION_ZIP = 5;
|
||||
const COMPRESSION_GZIP = 6;
|
||||
const COMPRESSION_BZIP2 = 7;
|
||||
const COMPRESSION_NEGOTIATE = 999;
|
||||
|
||||
/**
|
||||
* HNVSK constructor.
|
||||
* @param int $segmentNumber
|
||||
* @param string $bankCode
|
||||
* @param string $userName
|
||||
* @param int $systemId
|
||||
* @param int $securitySupplierRole
|
||||
* @param int $countryCode
|
||||
* @param int $compression
|
||||
* @param int $pinTanVersion
|
||||
*/
|
||||
public function __construct(
|
||||
$segmentNumber,
|
||||
$bankCode,
|
||||
$userName,
|
||||
$systemId = 0,
|
||||
$securitySupplierRole = self::SECURITY_SUPPLIER_ROLE_ISS,
|
||||
$countryCode = self::DEFAULT_COUNTRY_CODE,
|
||||
$compression = self::COMPRESSION_NONE,
|
||||
$pinTanVersion = SecurityProfile::PROFILE_VERSION_1
|
||||
) {
|
||||
parent::__construct(
|
||||
static::NAME,
|
||||
$segmentNumber,
|
||||
static::VERSION,
|
||||
array(
|
||||
new SecurityProfile(SecurityProfile::PROFILE_PIN, $pinTanVersion),
|
||||
998, // Just informational / invalid for PIN/TAN,
|
||||
$securitySupplierRole,
|
||||
new SecurityIdentificationDetails(SecurityIdentificationDetails::CID_NONE, $systemId),
|
||||
new SecurityDateTime(),
|
||||
new EncryptionAlgorithm(),
|
||||
new KeyName($countryCode, $bankCode, $userName),
|
||||
$compression,
|
||||
)
|
||||
);
|
||||
}
|
||||
|
||||
/**
|
||||
* @return string
|
||||
*/
|
||||
public function getName()
|
||||
{
|
||||
return static::NAME;
|
||||
}
|
||||
}
|
@ -1,119 +0,0 @@
|
||||
<?php
|
||||
|
||||
namespace Fhp\Segment;
|
||||
|
||||
/**
|
||||
* Class NameMapping
|
||||
* @package Fhp\Segment
|
||||
*/
|
||||
class NameMapping
|
||||
{
|
||||
protected static $mapping = array(
|
||||
// Formals
|
||||
// http://www.hbci-zka.de/dokumente/spezifikation_deutsch/fintsv3/FinTS_3.0_Formals_2011-06-14_final_version.pdf
|
||||
// Section: H.1.3
|
||||
'HKEND' => 'Dialogende',
|
||||
'HKIDN' => 'Identifikation',
|
||||
'HKSYN' => 'Synchronisation',
|
||||
'HKVVB' => 'Verarbeitungsvorbereitung',
|
||||
'HNHBK' => 'Nachrichtenkopf',
|
||||
'HNHBS' => 'Nachrichtenabschluss',
|
||||
'HNSHA' => 'Signaturabschluss',
|
||||
'HNSHK' => 'Signaturkopf',
|
||||
'HNVSD' => 'Verschlüsselte Daten',
|
||||
'HNVSK' => 'Verschlüsselungskopf',
|
||||
'HKISA' => 'Anforderung eines öffentlichen Schlüssels',
|
||||
'HIBPA' => 'Bankparameter allgemein',
|
||||
'HISSP' => 'Bestätigung der Schlüsselsperrung',
|
||||
'HIKPV' => 'Komprimierungsverfahren',
|
||||
'HIUPD' => 'Kontoinformation',
|
||||
'HIKIM' => 'Kreditinstitutsmeldung',
|
||||
'HKLIF' => 'Life-Indikator',
|
||||
'HIRMS' => 'Rückmeldung zu Segmenten',
|
||||
'HIRMG' => 'Rückmeldungen zur Gesamtnachricht',
|
||||
'HKSAK' => 'Schlüsseländerung',
|
||||
'HKSSP' => 'Schlüsselsperrung',
|
||||
'HISHV' => 'Sicherheitsverfahren',
|
||||
'HISYN' => 'Synchronisierungsantwort',
|
||||
'HIISA' => 'Übermittlung eines öffentlichen Schlüssels',
|
||||
'HIUPA' => 'Userparameter allgemein',
|
||||
'HIKOM' => 'Kommunikationszugang rückmelden',
|
||||
// Geschäftsvorfälle
|
||||
// http://www.hbci-zka.de/dokumente/spezifikation_deutsch/fintsv3/FinTS_3.0_Messages_Geschaeftsvorfaelle_2015-08-07_final_version.pdf
|
||||
// Section: E.1
|
||||
'HKADR' => 'Adressänderung',
|
||||
'HIADRS' => 'Adressänderung Parameter',
|
||||
'HITEA' => 'Änderung terminierter Einzellastschrift bestätigen',
|
||||
'HIDSA' => 'Änderung terminierter SEPA-Einzellastschriften bestätigen',
|
||||
'HIBSA' => 'Änderung terminierter SEPA-Firmeneinzellastschrift bestätigen',
|
||||
'HICSA' => 'Änderung terminierter SEPA-Überweisung bestätigen',
|
||||
'HITUA' => 'Änderung terminierter Überweisung bestätigen',
|
||||
'HICVE' => 'Anlage vorbereiteter SEPA-Überweisung bestätigen',
|
||||
'HIVUE' => 'Anlage vorbereiteter Überweisung bestätigen',
|
||||
'HKCTD' => 'Auftragsdetails für C-Transaktionen',
|
||||
'HICTDS' => 'Auftragsdetails für C-Transaktionen Parameter',
|
||||
'HICTD' => 'Auftragsdetails für C-Transaktionen rückmelden',
|
||||
'HKAUE' => 'Ausgeführte Überweisungen anfordern',
|
||||
'HIAUE' => 'Ausgeführte Überweisungen rückmelden',
|
||||
'HIAUES' => 'Ausgeführte Überweisungen Parameter',
|
||||
'HKAUB' => 'Auslandsüberweisung',
|
||||
'HKAOM' => 'Auslandsüberweisung ohne Meldeteil',
|
||||
'HIAOMS' => 'Auslandsüberweisung ohne Meldeteil Parameter',
|
||||
'HIAUBS' => 'Auslandsüberweisung Parameter',
|
||||
'HKCTA' => 'Auslösen von C-Transaktionen',
|
||||
'HICTAS' => 'Auslösen von C-Transaktionen Parameter',
|
||||
'HIAPN' => 'Auswahl Postfach-Nachrichtentypen rückmelden',
|
||||
'HKFDB' => 'Bearbeitungsstatus Dokument anfordern ',
|
||||
'HIFDBS' => 'Bearbeitungsstatus Dokument Parameter',
|
||||
'HIFDB' => 'Bearbeitungsstatus Dokument rückmelden',
|
||||
'HKPPB' => 'Bestand Daueraufträge Prepaidkarte laden anfordern',
|
||||
'HIPPBS' => 'Bestand Daueraufträge Prepaidkarte laden Parameter',
|
||||
'HIPPB' => 'Bestand Daueraufträge Prepaidkarte laden rückmelden',
|
||||
'HKCUB' => 'Bestand Empfängerkonten anfordern',
|
||||
'HKLWB' => 'Bestand Lastschriftwiderspruch',
|
||||
'HKSAL' => 'Saldenabfrage',
|
||||
'HISALS' => 'Saldenabfrage Parameter',
|
||||
'HISAL' => 'Saldenrückmeldung',
|
||||
'HIEKAS' => 'Kontoauszug Parameter',
|
||||
'HIKAZS' => 'Kontoumsätze/Zeitraum Parameter',
|
||||
'HIQTGS' => 'Empfangsquittung Parameter',
|
||||
'HICSBS' => 'Bestand terminierter SEPA-Überweisungen Parameter',
|
||||
'HICSLS' => 'Terminierte SEPA-Überweisung löschen Parameter',
|
||||
'HKSPA' => 'SEPA-Kontoverbindung anfordern',
|
||||
// tbc
|
||||
// PIN/TAN
|
||||
// http://www.hbci-zka.de/dokumente/spezifikation_deutsch/fintsv3/FinTS_3.0_Security_Sicherheitsverfahren_PINTAN_Rel_20101027_final_version.pdf
|
||||
//
|
||||
'HIPAES' => 'PIN ändern Parameter',
|
||||
'HIPSPS' => 'PIN sperren Parameter',
|
||||
|
||||
);
|
||||
|
||||
/**
|
||||
* @param string $code
|
||||
* @return string
|
||||
*/
|
||||
public static function codeToName($code)
|
||||
{
|
||||
return isset(static::$mapping[$code]) ? static::$mapping[$code] : $code;
|
||||
}
|
||||
|
||||
/**
|
||||
* @param string $name
|
||||
* @return string
|
||||
*/
|
||||
public static function nameToCode($name)
|
||||
{
|
||||
$flipped = array_flip(static::$mapping);
|
||||
return isset($flipped[$name]) ? $flipped[$name] : $name;
|
||||
}
|
||||
|
||||
/**
|
||||
* @param string $text
|
||||
* @return string
|
||||
*/
|
||||
public static function translateResponse($text)
|
||||
{
|
||||
return str_replace(array_flip(static::$mapping), static::$mapping, $text);
|
||||
}
|
||||
}
|
@ -1,35 +0,0 @@
|
||||
<?php
|
||||
|
||||
namespace Fhp\Segment;
|
||||
|
||||
/**
|
||||
* Class Segment
|
||||
* @package Fhp\Segment
|
||||
*/
|
||||
class Segment extends AbstractSegment
|
||||
{
|
||||
/**
|
||||
* @param string $string
|
||||
* @return Segment
|
||||
*/
|
||||
public static function createFromString($string)
|
||||
{
|
||||
$lines = explode('+', $string);
|
||||
$header = array_shift($lines);
|
||||
$headerParts = explode(':', $header);
|
||||
|
||||
$name = strtoupper($headerParts[0]);
|
||||
$segmentNumber = $headerParts[1];
|
||||
$version = $headerParts[2];
|
||||
|
||||
return new self($name, 0, $segmentNumber, $version, $lines);
|
||||
}
|
||||
|
||||
/**
|
||||
* @return string
|
||||
*/
|
||||
public function getName()
|
||||
{
|
||||
return $this->type;
|
||||
}
|
||||
}
|
@ -1,24 +0,0 @@
|
||||
<?php
|
||||
|
||||
namespace Fhp\Segment;
|
||||
|
||||
/**
|
||||
* Interface SegmentInterface
|
||||
* @package Fhp\Segment
|
||||
*/
|
||||
interface SegmentInterface
|
||||
{
|
||||
/**
|
||||
* Returns string representation of object.
|
||||
*
|
||||
* @return string
|
||||
*/
|
||||
public function __toString();
|
||||
|
||||
/**
|
||||
* Gets the name of the segment.
|
||||
*
|
||||
* @return string
|
||||
*/
|
||||
public function getName();
|
||||
}
|
@ -1,47 +0,0 @@
|
||||
<?php
|
||||
|
||||
namespace Tests\Fhp;
|
||||
|
||||
use Fhp\Adapter\AdapterInterface;
|
||||
use Fhp\Adapter\Curl;
|
||||
use Fhp\Connection;
|
||||
use Fhp\Message\Message;
|
||||
|
||||
class ConnectionTest extends \PHPUnit_Framework_TestCase
|
||||
{
|
||||
/** @var \PHPUnit_Framework_MockObject_MockObject|AdapterInterface */
|
||||
protected $adapter;
|
||||
/** @var \PHPUnit_Framework_MockObject_MockObject|Message */
|
||||
protected $message;
|
||||
|
||||
public function setUp()
|
||||
{
|
||||
$this->adapter = $this->getMockBuilder('\Fhp\Adapter\Curl')
|
||||
->disableOriginalConstructor()
|
||||
->setMethods(array('send'))
|
||||
->getMock();
|
||||
|
||||
$this->message = $this->getMockBuilder('\Fhp\Message\Message')
|
||||
->disableOriginalConstructor()
|
||||
->getMock();
|
||||
}
|
||||
|
||||
public function test_can_set_and_get_adapter()
|
||||
{
|
||||
$conn = new Connection($this->adapter);
|
||||
$this->assertEquals($this->adapter, $conn->getAdapter());
|
||||
}
|
||||
|
||||
public function test_send_calls_adapter_send()
|
||||
{
|
||||
$this->adapter->expects($this->once())
|
||||
->method('send')
|
||||
->with($this->message)
|
||||
->will($this->returnValue('response text'));
|
||||
|
||||
$conn = new Connection($this->adapter);
|
||||
$res = $conn->send($this->message);
|
||||
|
||||
$this->assertInternalType('string', $res);
|
||||
}
|
||||
}
|
@ -1,28 +0,0 @@
|
||||
<?php
|
||||
|
||||
namespace Tests\Fhp\DataElementGroups;
|
||||
|
||||
use Fhp\DataElementGroups\EncryptionAlgorithm;
|
||||
|
||||
class EncryptionAlgorithmTest extends \PHPUnit_Framework_TestCase
|
||||
{
|
||||
public function test_to_string()
|
||||
{
|
||||
$e = new EncryptionAlgorithm();
|
||||
$this->assertEquals('2:2:13:@8@00000000:5:1', (string) $e);
|
||||
$this->assertEquals('2:2:13:@8@00000000:5:1', $e->toString());
|
||||
}
|
||||
|
||||
public function test_custom_to_string()
|
||||
{
|
||||
$e = new EncryptionAlgorithm(
|
||||
EncryptionAlgorithm::TYPE_OSY,
|
||||
EncryptionAlgorithm::OPERATION_MODE_ISO_9796_1,
|
||||
EncryptionAlgorithm::ALGORITHM_KEY_TYPE_SYM_PUB,
|
||||
EncryptionAlgorithm::ALGORITHM_IV_DESCRIPTION_IVC
|
||||
);
|
||||
|
||||
$this->assertEquals('2:16:6:1:5:1', (string) $e);
|
||||
$this->assertEquals('2:16:6:1:5:1', $e->toString());
|
||||
}
|
||||
}
|
@ -1,15 +0,0 @@
|
||||
<?php
|
||||
|
||||
namespace Tests\Fhp\DataElementGroups;
|
||||
|
||||
use Fhp\DataElementGroups\HashAlgorithm;
|
||||
|
||||
class HashAlgorithmTest extends \PHPUnit_Framework_TestCase
|
||||
{
|
||||
public function test_to_string()
|
||||
{
|
||||
$e = new HashAlgorithm();
|
||||
$this->assertEquals('1:999:1', (string) $e);
|
||||
$this->assertEquals('1:999:1', $e->toString());
|
||||
}
|
||||
}
|
@ -1,16 +0,0 @@
|
||||
<?php
|
||||
|
||||
namespace Fhp\DataElementGroups;
|
||||
|
||||
use Fhp\DataTypes\Kik;
|
||||
use Fhp\Deg;
|
||||
|
||||
class KeyNameTest extends \PHPUnit_Framework_TestCase
|
||||
{
|
||||
public function test_to_string()
|
||||
{
|
||||
$e = new KeyName('DE', '72191600', 'username');
|
||||
$this->assertEquals('DE:72191600:username:V:0:0', (string) $e);
|
||||
$this->assertEquals('DE:72191600:username:V:0:0', $e->toString());
|
||||
}
|
||||
}
|
@ -1,15 +0,0 @@
|
||||
<?php
|
||||
|
||||
namespace Fhp\DataElementGroups;
|
||||
|
||||
class SecurityDateTimeTest extends \PHPUnit_Framework_TestCase
|
||||
{
|
||||
public function test_to_string()
|
||||
{
|
||||
$dateTime = new \DateTime();
|
||||
$e = new SecurityDateTime(SecurityDateTime::DATETIME_TYPE_STS, $dateTime);
|
||||
|
||||
$this->assertEquals('1:' . $dateTime->format('Ymd') . ':' . $dateTime->format('His'), (string) $e);
|
||||
$this->assertEquals('1:' . $dateTime->format('Ymd') . ':' . $dateTime->format('His'), $e->toString());
|
||||
}
|
||||
}
|
@ -1,17 +0,0 @@
|
||||
<?php
|
||||
|
||||
namespace Fhp\DataElementGroups;
|
||||
|
||||
class SecurityIdentificationDetailsTest extends \PHPUnit_Framework_TestCase
|
||||
{
|
||||
public function test_to_string()
|
||||
{
|
||||
$e = new SecurityIdentificationDetails();
|
||||
$this->assertEquals('1::0', (string) $e);
|
||||
$this->assertEquals('1::0', $e->toString());
|
||||
|
||||
$e = new SecurityIdentificationDetails(SecurityIdentificationDetails::PARTY_MS, 123);
|
||||
$this->assertEquals('1:1:123', (string) $e);
|
||||
$this->assertEquals('1:1:123', $e->toString());
|
||||
}
|
||||
}
|
@ -1,14 +0,0 @@
|
||||
<?php
|
||||
|
||||
namespace Fhp\DataElementGroups;
|
||||
|
||||
class SecurityProfileTest extends \PHPUnit_Framework_TestCase
|
||||
{
|
||||
public function test_to_string()
|
||||
{
|
||||
$e = new SecurityProfile(SecurityProfile::PROFILE_PIN, SecurityProfile::PROFILE_VERSION_2);
|
||||
|
||||
$this->assertEquals('PIN:2', (string) $e);
|
||||
$this->assertEquals('PIN:2', $e->toString());
|
||||
}
|
||||
}
|
@ -1,13 +0,0 @@
|
||||
<?php
|
||||
|
||||
namespace Fhp\DataElementGroups;
|
||||
|
||||
class SignatureAlgorithmTest extends \PHPUnit_Framework_TestCase
|
||||
{
|
||||
public function test_to_string()
|
||||
{
|
||||
$e = new SignatureAlgorithm();
|
||||
$this->assertEquals('6:10:16', (string) $e);
|
||||
$this->assertEquals('6:10:16', $e->toString());
|
||||
}
|
||||
}
|
@ -1,22 +0,0 @@
|
||||
<?php
|
||||
|
||||
namespace Fhp\DataTypes;
|
||||
|
||||
class BinTest extends \PHPUnit_Framework_TestCase
|
||||
{
|
||||
public function test_to_string()
|
||||
{
|
||||
$string = md5(uniqid());
|
||||
$string2 = md5(uniqid());
|
||||
|
||||
$d = new Bin($string);
|
||||
$this->assertEquals('@32@' . $string, (string) $d);
|
||||
$this->assertEquals('@32@' . $string, $d->toString());
|
||||
$this->assertEquals($string, $d->getData());
|
||||
|
||||
$d->setData($string2);
|
||||
$this->assertEquals('@32@' . $string2, (string) $d);
|
||||
$this->assertEquals('@32@' . $string2, $d->toString());
|
||||
$this->assertEquals($string2, $d->getData());
|
||||
}
|
||||
}
|
@ -1,23 +0,0 @@
|
||||
<?php
|
||||
|
||||
namespace Fhp\DataTypes;
|
||||
|
||||
class DatTest extends \PHPUnit_Framework_TestCase
|
||||
{
|
||||
public function test_to_string()
|
||||
{
|
||||
$dateTime = new \DateTime();
|
||||
$d = new Dat($dateTime);
|
||||
$this->assertEquals($dateTime->format('Ymd'), (string) $d);
|
||||
$this->assertEquals($dateTime->format('Ymd'), $d->toString());
|
||||
|
||||
$dateTime2 = new \DateTime();
|
||||
$dateTime2->modify('+1 month');
|
||||
|
||||
$d->setDate($dateTime2);
|
||||
$this->assertEquals($dateTime2->format('Ymd'), (string) $d);
|
||||
$this->assertEquals($dateTime2->format('Ymd'), $d->toString());
|
||||
|
||||
$this->assertEquals($dateTime2, $d->getDate());
|
||||
}
|
||||
}
|
@ -1,13 +0,0 @@
|
||||
<?php
|
||||
|
||||
namespace Fhp\DataTypes;
|
||||
|
||||
class KikTest extends \PHPUnit_Framework_TestCase
|
||||
{
|
||||
public function test_to_string()
|
||||
{
|
||||
$d = new Kik('DE', '72191600');
|
||||
$this->assertEquals('DE:72191600', (string) $d);
|
||||
$this->assertEquals('DE:72191600', $d->toString());
|
||||
}
|
||||
}
|
@ -1,14 +0,0 @@
|
||||
<?php
|
||||
|
||||
namespace Fhp\DataTypes;
|
||||
|
||||
class KtiTest extends \PHPUnit_Framework_TestCase
|
||||
{
|
||||
public function test_to_string()
|
||||
{
|
||||
$d = new Kti('someiban', 'somebic', 'someaccountNumber', 'sub', new Kik('DE', '72191600'));
|
||||
|
||||
$this->assertEquals('someiban:somebic:someaccountNumber:sub:DE:72191600', (string) $d);
|
||||
$this->assertEquals('someiban:somebic:someaccountNumber:sub:DE:72191600', $d->toString());
|
||||
}
|
||||
}
|
@ -1,14 +0,0 @@
|
||||
<?php
|
||||
|
||||
namespace Fhp\DataTypes;
|
||||
|
||||
class KtvTest extends \PHPUnit_Framework_TestCase
|
||||
{
|
||||
public function test_to_string()
|
||||
{
|
||||
$d = new Ktv('123123123', 'sub', new Kik('DE', '72191600'));
|
||||
|
||||
$this->assertEquals('123123123:sub:DE:72191600', (string) $d);
|
||||
$this->assertEquals('123123123:sub:DE:72191600', $d->toString());
|
||||
}
|
||||
}
|
@ -1,20 +0,0 @@
|
||||
<?php
|
||||
|
||||
namespace Tests\Fhp;
|
||||
|
||||
use Fhp\Deg;
|
||||
|
||||
class DegTest extends \PHPUnit_Framework_TestCase
|
||||
{
|
||||
public function test_can_add_new_element()
|
||||
{
|
||||
$deg = new Deg();
|
||||
$deg->addDataElement('foobar');
|
||||
|
||||
$this->assertEquals('foobar', $deg->toString());
|
||||
|
||||
$deg->addDataElement('baz');
|
||||
$this->assertEquals('foobar:baz', $deg->toString());
|
||||
$this->assertEquals('foobar:baz', (string) $deg);
|
||||
}
|
||||
}
|
@ -1,42 +0,0 @@
|
||||
<?php
|
||||
|
||||
namespace Tests\Fhp;
|
||||
|
||||
use Fhp\FinTs;
|
||||
|
||||
class FinTsTest extends \PHPUnit_Framework_TestCase
|
||||
{
|
||||
|
||||
public function escapeStringProvider()
|
||||
{
|
||||
return array(
|
||||
array('foo?@bar.de', 'foo@bar.de'),
|
||||
array('??pseudo?:pass?\'special?@', '?pseudo:pass\'special@'),
|
||||
array('nothingtodo', 'nothingtodo'),
|
||||
array('??', '?'),
|
||||
array('?:', ':'),
|
||||
array('?@', '@'),
|
||||
array('?\'', '\''),
|
||||
array('????', '??'),
|
||||
array('', ''),
|
||||
array('', null),
|
||||
);
|
||||
}
|
||||
|
||||
/**
|
||||
* @dataProvider escapeStringProvider
|
||||
* @param string $expected
|
||||
* @param string $value
|
||||
*/
|
||||
public function testEscapeString($expected, $value)
|
||||
{
|
||||
$fints = $this->getMockBuilder('\Fhp\FinTs')
|
||||
->disableOriginalConstructor()
|
||||
->getMock();
|
||||
|
||||
$reflMethod = new \ReflectionMethod('\Fhp\FinTs', 'escapeString');
|
||||
$reflMethod->setAccessible(true);
|
||||
|
||||
$this->assertSame($expected, $reflMethod->invoke($fints, $value));
|
||||
}
|
||||
}
|
@ -1,91 +0,0 @@
|
||||
<?php
|
||||
|
||||
namespace Fhp\Message;
|
||||
|
||||
use Fhp\DataTypes\Kik;
|
||||
use Fhp\DataTypes\Ktv;
|
||||
use Fhp\Segment\AbstractSegment;
|
||||
use Fhp\Segment\HKSAL;
|
||||
use Fhp\Segment\HNHBS;
|
||||
use Fhp\Segment\HNSHA;
|
||||
use Fhp\Segment\HNSHK;
|
||||
use Fhp\Segment\HNVSD;
|
||||
use Fhp\Segment\HNVSK;
|
||||
|
||||
class MessageTest extends \PHPUnit_Framework_TestCase
|
||||
{
|
||||
public function test_setter_and_getter()
|
||||
{
|
||||
$message = new Message('12345678', 'username', '1234', '987654');
|
||||
|
||||
$message->setDialogId(333);
|
||||
$this->assertEquals(333, $message->getDialogId());
|
||||
|
||||
$message->setMessageNumber(10);
|
||||
$this->assertEquals(10, $message->getMessageNumber());
|
||||
|
||||
$segments = $message->getSegments();
|
||||
|
||||
$this->assertInternalType('array', $segments);
|
||||
$this->assertCount(3, $segments);
|
||||
}
|
||||
|
||||
public function test_basic_message_creation()
|
||||
{
|
||||
$message = new Message('12345678', 'username', '1234', '987654');
|
||||
$date = new \DateTime();
|
||||
$dateString = $date->format('Ymd');
|
||||
|
||||
$this->assertRegExp(
|
||||
'/HNHBK:1:3\+000000000296\+300\+0\+0\'HNVSK:998:3\+PIN:1\+998\+1\+1::987654\+1:' . $dateString
|
||||
. ':(\d+)\+2:2:13:@8@00000000:5:1\+280:12345678:username:V:0:0\+0\'HNVSD:999:1\+@130@HNSHK:2:4\+PIN:1'
|
||||
. '\+999\+(\d+)\+1\+1\+1::987654\+1\+1:' . $dateString . ':(\d+)\+1:999:1\+6:10:16\+280:12345678:'
|
||||
. 'username:S:0:0\'HNSHA:3:2\+(\d+)\+\+1234\'\'HNHBS:4:1\+0\'/',
|
||||
(string) $message
|
||||
);
|
||||
}
|
||||
|
||||
public function test_message_creation_with_options_and_segments()
|
||||
{
|
||||
$kik = new Kik('290', '123123');
|
||||
$ktv = new Ktv('123123123', 'sub', $kik);
|
||||
$hksal = new HKSAL(HKSAL::VERSION, 3, $ktv, true);
|
||||
$options = array(
|
||||
Message::OPT_PINTAN_MECH => array('998')
|
||||
);
|
||||
|
||||
$message = new Message(
|
||||
'12345678',
|
||||
'username',
|
||||
'1234',
|
||||
'987654',
|
||||
0,
|
||||
0,
|
||||
array($hksal),
|
||||
$options
|
||||
);
|
||||
|
||||
$date = new \DateTime();
|
||||
$dateString = $date->format('Ymd');
|
||||
|
||||
$this->assertRegExp(
|
||||
'/HNHBK:1:3\+000000000333\+300\+0\+0\'HNVSK:998:3\+PIN:2\+998\+1\+1::987654\+1:' . $dateString
|
||||
. ':(\d+)\+2:2:13:@8@00000000:5:1\+280:12345678:username:V:0:0\+0\'HNVSD:999:1\+@167@HNSHK:2:4\+PIN:2\+'
|
||||
. '998\+(\d+)\+1\+1\+1::987654\+1\+1:' . $dateString . ':(\d+)\+1:999:1\+6:10:16\+280:12345678:username:'
|
||||
. 'S:0:0\'HKSAL:3:7\+123123123:sub:290:123123\+1\'HNSHA:4:2\+(\d+)\+\+1234\'\'HNHBS:5:1\+0\'/',
|
||||
(string) $message
|
||||
);
|
||||
}
|
||||
|
||||
public function test_get_encrypted_segments()
|
||||
{
|
||||
$message = new Message('12345678', 'username', '1234', '987654');
|
||||
$segments = $message->getEncryptedSegments();
|
||||
|
||||
$this->assertInternalType('array', $segments);
|
||||
|
||||
foreach ($segments as $segment) {
|
||||
$this->assertInstanceOf('\Fhp\Segment\AbstractSegment', $segment);
|
||||
}
|
||||
}
|
||||
}
|
@ -1,53 +0,0 @@
|
||||
<?php
|
||||
|
||||
namespace Tests\Fhp\Model;
|
||||
|
||||
use Fhp\Model\Account;
|
||||
|
||||
class AccountTest extends \PHPUnit_Framework_TestCase
|
||||
{
|
||||
public function test_getter_and_setter()
|
||||
{
|
||||
$obj = new Account();
|
||||
$this->assertNull($obj->getId());
|
||||
$this->assertNull($obj->getAccountDescription());
|
||||
$this->assertNull($obj->getAccountNumber());
|
||||
$this->assertNull($obj->getAccountOwnerName());
|
||||
$this->assertNull($obj->getBankCode());
|
||||
$this->assertNull($obj->getCurrency());
|
||||
$this->assertNull($obj->getCustomerId());
|
||||
$this->assertNull($obj->getIban());
|
||||
|
||||
// test id
|
||||
$obj->setId(10);
|
||||
$this->assertSame(10, $obj->getId());
|
||||
|
||||
// test description
|
||||
$obj->setAccountDescription('Description');
|
||||
$this->assertSame('Description', $obj->getAccountDescription());
|
||||
|
||||
// test account number
|
||||
$obj->setAccountNumber('123123123');
|
||||
$this->assertSame('123123123', $obj->getAccountNumber());
|
||||
|
||||
// test account owner name
|
||||
$obj->setAccountOwnerName('The Owner');
|
||||
$this->assertSame('The Owner', $obj->getAccountOwnerName());
|
||||
|
||||
// test bank code
|
||||
$obj->setBankCode('123123123');
|
||||
$this->assertSame('123123123', $obj->getBankCode());
|
||||
|
||||
// test currency
|
||||
$obj->setCurrency('EUR');
|
||||
$this->assertSame('EUR', $obj->getCurrency());
|
||||
|
||||
// test customer ID
|
||||
$obj->setCustomerId('123123123');
|
||||
$this->assertSame('123123123', $obj->getCustomerId());
|
||||
|
||||
// test iban
|
||||
$obj->setIban('DE123123123123');
|
||||
$this->assertSame('DE123123123123', $obj->getIban());
|
||||
}
|
||||
}
|
@ -1,25 +0,0 @@
|
||||
<?php
|
||||
|
||||
namespace Tests\Fhp\Model;
|
||||
|
||||
use Fhp\Model\SEPAAccount;
|
||||
|
||||
class SEPAAccountTest extends \PHPUnit_Framework_TestCase
|
||||
{
|
||||
public function test_getter_and_setter()
|
||||
{
|
||||
$obj = new SEPAAccount();
|
||||
|
||||
$this->assertNull($obj->getAccountNumber());
|
||||
$this->assertNull($obj->getBic());
|
||||
$this->assertNull($obj->getBlz());
|
||||
$this->assertNull($obj->getIban());
|
||||
$this->assertNull($obj->getSubAccount());
|
||||
|
||||
$this->assertSame('123456789', $obj->setAccountNumber('123456789')->getAccountNumber());
|
||||
$this->assertSame('123456789', $obj->setBic('123456789')->getBic());
|
||||
$this->assertSame('123456789', $obj->setIban('123456789')->getIban());
|
||||
$this->assertSame('123456789', $obj->setBlz('123456789')->getBlz());
|
||||
$this->assertSame('123456789', $obj->setSubAccount('123456789')->getSubAccount());
|
||||
}
|
||||
}
|
@ -1,28 +0,0 @@
|
||||
<?php
|
||||
|
||||
namespace Tests\Fhp\Model;
|
||||
|
||||
use Fhp\Model\Saldo;
|
||||
|
||||
class SaldoTest extends \PHPUnit_Framework_TestCase
|
||||
{
|
||||
public function test_getter_and_setter()
|
||||
{
|
||||
$s = new Saldo();
|
||||
$this->assertNull($s->getCurrency());
|
||||
$this->assertNull($s->getAmount());
|
||||
$this->assertNull($s->getValuta());
|
||||
|
||||
// test currency
|
||||
$s->setCurrency('EUR');
|
||||
$this->assertSame('EUR', $s->getCurrency());
|
||||
|
||||
// test amount
|
||||
$s->setAmount(12.00);
|
||||
$this->assertSame(12.00, $s->getAmount());
|
||||
|
||||
$d = new \DateTime();
|
||||
$s->setValuta($d);
|
||||
$this->assertEquals($d, $s->getValuta());
|
||||
}
|
||||
}
|
@ -1,33 +0,0 @@
|
||||
<?php
|
||||
|
||||
namespace Tests\Fhp\Model\StatementOfAccount;
|
||||
|
||||
use Fhp\Model\StatementOfAccount\Statement;
|
||||
use Fhp\Model\StatementOfAccount\StatementOfAccount;
|
||||
|
||||
class StatementOfAccountTest extends \PHPUnit_Framework_TestCase
|
||||
{
|
||||
public function test_getter_and_setter()
|
||||
{
|
||||
$obj = new StatementOfAccount();
|
||||
$this->assertInternalType('array', $obj->getStatements());
|
||||
|
||||
$s1 = new Statement();
|
||||
$s2 = new Statement();
|
||||
|
||||
$obj->addStatement($s1);
|
||||
$this->assertInternalType('array', $obj->getStatements());
|
||||
$this->assertCount(1, $obj->getStatements());
|
||||
$result = $obj->getStatements();
|
||||
$this->assertSame($s1, $result[0]);
|
||||
|
||||
$obj->setStatements(null);
|
||||
$this->assertInternalType('array', $obj->getStatements());
|
||||
$this->assertEmpty($obj->getStatements());
|
||||
|
||||
$obj->setStatements(array($s1, $s2));
|
||||
$this->assertInternalType('array', $obj->getStatements());
|
||||
$this->assertCount(2, $obj->getStatements());
|
||||
$this->assertSame(array($s1, $s2), $obj->getStatements());
|
||||
}
|
||||
}
|
@ -1,58 +0,0 @@
|
||||
<?php
|
||||
|
||||
namespace Tests\Fhp\Model\StatementOfAccount;
|
||||
|
||||
use Fhp\Model\StatementOfAccount\Statement;
|
||||
use Fhp\Model\StatementOfAccount\Transaction;
|
||||
|
||||
class StatementTest extends \PHPUnit_Framework_TestCase
|
||||
{
|
||||
public function test_getter_and_setter()
|
||||
{
|
||||
$obj = new Statement();
|
||||
|
||||
$this->assertInternalType('array', $obj->getTransactions());
|
||||
$this->assertEmpty($obj->getTransactions());
|
||||
$this->assertSame(0.0, $obj->getStartBalance());
|
||||
$this->assertNull($obj->getCreditDebit());
|
||||
$this->assertNull($obj->getDate());
|
||||
|
||||
$trx1 = new Transaction();
|
||||
$trx2 = new Transaction();
|
||||
|
||||
$obj->addTransaction($trx1);
|
||||
$this->assertCount(1, $obj->getTransactions());
|
||||
|
||||
$obj->addTransaction($trx2);
|
||||
$this->assertCount(2, $obj->getTransactions());
|
||||
|
||||
$obj->setTransactions(null);
|
||||
$this->assertNull($obj->getTransactions());
|
||||
|
||||
$obj->setTransactions(array());
|
||||
$this->assertInternalType('array', $obj->getTransactions());
|
||||
$this->assertCount(0, $obj->getTransactions());
|
||||
|
||||
$trxArray = array($trx1, $trx2);
|
||||
$obj->setTransactions($trxArray);
|
||||
$this->assertInternalType('array', $obj->getTransactions());
|
||||
$this->assertCount(2, $obj->getTransactions());
|
||||
|
||||
$obj->setStartBalance(20.00);
|
||||
$this->assertInternalType('float', $obj->getStartBalance());
|
||||
$this->assertSame(20.00, $obj->getStartBalance());
|
||||
|
||||
$obj->setStartBalance('string');
|
||||
$this->assertSame(0.0, $obj->getStartBalance());
|
||||
|
||||
$obj->setCreditDebit(Statement::CD_CREDIT);
|
||||
$this->assertSame(Statement::CD_CREDIT, $obj->getCreditDebit());
|
||||
|
||||
$obj->setCreditDebit(Statement::CD_DEBIT);
|
||||
$this->assertSame(Statement::CD_DEBIT, $obj->getCreditDebit());
|
||||
|
||||
$date = new \DateTime();
|
||||
$obj->setDate($date);
|
||||
$this->assertSame($date, $obj->getDate());
|
||||
}
|
||||
}
|
@ -1,37 +0,0 @@
|
||||
<?php
|
||||
|
||||
namespace Tests\Fhp\Model\StatementOfAccount;
|
||||
|
||||
use Fhp\Model\StatementOfAccount\Transaction;
|
||||
|
||||
class TransactionTest extends \PHPUnit_Framework_TestCase
|
||||
{
|
||||
public function test_getter_and_setter()
|
||||
{
|
||||
$obj = new Transaction();
|
||||
|
||||
$this->assertNull($obj->getAccountNumber());
|
||||
$this->assertNull($obj->getAmount());
|
||||
$this->assertNull($obj->getBankCode());
|
||||
$this->assertNull($obj->getBookingDate());
|
||||
$this->assertNull($obj->getBookingText());
|
||||
$this->assertNull($obj->getCreditDebit());
|
||||
$this->assertNull($obj->getDescription1());
|
||||
$this->assertNull($obj->getDescription2());
|
||||
$this->assertNull($obj->getName());
|
||||
$this->assertNull($obj->getValutaDate());
|
||||
|
||||
$date = new \DateTime();
|
||||
$this->assertSame('123456789', $obj->setAccountNumber('123456789')->getAccountNumber());
|
||||
$this->assertSame(20.00, $obj->setAmount(20.00)->getAmount());
|
||||
$this->assertSame('123456789', $obj->setBankCode('123456789')->getBankCode());
|
||||
$this->assertSame($date, $obj->setBookingDate($date)->getBookingDate());
|
||||
$this->assertSame($date, $obj->setValutaDate($date)->getValutaDate());
|
||||
$this->assertSame('text', $obj->setBookingText('text')->getBookingText());
|
||||
$this->assertSame(Transaction::CD_DEBIT, $obj->setCreditDebit(Transaction::CD_DEBIT)->getCreditDebit());
|
||||
$this->assertSame(Transaction::CD_CREDIT, $obj->setCreditDebit(Transaction::CD_CREDIT)->getCreditDebit());
|
||||
$this->assertSame('desc1', $obj->setDescription1('desc1')->getDescription1());
|
||||
$this->assertSame('desc2', $obj->setDescription2('desc2')->getDescription2());
|
||||
$this->assertSame('name', $obj->setName('name')->getName());
|
||||
}
|
||||
}
|
@ -1,51 +0,0 @@
|
||||
<?php
|
||||
|
||||
namespace Fhp\ResponseTest;
|
||||
|
||||
use Fhp\Response\Response;
|
||||
|
||||
class ResponseTest extends \PHPUnit_Framework_TestCase
|
||||
{
|
||||
protected static function getMethod($class, $name)
|
||||
{
|
||||
$class = new \ReflectionClass($class);
|
||||
$method = $class->getMethod($name);
|
||||
$method->setAccessible(TRUE);
|
||||
|
||||
return $method;
|
||||
}
|
||||
|
||||
public function test_getter_and_setter()
|
||||
{
|
||||
$response = self::getMethod('Fhp\Response\Response', 'splitSegment');
|
||||
|
||||
$withoutEscape = new Response('');
|
||||
$escaped = clone $withoutEscape;
|
||||
|
||||
$segments = $response->invokeArgs($withoutEscape, [
|
||||
'HISAL:5:5:3+111111111::280:111111111+GiroBest+EUR+C:9999,99:EUR:20161018+C:0,:EUR:20161018+0,:EUR+9999,99:EUR',
|
||||
]);
|
||||
|
||||
$segmentsEscaped = $response->invokeArgs($escaped, [
|
||||
'HISAL:5:5:3+111111111::280:111111111+GiroBusiness?++EUR+C:9999,99:EUR:20161018+C:0,:EUR:20161018+0,:EUR+9999,99:EUR',
|
||||
]);
|
||||
|
||||
$this->assertEquals('HISAL:5:5:3', $segments[0]);
|
||||
$this->assertEquals('111111111::280:111111111', $segments[1]);
|
||||
$this->assertEquals('GiroBest', $segments[2]);
|
||||
$this->assertEquals('EUR', $segments[3]);
|
||||
$this->assertEquals('C:9999,99:EUR:20161018', $segments[4]);
|
||||
$this->assertEquals('C:0,:EUR:20161018', $segments[5]);
|
||||
$this->assertEquals('0,:EUR', $segments[6]);
|
||||
$this->assertEquals('9999,99:EUR', $segments[7]);
|
||||
|
||||
$this->assertEquals('HISAL:5:5:3', $segmentsEscaped[0]);
|
||||
$this->assertEquals('111111111::280:111111111', $segmentsEscaped[1]);
|
||||
$this->assertEquals('GiroBusiness+', $segmentsEscaped[2]);
|
||||
$this->assertEquals('EUR', $segmentsEscaped[3]);
|
||||
$this->assertEquals('C:9999,99:EUR:20161018', $segmentsEscaped[4]);
|
||||
$this->assertEquals('C:0,:EUR:20161018', $segmentsEscaped[5]);
|
||||
$this->assertEquals('0,:EUR', $segmentsEscaped[6]);
|
||||
$this->assertEquals('9999,99:EUR', $segmentsEscaped[7]);
|
||||
}
|
||||
}
|
@ -1,33 +0,0 @@
|
||||
<?php
|
||||
|
||||
namespace Tests;
|
||||
|
||||
error_reporting(E_ALL | E_STRICT);
|
||||
|
||||
// register silently failing autoloader
|
||||
spl_autoload_register(function($class) {
|
||||
if (0 === strpos($class, 'Fhp\Tests\\')) {
|
||||
$path = __DIR__ . '/../../' . strtr($class, '\\', '/') . '.php';
|
||||
if (is_file($path) && is_readable($path)) {
|
||||
require_once $path;
|
||||
|
||||
return true;
|
||||
}
|
||||
}
|
||||
});
|
||||
|
||||
require_once __DIR__ . "/../../vendor/autoload.php";
|
||||
|
||||
$files = array(
|
||||
__DIR__ . '/../../vendor/autoload.php',
|
||||
__DIR__ . '/../../../../../vendor/autoload.php',
|
||||
);
|
||||
|
||||
$loader = null;
|
||||
|
||||
foreach ($files as $file) {
|
||||
if (file_exists($file)) {
|
||||
$loader = require $file;
|
||||
break;
|
||||
}
|
||||
}
|
@ -1,31 +0,0 @@
|
||||
#!/bin/bash
|
||||
|
||||
error=false
|
||||
|
||||
while test $# -gt 0; do
|
||||
current=$1
|
||||
shift
|
||||
|
||||
if [ ! -d $current ] && [ ! -f $current ] ; then
|
||||
echo "Invalid directory or file: $current"
|
||||
error=true
|
||||
|
||||
continue
|
||||
fi
|
||||
|
||||
for file in `find $current -type f -name "*.php"` ; do
|
||||
RESULTS=`php -l $file`
|
||||
if [ "$RESULTS" != "No syntax errors detected in $file" ] ; then
|
||||
echo $RESULTS
|
||||
error=true
|
||||
fi
|
||||
done
|
||||
done
|
||||
|
||||
|
||||
if [ "$error" = true ] ; then
|
||||
exit 1
|
||||
else
|
||||
echo No syntax errors detected.
|
||||
exit 0
|
||||
fi
|
@ -1,24 +0,0 @@
|
||||
<?xml version="1.0" encoding="UTF-8"?>
|
||||
|
||||
<phpunit backupGlobals="false"
|
||||
backupStaticAttributes="false"
|
||||
colors="true"
|
||||
convertErrorsToExceptions="true"
|
||||
convertNoticesToExceptions="true"
|
||||
convertWarningsToExceptions="true"
|
||||
processIsolation="false"
|
||||
stopOnFailure="false"
|
||||
syntaxCheck="false"
|
||||
bootstrap="./lib/Tests/TestInit.php"
|
||||
>
|
||||
<testsuites>
|
||||
<testsuite name="FHP Test Suite">
|
||||
<directory>./lib/Tests/Fhp/</directory>
|
||||
</testsuite>
|
||||
</testsuites>
|
||||
<filter>
|
||||
<whitelist processUncoveredFilesFromWhitelist="true">
|
||||
<directory suffix=".php">./lib/Fhp/</directory>
|
||||
</whitelist>
|
||||
</filter>
|
||||
</phpunit>
|
@ -1,19 +0,0 @@
|
||||
Copyright (c) 2012 PHP Framework Interoperability Group
|
||||
|
||||
Permission is hereby granted, free of charge, to any person obtaining a copy
|
||||
of this software and associated documentation files (the "Software"), to deal
|
||||
in the Software without restriction, including without limitation the rights
|
||||
to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
|
||||
copies of the Software, and to permit persons to whom the Software is
|
||||
furnished to do so, subject to the following conditions:
|
||||
|
||||
The above copyright notice and this permission notice shall be included in
|
||||
all copies or substantial portions of the Software.
|
||||
|
||||
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
|
||||
IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
|
||||
FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
|
||||
AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
|
||||
LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
|
||||
OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
|
||||
THE SOFTWARE.
|
@ -1,128 +0,0 @@
|
||||
<?php
|
||||
|
||||
namespace Psr\Log;
|
||||
|
||||
/**
|
||||
* This is a simple Logger implementation that other Loggers can inherit from.
|
||||
*
|
||||
* It simply delegates all log-level-specific methods to the `log` method to
|
||||
* reduce boilerplate code that a simple Logger that does the same thing with
|
||||
* messages regardless of the error level has to implement.
|
||||
*/
|
||||
abstract class AbstractLogger implements LoggerInterface
|
||||
{
|
||||
/**
|
||||
* System is unusable.
|
||||
*
|
||||
* @param string $message
|
||||
* @param array $context
|
||||
*
|
||||
* @return void
|
||||
*/
|
||||
public function emergency($message, array $context = array())
|
||||
{
|
||||
$this->log(LogLevel::EMERGENCY, $message, $context);
|
||||
}
|
||||
|
||||
/**
|
||||
* Action must be taken immediately.
|
||||
*
|
||||
* Example: Entire website down, database unavailable, etc. This should
|
||||
* trigger the SMS alerts and wake you up.
|
||||
*
|
||||
* @param string $message
|
||||
* @param array $context
|
||||
*
|
||||
* @return void
|
||||
*/
|
||||
public function alert($message, array $context = array())
|
||||
{
|
||||
$this->log(LogLevel::ALERT, $message, $context);
|
||||
}
|
||||
|
||||
/**
|
||||
* Critical conditions.
|
||||
*
|
||||
* Example: Application component unavailable, unexpected exception.
|
||||
*
|
||||
* @param string $message
|
||||
* @param array $context
|
||||
*
|
||||
* @return void
|
||||
*/
|
||||
public function critical($message, array $context = array())
|
||||
{
|
||||
$this->log(LogLevel::CRITICAL, $message, $context);
|
||||
}
|
||||
|
||||
/**
|
||||
* Runtime errors that do not require immediate action but should typically
|
||||
* be logged and monitored.
|
||||
*
|
||||
* @param string $message
|
||||
* @param array $context
|
||||
*
|
||||
* @return void
|
||||
*/
|
||||
public function error($message, array $context = array())
|
||||
{
|
||||
$this->log(LogLevel::ERROR, $message, $context);
|
||||
}
|
||||
|
||||
/**
|
||||
* Exceptional occurrences that are not errors.
|
||||
*
|
||||
* Example: Use of deprecated APIs, poor use of an API, undesirable things
|
||||
* that are not necessarily wrong.
|
||||
*
|
||||
* @param string $message
|
||||
* @param array $context
|
||||
*
|
||||
* @return void
|
||||
*/
|
||||
public function warning($message, array $context = array())
|
||||
{
|
||||
$this->log(LogLevel::WARNING, $message, $context);
|
||||
}
|
||||
|
||||
/**
|
||||
* Normal but significant events.
|
||||
*
|
||||
* @param string $message
|
||||
* @param array $context
|
||||
*
|
||||
* @return void
|
||||
*/
|
||||
public function notice($message, array $context = array())
|
||||
{
|
||||
$this->log(LogLevel::NOTICE, $message, $context);
|
||||
}
|
||||
|
||||
/**
|
||||
* Interesting events.
|
||||
*
|
||||
* Example: User logs in, SQL logs.
|
||||
*
|
||||
* @param string $message
|
||||
* @param array $context
|
||||
*
|
||||
* @return void
|
||||
*/
|
||||
public function info($message, array $context = array())
|
||||
{
|
||||
$this->log(LogLevel::INFO, $message, $context);
|
||||
}
|
||||
|
||||
/**
|
||||
* Detailed debug information.
|
||||
*
|
||||
* @param string $message
|
||||
* @param array $context
|
||||
*
|
||||
* @return void
|
||||
*/
|
||||
public function debug($message, array $context = array())
|
||||
{
|
||||
$this->log(LogLevel::DEBUG, $message, $context);
|
||||
}
|
||||
}
|
@ -1,7 +0,0 @@
|
||||
<?php
|
||||
|
||||
namespace Psr\Log;
|
||||
|
||||
class InvalidArgumentException extends \InvalidArgumentException
|
||||
{
|
||||
}
|
@ -1,18 +0,0 @@
|
||||
<?php
|
||||
|
||||
namespace Psr\Log;
|
||||
|
||||
/**
|
||||
* Describes log levels.
|
||||
*/
|
||||
class LogLevel
|
||||
{
|
||||
const EMERGENCY = 'emergency';
|
||||
const ALERT = 'alert';
|
||||
const CRITICAL = 'critical';
|
||||
const ERROR = 'error';
|
||||
const WARNING = 'warning';
|
||||
const NOTICE = 'notice';
|
||||
const INFO = 'info';
|
||||
const DEBUG = 'debug';
|
||||
}
|
@ -1,18 +0,0 @@
|
||||
<?php
|
||||
|
||||
namespace Psr\Log;
|
||||
|
||||
/**
|
||||
* Describes a logger-aware instance.
|
||||
*/
|
||||
interface LoggerAwareInterface
|
||||
{
|
||||
/**
|
||||
* Sets a logger instance on the object.
|
||||
*
|
||||
* @param LoggerInterface $logger
|
||||
*
|
||||
* @return void
|
||||
*/
|
||||
public function setLogger(LoggerInterface $logger);
|
||||
}
|
@ -1,26 +0,0 @@
|
||||
<?php
|
||||
|
||||
namespace Psr\Log;
|
||||
|
||||
/**
|
||||
* Basic Implementation of LoggerAwareInterface.
|
||||
*/
|
||||
trait LoggerAwareTrait
|
||||
{
|
||||
/**
|
||||
* The logger instance.
|
||||
*
|
||||
* @var LoggerInterface
|
||||
*/
|
||||
protected $logger;
|
||||
|
||||
/**
|
||||
* Sets a logger.
|
||||
*
|
||||
* @param LoggerInterface $logger
|
||||
*/
|
||||
public function setLogger(LoggerInterface $logger)
|
||||
{
|
||||
$this->logger = $logger;
|
||||
}
|
||||
}
|
@ -1,123 +0,0 @@
|
||||
<?php
|
||||
|
||||
namespace Psr\Log;
|
||||
|
||||
/**
|
||||
* Describes a logger instance.
|
||||
*
|
||||
* The message MUST be a string or object implementing __toString().
|
||||
*
|
||||
* The message MAY contain placeholders in the form: {foo} where foo
|
||||
* will be replaced by the context data in key "foo".
|
||||
*
|
||||
* The context array can contain arbitrary data. The only assumption that
|
||||
* can be made by implementors is that if an Exception instance is given
|
||||
* to produce a stack trace, it MUST be in a key named "exception".
|
||||
*
|
||||
* See https://github.com/php-fig/fig-standards/blob/master/accepted/PSR-3-logger-interface.md
|
||||
* for the full interface specification.
|
||||
*/
|
||||
interface LoggerInterface
|
||||
{
|
||||
/**
|
||||
* System is unusable.
|
||||
*
|
||||
* @param string $message
|
||||
* @param array $context
|
||||
*
|
||||
* @return void
|
||||
*/
|
||||
public function emergency($message, array $context = array());
|
||||
|
||||
/**
|
||||
* Action must be taken immediately.
|
||||
*
|
||||
* Example: Entire website down, database unavailable, etc. This should
|
||||
* trigger the SMS alerts and wake you up.
|
||||
*
|
||||
* @param string $message
|
||||
* @param array $context
|
||||
*
|
||||
* @return void
|
||||
*/
|
||||
public function alert($message, array $context = array());
|
||||
|
||||
/**
|
||||
* Critical conditions.
|
||||
*
|
||||
* Example: Application component unavailable, unexpected exception.
|
||||
*
|
||||
* @param string $message
|
||||
* @param array $context
|
||||
*
|
||||
* @return void
|
||||
*/
|
||||
public function critical($message, array $context = array());
|
||||
|
||||
/**
|
||||
* Runtime errors that do not require immediate action but should typically
|
||||
* be logged and monitored.
|
||||
*
|
||||
* @param string $message
|
||||
* @param array $context
|
||||
*
|
||||
* @return void
|
||||
*/
|
||||
public function error($message, array $context = array());
|
||||
|
||||
/**
|
||||
* Exceptional occurrences that are not errors.
|
||||
*
|
||||
* Example: Use of deprecated APIs, poor use of an API, undesirable things
|
||||
* that are not necessarily wrong.
|
||||
*
|
||||
* @param string $message
|
||||
* @param array $context
|
||||
*
|
||||
* @return void
|
||||
*/
|
||||
public function warning($message, array $context = array());
|
||||
|
||||
/**
|
||||
* Normal but significant events.
|
||||
*
|
||||
* @param string $message
|
||||
* @param array $context
|
||||
*
|
||||
* @return void
|
||||
*/
|
||||
public function notice($message, array $context = array());
|
||||
|
||||
/**
|
||||
* Interesting events.
|
||||
*
|
||||
* Example: User logs in, SQL logs.
|
||||
*
|
||||
* @param string $message
|
||||
* @param array $context
|
||||
*
|
||||
* @return void
|
||||
*/
|
||||
public function info($message, array $context = array());
|
||||
|
||||
/**
|
||||
* Detailed debug information.
|
||||
*
|
||||
* @param string $message
|
||||
* @param array $context
|
||||
*
|
||||
* @return void
|
||||
*/
|
||||
public function debug($message, array $context = array());
|
||||
|
||||
/**
|
||||
* Logs with an arbitrary level.
|
||||
*
|
||||
* @param mixed $level
|
||||
* @param string $message
|
||||
* @param array $context
|
||||
*
|
||||
* @return void
|
||||
*/
|
||||
public function log($level, $message, array $context = array());
|
||||
}
|
@ -1,140 +0,0 @@
|
||||
<?php
|
||||
|
||||
namespace Psr\Log;
|
||||
|
||||
/**
|
||||
* This is a simple Logger trait that classes unable to extend AbstractLogger
|
||||
* (because they extend another class, etc) can include.
|
||||
*
|
||||
* It simply delegates all log-level-specific methods to the `log` method to
|
||||
* reduce boilerplate code that a simple Logger that does the same thing with
|
||||
* messages regardless of the error level has to implement.
|
||||
*/
|
||||
trait LoggerTrait
|
||||
{
|
||||
/**
|
||||
* System is unusable.
|
||||
*
|
||||
* @param string $message
|
||||
* @param array $context
|
||||
*
|
||||
* @return void
|
||||
*/
|
||||
public function emergency($message, array $context = array())
|
||||
{
|
||||
$this->log(LogLevel::EMERGENCY, $message, $context);
|
||||
}
|
||||
|
||||
/**
|
||||
* Action must be taken immediately.
|
||||
*
|
||||
* Example: Entire website down, database unavailable, etc. This should
|
||||
* trigger the SMS alerts and wake you up.
|
||||
*
|
||||
* @param string $message
|
||||
* @param array $context
|
||||
*
|
||||
* @return void
|
||||
*/
|
||||
public function alert($message, array $context = array())
|
||||
{
|
||||
$this->log(LogLevel::ALERT, $message, $context);
|
||||
}
|
||||
|
||||
/**
|
||||
* Critical conditions.
|
||||
*
|
||||
* Example: Application component unavailable, unexpected exception.
|
||||
*
|
||||
* @param string $message
|
||||
* @param array $context
|
||||
*
|
||||
* @return void
|
||||
*/
|
||||
public function critical($message, array $context = array())
|
||||
{
|
||||
$this->log(LogLevel::CRITICAL, $message, $context);
|
||||
}
|
||||
|
||||
/**
|
||||
* Runtime errors that do not require immediate action but should typically
|
||||
* be logged and monitored.
|
||||
*
|
||||
* @param string $message
|
||||
* @param array $context
|
||||
*
|
||||
* @return void
|
||||
*/
|
||||
public function error($message, array $context = array())
|
||||
{
|
||||
$this->log(LogLevel::ERROR, $message, $context);
|
||||
}
|
||||
|
||||
/**
|
||||
* Exceptional occurrences that are not errors.
|
||||
*
|
||||
* Example: Use of deprecated APIs, poor use of an API, undesirable things
|
||||
* that are not necessarily wrong.
|
||||
*
|
||||
* @param string $message
|
||||
* @param array $context
|
||||
*
|
||||
* @return void
|
||||
*/
|
||||
public function warning($message, array $context = array())
|
||||
{
|
||||
$this->log(LogLevel::WARNING, $message, $context);
|
||||
}
|
||||
|
||||
/**
|
||||
* Normal but significant events.
|
||||
*
|
||||
* @param string $message
|
||||
* @param array $context
|
||||
*
|
||||
* @return void
|
||||
*/
|
||||
public function notice($message, array $context = array())
|
||||
{
|
||||
$this->log(LogLevel::NOTICE, $message, $context);
|
||||
}
|
||||
|
||||
/**
|
||||
* Interesting events.
|
||||
*
|
||||
* Example: User logs in, SQL logs.
|
||||
*
|
||||
* @param string $message
|
||||
* @param array $context
|
||||
*
|
||||
* @return void
|
||||
*/
|
||||
public function info($message, array $context = array())
|
||||
{
|
||||
$this->log(LogLevel::INFO, $message, $context);
|
||||
}
|
||||
|
||||
/**
|
||||
* Detailed debug information.
|
||||
*
|
||||
* @param string $message
|
||||
* @param array $context
|
||||
*
|
||||
* @return void
|
||||
*/
|
||||
public function debug($message, array $context = array())
|
||||
{
|
||||
$this->log(LogLevel::DEBUG, $message, $context);
|
||||
}
|
||||
|
||||
/**
|
||||
* Logs with an arbitrary level.
|
||||
*
|
||||
* @param mixed $level
|
||||
* @param string $message
|
||||
* @param array $context
|
||||
*
|
||||
* @return void
|
||||
*/
|
||||
abstract public function log($level, $message, array $context = array());
|
||||
}
|
Some files were not shown because too many files have changed in this diff Show More
Loading…
Reference in New Issue
Block a user