/** * @param Message $message */ public function __construct(DTO\Message $message) { $appendIterator = new AppendIterator(); $records = $message->getRecords(); foreach ($records as $record) { $appendIterator->append(new ArrayIterator($record->getEntries())); } parent::__construct($appendIterator); }
/** * @param DTO\Message $message * @param SimpleXMLElement $document */ public function addGroupHeader(DTO\Message $message, SimpleXMLElement $document) { $xmlGroupHeader = $this->getRootElement($document)->GrpHdr; $groupHeader = new DTO\GroupHeader((string) $xmlGroupHeader->MsgId, new DateTimeImmutable((string) $xmlGroupHeader->CreDtTm)); if (isset($xmlGroupHeader->AddtlInf)) { $groupHeader->setAdditionalInformation((string) $xmlGroupHeader->AddtlInf); } if (isset($xmlGroupHeader->MsgRcpt)) { $groupHeader->setMessageRecipient(DTOFactory\Recipient::createFromXml($xmlGroupHeader->MsgRcpt)); } $message->setGroupHeader($groupHeader); }
/** * @param DTO\Message $message * @param SimpleXMLElement $document */ public function addRecords(DTO\Message $message, SimpleXMLElement $document) { $notifications = []; $xmlNotifications = $this->getRootElement($document)->Ntfctn; foreach ($xmlNotifications as $xmlNotification) { $notification = new Camt054DTO\Notification((string) $xmlNotification->Id, new DateTimeImmutable((string) $xmlNotification->CreDtTm), $this->getAccount($xmlNotification)); if (isset($xmlNotification->NtfctnPgntn)) { $notification->setPagination(new DTO\Pagination((string) $xmlNotification->NtfctnPgntn->PgNb, 'true' === (string) $xmlNotification->NtfctnPgntn->LastPgInd ? true : false)); } if (isset($xmlNotification->AddtlNtfctnInf)) { $notification->setAdditionalInformation((string) $xmlNotification->AddtlNtfctnInf); } $this->addCommonRecordInformation($notification, $xmlNotification); $this->recordDecoder->addEntries($notification, $xmlNotification); $notifications[] = $notification; } $message->setRecords($notifications); }
/** * @param DTO\Message $message * @param SimpleXMLElement $document */ public function addRecords(DTO\Message $message, SimpleXMLElement $document) { $reports = []; $xmlReports = $this->getRootElement($document)->Rpt; foreach ($xmlReports as $xmlReport) { $report = new Camt052DTO\Report((string) $xmlReport->Id, new DateTimeImmutable((string) $xmlReport->CreDtTm), $this->getAccount($xmlReport)); if (isset($xmlReport->RptPgntn)) { $report->setPagination(new DTO\Pagination((string) $xmlReport->RptPgntn->PgNb, 'true' === (string) $xmlReport->RptPgntn->LastPgInd ? true : false)); } if (isset($xmlReport->AddtlRptInf)) { $report->setAdditionalInformation((string) $xmlReport->AddtlRptInf); } $this->addCommonRecordInformation($report, $xmlReport); $this->recordDecoder->addBalances($report, $xmlReport); $this->recordDecoder->addEntries($report, $xmlReport); $reports[] = $report; } $message->setRecords($reports); }
/** * {@inheritdoc} */ public function addGroupHeader(DTO\Message $message, SimpleXMLElement $document) { $xmlGroupHeader = $this->getRootElement($document)->GrpHdr; $groupHeader = new Camt054V04DTO\GroupHeader((string) $xmlGroupHeader->MsgId, new DateTimeImmutable((string) $xmlGroupHeader->CreDtTm)); if (isset($xmlGroupHeader->OrgnlBizQry)) { $originalBusinessQuery = new Camt054V04DTO\OriginalBusinessQuery((string) $xmlGroupHeader->OrgnlBizQry->MsgId); if (isset($xmlGroupHeader->OrgnlBizQry->CreDtTm)) { $originalBusinessQuery->setCreatedOn(new DateTimeImmutable((string) $xmlGroupHeader->OrgnlBizQry->CreDtTm)); } if (isset($xmlGroupHeader->OrgnlBizQry->MsgNmId)) { $originalBusinessQuery->setMessageNameId((string) $xmlGroupHeader->OrgnlBizQry->MsgNmId); } if (isset($xmlGroupHeader->MsgRcpt)) { $groupHeader->setMessageRecipient(DTOFactory\Recipient::createFromXml($xmlGroupHeader->MsgRcpt)); } $groupHeader->setOriginalBusinessQuery($originalBusinessQuery); } if (isset($xmlGroupHeader->AddtlInf)) { $groupHeader->setAdditionalInformation((string) $xmlGroupHeader->AddtlInf); } $message->setGroupHeader($groupHeader); }