in app/com/gu/memsub/promo/Promotion.scala [218:232]
def validateFor(prpId: ProductRatePlanId, country: Country, now: DateTime = DateTime.now()): PromoError \/ Unit =
toLegacyResponse(validateAll(Some(prpId), country, now))
def validate(country: Country, now: DateTime = DateTime.now()): PromoError \/ Unit = toLegacyResponse(validateAll(None, country, now))
def validateAll(prpId: Option[ProductRatePlanId] = None, country: Country, now: DateTime = DateTime.now()): Seq[PromoError] =
List(
prpId.find(pId => promotionType != Tracking && !appliesTo.productRatePlanIds.contains(pId)).map(_ => InvalidProductRatePlan),
(!appliesTo.countries.contains(country)).option(InvalidCountry),
starts.isAfter(now).option(PromotionNotActiveYet),
expires.find(e => e.isEqual(now) || e.isBefore(now)).map(_ => ExpiredPromotion)
).flatten
}
object CovariantIdObject {