Skip to content

[Mailer] [Mailjet] Use body MessageID instead of X-MJ-Request-GUID #49992

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Closed
wants to merge 6 commits into from
Closed
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Original file line number Diff line number Diff line change
Expand Up @@ -102,15 +102,21 @@ public function testSendSuccess()
{
$json = json_encode([
'Messages' => [
'foo' => 'bar',
[
'Status' => 'success',
'To' => [
[
'Email' => 'passenger1@mailjet.com',
'MessageUUID' => '7c5f9f29-42ba-4959-b19c-dcd8b2f327ca',
'MessageID' => '576460756513665525',
'MessageHref' => 'https://api.mailjet.com/v3/message/576460756513665525',
],
],
],
],
]);

$responseHeaders = [
'x-mj-request-guid' => ['baz'],
];

$response = new MockResponse($json, ['response_headers' => $responseHeaders]);
$response = new MockResponse($json);

$client = new MockHttpClient($response);

Expand All @@ -124,7 +130,7 @@ public function testSendSuccess()

$sentMessage = $transport->send($email);
$this->assertInstanceOf(SentMessage::class, $sentMessage);
$this->assertSame('baz', $sentMessage->getMessageId());
$this->assertSame('576460756513665525', $sentMessage->getMessageId());
}

public function testSendWithDecodingException()
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -85,7 +85,7 @@ protected function doSendApi(SentMessage $sentMessage, Email $email, Envelope $e
throw new HttpTransportException(sprintf('Unable to send an email: "%s" malformed api response.', $response->getContent(false)), $response);
}

$sentMessage->setMessageId($response->getHeaders(false)['x-mj-request-guid'][0]);
$sentMessage->setMessageId($result['Messages'][0]['To'][0]['MessageID'] ?? '');

return $response;
}
Expand Down