def apply()

in membership-attribute-service/app/models/SelfServiceCancellation.scala [24:51]


  def apply(product: Product, billingCountry: Option[Country]): SelfServiceCancellation = {

    if (isOneOf(product, Membership, Contribution, SupporterPlus, Digipack, TierThree, AdLite)) {
      SelfServiceCancellation(
        isAllowed = true,
        shouldDisplayEmail = true,
        phoneRegionsToDisplay = allPhones,
      )
    } else if (billingCountry.contains(UK)) {
      SelfServiceCancellation(
        isAllowed = false,
        shouldDisplayEmail = false,
        phoneRegionsToDisplay = List(ukRowPhone),
      )
    } else if (isOneOf(billingCountry, US, Canada)) {
      SelfServiceCancellation(
        isAllowed = true,
        shouldDisplayEmail = true,
        phoneRegionsToDisplay = List(usaPhone),
      )
    } else {
      SelfServiceCancellation(
        isAllowed = true,
        shouldDisplayEmail = true,
        phoneRegionsToDisplay = allPhones,
      )
    }
  }