/** * Crawl Transactions * * @param TransferInformationInterface $transactionInformation * @return mixed */ public function visitTransferInformation(TransferInformationInterface $transactionInformation) { /** @var $transactionInformation CustomerDirectDebitTransferInformation */ $directDebitTransactionInformation = $this->createElement('DrctDbtTxInf'); $paymentId = $this->createElement('PmtId'); $paymentId->appendChild($this->createElement('EndToEndId', $transactionInformation->getEndToEndIdentification())); $directDebitTransactionInformation->appendChild($paymentId); $instructedAmount = $this->createElement('InstdAmt', $this->intToCurrency($transactionInformation->getTransferAmount())); $instructedAmount->setAttribute('Ccy', $transactionInformation->getCurrency()); $directDebitTransactionInformation->appendChild($instructedAmount); $directDebitTransaction = $this->createElement('DrctDbtTx'); $mandateRelatedInformation = $this->createElement('MndtRltdInf'); $directDebitTransaction->appendChild($mandateRelatedInformation); $mandateRelatedInformation->appendChild($this->createElement('MndtId', $transactionInformation->getMandateId())); $mandateRelatedInformation->appendChild($this->createElement('DtOfSgntr', $transactionInformation->getMandateSignDate()->format('Y-m-d'))); $directDebitTransactionInformation->appendChild($directDebitTransaction); // TODO add the possibility to add CreditorSchemeId on transfer level $debtorAgent = $this->createElement('DbtrAgt'); $debtorAgent->appendChild($this->getFinancialInstitutionElement($transactionInformation->getBic())); $directDebitTransactionInformation->appendChild($debtorAgent); $debtor = $this->createElement('Dbtr'); $debtor->appendChild($this->createElement('Nm', $transactionInformation->getDebitorName())); $directDebitTransactionInformation->appendChild($debtor); $debtorAccount = $this->createElement('DbtrAcct'); $debtorAccount->appendChild($this->getIbanElement($transactionInformation->getIban())); $directDebitTransactionInformation->appendChild($debtorAccount); $directDebitTransactionInformation->appendChild($this->getRemittenceElement($transactionInformation->getRemittanceInformation())); if ($transactionInformation->hasAmendments()) { $amendmentIndicator = $this->createElement('AmdmntInd', 'true'); $mandateRelatedInformation->appendChild($amendmentIndicator); $amendmentInformationDetails = $this->createElement('AmdmntInfDtls'); if ($transactionInformation->hasAmendedDebtorAgent()) { $originalDebtorAgent = $this->createElement('OrgnlDbtrAgt'); $financialInstitutionIdentification = $this->createElement('FinInstnId'); $other = $this->createElement('Othr'); // Same Mandate New Debtor Agent $id = $this->createElement('Id', 'SMNDA'); $other->appendChild($id); $financialInstitutionIdentification->appendChild($other); $originalDebtorAgent->appendChild($financialInstitutionIdentification); $amendmentInformationDetails->appendChild($originalDebtorAgent); } if ($transactionInformation->getOriginalDebtorIban() !== null) { $originalDebtorAccount = $this->createElement('OrgnlDbtrAcct'); $originalDebtorAccount->appendChild($this->getIbanElement($transactionInformation->getOriginalDebtorIban())); $amendmentInformationDetails->appendChild($originalDebtorAccount); } if ($transactionInformation->getOriginalMandateId() !== null) { $originalMandateId = $this->createElement('OrgnlMndtId', $transactionInformation->getOriginalMandateId()); $amendmentInformationDetails->appendChild($originalMandateId); } $mandateRelatedInformation->appendChild($amendmentInformationDetails); } $this->currentPayment->appendChild($directDebitTransactionInformation); }