Skip to content

Commit

Permalink
Merge pull request #1075 from guardian/ph-20240921-1333-decommission-…
Browse files Browse the repository at this point in the history
…s+2023

Decommission SupporterPlus2023V1V2
  • Loading branch information
shtukas authored Sep 25, 2024
2 parents dff9e68 + 0d05304 commit dae3750
Show file tree
Hide file tree
Showing 31 changed files with 7 additions and 74,843 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -86,12 +86,11 @@ object AmendmentHandler extends CohortHandler {
}

private def shouldPerformFinalPriceCheck(cohortSpec: CohortSpec): Boolean = {
// We do not apply the check to the SupporterPlus2023V1V2 migration, nor the SupporterPlus2024
// We do not apply the check to the SupporterPlus2024
// migration where, due to the way the prices are computed, the new price can be higher than the
// estimated price (which wasn't including the extra contribution).

MigrationType(cohortSpec) match {
case SupporterPlus2023V1V2MA => false
case Membership2023Monthlies => true
case Membership2023Annuals => true
case DigiSubs2023 => true
Expand Down Expand Up @@ -148,16 +147,6 @@ object AmendmentHandler extends CohortHandler {
startDate
)
)
case SupporterPlus2023V1V2MA =>
ZIO.fromEither(
SupporterPlus2023V1V2Migration
.zuoraUpdate(
item,
subscriptionBeforeUpdate,
invoicePreviewBeforeUpdate,
startDate
)
)
case DigiSubs2023 =>
ZIO.fromEither(
DigiSubs2023Migration.zuoraUpdate(
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -87,17 +87,9 @@ object EstimationHandler extends CohortHandler {
case e => ZIO.fail(e)
},
success = { result =>
val cohortItemToWrite = MigrationType(cohortSpec) match {
case SupporterPlus2023V1V2MA => {
// SupporterPlus2023V1V2 is different here, because it's a rate plan migration and not a price increase
// The first of its kind. In particular we do not want processing stage `NoPriceIncrease`
CohortItem.fromSuccessfulEstimationResult(result)
}
case _ => {
if (result.estimatedNewPrice <= result.oldPrice) CohortItem.fromNoPriceIncreaseEstimationResult(result)
else CohortItem.fromSuccessfulEstimationResult(result)
}
}
val cohortItemToWrite =
if (result.estimatedNewPrice <= result.oldPrice) CohortItem.fromNoPriceIncreaseEstimationResult(result)
else CohortItem.fromSuccessfulEstimationResult(result)

for {
cohortItem <- cohortItemToWrite
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -133,7 +133,7 @@ object NotificationHandler extends CohortHandler {
contact <- SalesforceClient.getContact(sfSubscription.Buyer__c)
firstName <- ZIO.fromEither(firstName(contact))
lastName <- ZIO.fromEither(requiredField(contact.LastName, "Contact.LastName"))
address <- ZIO.fromEither(address(cohortSpec, contact))
address <- ZIO.fromEither(targetAddress(cohortSpec, contact))
street <- ZIO.fromEither(street(cohortSpec, address: SalesforceAddress))
postalCode = address.postalCode.getOrElse("")
country <- ZIO.fromEither(country(cohortSpec, address))
Expand All @@ -149,7 +149,6 @@ object NotificationHandler extends CohortHandler {
case Legacy => s"${currencySymbol}${PriceCap.priceCapLegacy(oldPrice, estimatedNewPrice)}"
case Membership2023Monthlies => s"${currencySymbol}${estimatedNewPrice}"
case Membership2023Annuals => s"${currencySymbol}${estimatedNewPrice}"
case SupporterPlus2023V1V2MA => s"${currencySymbol}${estimatedNewPrice}"
case DigiSubs2023 => s"${currencySymbol}${estimatedNewPrice}"
case Newspaper2024 => s"${currencySymbol}${estimatedNewPrice}"
case GW2024 =>
Expand Down Expand Up @@ -292,7 +291,6 @@ object NotificationHandler extends CohortHandler {
MigrationType(cohortSpec) match {
case Membership2023Monthlies => Membership2023Migration.maxLeadTime
case Membership2023Annuals => Membership2023Migration.maxLeadTime
case SupporterPlus2023V1V2MA => SupporterPlus2023V1V2Migration.maxLeadTime
case DigiSubs2023 => DigiSubs2023Migration.maxLeadTime
case Newspaper2024 => newspaper2024Migration.StaticData.maxLeadTime
case GW2024 => GW2024Migration.maxLeadTime
Expand All @@ -305,7 +303,6 @@ object NotificationHandler extends CohortHandler {
MigrationType(cohortSpec) match {
case Membership2023Monthlies => Membership2023Migration.minLeadTime
case Membership2023Annuals => Membership2023Migration.minLeadTime
case SupporterPlus2023V1V2MA => SupporterPlus2023V1V2Migration.minLeadTime
case DigiSubs2023 => DigiSubs2023Migration.minLeadTime
case Newspaper2024 => newspaper2024Migration.StaticData.minLeadTime
case GW2024 => GW2024Migration.minLeadTime
Expand Down Expand Up @@ -387,16 +384,6 @@ object NotificationHandler extends CohortHandler {
.flatMap(_ => requiredField(contact.Salutation.fold(Some("Member"))(Some(_)), "Contact.Salutation"))
}

def address(
cohortSpec: CohortSpec,
contact: SalesforceContact
): Either[NotificationHandlerFailure, SalesforceAddress] = {
MigrationType(cohortSpec) match {
case SupporterPlus2023V1V2MA => Right(SalesforceAddress(None, None, None, None, None))
case _ => targetAddress(cohortSpec, contact)
}
}

def street(
cohortSpec: CohortSpec,
address: SalesforceAddress
Expand All @@ -406,8 +393,7 @@ object NotificationHandler extends CohortHandler {
requiredField(address.street.fold(Some(""))(Some(_)), "Contact.OtherAddress.street")
case Membership2023Annuals =>
requiredField(address.street.fold(Some(""))(Some(_)), "Contact.OtherAddress.street")
case SupporterPlus2023V1V2MA => Right("")
case _ => requiredField(address.street, "Contact.OtherAddress.street")
case _ => requiredField(address.street, "Contact.OtherAddress.street")
}
}

Expand All @@ -424,8 +410,6 @@ object NotificationHandler extends CohortHandler {
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 SupporterPlus2023V1V2MA =>
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 @@ -84,7 +84,6 @@ object SalesforcePriceRiseCreationHandler extends CohortHandler {
val estimatedPriceWithOptionalCapping = MigrationType(cohortSpec) match {
case Membership2023Monthlies => estimatedNewPrice
case Membership2023Annuals => estimatedNewPrice
case SupporterPlus2023V1V2MA => estimatedNewPrice
case DigiSubs2023 => estimatedNewPrice
case Newspaper2024 => estimatedNewPrice
case GW2024 => PriceCap.priceCapForNotification(oldPrice, estimatedNewPrice, GW2024Migration.priceCap)
Expand Down
Loading

0 comments on commit dae3750

Please sign in to comment.