8000 bug #53824 [Mailer][Postmark][Webhook] Don't require tag and metadata… · symfony/symfony@8f98550 · GitHub
[go: up one dir, main page]

Skip to content

Commit 8f98550

Browse files
bug #53824 [Mailer][Postmark][Webhook] Don't require tag and metadata (aleho)
This PR was merged into the 6.4 branch. Discussion ---------- [Mailer][Postmark][Webhook] Don't require tag and metadata | Q | A | ------------- | --- | Branch? | 6.4 | Bug fix? | yes | New feature? | no | Deprecations? | no | License | MIT Postmark webhooks will fail if metadata or tag are missing. As both are optional they should not be required in parsing as well. This was observed in our setup with all webhooks failing because `Tag` was missing. Commits ------- 7127ede [Mailer][Postmark][Webhook] Don't require tag and metadata
2 parents 5c275fe + 7127ede commit 8f98550

File tree

2 files changed

+7
-4
lines changed

2 files changed

+7
-4
lines changed

src/Symfony/Component/Mailer/Bridge/Postmark/RemoteEvent/PostmarkPayloadConverter.php

Lines changed: 7 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -52,8 +52,13 @@ public function convert(array $payload): AbstractMailerEvent
5252
}
5353
$event->setDate($date);
5454
$event->setRecipientEmail($payload['Recipient'] ?? $payload['Email']);
55-
$event->setMetadata($payload['Metadata']);
56-
$event->setTags([$payload['Tag']]);
55+
56+
if (isset($payload['Metadata'])) {
57+
$event->setMetadata($payload['Metadata']);
58+
}
59+
if (isset($payload['Tag'])) {
60+
$event->setTags([$payload['Tag']]);
61+
}
5762

5863
return $event;
5964
}

src/Symfony/Component/Mailer/Bridge/Postmark/Webhook/PostmarkRequestParser.php

Lines changed: 0 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -48,8 +48,6 @@ protected function doParse(Request $request, #[\SensitiveParameter] string $secr
4848
!isset($payload['RecordType'])
4949
|| !isset($payload['MessageID'])
5050
|| !(isset($payload['Recipient']) || isset($payload['Email']))
51-
|| !isset($payload['Metadata'])
52-
|| !isset($payload['Tag'])
5351
) {
5452
throw new RejectWebhookException(406, 'Payload is malformed.');
5553
}

0 commit comments

Comments
 (0)
0