Skip to content

Commit

Permalink
Merge pull request #1079 from guardian/ph-20240926-1413-legacy
Browse files Browse the repository at this point in the history
Rename migration type Legacy into Default
  • Loading branch information
shtukas authored Sep 26, 2024
2 parents 32923d6 + 6e61f30 commit 134f148
Show file tree
Hide file tree
Showing 6 changed files with 12 additions and 23 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -95,7 +95,7 @@ object AmendmentHandler extends CohortHandler {
case Newspaper2024 => true
case GW2024 => true
case SupporterPlus2024 => false
case Legacy => true
case Default => true
}
}

Expand Down Expand Up @@ -161,7 +161,7 @@ object AmendmentHandler extends CohortHandler {
SupporterPlus2024Migration.priceCap
)
)
case Legacy =>
case Default =>
ZIO.fromEither(
ZuoraSubscriptionUpdate
.zuoraUpdate(
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -145,7 +145,7 @@ object NotificationHandler extends CohortHandler {
currencySymbol <- currencyISOtoSymbol(currencyISOCode)

priceWithOptionalCappingWithCurrencySymbol = MigrationType(cohortSpec) match {
case Legacy => s"${currencySymbol}${PriceCap.priceCapLegacy(oldPrice, estimatedNewPrice)}"
case Default => s"${currencySymbol}${PriceCap.priceCapLegacy(oldPrice, estimatedNewPrice)}"
case DigiSubs2023 => s"${currencySymbol}${estimatedNewPrice}"
case Newspaper2024 => s"${currencySymbol}${estimatedNewPrice}"
case GW2024 =>
Expand Down Expand Up @@ -290,7 +290,7 @@ object NotificationHandler extends CohortHandler {
case Newspaper2024 => newspaper2024Migration.StaticData.maxLeadTime
case GW2024 => GW2024Migration.maxLeadTime
case SupporterPlus2024 => SupporterPlus2024Migration.maxLeadTime
case Legacy => 49
case Default => 49
}
}

Expand All @@ -300,7 +300,7 @@ object NotificationHandler extends CohortHandler {
case Newspaper2024 => newspaper2024Migration.StaticData.minLeadTime
case GW2024 => GW2024Migration.minLeadTime
case SupporterPlus2024 => SupporterPlus2024Migration.minLeadTime
case Legacy => 35
case Default => 35
}
}

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -86,7 +86,7 @@ object SalesforcePriceRiseCreationHandler extends CohortHandler {
case Newspaper2024 => estimatedNewPrice
case GW2024 => PriceCap.priceCapForNotification(oldPrice, estimatedNewPrice, GW2024Migration.priceCap)
case SupporterPlus2024 => estimatedNewPrice // [1]
case Legacy => PriceCap.priceCapLegacy(oldPrice, estimatedNewPrice)
case Default => PriceCap.priceCapLegacy(oldPrice, estimatedNewPrice)
}
// [1]
// (Comment group: 7992fa98)
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -293,7 +293,7 @@ object AmendmentData {
case Newspaper2024 => newspaper2024Migration.Estimation.priceData(subscription)
case GW2024 => GW2024Migration.priceData(subscription, account)
case SupporterPlus2024 => SupporterPlus2024Migration.priceData(subscription)
case Legacy => priceDataWithRatePlanMatching(account, catalogue, subscription, invoiceList, nextServiceStartDate)
case Default => priceDataWithRatePlanMatching(account, catalogue, subscription, invoiceList, nextServiceStartDate)
}
}

Expand Down
Original file line number Diff line number Diff line change
@@ -1,18 +1,7 @@
package pricemigrationengine.model

/*
MigrationType.apply: CohortSpec -> MigrationType
was introduced to help remove the `if else if else if ... else` pattern that was showing up as we started to
have more migrations, notably the SupporterPlus 2023 migration after the membership annuals. Having defined a
sealed trait means that we can use a `match / case` layout, which makes the code more readable
MigrationType does not identity a migration (despite the fact that some migrations map to a unique migration type)
It simply helps identify common code used by possibly more than one migration. For instance all the pre 2023 migrations
map to `Legacy`
*/

sealed trait MigrationType
object Legacy extends MigrationType // refers to all migrations before membership 2023 and supporter 2023
object Default extends MigrationType
object DigiSubs2023 extends MigrationType
object Newspaper2024 extends MigrationType
object GW2024 extends MigrationType
Expand All @@ -25,6 +14,6 @@ object MigrationType {
case "Newspaper2024" => Newspaper2024
case "GW2024" => GW2024
case "SupporterPlus2024" => SupporterPlus2024
case _ => Legacy
case _ => Default
}
}
Original file line number Diff line number Diff line change
Expand Up @@ -31,7 +31,7 @@ object StartDates {
case DigiSubs2023 => None
case Newspaper2024 => None
case SupporterPlus2024 => None
case Legacy => None
case Default => None
}
}

Expand Down Expand Up @@ -90,7 +90,7 @@ object StartDates {
case DigiSubs2023 => 3
case GW2024 => 3
case SupporterPlus2024 => 1 // no spread for S+2024 monthlies
case Legacy => 3
case Default => 3
}
} else 1
}
Expand All @@ -109,7 +109,7 @@ object StartDates {
case DigiSubs2023 => cohortSpecLowerBound(cohortSpec, today)
case GW2024 => cohortSpecLowerBound(cohortSpec, today)
case SupporterPlus2024 => cohortSpecLowerBound(cohortSpec, today)
case Legacy => cohortSpecLowerBound(cohortSpec, today)
case Default => cohortSpecLowerBound(cohortSpec, today)
}

// We now respect the policy of not increasing members during their first year
Expand Down

0 comments on commit 134f148

Please sign in to comment.