-
Notifications
You must be signed in to change notification settings - Fork 42
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge pull request #10 from ampaze/camt
Möglichkeit der Abfrage der Kontoumsätze als CAMT-XML
- Loading branch information
Showing
3 changed files
with
209 additions
and
1 deletion.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,48 @@ | ||
<?php | ||
|
||
namespace Fhp\Response; | ||
|
||
use Fhp\Segment\HKCAZ; | ||
|
||
/** | ||
* Class BankToCustomerAccountReportHICAZ.php | ||
* @package Fhp\Response | ||
*/ | ||
class BankToCustomerAccountReportHICAZ extends Response | ||
{ | ||
const SEG_ACCOUNT_INFORMATION = 'HICAZ'; | ||
|
||
/** | ||
* Gets the raw MT940 string from response. | ||
* | ||
* @return string | ||
*/ | ||
public function getBookedXML() | ||
{ | ||
$seg = $this->findSegment(static::SEG_ACCOUNT_INFORMATION); | ||
|
||
$parts = $this->splitSegment($seg); | ||
|
||
if (count($parts) > 3) { | ||
|
||
if ($parts[2] == HKCAZ::CAMT_FORMAT . '.xsd') { | ||
list($empty, $length, $xml) = explode('@', $parts[3], 3); | ||
if ($empty == '' && intval($length) == strlen($xml)) { | ||
return $xml; | ||
} | ||
|
||
throw new \Exception('Fehler im XML Payload'); | ||
|
||
} else { | ||
throw new \Exception('Unerwartetes CAMT XML Format (' . $parts[2] . ')'); | ||
} | ||
} | ||
|
||
return ''; | ||
} | ||
|
||
protected function conformToUtf8($string) | ||
{ | ||
return $string; | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,69 @@ | ||
<?php | ||
|
||
namespace Fhp\Segment; | ||
|
||
use Fhp\DataTypes\Dat; | ||
use Fhp\DataTypes\Kti; | ||
|
||
/** | ||
* Class HKCAZ (Kontoumsätze/Zeitraum (camt)) | ||
* 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.3.1.1.1 | ||
* | ||
* @package Fhp\Segment | ||
*/ | ||
class HKCAZ extends AbstractSegment | ||
{ | ||
const NAME = 'HKCAZ'; | ||
const ALL_ACCOUNTS_N = 'N'; | ||
const ALL_ACCOUNTS_Y = 'J'; | ||
const CAMT_FORMAT = 'camt.052.001.02'; | ||
const CAMT_FORMAT_FQ = 'urn:iso:std:iso:20022:tech:xsd:' . self::CAMT_FORMAT; | ||
|
||
/** | ||
* HKCAZ constructor. | ||
* @param int $version | ||
* @param int $segmentNumber | ||
* @param Kti $kti | ||
* @param string $camtFormat | ||
* @param array $allAccounts | ||
* @param \DateTime $from | ||
* @param \DateTime $to | ||
* @param string|null $touchdown | ||
*/ | ||
public function __construct( | ||
$version, | ||
$segmentNumber, | ||
$kti, | ||
$camtFormat, | ||
$allAccounts, | ||
\DateTime $from, | ||
\DateTime $to, | ||
$touchdown = null | ||
) { | ||
parent::__construct( | ||
static::NAME, | ||
$segmentNumber, | ||
$version, | ||
array( | ||
$kti, | ||
$camtFormat, | ||
$allAccounts, | ||
new Dat($from), | ||
new Dat($to), | ||
null, | ||
$touchdown | ||
) | ||
); | ||
} | ||
|
||
/** | ||
* @return string | ||
*/ | ||
public function getName() | ||
{ | ||
return static::NAME; | ||
} | ||
} |