def processMessage()

in payment-failure/src/main/scala/com/gu/identity/paymentfailure/LambdaService.scala [15:24]


  def processMessage(message: SQSMessage): Either[Throwable, BrazeResponse] =
    for {
      emailData <- sqsService.parseMessage[IdentityBrazeEmailData](message)
      brazeResponse <- brazeEmailService.sendEmail(emailData)
      // Deleting a message from the queue will mean that even if the lambda throws an error
      // to signify that not all messages in the event have been processed successfully,
      // messages that have been processed successfully will not be put back on the queue.
      result <- sqsService.deleteMessage(message)
      _ <- sqsService.processDeleteMessageResult(result)
    } yield brazeResponse