|
5 | 5 | use DigitalPost\MeMo\Message; |
6 | 6 | use Drupal\Core\Logger\LoggerChannelInterface; |
7 | 7 | use Drupal\os2forms_digital_post\Exception\RuntimeException; |
| 8 | +use Drupal\os2web_audit\Service\Logger; |
8 | 9 | use Drupal\os2web_datalookup\LookupResult\CompanyLookupResult; |
9 | 10 | use Drupal\os2web_datalookup\LookupResult\CprLookupResult; |
10 | 11 | use Drupal\os2web_datalookup\Plugin\DataLookupManager; |
@@ -35,6 +36,7 @@ public function __construct( |
35 | 36 | private readonly BeskedfordelerHelper $beskedfordelerHelper, |
36 | 37 | private readonly LoggerChannelInterface $logger, |
37 | 38 | private readonly LoggerChannelInterface $submissionLogger, |
| 39 | + private readonly Logger $auditLogger, |
38 | 40 | ) { |
39 | 41 | } |
40 | 42 |
|
@@ -64,13 +66,19 @@ public function sendDigitalPost(string $type, Message $message, ?ForsendelseI $f |
64 | 66 | ]; |
65 | 67 | $service = new SF1601($options); |
66 | 68 | $transactionId = Serializer::createUuid(); |
| 69 | + |
67 | 70 | $response = $service->kombiPostAfsend($transactionId, $type, $message, $forsendelse); |
68 | 71 |
|
69 | 72 | $content = (string) $response->getContent(); |
70 | 73 | if (NULL !== $submission) { |
71 | 74 | $this->beskedfordelerHelper->createMessage($submission->id(), $message, $content); |
72 | 75 | } |
73 | 76 |
|
| 77 | + // RecipientID should be the same in Message and Forsendelse, |
| 78 | + // so fetch it from Message as it is always set. |
| 79 | + $msg = sprintf('Sent digital post of type %s to %s', $type, $message->getMessageHeader()->getRecipient()->getRecipientID()); |
| 80 | + $this->auditLogger->info('DigitalPost', $msg); |
| 81 | + |
74 | 82 | return [$response, $service->getLastKombiMeMoMessage()]; |
75 | 83 | } |
76 | 84 |
|
|
0 commit comments