in src/main/scala/housekeeper/Lambda.scala [18:33]
def handleBounce(bounceNotification: BounceNotification): Future[_] = {
val bounce = bounceNotification.bounce
logger.info(Map(
"bounce.type" -> bounce.bounceType,
"bounce.subtype" -> bounce.bounceSubType,
"bounce.permanent" -> bounce.isPermanent,
"bounce.mail.source" -> bounceNotification.senderOfBouncedEmail,
"bounce.bouncedEmailAddresses" -> bounceNotification.bouncedAddresses.asJava
), bounceNotification.bounceSummary)
if (bounce.isPermanent) {
val deletionF = Future.traverse(bounceNotification.bouncedAddresses)(alertDeletion.deleteAllAlertsForEmailAddress)
val notificationF = alertDevsIfEmailWasSuppressed(bounceNotification)
for { _ <- deletionF; _ <- notificationF } yield ()
} else Future.successful(())
}