@@ -52,13 +52,13 @@ protected function createRequest(BPD $bpd, ?UPD $upd)
5252 $ numberOfTransactions = $ xmlAsObject ->CstmrCdtTrfInitn ->GrpHdr ->NbOfTxs ;
5353 $ hasReqdExDates = false ;
5454 foreach ($ xmlAsObject ->CstmrCdtTrfInitn ?->PmtInf as $ pmtInfo ) {
55- if (isset ($ pmtInfo ->ReqdExctnDt ) && $ pmtInfo ->ReqdExctnDt != '1999-01-01 ' ) {
55+ // Checks for both, <ReqdExctnDt>1999-01-01</ReqdExctnDt> and <ReqdExctnDt><Dt>1999-01-01</Dt></ReqdExctnDt>
56+ if (isset ($ pmtInfo ->ReqdExctnDt ) && ($ pmtInfo ->ReqdExctnDt ->Dt ?? $ pmtInfo ->ReqdExctnDt ) != '1999-01-01 ' ) {
5657 $ hasReqdExDates = true ;
5758 break ;
5859 }
5960 }
6061
61-
6262 //NOW READ OUT, WICH SEGMENT SHOULD BE USED:
6363 if ($ numberOfTransactions > 1 && $ hasReqdExDates ) {
6464
@@ -89,7 +89,17 @@ protected function createRequest(BPD $bpd, ?UPD $upd)
8989 /** @var HISPAS $hispas */
9090 $ parameters = $ bpd ->requireLatestSupportedParameters ('HISPAS ' );
9191 $ supportedSchemas = $ parameters ->getParameter ()->getUnterstuetzteSepaDatenformate ();
92- if (!in_array ($ this ->xmlSchema , $ supportedSchemas )) {
92+
93+ // Sometimes the Bank reports supported schemas with a "_GBIC_X" postfix.
94+ // GIBC_X stands for German Banking Industry Committee and a version counter.
95+ $ xmlSchema = $ this ->xmlSchema ;
96+ $ matchingSchemas = array_filter ($ supportedSchemas , function ($ value ) use ($ xmlSchema ) {
97+ // For example urn:iso:std:iso:20022:tech:xsd:pain.001.001.09 from the xml matches
98+ // urn:iso:std:iso:20022:tech:xsd:pain.001.001.09_GBIC_4
99+ return str_starts_with ($ value , $ xmlSchema );
100+ });
101+
102+ if (count ($ matchingSchemas ) === 0 ) {
93103 throw new UnsupportedException ("The bank does not support the XML schema $ this ->xmlSchema , but only "
94104 . implode (', ' , $ supportedSchemas ));
95105 }
0 commit comments