in lambda/src/main/scala/pricemigrationengine/handlers/NotificationHandler.scala [224:253]
private def subscriptionRatePlansCheck(
cohortSpec: CohortSpec,
item: CohortItem,
subscription: ZuoraSubscription,
date: LocalDate
): ZIO[CohortTable with Zuora with SalesforceClient with Logging, Failure, Unit] = {
for {
_ <- RateplansProbe.probe(subscription: ZuoraSubscription, date) match {
case ShouldProceed => ZIO.succeed(())
case ShouldCancel =>
val result = CancelledAmendmentResult(item.subscriptionName)
for {
_ <- CohortTable
.update(
CohortItem
.fromCancelledAmendmentResult(result, "(cause: f5c291b0) Migration cancelled by RateplansProbe")
)
_ <- notifySalesforceOfCancelledStatus(cohortSpec, item, Some("Migration cancelled by RateplansProbe"))
} yield ZIO.fail(
RatePlansProbeFailure("(cause: f5c291b0) Migration cancelled by RateplansProbe")
)
case IndeterminateConclusion =>
ZIO.fail(
RatePlansProbeFailure(
s"[4f7589ea] NotificationHandler probeRatePlans could not determine a probe outcome for cohort item ${item}. Please investigate."
)
)
}
} yield ()
}