Esempio n. 1
0
 /**
  * {@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;
 }
Esempio n. 2
0
 /**
  * {@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;
 }
Esempio n. 3
0
 /**
  * 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;
 }
Esempio n. 4
0
 /**
  * @depends testFormat
  * @dataProvider samplesValid
  * @covers \Z38\SwissPayment\IBAN::__toString
  */
 public function testToString($iban)
 {
     $instance = new IBAN($iban);
     $this->assertEquals($instance->format(), (string) $instance);
 }