diff --git a/lib/Digitick/Sepa/DomBuilder/BaseDomBuilder.php b/lib/Digitick/Sepa/DomBuilder/BaseDomBuilder.php index 9267035..e5325a7 100644 --- a/lib/Digitick/Sepa/DomBuilder/BaseDomBuilder.php +++ b/lib/Digitick/Sepa/DomBuilder/BaseDomBuilder.php @@ -28,6 +28,7 @@ abstract class BaseDomBuilder implements DomBuilderInterface { const INITIAL_STRING = ''; + const BIC_NOT_PROVIDED ='NOTPROVIDED'; protected $doc; @@ -112,8 +113,13 @@ public function visitGroupHeader(GroupHeader $groupHeader) { */ protected function getFinancialInstitutionElement($bic) { $finInstitution = $this->createElement('FinInstnId'); - $finInstitution->appendChild($this->createElement('BIC', $bic)); - + if (!isset($bic) || trim($bic)==='') { + $other = $this->createElement ( 'Othr' ); + $id = $this->createElement ( 'Id', self::BIC_NOT_PROVIDED ); + $other->appendChild ( $id ); + $finInstitution->appendChild ( $other ); + } else + $finInstitution->appendChild ( $this->createElement ( 'BIC', $bic ) ); return $finInstitution; } @@ -140,4 +146,4 @@ public function getRemittenceElement($remittenceInformation) { return $remittanceInformation; } -} \ No newline at end of file +}