/** * Crawl PaymentInformation containing the Transactions * * @param PaymentInformation $paymentInformation * @return mixed */ 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())); $this->currentPayment->appendChild($this->createElement('CtrlSum', $this->intToCurrency($paymentInformation->getControlSumCents()))); $paymentTypeInformation = $this->createElement('PmtTpInf'); $serviceLevel = $this->createElement('SvcLvl'); $serviceLevel->appendChild($this->createElement('Cd', 'SEPA')); $paymentTypeInformation->appendChild($serviceLevel); $this->currentPayment->appendChild($paymentTypeInformation); $localInstrument = $this->createElement('LclInstrm'); if ($paymentInformation->getLocalInstrumentCode()) { $localInstrument->appendChild($this->createElement('Cd', $paymentInformation->getLocalInstrumentCode())); } else { $localInstrument->appendChild($this->createElement('Cd', 'CORE')); } $paymentTypeInformation->appendChild($localInstrument); $paymentTypeInformation->appendChild($this->createElement('SeqTp', $paymentInformation->getSequenceType())); $this->currentPayment->appendChild($this->createElement('ReqdColltnDt', $paymentInformation->getDueDate())); $creditor = $this->createElement('Cdtr'); $creditor->appendChild($this->createElement('Nm', $paymentInformation->getOriginName())); $this->currentPayment->appendChild($creditor); // <CdtrAcct> $creditorAccount = $this->createElement('CdtrAcct'); $id = $this->getIbanElement($paymentInformation->getOriginAccountIBAN()); $creditorAccount->appendChild($id); $this->currentPayment->appendChild($creditorAccount); // <CdtrAgt> if ($paymentInformation->getOriginAgentBIC()) { $creditorAgent = $this->createElement('CdtrAgt'); $creditorAgent->appendChild($this->getFinancialInstitutionElement($paymentInformation->getOriginAgentBIC())); $this->currentPayment->appendChild($creditorAgent); } $this->currentPayment->appendChild($this->createElement('ChrgBr', 'SLEV')); $creditorSchemeId = $this->createElement('CdtrSchmeId'); $id = $this->createElement('Id'); $privateId = $this->createElement('PrvtId'); $other = $this->createElement('Othr'); $other->appendChild($this->createElement('Id', $paymentInformation->getCreditorId())); $schemeName = $this->createElement('SchmeNm'); $schemeName->appendChild($this->createElement('Prtry', 'SEPA')); $other->appendChild($schemeName); $privateId->appendChild($other); $id->appendChild($privateId); $creditorSchemeId->appendChild($id); $this->currentPayment->appendChild($creditorSchemeId); $this->currentTransfer->appendChild($this->currentPayment); }