in handlers/new-product-api/src/main/scala/com/gu/newproduct/api/productcatalog/NewProductApi.scala [11:31]
private def paymentPlansFor(
billingPeriod: BillingPeriod,
pricesByCurrency: Map[Currency, AmountMinorUnits],
): Map[Currency, PaymentPlan] = {
val billingPeriodDescription = billingPeriod match {
case Monthly => "every month"
case Quarterly => "every 3 months"
case Annual => "every 12 months"
case SixWeeks => "for the first six weeks"
}
pricesByCurrency.map { case (currency, amount) =>
currency ->
PaymentPlan(
currency = currency,
amountMinorUnits = amount,
billingPeriod = billingPeriod,
description = s"${currency.iso} ${amount.formatted} $billingPeriodDescription",
)
}
}