public function __construct( private readonly PostmarkPayloadConverter
$converter,
) { } protected function getRequestMatcher(): RequestMatcherInterface
{ return new ChainRequestMatcher([ new MethodRequestMatcher('POST'
),
// https://postmarkapp.com/support/article/800-ips-for-firewalls#webhooks
// localhost is added for testing
new IpsRequestMatcher(['3.134.147.250', '50.31.156.6', '50.31.156.77', '18.217.206.57', '127.0.0.1'
]),
new IsJsonRequestMatcher(),
]);
} protected function doParse(Request
$request, string
$secret): ?AbstractMailerEvent
{ $payload =
$request->
toArray();
if ( !
isset($payload['RecordType'
]) || !
isset($payload['MessageID'
]) || !
(isset($payload['Recipient'
]) ||
isset($payload['Email'
]))