private def sendUpdateAmountEmail()

in membership-attribute-service/app/controllers/AccountController.scala [302:328]


  private def sendUpdateAmountEmail(
      newPrice: BigDecimal,
      email: String,
      contact: Contact,
      currency: Currency,
      billingPeriod: RecurringPeriod,
      nextPaymentDate: LocalDate,
  )(implicit logPrefix: LogPrefix) =
    SimpleEitherT.right(sendEmail.send(updateAmountEmail(email, contact, newPrice, currency, billingPeriod, nextPaymentDate)))

  private def sendSubscriptionCancelledEmail(
      email: String,
      contact: Contact,
      productType: ProductType,
      cancellationEffectiveDate: Option[LocalDate],
  )(implicit logPrefix: LogPrefix) =
    SimpleEitherT
      .right(sendEmail.send(subscriptionCancelledEmail(email, contact, productType, cancellationEffectiveDate)))
      .leftMap(ApiError(_, "Email could not be put on the queue", 500))

  private[controllers] def validateContributionAmountUpdateForm(implicit request: Request[AnyContent]): Either[String, BigDecimal] = {
    val minAmount = 1
    for {
      amount <- Form(single("newPaymentAmount" -> bigDecimal(5, 2))).bindFromRequest().value.toRight("no new payment amount submitted with request")
      validAmount <- Either.cond(amount >= minAmount, amount, s"New payment amount '$amount' is too small")
    } yield validAmount
  }