com.gu.config.LegacyMembershipRatePlanIds.scala Maven / Gradle / Ivy
Go to download
Show more of this group Show more artifacts with this name
Show all versions of membership-common_2.12 Show documentation
Show all versions of membership-common_2.12 Show documentation
Scala library for common Guardian Membership/Subscriptions functionality.
package com.gu.config
import com.gu.memsub.Subscription.ProductRatePlanId
case class LegacyMembershipRatePlanIds(friend: ProductRatePlanId,
supporterMonthly: ProductRatePlanId,
supporterYearly: ProductRatePlanId,
partnerMonthly: ProductRatePlanId,
partnerYearly: ProductRatePlanId,
patronMonthly: ProductRatePlanId,
patronYearly: ProductRatePlanId) {
val productRatePlanIds = Set(
friend,
supporterMonthly,
supporterYearly,
partnerMonthly,
partnerYearly,
patronMonthly,
patronYearly
)
}
object LegacyMembershipRatePlanIds {
def fromConfig(config: com.typesafe.config.Config) = {
def prpId(s: String) = ProductRatePlanId(s)
LegacyMembershipRatePlanIds(
friend = prpId(config.getString("friend")),
supporterMonthly = prpId(config.getString("supporter.monthly")),
supporterYearly = prpId(config.getString("supporter.yearly")),
partnerMonthly = prpId(config.getString("partner.monthly")),
partnerYearly = prpId(config.getString("partner.yearly")),
patronMonthly = prpId(config.getString("patron.monthly")),
patronYearly = prpId(config.getString("patron.yearly"))
)
}
}