/**
  * 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);
 }
 /**
  * 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);
     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);
 }