fix: drop errors in form submissions to myep api silently
This commit is contained in:
@@ -23,16 +23,31 @@ class BpnApiFinisher extends AbstractFinisher
|
||||
|
||||
protected function executeInternal()
|
||||
{
|
||||
$values = [];
|
||||
$formValues = $this->finisherContext->getFormValues();
|
||||
$mappingOption = $this->parseOption('mapping');
|
||||
$mappings = GeneralUtility::trimExplode(',', $mappingOption, true);
|
||||
foreach ($mappings as $mapping) {
|
||||
[$remote, $local] = GeneralUtility::trimExplode(':', $mapping);
|
||||
$values[$remote] = $formValues[$local];
|
||||
}
|
||||
if (count($values) > 0) {
|
||||
$this->apiClient->registerAddress($values);
|
||||
try {
|
||||
$values = [];
|
||||
$formValues = $this->finisherContext->getFormValues();
|
||||
$mappingOption = (string)$this->parseOption('mapping');
|
||||
$mappings = GeneralUtility::trimExplode(',', $mappingOption, true);
|
||||
|
||||
foreach ($mappings as $mapping) {
|
||||
$parts = GeneralUtility::trimExplode(':', $mapping, true, 2);
|
||||
if (2 !== count($parts)) {
|
||||
continue;
|
||||
}
|
||||
|
||||
[$remote, $local] = $parts;
|
||||
if ('' === $remote || '' === $local || false === array_key_exists($local, $formValues)) {
|
||||
continue;
|
||||
}
|
||||
|
||||
$values[$remote] = $formValues[$local];
|
||||
}
|
||||
|
||||
if ([] !== $values) {
|
||||
$this->apiClient->registerAddress($values);
|
||||
}
|
||||
} catch (\Throwable $e) {
|
||||
// Intentionally ignore all errors so the form submission stays silent.
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user