From c97ff38d70ba4282c83b3fb86f54e2d0ebd62b52 Mon Sep 17 00:00:00 2001 From: Wouter Pirotte Date: Tue, 28 Oct 2014 10:31:34 +0100 Subject: [PATCH] Moved the BtchBookg node to the correct position and introduced the missing Issr node. --- .../Sepa/DomBuilder/BaseDomBuilder.php | 4 +- .../CustomerCreditTransferDomBuilder.php | 10 ++++ lib/Digitick/Sepa/GroupHeader.php | 48 +++++++++---------- lib/Digitick/Sepa/PaymentInformation.php | 24 +++++++++- 4 files changed, 58 insertions(+), 28 deletions(-) diff --git a/lib/Digitick/Sepa/DomBuilder/BaseDomBuilder.php b/lib/Digitick/Sepa/DomBuilder/BaseDomBuilder.php index 02af781..456b3c0 100644 --- a/lib/Digitick/Sepa/DomBuilder/BaseDomBuilder.php +++ b/lib/Digitick/Sepa/DomBuilder/BaseDomBuilder.php @@ -116,9 +116,7 @@ public function visitGroupHeader(GroupHeader $groupHeader) $groupHeaderTag->appendChild( $this->createElement('CtrlSum', $this->intToCurrency($groupHeader->getControlSumCents())) ); - if($groupHeader->getBatchBooking() !== null) { - $groupHeaderTag->appendChild($this->createElement('BtchBookg', $groupHeader->getBatchBooking())); - } + $initiatingParty = $this->createElement('InitgPty'); $initiatingPartyName = $this->createElement('Nm', $groupHeader->getInitiatingPartyName()); $initiatingParty->appendChild($initiatingPartyName); diff --git a/lib/Digitick/Sepa/DomBuilder/CustomerCreditTransferDomBuilder.php b/lib/Digitick/Sepa/DomBuilder/CustomerCreditTransferDomBuilder.php index 843929a..d47e08e 100644 --- a/lib/Digitick/Sepa/DomBuilder/CustomerCreditTransferDomBuilder.php +++ b/lib/Digitick/Sepa/DomBuilder/CustomerCreditTransferDomBuilder.php @@ -59,6 +59,11 @@ public function visitPaymentInformation(PaymentInformation $paymentInformation) $this->currentPayment = $this->createElement('PmtInf'); $this->currentPayment->appendChild($this->createElement('PmtInfId', $paymentInformation->getId())); $this->currentPayment->appendChild($this->createElement('PmtMtd', $paymentInformation->getPaymentMethod())); + + if($paymentInformation->getBatchBooking() !== null) { + $this->currentPayment->appendChild($this->createElement('BtchBookg', $paymentInformation->getBatchBooking())); + } + $this->currentPayment->appendChild( $this->createElement('NbOfTxs', $paymentInformation->getNumberOfTransactions()) ); @@ -178,6 +183,11 @@ public function visitGroupHeader(GroupHeader $groupHeader) $orgId = $this->createElement('OrgId'); $othr = $this->createElement('Othr'); $othr->appendChild($this->createElement('Id', $groupHeader->getInitiatingPartyId())); + + if ($groupHeader->getIssuer()) { + $othr->appendChild($this->createElement('Issr', $groupHeader->getIssuer())); + } + $orgId->appendChild($othr); $newId->appendChild($orgId); diff --git a/lib/Digitick/Sepa/GroupHeader.php b/lib/Digitick/Sepa/GroupHeader.php index c674567..4ccd8b3 100644 --- a/lib/Digitick/Sepa/GroupHeader.php +++ b/lib/Digitick/Sepa/GroupHeader.php @@ -46,6 +46,13 @@ class GroupHeader */ protected $initiatingPartyId; + /** + * The Issuer. + * + * @var string + */ + protected $issuer; + /** * @var int */ @@ -66,13 +73,6 @@ class GroupHeader */ protected $creationDateTime; - /** - * Should the bank book multiple transaction as a batch - * - * @var int - */ - protected $batchBooking = null; - /** * @param $messageIdentification * @param $isTest @@ -123,6 +123,22 @@ public function getInitiatingPartyId() return $this->initiatingPartyId; } + /** + * @return string + */ + public function getIssuer() + { + return $this->issuer; + } + + /** + * @param string $issuer + */ + public function setIssuer($issuer) + { + $this->issuer = $issuer; + } + /** * @param string $initiatingPartyName */ @@ -154,22 +170,6 @@ public function getIsTest() { return $this->isTest; } - - /** - * @param boolean $batchBooking - */ - public function setBatchBooking($batchBooking) - { - $this->batchBooking = $batchBooking; - } - - /** - * @return int|null - */ - public function getBatchBooking() - { - return $this->batchBooking; - } /** * @param string $messageIdentification @@ -211,4 +211,4 @@ public function getCreationDateTime() return $this->creationDateTime; } -} \ No newline at end of file +} diff --git a/lib/Digitick/Sepa/PaymentInformation.php b/lib/Digitick/Sepa/PaymentInformation.php index 6e6fb7e..251a23b 100644 --- a/lib/Digitick/Sepa/PaymentInformation.php +++ b/lib/Digitick/Sepa/PaymentInformation.php @@ -128,6 +128,13 @@ class PaymentInformation */ protected $sequenceType; + /** + * Should the bank book multiple transaction as a batch + * + * @var int + */ + protected $batchBooking = null; + /** * @param string $id * @param string $originAccountIBAN This is your IBAN @@ -408,4 +415,19 @@ public function getSequenceType() return $this->sequenceType; } -} \ No newline at end of file + /** + * @param boolean $batchBooking + */ + public function setBatchBooking($batchBooking) + { + $this->batchBooking = $batchBooking; + } + + /** + * @return int|null + */ + public function getBatchBooking() + { + return $this->batchBooking; + } +}