Skip to content

Commit

Permalink
Add MessageFormat V06 for Camt052 messages
Browse files Browse the repository at this point in the history
  • Loading branch information
DBX12 authored and PowerKiKi committed Apr 5, 2020
1 parent d778e98 commit b7233d2
Show file tree
Hide file tree
Showing 2 changed files with 73 additions and 0 deletions.
19 changes: 19 additions & 0 deletions src/Camt052/Decoder/V06/Message.php
Original file line number Diff line number Diff line change
@@ -0,0 +1,19 @@
<?php

declare(strict_types=1);

namespace Genkgo\Camt\Camt052\Decoder\V06;

use Genkgo\Camt\Camt052\Decoder\Message as BaseMessageDecoder;
use \SimpleXMLElement;

class Message extends BaseMessageDecoder
{
/**
* {@inheritdoc}
*/
public function getRootElement(SimpleXMLElement $document): SimpleXMLElement
{
return $document->BkToCstmrAcctRpt;
}
}
54 changes: 54 additions & 0 deletions src/Camt052/MessageFormat/V06.php
Original file line number Diff line number Diff line change
@@ -0,0 +1,54 @@
<?php

declare(strict_types=1);

namespace Genkgo\Camt\Camt052\MessageFormat;

use Genkgo\Camt\Camt052;
use Genkgo\Camt\Decoder;
use Genkgo\Camt\DecoderInterface;
use Genkgo\Camt\MessageFormatInterface;

/**
* Class MessageFormat
* @package Genkgo\Camt\Camt052
*/
final class V06 implements MessageFormatInterface
{
/**
* @return string
*/
public function getXmlNs(): string
{
return 'urn:iso:std:iso:20022:tech:xsd:camt.052.001.06';
}

/**
* @return string
*/
public function getMsgId(): string
{
return 'camt.052.001.06';
}

/**
* @return string
*/
public function getName(): string
{
return 'BankToCustomerAccountReportV06';
}

/**
* @return DecoderInterface
*/
public function getDecoder(): DecoderInterface
{
$entryTransactionDetailDecoder = new Camt052\Decoder\EntryTransactionDetail(new Decoder\Date());
$entryDecoder = new Decoder\Entry($entryTransactionDetailDecoder);
$recordDecoder = new Decoder\Record($entryDecoder, new Decoder\Date());
$messageDecoder = new Camt052\Decoder\V06\Message($recordDecoder, new Decoder\Date());

return new Decoder($messageDecoder, sprintf('/assets/%s.xsd', $this->getMsgId()));
}
}

0 comments on commit b7233d2

Please sign in to comment.