Skip to content

Commit 573bd7a

Browse files
authored
Merge branch 'master' into feature/avoid-double-save-on-name-and-address-protected-submission
2 parents e040f16 + 2fb181d commit 573bd7a

File tree

2 files changed

+19
-2
lines changed

2 files changed

+19
-2
lines changed

CHANGELOG.md

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -12,6 +12,10 @@ before starting to add changes. Use example [placed in the end of the page](#exa
1212
## [Unreleased]
1313

1414
- Avoid double-saving submissions when handling name and address protection.
15+
- [PR-191](https://github.com/OS2Forms/os2forms/pull/191)
16+
Re-throws exception to ensure failed status during Maestro notification job.
17+
- [PR-202](https://github.com/OS2Forms/os2forms/pull/202)
18+
- Removed non-digits from recipient id in Maestro digital post notifications.
1519
- [PR-189](https://github.com/OS2Forms/os2forms/pull/189)
1620
- Added support for MeMo 1.2 and added additional validation of MeMo actions.
1721

modules/os2forms_forloeb/src/MaestroHelper.php

Lines changed: 15 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -205,7 +205,14 @@ public function processJob(Job $job): JobResult {
205205

206206
$submission = $this->webformSubmissionStorage->load($submissionID);
207207

208-
$this->sendNotification($notificationType, $submission, $templateTask, $maestroQueueID);
208+
try {
209+
$this->sendNotification($notificationType, $submission, $templateTask, $maestroQueueID);
210+
}
211+
catch (\Exception $e) {
212+
// Logging is done by the sendNotification method.
213+
// The job should be considered failed.
214+
return JobResult::failure($e->getMessage());
215+
}
209216

210217
return JobResult::success();
211218
}
@@ -261,12 +268,15 @@ private function sendNotification(
261268
}
262269
}
263270
catch (\Exception $exception) {
271+
// Log with context and rethrow exception.
264272
$this->error('Error sending notification: @message', $context + [
265273
'@message' => $exception->getMessage(),
266274
'handler_id' => 'os2forms_forloeb',
267275
'operation' => 'notification failed',
268276
'exception' => $exception,
269277
]);
278+
279+
throw $exception;
270280
}
271281
}
272282

@@ -389,7 +399,10 @@ private function sendNotificationDigitalPost(
389399
$senderLabel = $subject;
390400
$messageLabel = $subject;
391401

392-
$recipientLookupResult = $this->digitalPostHelper->lookupRecipient($recipient);
402+
// Remove all non-digits from recipient identifier.
403+
$recipientIdentifier = preg_replace('/[^\d]+/', '', $recipient);
404+
405+
$recipientLookupResult = $this->digitalPostHelper->lookupRecipient($recipientIdentifier);
393406
$actions = [
394407
(new Action())
395408
->setActionCode(SF1601::ACTION_SELVBETJENING)

0 commit comments

Comments
 (0)