diff --git a/src/Decoder/EntryTransactionDetail.php b/src/Decoder/EntryTransactionDetail.php index da85926..630ec89 100644 --- a/src/Decoder/EntryTransactionDetail.php +++ b/src/Decoder/EntryTransactionDetail.php @@ -198,17 +198,13 @@ public function addRemittanceInformation(DTO\EntryTransactionDetail $detail, Sim ); } - if (isset($xmlDetailsStructuredBlock->CdtrRefInf->Tp, $xmlDetailsStructuredBlock->CdtrRefInf->Tp->CdOrPrtry, $xmlDetailsStructuredBlock->CdtrRefInf->Tp->CdOrPrtry->Prtry) - - ) { + if (isset($xmlDetailsStructuredBlock->CdtrRefInf->Tp, $xmlDetailsStructuredBlock->CdtrRefInf->Tp->CdOrPrtry, $xmlDetailsStructuredBlock->CdtrRefInf->Tp->CdOrPrtry->Prtry)) { $creditorReferenceInformation->setProprietary( (string) $xmlDetailsStructuredBlock->CdtrRefInf->Tp->CdOrPrtry->Prtry ); } - if (isset($xmlDetailsStructuredBlock->CdtrRefInf->Tp, $xmlDetailsStructuredBlock->CdtrRefInf->Tp->CdOrPrtry, $xmlDetailsStructuredBlock->CdtrRefInf->Tp->CdOrPrtry->Cd) - - ) { + if (isset($xmlDetailsStructuredBlock->CdtrRefInf->Tp, $xmlDetailsStructuredBlock->CdtrRefInf->Tp->CdOrPrtry, $xmlDetailsStructuredBlock->CdtrRefInf->Tp->CdOrPrtry->Cd)) { $creditorReferenceInformation->setCode( (string) $xmlDetailsStructuredBlock->CdtrRefInf->Tp->CdOrPrtry->Cd ); @@ -218,8 +214,10 @@ public function addRemittanceInformation(DTO\EntryTransactionDetail $detail, Sim // Legacy : do not overwrite message if already defined above // and no creditor reference is already defined - if (false === $unstructuredBlockExists - && $remittanceInformation->getCreditorReferenceInformation() === null) { + if ( + false === $unstructuredBlockExists + && $remittanceInformation->getCreditorReferenceInformation() === null + ) { $remittanceInformation->setCreditorReferenceInformation($creditorReferenceInformation); } } @@ -362,6 +360,6 @@ abstract public function getRelatedPartyAccount(?SimpleXMLElement $xmlRelatedPar */ protected function getAgentBic(SimpleXMLElement $xmlAgent): ?SimpleXMLElement { - return $xmlAgent->FinInstnId->BIC; + return $xmlAgent->FinInstnId->BIC ?? $xmlAgent->FinInstnId->BICFI; } } diff --git a/test/data/camt052.v4.json b/test/data/camt052.v4.json index eb08709..6375399 100644 --- a/test/data/camt052.v4.json +++ b/test/data/camt052.v4.json @@ -180,7 +180,7 @@ "__CLASS__": "Genkgo\\Camt\\DTO\\RelatedAgent", "getRelatedAgentType": { "__CLASS__": "Genkgo\\Camt\\DTO\\CreditorAgent", - "getBIC": "", + "getBIC": "BANKCHZHXXX", "getName": "" } }, @@ -190,7 +190,7 @@ "__CLASS__": "Genkgo\\Camt\\DTO\\RelatedAgent", "getRelatedAgentType": { "__CLASS__": "Genkgo\\Camt\\DTO\\DebtorAgent", - "getBIC": "", + "getBIC": "BANKCHBE", "getName": "" } } diff --git a/test/data/camt052.v6.json b/test/data/camt052.v6.json index f80ef45..9bb97e8 100644 --- a/test/data/camt052.v6.json +++ b/test/data/camt052.v6.json @@ -180,7 +180,7 @@ "__CLASS__": "Genkgo\\Camt\\DTO\\RelatedAgent", "getRelatedAgentType": { "__CLASS__": "Genkgo\\Camt\\DTO\\CreditorAgent", - "getBIC": "", + "getBIC": "BANKCHZHXXX", "getName": "" } }, @@ -190,7 +190,7 @@ "__CLASS__": "Genkgo\\Camt\\DTO\\RelatedAgent", "getRelatedAgentType": { "__CLASS__": "Genkgo\\Camt\\DTO\\DebtorAgent", - "getBIC": "", + "getBIC": "BANKCHBE", "getName": "" } } diff --git a/test/data/camt053.v3.json b/test/data/camt053.v3.json index e983811..5e7ce2d 100644 --- a/test/data/camt053.v3.json +++ b/test/data/camt053.v3.json @@ -184,7 +184,7 @@ "__CLASS__": "Genkgo\\Camt\\DTO\\RelatedAgent", "getRelatedAgentType": { "__CLASS__": "Genkgo\\Camt\\DTO\\CreditorAgent", - "getBIC": "", + "getBIC": "KREDBEBB", "getName": "" } }, @@ -194,7 +194,7 @@ "__CLASS__": "Genkgo\\Camt\\DTO\\RelatedAgent", "getRelatedAgentType": { "__CLASS__": "Genkgo\\Camt\\DTO\\DebtorAgent", - "getBIC": "", + "getBIC": "KREDBEBB", "getName": "" } }