in lambda/src/main/scala/pricemigrationengine/handlers/SalesforceNotificationDateUpdateHandler.scala [17:36]
private def updateDateLetterSentInSF(
cohortSpec: CohortSpec,
item: CohortItem
): ZIO[Logging with CohortTable with SalesforceClient, Failure, Unit] =
for {
_ <- updateSalesforce(cohortSpec, item)
.tapBoth(
e => Logging.error(s"Failed to write create Price_Rise in salesforce: $e"),
result => Logging.info(s"SalesforcePriceRise result: $result")
)
now <- Clock.instant
newCohortItem = CohortItem(
subscriptionName = item.subscriptionName,
processingStage = NotificationSendDateWrittenToSalesforce,
whenNotificationSentWrittenToSalesforce = Some(now)
)
_ <-
CohortTable
.update(newCohortItem)
} yield ()