Skip to content

Commit

Permalink
Decommission Membership2023
Browse files Browse the repository at this point in the history
  • Loading branch information
shtukas committed Sep 26, 2024
1 parent dae3750 commit 457f2ab
Show file tree
Hide file tree
Showing 28 changed files with 44 additions and 57,268 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -91,13 +91,11 @@ object AmendmentHandler extends CohortHandler {
// estimated price (which wasn't including the extra contribution).

MigrationType(cohortSpec) match {
case Membership2023Monthlies => true
case Membership2023Annuals => true
case DigiSubs2023 => true
case Newspaper2024 => true
case GW2024 => true
case SupporterPlus2024 => false
case Legacy => true
case DigiSubs2023 => true
case Newspaper2024 => true
case GW2024 => true
case SupporterPlus2024 => false
case Legacy => true
}
}

Expand Down Expand Up @@ -129,24 +127,6 @@ object AmendmentHandler extends CohortHandler {
Zuora.fetchInvoicePreview(subscriptionBeforeUpdate.accountId, invoicePreviewTargetDate)

update <- MigrationType(cohortSpec) match {
case Membership2023Monthlies =>
ZIO.fromEither(
Membership2023Migration
.zuoraUpdate_Monthlies(
subscriptionBeforeUpdate,
invoicePreviewBeforeUpdate,
startDate
)
)
case Membership2023Annuals =>
ZIO.fromEither(
Membership2023Migration
.zuoraUpdate_Annuals(
subscriptionBeforeUpdate,
invoicePreviewBeforeUpdate,
startDate
)
)
case DigiSubs2023 =>
ZIO.fromEither(
DigiSubs2023Migration.zuoraUpdate(
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,6 @@ import com.gu.i18n
import pricemigrationengine.migrations.{
DigiSubs2023Migration,
GW2024Migration,
Membership2023Migration,
newspaper2024Migration,
SupporterPlus2024Migration,
}
Expand Down Expand Up @@ -134,7 +133,7 @@ object NotificationHandler extends CohortHandler {
firstName <- ZIO.fromEither(firstName(contact))
lastName <- ZIO.fromEither(requiredField(contact.LastName, "Contact.LastName"))
address <- ZIO.fromEither(targetAddress(cohortSpec, contact))
street <- ZIO.fromEither(street(cohortSpec, address: SalesforceAddress))
street <- ZIO.fromEither(requiredField(address.street, "Contact.OtherAddress.street"))
postalCode = address.postalCode.getOrElse("")
country <- ZIO.fromEither(country(cohortSpec, address))
oldPrice <- ZIO.fromEither(requiredField(cohortItem.oldPrice, "CohortItem.oldPrice"))
Expand All @@ -146,11 +145,9 @@ object NotificationHandler extends CohortHandler {
currencySymbol <- currencyISOtoSymbol(currencyISOCode)

priceWithOptionalCappingWithCurrencySymbol = MigrationType(cohortSpec) match {
case Legacy => s"${currencySymbol}${PriceCap.priceCapLegacy(oldPrice, estimatedNewPrice)}"
case Membership2023Monthlies => s"${currencySymbol}${estimatedNewPrice}"
case Membership2023Annuals => s"${currencySymbol}${estimatedNewPrice}"
case DigiSubs2023 => s"${currencySymbol}${estimatedNewPrice}"
case Newspaper2024 => s"${currencySymbol}${estimatedNewPrice}"
case Legacy => s"${currencySymbol}${PriceCap.priceCapLegacy(oldPrice, estimatedNewPrice)}"
case DigiSubs2023 => s"${currencySymbol}${estimatedNewPrice}"
case Newspaper2024 => s"${currencySymbol}${estimatedNewPrice}"
case GW2024 =>
s"${currencySymbol}${PriceCap.priceCapForNotification(oldPrice, estimatedNewPrice, GW2024Migration.priceCap)}"
case SupporterPlus2024 => s"${currencySymbol}${estimatedNewPrice}"
Expand Down Expand Up @@ -289,25 +286,21 @@ object NotificationHandler extends CohortHandler {

def maxLeadTime(cohortSpec: CohortSpec): Int = {
MigrationType(cohortSpec) match {
case Membership2023Monthlies => Membership2023Migration.maxLeadTime
case Membership2023Annuals => Membership2023Migration.maxLeadTime
case DigiSubs2023 => DigiSubs2023Migration.maxLeadTime
case Newspaper2024 => newspaper2024Migration.StaticData.maxLeadTime
case GW2024 => GW2024Migration.maxLeadTime
case SupporterPlus2024 => SupporterPlus2024Migration.maxLeadTime
case Legacy => 49
case DigiSubs2023 => DigiSubs2023Migration.maxLeadTime
case Newspaper2024 => newspaper2024Migration.StaticData.maxLeadTime
case GW2024 => GW2024Migration.maxLeadTime
case SupporterPlus2024 => SupporterPlus2024Migration.maxLeadTime
case Legacy => 49
}
}

def minLeadTime(cohortSpec: CohortSpec): Int = {
MigrationType(cohortSpec) match {
case Membership2023Monthlies => Membership2023Migration.minLeadTime
case Membership2023Annuals => Membership2023Migration.minLeadTime
case DigiSubs2023 => DigiSubs2023Migration.minLeadTime
case Newspaper2024 => newspaper2024Migration.StaticData.minLeadTime
case GW2024 => GW2024Migration.minLeadTime
case SupporterPlus2024 => SupporterPlus2024Migration.minLeadTime
case Legacy => 35
case DigiSubs2023 => DigiSubs2023Migration.minLeadTime
case Newspaper2024 => newspaper2024Migration.StaticData.minLeadTime
case GW2024 => GW2024Migration.minLeadTime
case SupporterPlus2024 => SupporterPlus2024Migration.minLeadTime
case Legacy => 35
}
}

Expand Down Expand Up @@ -366,10 +359,8 @@ object NotificationHandler extends CohortHandler {
}

MigrationType(cohortSpec) match {
case DigiSubs2023 => testCompatibleEmptySalesforceAddress(contact)
case Membership2023Monthlies => testCompatibleEmptySalesforceAddress(contact)
case Membership2023Annuals => testCompatibleEmptySalesforceAddress(contact)
case SupporterPlus2024 => testCompatibleEmptySalesforceAddress(contact)
case DigiSubs2023 => testCompatibleEmptySalesforceAddress(contact)
case SupporterPlus2024 => testCompatibleEmptySalesforceAddress(contact)
case _ =>
(for {
billingAddress <- requiredField(contact.OtherAddress, "Contact.OtherAddress")
Expand All @@ -384,19 +375,6 @@ object NotificationHandler extends CohortHandler {
.flatMap(_ => requiredField(contact.Salutation.fold(Some("Member"))(Some(_)), "Contact.Salutation"))
}

def street(
cohortSpec: CohortSpec,
address: SalesforceAddress
): Either[NotificationHandlerFailure, String] = {
MigrationType(cohortSpec) match {
case Membership2023Monthlies =>
requiredField(address.street.fold(Some(""))(Some(_)), "Contact.OtherAddress.street")
case Membership2023Annuals =>
requiredField(address.street.fold(Some(""))(Some(_)), "Contact.OtherAddress.street")
case _ => requiredField(address.street, "Contact.OtherAddress.street")
}
}

def country(
cohortSpec: CohortSpec,
address: SalesforceAddress
Expand All @@ -406,10 +384,6 @@ object NotificationHandler extends CohortHandler {
// the 2024 print migration, "United Kingdom" can be substituted for missing values considering
// that we are only delivery in the UK.
MigrationType(cohortSpec) match {
case Membership2023Monthlies =>
requiredField(address.country.fold(Some("United Kingdom"))(Some(_)), "Contact.OtherAddress.country")
case Membership2023Annuals =>
requiredField(address.country.fold(Some("United Kingdom"))(Some(_)), "Contact.OtherAddress.country")
case Newspaper2024 => Right(address.country.getOrElse("United Kingdom"))
case SupporterPlus2024 => Right(address.country.getOrElse(""))
case _ => requiredField(address.country, "Contact.OtherAddress.country")
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -82,11 +82,9 @@ object SalesforcePriceRiseCreationHandler extends CohortHandler {
.orElseFail(SalesforcePriceRiseWriteFailure(s"$cohortItem does not have a startDate"))
} yield {
val estimatedPriceWithOptionalCapping = MigrationType(cohortSpec) match {
case Membership2023Monthlies => estimatedNewPrice
case Membership2023Annuals => estimatedNewPrice
case DigiSubs2023 => estimatedNewPrice
case Newspaper2024 => estimatedNewPrice
case GW2024 => PriceCap.priceCapForNotification(oldPrice, estimatedNewPrice, GW2024Migration.priceCap)
case DigiSubs2023 => estimatedNewPrice
case Newspaper2024 => estimatedNewPrice
case GW2024 => PriceCap.priceCapForNotification(oldPrice, estimatedNewPrice, GW2024Migration.priceCap)
case SupporterPlus2024 => estimatedNewPrice // [1]
case Legacy => PriceCap.priceCapLegacy(oldPrice, estimatedNewPrice)
}
Expand Down

This file was deleted.

Loading

0 comments on commit 457f2ab

Please sign in to comment.