|
1
|
|
|
<?php |
|
2
|
|
|
|
|
3
|
|
|
declare(strict_types=1); |
|
4
|
|
|
|
|
5
|
|
|
namespace Genkgo\Camt\Camt054\Decoder\V04; |
|
6
|
|
|
|
|
7
|
|
|
use Genkgo\Camt\Camt054\Decoder\Message as BaseMessage; |
|
8
|
|
|
use Genkgo\Camt\Camt054\DTO\V04 as Camt054V04DTO; |
|
9
|
|
|
use Genkgo\Camt\Decoder\Factory\DTO as DTOFactory; |
|
10
|
|
|
use Genkgo\Camt\DTO; |
|
11
|
|
|
use SimpleXMLElement; |
|
12
|
|
|
|
|
13
|
|
|
class Message extends BaseMessage |
|
14
|
|
|
{ |
|
15
|
|
|
/** |
|
16
|
|
|
* @inheritDoc |
|
17
|
|
|
*/ |
|
18
|
4 |
|
public function addGroupHeader(DTO\Message $message, SimpleXMLElement $document): void |
|
19
|
|
|
{ |
|
20
|
4 |
|
$xmlGroupHeader = $this->getRootElement($document)->GrpHdr; |
|
21
|
4 |
|
$groupHeader = new Camt054V04DTO\GroupHeader( |
|
22
|
4 |
|
(string) $xmlGroupHeader->MsgId, |
|
23
|
4 |
|
$this->dateDecoder->decode((string) $xmlGroupHeader->CreDtTm) |
|
24
|
|
|
); |
|
25
|
|
|
|
|
26
|
4 |
|
if (isset($xmlGroupHeader->OrgnlBizQry)) { |
|
27
|
4 |
|
$originalBusinessQuery = new Camt054V04DTO\OriginalBusinessQuery( |
|
28
|
4 |
|
(string) $xmlGroupHeader->OrgnlBizQry->MsgId |
|
29
|
|
|
); |
|
30
|
|
|
|
|
31
|
4 |
|
if (isset($xmlGroupHeader->OrgnlBizQry->CreDtTm)) { |
|
32
|
4 |
|
$originalBusinessQuery->setCreatedOn( |
|
33
|
4 |
|
$this->dateDecoder->decode((string) $xmlGroupHeader->OrgnlBizQry->CreDtTm) |
|
34
|
|
|
); |
|
35
|
|
|
} |
|
36
|
|
|
|
|
37
|
4 |
|
if (isset($xmlGroupHeader->OrgnlBizQry->MsgNmId)) { |
|
38
|
4 |
|
$originalBusinessQuery->setMessageNameId((string) $xmlGroupHeader->OrgnlBizQry->MsgNmId); |
|
39
|
|
|
} |
|
40
|
|
|
|
|
41
|
4 |
|
if (isset($xmlGroupHeader->MsgRcpt)) { |
|
42
|
4 |
|
$groupHeader->setMessageRecipient( |
|
43
|
4 |
|
DTOFactory\Recipient::createFromXml($xmlGroupHeader->MsgRcpt) |
|
44
|
|
|
); |
|
45
|
|
|
} |
|
46
|
|
|
|
|
47
|
4 |
|
$groupHeader->setOriginalBusinessQuery($originalBusinessQuery); |
|
48
|
|
|
} |
|
49
|
|
|
|
|
50
|
4 |
|
if (isset($xmlGroupHeader->AddtlInf)) { |
|
51
|
4 |
|
$groupHeader->setAdditionalInformation((string) $xmlGroupHeader->AddtlInf); |
|
52
|
|
|
} |
|
53
|
|
|
|
|
54
|
4 |
|
if (isset($xmlGroupHeader->MsgPgntn)) { |
|
55
|
4 |
|
$groupHeader->setPagination(new DTO\Pagination( |
|
56
|
4 |
|
(string) $xmlGroupHeader->MsgPgntn->PgNb, |
|
57
|
4 |
|
('true' === (string) $xmlGroupHeader->MsgPgntn->LastPgInd) ? true : false |
|
58
|
|
|
)); |
|
59
|
|
|
} |
|
60
|
|
|
|
|
61
|
4 |
|
$message->setGroupHeader($groupHeader); |
|
62
|
4 |
|
} |
|
63
|
|
|
} |
|
64
|
|
|
|