/**
  * {@inheritdoc}
  */
 public function asDom(\DOMDocument $doc)
 {
     $root = $this->buildHeader($doc, null);
     $creditorAgent = $doc->createElement('CdtrAgt');
     $creditorAgent->appendChild($this->creditorAgent->asDom($doc));
     $root->appendChild($creditorAgent);
     $root->appendChild($this->buildCreditor($doc));
     $creditorAccount = $doc->createElement('CdtrAcct');
     $creditorAccountId = $doc->createElement('Id');
     $creditorAccountId->appendChild($doc->createElement('IBAN', $this->creditorIBAN->normalize()));
     $creditorAccount->appendChild($creditorAccountId);
     $root->appendChild($creditorAccount);
     if ($this->hasRemittanceInformation()) {
         $root->appendChild($this->buildRemittanceInformation($doc));
     }
     return $root;
 }
 /**
  * Builds a DOM tree of this payment instruction
  *
  * @param \DOMDocument $doc
  *
  * @return \DOMElement The built DOM tree
  */
 public function asDom(\DOMDocument $doc)
 {
     $root = $doc->createElement('PmtInf');
     $root->appendChild($doc->createElement('PmtInfId', $this->id));
     $root->appendChild($doc->createElement('PmtMtd', 'TRF'));
     $root->appendChild($doc->createElement('BtchBookg', $this->batchBooking ? 'true' : 'false'));
     $root->appendChild($doc->createElement('ReqdExctnDt', $this->executionDate->format('Y-m-d')));
     $debtor = $doc->createElement('Dbtr');
     $debtor->appendChild($doc->createElement('Nm', $this->debtorName));
     $root->appendChild($debtor);
     $debtorAccount = $doc->createElement('DbtrAcct');
     $debtorAccountId = $doc->createElement('Id');
     $debtorAccountId->appendChild($doc->createElement('IBAN', $this->debtorIBAN->normalize()));
     $debtorAccount->appendChild($debtorAccountId);
     $root->appendChild($debtorAccount);
     $debtorAgent = $doc->createElement('DbtrAgt');
     $debtorAgent->appendChild($this->debtorAgent->asDom($doc));
     $root->appendChild($debtorAgent);
     foreach ($this->transactions as $transaction) {
         $root->appendChild($transaction->asDom($doc));
     }
     return $root;
 }