Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
11 changes: 10 additions & 1 deletion lib/Fhp/Action/SendSEPADirectDebit.php
Original file line number Diff line number Diff line change
Expand Up @@ -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($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 str_starts_with($value, $xmlSchema);
});

if (count($matchingSchemas) === 0) {
throw new UnsupportedException("The bank does not support the XML schema $this->painNamespace, but only "
. implode(', ', $supportedPainNamespaces));
}
Expand Down
23 changes: 19 additions & 4 deletions lib/Fhp/Action/SendSEPARealtimeTransfer.php
Original file line number Diff line number Diff line change
Expand Up @@ -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" postfix.
// GIBC_X stands for German Banking Industry Committee and a version counter.
$xmlSchema = $this->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 str_starts_with($value, $xmlSchema);
});

if (count($matchingSchemas) === 0) {
throw new UnsupportedException("The bank does not support the XML schema $this->xmlSchema, but only "
. implode(', ', $supportedSchemas));
}
Expand Down
16 changes: 13 additions & 3 deletions lib/Fhp/Action/SendSEPATransfer.php
Original file line number Diff line number Diff line change
Expand Up @@ -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, <ReqdExctnDt>1999-01-01</ReqdExctnDt> and <ReqdExctnDt><Dt>1999-01-01</Dt></ReqdExctnDt>
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) {

Expand Down Expand Up @@ -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" postfix.
// GIBC_X stands for German Banking Industry Committee and a version counter.
$xmlSchema = $this->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 str_starts_with($value, $xmlSchema);
});

if (count($matchingSchemas) === 0) {
throw new UnsupportedException("The bank does not support the XML schema $this->xmlSchema, but only "
. implode(', ', $supportedSchemas));
}
Expand Down