1
|
|
|
<?php |
2
|
|
|
|
3
|
|
|
declare(strict_types=1); |
4
|
|
|
|
5
|
|
|
namespace Genkgo\Camt\Decoder; |
6
|
|
|
|
7
|
|
|
use Genkgo\Camt\DTO; |
8
|
|
|
use SimpleXMLElement; |
9
|
|
|
|
10
|
|
|
class Entry |
11
|
|
|
{ |
12
|
|
|
private EntryTransactionDetail $entryTransactionDetailDecoder; |
13
|
|
|
|
14
|
|
|
public function __construct(EntryTransactionDetail $entryTransactionDetailDecoder) |
15
|
|
|
{ |
16
|
|
|
$this->entryTransactionDetailDecoder = $entryTransactionDetailDecoder; |
17
|
29 |
|
} |
18
|
|
|
|
19
|
29 |
|
public function addTransactionDetails(DTO\Entry $entry, SimpleXMLElement $xmlEntry): void |
20
|
29 |
|
{ |
21
|
|
|
$xmlDetails = $xmlEntry->NtryDtls->TxDtls; |
22
|
24 |
|
|
23
|
|
|
if ($xmlDetails !== null) { |
24
|
24 |
|
foreach ($xmlDetails as $xmlDetail) { |
25
|
|
|
$detail = new DTO\EntryTransactionDetail(); |
26
|
24 |
|
$this->entryTransactionDetailDecoder->addCreditDebitIdentifier($detail, $xmlEntry->CdtDbtInd); |
27
|
23 |
|
$this->entryTransactionDetailDecoder->addReference($detail, $xmlDetail); |
|
|
|
|
28
|
23 |
|
$this->entryTransactionDetailDecoder->addRelatedParties($detail, $xmlDetail); |
|
|
|
|
29
|
23 |
|
$this->entryTransactionDetailDecoder->addRelatedAgents($detail, $xmlDetail); |
|
|
|
|
30
|
23 |
|
$this->entryTransactionDetailDecoder->addRemittanceInformation($detail, $xmlDetail); |
|
|
|
|
31
|
23 |
|
$this->entryTransactionDetailDecoder->addRelatedDates($detail, $xmlDetail); |
|
|
|
|
32
|
23 |
|
$this->entryTransactionDetailDecoder->addReturnInformation($detail, $xmlDetail); |
|
|
|
|
33
|
23 |
|
$this->entryTransactionDetailDecoder->addAdditionalTransactionInformation($detail, $xmlDetail); |
|
|
|
|
34
|
23 |
|
$this->entryTransactionDetailDecoder->addBankTransactionCode($detail, $xmlDetail); |
|
|
|
|
35
|
23 |
|
$this->entryTransactionDetailDecoder->addCharges($detail, $xmlDetail); |
|
|
|
|
36
|
23 |
|
$this->entryTransactionDetailDecoder->addAmountDetails($detail, $xmlDetail, $xmlEntry->CdtDbtInd); |
|
|
|
|
37
|
23 |
|
$this->entryTransactionDetailDecoder->addAmount($detail, $xmlDetail, $xmlEntry->CdtDbtInd); |
|
|
|
|
38
|
23 |
|
|
39
|
23 |
|
$entry->addTransactionDetail($detail); |
40
|
|
|
} |
41
|
23 |
|
} |
42
|
|
|
} |
43
|
|
|
} |
44
|
|
|
|