Skip to content

Commit

Permalink
Merge pull request #1012 from guardian/ph-20240304-0001-GW2024-step
Browse files Browse the repository at this point in the history
GW2024 Part 1: GW2024 extends MigrationType
  • Loading branch information
shtukas authored Mar 15, 2024
2 parents f9a98f9 + 904bacd commit adeb8ab
Show file tree
Hide file tree
Showing 7 changed files with 62 additions and 12 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -170,6 +170,13 @@ object AmendmentHandler extends CohortHandler {
startDate,
)
)
case GW2024 =>
ZIO.fromEither(
GW2024Migration.zuoraUpdate(
subscriptionBeforeUpdate,
startDate,
)
)
case Legacy =>
ZIO.fromEither(
ZuoraSubscriptionUpdate
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -103,14 +103,18 @@ object EstimationHandler extends CohortHandler {
}

def handle(input: CohortSpec): ZIO[Logging, Failure, HandlerOutput] = {
main(input).provideSome[Logging](
EnvConfig.cohortTable.layer,
EnvConfig.zuora.layer,
EnvConfig.stage.layer,
DynamoDBZIOLive.impl,
DynamoDBClientLive.impl,
CohortTableLive.impl(input),
ZuoraLive.impl
)
MigrationType(input) match {
case GW2024 => ZIO.succeed(HandlerOutput(isComplete = true))
case _ =>
main(input).provideSome[Logging](
EnvConfig.cohortTable.layer,
EnvConfig.zuora.layer,
EnvConfig.stage.layer,
DynamoDBZIOLive.impl,
DynamoDBClientLive.impl,
CohortTableLive.impl(input),
ZuoraLive.impl
)
}
}
}
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,12 @@ import pricemigrationengine.model.membershipworkflow._
import pricemigrationengine.services._
import zio.{Clock, ZIO}
import com.gu.i18n
import pricemigrationengine.migrations.{DigiSubs2023Migration, Membership2023Migration, newspaper2024Migration}
import pricemigrationengine.migrations.{
DigiSubs2023Migration,
GW2024Migration,
Membership2023Migration,
newspaper2024Migration
}
import pricemigrationengine.model.RateplansProbe

import java.time.{LocalDate, ZoneId}
Expand Down Expand Up @@ -205,6 +210,7 @@ object NotificationHandler extends CohortHandler {
case SupporterPlus2023V1V2MA => SupporterPlus2023V1V2Migration.maxLeadTime
case DigiSubs2023 => DigiSubs2023Migration.maxLeadTime
case Newspaper2024 => newspaper2024Migration.StaticData.maxLeadTime
case GW2024 => GW2024Migration.maxLeadTime
case Legacy => 49
}
}
Expand All @@ -216,6 +222,7 @@ object NotificationHandler extends CohortHandler {
case SupporterPlus2023V1V2MA => SupporterPlus2023V1V2Migration.minLeadTime
case DigiSubs2023 => DigiSubs2023Migration.minLeadTime
case Newspaper2024 => newspaper2024Migration.StaticData.minLeadTime
case GW2024 => GW2024Migration.minLeadTime
case Legacy => 35
}
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -87,6 +87,7 @@ object SalesforcePriceRiseCreationHandler extends CohortHandler {
case SupporterPlus2023V1V2MA => true
case DigiSubs2023 => true
case Newspaper2024 => true
case GW2024 => true
case Legacy => false
}
SalesforcePriceRise(
Expand Down
Original file line number Diff line number Diff line change
@@ -1,7 +1,13 @@
package pricemigrationengine.migrations

import pricemigrationengine.model._
import java.time.LocalDate

object GW2024Migration {

val maxLeadTime = 49
val minLeadTime = 36

val priceMapMonthlies: Map[String, BigDecimal] = Map(
"GBP" -> BigDecimal(15),
"USD" -> BigDecimal(30),
Expand Down Expand Up @@ -32,4 +38,17 @@ object GW2024Migration {
"ROW (USD)" -> BigDecimal(396)
)

def priceData(
subscription: ZuoraSubscription,
account: ZuoraAccount
): Either[AmendmentDataFailure, PriceData] = {
???
}

def zuoraUpdate(
subscription: ZuoraSubscription,
effectiveDate: LocalDate,
): Either[AmendmentDataFailure, ZuoraSubscriptionUpdate] = {
???
}
}
Original file line number Diff line number Diff line change
@@ -1,7 +1,12 @@
package pricemigrationengine.model

import pricemigrationengine.migrations.newspaper2024Migration
import pricemigrationengine.migrations.{DigiSubs2023Migration, GuardianWeeklyMigration, Membership2023Migration}
import pricemigrationengine.migrations.{
DigiSubs2023Migration,
GW2024Migration,
GuardianWeeklyMigration,
Membership2023Migration,
newspaper2024Migration
}
import pricemigrationengine.model.ZuoraProductCatalogue.{homeDeliveryRatePlans, productPricingMap}

import java.time.LocalDate
Expand Down Expand Up @@ -340,6 +345,11 @@ object AmendmentData {
newspaper2024Migration.Estimation.priceData(
subscription
)
case GW2024 =>
GW2024Migration.priceData(
subscription: ZuoraSubscription,
account: ZuoraAccount
)
case Legacy => priceDataWithRatePlanMatching(account, catalogue, subscription, invoiceList, nextServiceStartDate)
}
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -18,6 +18,7 @@ object Membership2023Annuals extends MigrationType
object SupporterPlus2023V1V2MA extends MigrationType
object DigiSubs2023 extends MigrationType
object Newspaper2024 extends MigrationType
object GW2024 extends MigrationType

object MigrationType {
def apply(cohortSpec: CohortSpec): MigrationType = cohortSpec.cohortName match {
Expand All @@ -28,6 +29,7 @@ object MigrationType {
case "DigiSubs2023_Batch1" => DigiSubs2023
case "DigiSubs2023_Batch2" => DigiSubs2023
case "Newspaper2024" => Newspaper2024
case "GW2024" => GW2024
case _ => Legacy
}
}

0 comments on commit adeb8ab

Please sign in to comment.