diff --git a/EventSubscriber/CallbackSubscriber.php b/EventSubscriber/CallbackSubscriber.php index fdc0743..cbc2f55 100644 --- a/EventSubscriber/CallbackSubscriber.php +++ b/EventSubscriber/CallbackSubscriber.php @@ -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; diff --git a/Tests/Functional/EventSubscriber/CallbackSubscriberTest.php b/Tests/Functional/EventSubscriber/CallbackSubscriberTest.php index f426233..4bfea3d 100644 --- a/Tests/Functional/EventSubscriber/CallbackSubscriberTest.php +++ b/Tests/Functional/EventSubscriber/CallbackSubscriberTest.php @@ -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 = <<sparkpostTransport->processCallbackRequest($request); + $this->transportCallback->expects($this->never()) + ->method($this->anything()); + } }