Skip to content
This repository was archived by the owner on Jul 5, 2024. It is now read-only.
Open
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
2 changes: 1 addition & 1 deletion EventSubscriber/CallbackSubscriber.php
Original file line number Diff line number Diff line change
Expand Up @@ -58,7 +58,7 @@ public function processCallbackRequest(TransportWebhookEvent $event): void
$type = $messageEvent['type'] ?? null;
$bounceClass = $messageEvent['bounce_class'] ?? null;

if ('bounce' === $type && !in_array((int) $bounceClass, [10, 30, 50, 51, 52, 53, 54, 90])) {
if ('bounce' === $type && !in_array((int) $bounceClass, [10, 30, 50, 51, 52, 53, 54, 90]) || ('out_of_band' === $type && (int) $bounceClass === 60)) {
// Only parse hard bounces
// https://support.sparkpost.com/customer/portal/articles/1929896-bounce-classification-codes
continue;
Expand Down
32 changes: 32 additions & 0 deletions Tests/Functional/EventSubscriber/CallbackSubscriberTest.php
Original file line number Diff line number Diff line change
Expand Up @@ -198,4 +198,36 @@ private function getCommentAndReason(string $type): array
],
};
}

/**
* For the message with 'type': 'out of band' and 'bounce class': 60 should never be called transportCallback.
*/
public function testProcessCallbackRequestWhenSoftBounce(): void
{
$payload = <<<JSON
[
{
"msys": {
"message_event": {
"reason":"550 [internal] [oob] The message is an auto-reply/vacation mail.",
"msg_from":"msprvs1=18290qww0ygol=bounces-44585-172@bounces.mauticsparkt3.com",
"event_id":"13251575597141532",
"raw_reason":"550 [internal] [oob] The message is an auto-reply/vacation mail.",
"error_code":"550",
"subaccount_id":172,
"delv_method":"esmtp",
"customer_id":44585,
"type":"out_of_band",
"bounce_class":"60",
"timestamp":"2020-01-22T21:59:32.000Z"
}
}
}
]
JSON;
$request = new Request([], json_decode($payload, true));
$this->sparkpostTransport->processCallbackRequest($request);
$this->transportCallback->expects($this->never())
->method($this->anything());
}
}