private def augmentRecordsWithBrazeId()

in src/main/scala/payment_failure_comms/Handler.scala [95:103]


  private def augmentRecordsWithBrazeId(findBrazeId: PaymentFailureRecord => Option[String])(
      records: Seq[PaymentFailureRecord]
  ): PartitionedRecords =
    records.foldLeft(PartitionedRecords(Nil, Nil))((acc, record) =>
      findBrazeId(record) match {
        case None => acc.copy(withoutBrazeId = acc.withoutBrazeId :+ record)
        case Some(brazeId) =>
          acc.copy(withBrazeId = acc.withBrazeId :+ PaymentFailureRecordWithBrazeId(record, brazeId))
      }