From d94129dab0e5599c636ef99c91994afc1dd3c808 Mon Sep 17 00:00:00 2001 From: ampaze Date: Mon, 1 Sep 2025 12:19:59 +0200 Subject: [PATCH 1/3] Better support for new pain formats --- lib/Fhp/Action/SendSEPARealtimeTransfer.php | 23 +++++++++++++++++---- lib/Fhp/Action/SendSEPATransfer.php | 16 +++++++++++--- 2 files changed, 32 insertions(+), 7 deletions(-) diff --git a/lib/Fhp/Action/SendSEPARealtimeTransfer.php b/lib/Fhp/Action/SendSEPARealtimeTransfer.php index 1180124f..af790837 100644 --- a/lib/Fhp/Action/SendSEPARealtimeTransfer.php +++ b/lib/Fhp/Action/SendSEPARealtimeTransfer.php @@ -58,10 +58,25 @@ protected function createRequest(BPD $bpd, ?UPD $upd) /** @var HIIPZSv1|HIIPZSv2 $hiipzs */ $hiipzs = $bpd->requireLatestSupportedParameters('HIIPZS'); - /** @var HISPAS $hispas */ - $hispas = $bpd->requireLatestSupportedParameters('HISPAS'); - $supportedSchemas = $hispas->getParameter()->getUnterstuetzteSepaDatenformate(); - if (!in_array($this->xmlSchema, $supportedSchemas)) { + $supportedSchemas = $hiipzs->parameter->unterstuetzteSEPADatenformate; + + // If there are no SEPA formats available in the HIIPZS Parameters, we look to the general formats + if (is_null($supportedSchemas)) { + /** @var HISPAS $hispas */ + $hispas = $bpd->requireLatestSupportedParameters('HISPAS'); + $supportedSchemas = $hispas->getParameter()->getUnterstuetzteSepaDatenformate(); + } + + // Sometimes the Bank reports supported schemas with a "_GBIC_X" prefix. + // GIBC_X stands for German Banking Industry Committee and a version counter. + $xmlSchema = $this->xmlSchema; + $matchingSchemas = array_filter($supportedSchemas, function($key) use ($xmlSchema) { + // For example urn:iso:std:iso:20022:tech:xsd:pain.001.001.09 from the xml matches + // urn:iso:std:iso:20022:tech:xsd:pain.001.001.09_GBIC_4 + return strpos($key, $xmlSchema) === 0; + }, ARRAY_FILTER_USE_KEY); + + if (count($matchingSchemas) > 0) { throw new UnsupportedException("The bank does not support the XML schema $this->xmlSchema, but only " . implode(', ', $supportedSchemas)); } diff --git a/lib/Fhp/Action/SendSEPATransfer.php b/lib/Fhp/Action/SendSEPATransfer.php index 463379d1..530983fc 100644 --- a/lib/Fhp/Action/SendSEPATransfer.php +++ b/lib/Fhp/Action/SendSEPATransfer.php @@ -52,13 +52,13 @@ protected function createRequest(BPD $bpd, ?UPD $upd) $numberOfTransactions = $xmlAsObject->CstmrCdtTrfInitn->GrpHdr->NbOfTxs; $hasReqdExDates = false; foreach ($xmlAsObject->CstmrCdtTrfInitn?->PmtInf as $pmtInfo) { - if (isset($pmtInfo->ReqdExctnDt) && $pmtInfo->ReqdExctnDt != '1999-01-01') { + // Checks for both, 1999-01-01 and
1999-01-01
+ if (isset($pmtInfo->ReqdExctnDt) && ($pmtInfo->ReqdExctnDt->Dt ?? $pmtInfo->ReqdExctnDt) != '1999-01-01') { $hasReqdExDates = true; break; } } - //NOW READ OUT, WICH SEGMENT SHOULD BE USED: if ($numberOfTransactions > 1 && $hasReqdExDates) { @@ -89,7 +89,17 @@ protected function createRequest(BPD $bpd, ?UPD $upd) /** @var HISPAS $hispas */ $parameters = $bpd->requireLatestSupportedParameters('HISPAS'); $supportedSchemas = $parameters->getParameter()->getUnterstuetzteSepaDatenformate(); - if (!in_array($this->xmlSchema, $supportedSchemas)) { + + // Sometimes the Bank reports supported schemas with a "_GBIC_X" prefix. + // GIBC_X stands for German Banking Industry Committee and a version counter. + $xmlSchema = $this->xmlSchema; + $matchingSchemas = array_filter($supportedSchemas, function($key) use ($xmlSchema) { + // For example urn:iso:std:iso:20022:tech:xsd:pain.001.001.09 from the xml matches + // urn:iso:std:iso:20022:tech:xsd:pain.001.001.09_GBIC_4 + return strpos($key, $xmlSchema) === 0; + }, ARRAY_FILTER_USE_KEY); + + if (count($matchingSchemas) > 0) { throw new UnsupportedException("The bank does not support the XML schema $this->xmlSchema, but only " . implode(', ', $supportedSchemas)); } From 7af5869b226e028a2fc7bd19bb94c438ccd18530 Mon Sep 17 00:00:00 2001 From: ampaze Date: Mon, 1 Sep 2025 12:38:38 +0200 Subject: [PATCH 2/3] Better support for new pain formats --- lib/Fhp/Action/SendSEPADirectDebit.php | 11 ++++++++++- lib/Fhp/Action/SendSEPARealtimeTransfer.php | 4 ++-- lib/Fhp/Action/SendSEPATransfer.php | 4 ++-- 3 files changed, 14 insertions(+), 5 deletions(-) diff --git a/lib/Fhp/Action/SendSEPADirectDebit.php b/lib/Fhp/Action/SendSEPADirectDebit.php index 6452c508..a4dcbe6e 100644 --- a/lib/Fhp/Action/SendSEPADirectDebit.php +++ b/lib/Fhp/Action/SendSEPADirectDebit.php @@ -148,7 +148,16 @@ protected function createRequest(BPD $bpd, ?UPD $upd) $supportedPainNamespaces = $hispas->getParameter()->getUnterstuetzteSepaDatenformate(); } - if (!in_array($this->painNamespace, $supportedPainNamespaces)) { + // Sometimes the Bank reports supported schemas with a "_GBIC_X" postfix. + // GIBC_X stands for German Banking Industry Committee and a version counter. + $xmlSchema = $this->painNamespace; + $matchingSchemas = array_filter($supportedPainNamespaces, function($key) use ($xmlSchema) { + // For example urn:iso:std:iso:20022:tech:xsd:pain.008.001.08 from the xml matches + // urn:iso:std:iso:20022:tech:xsd:pain.008.001.08_GBIC_4 + return strpos($key, $xmlSchema) === 0; + }, ARRAY_FILTER_USE_KEY); + + if (count($matchingSchemas) > 0) { throw new UnsupportedException("The bank does not support the XML schema $this->painNamespace, but only " . implode(', ', $supportedPainNamespaces)); } diff --git a/lib/Fhp/Action/SendSEPARealtimeTransfer.php b/lib/Fhp/Action/SendSEPARealtimeTransfer.php index af790837..75eaaf2a 100644 --- a/lib/Fhp/Action/SendSEPARealtimeTransfer.php +++ b/lib/Fhp/Action/SendSEPARealtimeTransfer.php @@ -67,8 +67,8 @@ protected function createRequest(BPD $bpd, ?UPD $upd) $supportedSchemas = $hispas->getParameter()->getUnterstuetzteSepaDatenformate(); } - // Sometimes the Bank reports supported schemas with a "_GBIC_X" prefix. - // GIBC_X stands for German Banking Industry Committee and a version counter. + // Sometimes the Bank reports supported schemas with a "_GBIC_X" postfix. + // GIBC_X stands for German Banking Industry Committee and a version counter. $xmlSchema = $this->xmlSchema; $matchingSchemas = array_filter($supportedSchemas, function($key) use ($xmlSchema) { // For example urn:iso:std:iso:20022:tech:xsd:pain.001.001.09 from the xml matches diff --git a/lib/Fhp/Action/SendSEPATransfer.php b/lib/Fhp/Action/SendSEPATransfer.php index 530983fc..74ca31b6 100644 --- a/lib/Fhp/Action/SendSEPATransfer.php +++ b/lib/Fhp/Action/SendSEPATransfer.php @@ -90,8 +90,8 @@ protected function createRequest(BPD $bpd, ?UPD $upd) $parameters = $bpd->requireLatestSupportedParameters('HISPAS'); $supportedSchemas = $parameters->getParameter()->getUnterstuetzteSepaDatenformate(); - // Sometimes the Bank reports supported schemas with a "_GBIC_X" prefix. - // GIBC_X stands for German Banking Industry Committee and a version counter. + // Sometimes the Bank reports supported schemas with a "_GBIC_X" postfix. + // GIBC_X stands for German Banking Industry Committee and a version counter. $xmlSchema = $this->xmlSchema; $matchingSchemas = array_filter($supportedSchemas, function($key) use ($xmlSchema) { // For example urn:iso:std:iso:20022:tech:xsd:pain.001.001.09 from the xml matches From 43d321c9da09685d6f1fc79298e767a890be2337 Mon Sep 17 00:00:00 2001 From: ampaze Date: Tue, 2 Sep 2025 09:12:00 +0200 Subject: [PATCH 3/3] Better support for new pain formats --- lib/Fhp/Action/SendSEPADirectDebit.php | 8 ++++---- lib/Fhp/Action/SendSEPARealtimeTransfer.php | 8 ++++---- lib/Fhp/Action/SendSEPATransfer.php | 8 ++++---- 3 files changed, 12 insertions(+), 12 deletions(-) diff --git a/lib/Fhp/Action/SendSEPADirectDebit.php b/lib/Fhp/Action/SendSEPADirectDebit.php index a4dcbe6e..b4ea99cb 100644 --- a/lib/Fhp/Action/SendSEPADirectDebit.php +++ b/lib/Fhp/Action/SendSEPADirectDebit.php @@ -151,13 +151,13 @@ protected function createRequest(BPD $bpd, ?UPD $upd) // Sometimes the Bank reports supported schemas with a "_GBIC_X" postfix. // GIBC_X stands for German Banking Industry Committee and a version counter. $xmlSchema = $this->painNamespace; - $matchingSchemas = array_filter($supportedPainNamespaces, function($key) use ($xmlSchema) { + $matchingSchemas = array_filter($supportedPainNamespaces, function($value) use ($xmlSchema) { // For example urn:iso:std:iso:20022:tech:xsd:pain.008.001.08 from the xml matches // urn:iso:std:iso:20022:tech:xsd:pain.008.001.08_GBIC_4 - return strpos($key, $xmlSchema) === 0; - }, ARRAY_FILTER_USE_KEY); + return str_starts_with($value, $xmlSchema); + }); - if (count($matchingSchemas) > 0) { + if (count($matchingSchemas) === 0) { throw new UnsupportedException("The bank does not support the XML schema $this->painNamespace, but only " . implode(', ', $supportedPainNamespaces)); } diff --git a/lib/Fhp/Action/SendSEPARealtimeTransfer.php b/lib/Fhp/Action/SendSEPARealtimeTransfer.php index 75eaaf2a..1dafb8b2 100644 --- a/lib/Fhp/Action/SendSEPARealtimeTransfer.php +++ b/lib/Fhp/Action/SendSEPARealtimeTransfer.php @@ -70,13 +70,13 @@ protected function createRequest(BPD $bpd, ?UPD $upd) // Sometimes the Bank reports supported schemas with a "_GBIC_X" postfix. // GIBC_X stands for German Banking Industry Committee and a version counter. $xmlSchema = $this->xmlSchema; - $matchingSchemas = array_filter($supportedSchemas, function($key) use ($xmlSchema) { + $matchingSchemas = array_filter($supportedSchemas, function($value) use ($xmlSchema) { // For example urn:iso:std:iso:20022:tech:xsd:pain.001.001.09 from the xml matches // urn:iso:std:iso:20022:tech:xsd:pain.001.001.09_GBIC_4 - return strpos($key, $xmlSchema) === 0; - }, ARRAY_FILTER_USE_KEY); + return str_starts_with($value, $xmlSchema); + }); - if (count($matchingSchemas) > 0) { + if (count($matchingSchemas) === 0) { throw new UnsupportedException("The bank does not support the XML schema $this->xmlSchema, but only " . implode(', ', $supportedSchemas)); } diff --git a/lib/Fhp/Action/SendSEPATransfer.php b/lib/Fhp/Action/SendSEPATransfer.php index 74ca31b6..477bcbeb 100644 --- a/lib/Fhp/Action/SendSEPATransfer.php +++ b/lib/Fhp/Action/SendSEPATransfer.php @@ -93,13 +93,13 @@ protected function createRequest(BPD $bpd, ?UPD $upd) // Sometimes the Bank reports supported schemas with a "_GBIC_X" postfix. // GIBC_X stands for German Banking Industry Committee and a version counter. $xmlSchema = $this->xmlSchema; - $matchingSchemas = array_filter($supportedSchemas, function($key) use ($xmlSchema) { + $matchingSchemas = array_filter($supportedSchemas, function($value) use ($xmlSchema) { // For example urn:iso:std:iso:20022:tech:xsd:pain.001.001.09 from the xml matches // urn:iso:std:iso:20022:tech:xsd:pain.001.001.09_GBIC_4 - return strpos($key, $xmlSchema) === 0; - }, ARRAY_FILTER_USE_KEY); + return str_starts_with($value, $xmlSchema); + }); - if (count($matchingSchemas) > 0) { + if (count($matchingSchemas) === 0) { throw new UnsupportedException("The bank does not support the XML schema $this->xmlSchema, but only " . implode(', ', $supportedSchemas)); }