def getBillingPeriod()

in app/com/gu/memsub/subsv2/reads/ChargeListReads.scala [190:197]


    def getBillingPeriod(charges: List[ZuoraCharge]): ValidationNel[String, BillingPeriod] = {
      val billingPeriods = charges.flatMap(_.billingPeriod).distinct
      billingPeriods match {
        case Nil => Validation.failureNel("No billing period found")
        case b :: Nil => validateBillingPeriod(b)
        case _ => Validation.failureNel("Too many billing periods found")
      }
    }