/** * 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())); $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); if ($paymentInformation->getCategoryPurposeCode()) { $categoryPurpose = $this->createElement('CtgyPurp'); $categoryPurpose->appendChild($this->createElement('Cd', $paymentInformation->getCategoryPurposeCode())); $paymentTypeInformation->appendChild($categoryPurpose); } $this->currentPayment->appendChild($paymentTypeInformation); if ($paymentInformation->getLocalInstrumentCode()) { $localInstrument = $this->createElement('LclInstr'); $localInstrument->appendChild($this->createElement('Cd', $paymentInformation->getLocalInstrumentCode())); $this->currentPayment->appendChild($localInstrument); } $this->currentPayment->appendChild($this->createElement('ReqdExctnDt', $paymentInformation->getDueDate())); $debtor = $this->createElement('Dbtr'); $debtor->appendChild($this->createElement('Nm', $paymentInformation->getOriginName())); $this->currentPayment->appendChild($debtor); $debtorAccount = $this->createElement('DbtrAcct'); $id = $this->createElement('Id'); $id->appendChild($this->createElement('IBAN', $paymentInformation->getOriginAccountIBAN())); $debtorAccount->appendChild($id); if ($paymentInformation->getOriginAccountCurrency()) { $debtorAccount->appendChild($this->createElement('Ccy', $paymentInformation->getOriginAccountCurrency())); } $this->currentPayment->appendChild($debtorAccount); $debtorAgent = $this->createElement('DbtrAgt'); $financialInstitutionId = $this->createElement('FinInstnId'); $financialInstitutionId->appendChild($this->createElement('BIC', $paymentInformation->getOriginAgentBIC())); $debtorAgent->appendChild($financialInstitutionId); $this->currentPayment->appendChild($debtorAgent); $this->currentPayment->appendChild($this->createElement('ChrgBr', 'SLEV')); $this->currentTransfer->appendChild($this->currentPayment); }