Skip to content

Commit

Permalink
Get rid of default values for RenewalRequest body
Browse files Browse the repository at this point in the history
  • Loading branch information
rupertbates committed Nov 6, 2023
1 parent 5b594a8 commit 0e8ffd1
Showing 1 changed file with 9 additions and 3 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -98,7 +98,13 @@ private class TermRenewalLive(zuoraGet: ZuoraGet) extends TermRenewal:
subscriptionName: SubscriptionName,
): ZIO[Stage, ErrorResponse, R] = {
val today = LocalDate.now
val requestBody = RenewalRequest(today)
val requestBody = RenewalRequest(
today,
// When we shorten the existing term and then renew we end up with a negative and a positive
// invoice for the same amount. Setting applyCreditBalance to true cancels them out against each other
applyCreditBalance = true,
runBilling = true,
)
zuoraGet.put[RenewalRequest, R](
relativeUrl = uri"subscriptions/${subscriptionName.value}/renew",
input = requestBody,
Expand Down Expand Up @@ -130,8 +136,8 @@ case class AmendmentResponse(results: List[AmendmentResult])
case class AmendmentResult(AmendmentIds: List[String], Success: Boolean)
case class RenewalRequest(
contractEffectiveDate: LocalDate,
applyCreditBalance: Boolean = true, // When we shorten
runBilling: Boolean = true,
applyCreditBalance: Boolean,
runBilling: Boolean,
)
case class RenewalResponse(success: Option[Boolean])
given JsonEncoder[AmendTermLengthRequest] = DeriveJsonEncoder.gen[AmendTermLengthRequest]
Expand Down

0 comments on commit 0e8ffd1

Please sign in to comment.