/**
  * {@inheritdoc}
  */
 public function asDom(\DOMDocument $doc)
 {
     $root = $this->buildHeader($doc, 'CH02');
     $root->appendChild($this->buildCreditor($doc));
     $creditorAccount = $doc->createElement('CdtrAcct');
     $creditorAccountId = $doc->createElement('Id');
     $creditorAccountIdOther = $doc->createElement('Othr');
     $creditorAccountIdOther->appendChild($doc->createElement('Id', $this->creditorAccount->format()));
     $creditorAccountId->appendChild($creditorAccountIdOther);
     $creditorAccount->appendChild($creditorAccountId);
     $root->appendChild($creditorAccount);
     if ($this->hasRemittanceInformation()) {
         $root->appendChild($this->buildRemittanceInformation($doc));
     }
     return $root;
 }
 /**
  * {@inheritdoc}
  */
 public function asDom(\DOMDocument $doc)
 {
     $root = $this->buildHeader($doc, 'CH03');
     $creditorAgent = $doc->createElement('CdtrAgt');
     $creditorAgentId = $doc->createElement('FinInstnId');
     $creditorAgentId->appendChild($doc->createElement('Nm', $this->creditorAgentName));
     $creditorAgentIdOther = $doc->createElement('Othr');
     $creditorAgentIdOther->appendChild($doc->createElement('Id', $this->creditorAgentPostal->format()));
     $creditorAgentId->appendChild($creditorAgentIdOther);
     $creditorAgent->appendChild($creditorAgentId);
     $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;
 }
 /**
  * @dataProvider validSamples
  * @covers \Z38\SwissPayment\PostalAccount::format
  */
 public function testFormat($postalAccount)
 {
     $instance = new PostalAccount($postalAccount);
     $this->assertEquals($postalAccount, $instance->format());
 }