Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
15 changes: 15 additions & 0 deletions src/Camt054/DTO/Notification.php
Original file line number Diff line number Diff line change
Expand Up @@ -4,8 +4,23 @@

namespace Genkgo\Camt\Camt054\DTO;

use DateTimeImmutable;
use Genkgo\Camt\DTO\Account;
use Genkgo\Camt\DTO\Record;

class Notification extends Record
{
protected ?DateTimeImmutable $createdOn;

public function __construct(string $id, ?DateTimeImmutable $createdOn, Account $account)
{
parent::__construct($id, $account);

$this->createdOn = $createdOn;
}

public function getCreatedOn(): ?DateTimeImmutable
{
return $this->createdOn;
}
}
3 changes: 2 additions & 1 deletion src/Camt054/Decoder/Message.php
Original file line number Diff line number Diff line change
Expand Up @@ -20,9 +20,10 @@ public function addRecords(DTO\Message $message, SimpleXMLElement $document): vo

$xmlNotifications = $this->getRootElement($document)->Ntfctn;
foreach ($xmlNotifications as $xmlNotification) {
$createdOn = (string) $xmlNotification->CreDtTm;
$notification = new Camt054DTO\Notification(
(string) $xmlNotification->Id,
$this->dateDecoder->decode((string) $xmlNotification->CreDtTm),
$createdOn ? $this->dateDecoder->decode($createdOn) : null,
$this->getAccount($xmlNotification)
);

Expand Down
10 changes: 1 addition & 9 deletions src/DTO/Record.php
Original file line number Diff line number Diff line change
Expand Up @@ -10,8 +10,6 @@ abstract class Record
{
protected string $id;

protected DateTimeImmutable $createdOn;

protected Account $account;

protected ?Pagination $pagination = null;
Expand All @@ -33,10 +31,9 @@ abstract class Record

protected ?string $additionalInformation = null;

public function __construct(string $id, DateTimeImmutable $createdOn, Account $account)
public function __construct(string $id, Account $account)
{
$this->id = $id;
$this->createdOn = $createdOn;
$this->account = $account;
}

Expand All @@ -45,11 +42,6 @@ public function getId(): string
return $this->id;
}

public function getCreatedOn(): DateTimeImmutable
{
return $this->createdOn;
}

public function getAccount(): Account
{
return $this->account;
Expand Down
16 changes: 16 additions & 0 deletions src/DTO/RecordWithBalances.php
Original file line number Diff line number Diff line change
Expand Up @@ -4,8 +4,24 @@

namespace Genkgo\Camt\DTO;

use DateTimeImmutable;

abstract class RecordWithBalances extends Record
{
protected DateTimeImmutable $createdOn;

public function __construct(string $id, DateTimeImmutable $createdOn, Account $account)
{
parent::__construct($id, $account);

$this->createdOn = $createdOn;
}

public function getCreatedOn(): DateTimeImmutable
{
return $this->createdOn;
}

/**
* @var Balance[]
*/
Expand Down
152 changes: 152 additions & 0 deletions test/data/camt054.v8-grphdr-credttm.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,152 @@
{
"__CLASS__": "Genkgo\\Camt\\DTO\\Message",
"getEntries": [
{
"__CLASS__": "Genkgo\\Camt\\DTO\\Entry",
"getAccountServicerReference": null,
"getAdditionalInfo": "",
"getAmount": {
"__CLASS__": "Money\\Money",
"getAmount": "4740",
"getCurrency": {
"__CLASS__": "Money\\Currency",
"getCode": "EUR"
}
},
"getBankTransactionCode": {
"__CLASS__": "Genkgo\\Camt\\DTO\\BankTransactionCode",
"getDomain": {
"__CLASS__": "Genkgo\\Camt\\DTO\\DomainBankTransactionCode",
"getCode": "PMNT",
"getFamily": {
"__CLASS__": "Genkgo\\Camt\\DTO\\DomainFamilyBankTransactionCode",
"getCode": "RRCT",
"getSubFamilyCode": "ESCT"
}
},
"getProprietary": null
},
"getBatchPaymentId": null,
"getBookingDate": null,
"getCharges": null,
"getCreditDebitIndicator": "CRDT",
"getIndex": 0,
"getRecord": {
"__CLASS__": "Genkgo\\Camt\\Camt054\\DTO\\Notification",
"getAccount": {
"__CLASS__": "Genkgo\\Camt\\DTO\\IbanAccount",
"getIban": {
"__CLASS__": "Genkgo\\Camt\\Iban",
"getIban": "DE91100000000123456789"
},
"getIdentification": "DE91100000000123456789",
"getName": null
},
"getAdditionalInformation": null,
"getCopyDuplicateIndicator": null,
"getCreatedOn": null,
"getElectronicSequenceNumber": null,
"getEntries": [
"__RECURSIVITY__"
],
"getFromDate": null,
"getId": "250326012345678",
"getLegalSequenceNumber": null,
"getPagination": null,
"getToDate": null
},
"getReference": null,
"getReversalIndicator": false,
"getStatus": "INFO",
"getTransactionDetail": {
"__CLASS__": "Genkgo\\Camt\\DTO\\EntryTransactionDetail",
"getAdditionalTransactionInformation": null,
"getAmount": null,
"getAmountDetails": null,
"getBankTransactionCode": {
"__CLASS__": "Genkgo\\Camt\\DTO\\BankTransactionCode",
"getDomain": null,
"getProprietary": null
},
"getCharges": null,
"getCreditDebitIndicator": "CRDT",
"getReference": {
"__CLASS__": "Genkgo\\Camt\\DTO\\Reference",
"getAccountOwnerTransactionId": null,
"getAccountServicerReference": null,
"getAccountServicerTransactionId": null,
"getChequeNumber": null,
"getClearingSystemReference": null,
"getEndToEndId": "NOTPROVIDED",
"getInstructionId": null,
"getMandateId": null,
"getMarketInfrastructureTransactionId": null,
"getMessageId": null,
"getPaymentInformationId": null,
"getProcessingId": null,
"getProprietaries": [],
"getTransactionId": null,
"getUuidEndToEndReference": null
},
"getRelatedAgent": null,
"getRelatedAgents": [],
"getRelatedDates": null,
"getRelatedParties": [
{
"__CLASS__": "Genkgo\\Camt\\DTO\\RelatedParty",
"getAccount": null,
"getRelatedPartyType": {
"__CLASS__": "Genkgo\\Camt\\DTO\\Creditor",
"getAddress": null,
"getIdentification": null,
"getName": "MyBigCompany GmbH"
}
},
{
"__CLASS__": "Genkgo\\Camt\\DTO\\RelatedParty",
"getAccount": {
"__CLASS__": "Genkgo\\Camt\\DTO\\IbanAccount",
"getIban": {
"__CLASS__": "Genkgo\\Camt\\Iban",
"getIban": "DE02200505501015871393"
},
"getIdentification": "DE02200505501015871393",
"getName": null
},
"getRelatedPartyType": {
"__CLASS__": "Genkgo\\Camt\\DTO\\Debtor",
"getAddress": null,
"getIdentification": null,
"getName": "Remote Party"
}
}
],
"getRelatedParty": "__RECURSIVITY__",
"getRemittanceInformation": null,
"getReturnInformation": null
},
"getTransactionDetails": [
"__RECURSIVITY__"
],
"getValueDate": {
"__CLASS__": "DateTimeImmutable",
"0": "2025-03-25T00:00:00+00:00"
}
}
],
"getGroupHeader": {
"__CLASS__": "Genkgo\\Camt\\Camt054\\DTO\\V04\\GroupHeader",
"getAdditionalInformation": null,
"getCreatedOn": {
"__CLASS__": "DateTimeImmutable",
"0": "2025-03-25T20:18:34+00:00"
},
"getMessageId": "COBADEFF250326012345678",
"getMessageRecipient": null,
"getOriginalBusinessQuery": null,
"getPagination": null
},
"getRecords": [
"__RECURSIVITY__"
]
}
65 changes: 65 additions & 0 deletions test/data/camt054.v8-grphdr-credttm.xml
Original file line number Diff line number Diff line change
@@ -0,0 +1,65 @@
<?xml version="1.0" encoding="UTF-8"?>
<Document xmlns="urn:iso:std:iso:20022:tech:xsd:camt.054.001.08" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance">
<BkToCstmrDbtCdtNtfctn>
<GrpHdr>
<MsgId>COBADEFF250326012345678</MsgId>
<CreDtTm>2025-03-25T21:18:34+01:00</CreDtTm>
</GrpHdr>
<Ntfctn>
<Id>250326012345678</Id>
<Acct>
<Id>
<IBAN>DE91100000000123456789</IBAN>
</Id>
<Svcr>
<FinInstnId>
<BICFI>COBADEFF</BICFI>
</FinInstnId>
</Svcr>
</Acct>
<Ntry>
<Amt Ccy="EUR">47.4</Amt>
<CdtDbtInd>CRDT</CdtDbtInd>
<Sts>
<Cd>INFO</Cd>
</Sts>
<ValDt>
<Dt>2025-03-25</Dt>
</ValDt>
<BkTxCd>
<Domn>
<Cd>PMNT</Cd>
<Fmly>
<Cd>RRCT</Cd>
<SubFmlyCd>ESCT</SubFmlyCd>
</Fmly>
</Domn>
</BkTxCd>
<NtryDtls>
<TxDtls>
<Refs>
<EndToEndId>NOTPROVIDED</EndToEndId>
</Refs>
<RltdPties>
<Dbtr>
<Pty>
<Nm>Remote Party</Nm>
</Pty>
</Dbtr>
<DbtrAcct>
<Id>
<IBAN>DE02200505501015871393</IBAN>
</Id>
</DbtrAcct>
<Cdtr>
<Pty>
<Nm>MyBigCompany GmbH</Nm>
</Pty>
</Cdtr>
</RltdPties>
</TxDtls>
</NtryDtls>
</Ntry>
</Ntfctn>
</BkToCstmrDbtCdtNtfctn>
</Document>
Loading