Skip to content

Commit

Permalink
Introduce ZuoraAmendmentOrderPayload
Browse files Browse the repository at this point in the history
  • Loading branch information
shtukas committed Oct 25, 2024
1 parent 0e0fcaa commit 61b4277
Showing 1 changed file with 76 additions and 0 deletions.
Original file line number Diff line number Diff line change
@@ -0,0 +1,76 @@
package pricemigrationengine.model

import java.time.LocalDate
import upickle.default.{ReadWriter, macroRW}

// Zuora documentation: https://knowledgecenter.zuora.com/Zuora_Billing/Manage_subscription_transactions/Orders/Order_actions_tutorials/D_Replace_a_product_in_a_subscription

sealed trait ZuoraAmendmentOrderPayloadOrderAction
object ZuoraAmendmentOrderPayloadOrderAction {
implicit val rw: ReadWriter[ZuoraAmendmentOrderPayloadOrderAction] = macroRW
}

case class ZuoraAmendmentOrderPayloadOrderActionTriggerDate(name: String, triggerDate: LocalDate)
object ZuoraAmendmentOrderPayloadOrderActionTriggerDate {
implicit val rw: ReadWriter[ZuoraAmendmentOrderPayloadOrderActionTriggerDate] = macroRW
}

case class ZuoraAmendmentOrderPayloadOrderActionRemoveProduct(ratePlanId: String)
object ZuoraAmendmentOrderPayloadOrderActionRemoveProduct {
implicit val rw: ReadWriter[ZuoraAmendmentOrderPayloadOrderActionRemoveProduct] = macroRW
}

case class ZuoraAmendmentOrderPayloadOrderActionRemove(
triggerDates: List[ZuoraAmendmentOrderPayloadOrderActionTriggerDate],
removeProduct: ZuoraAmendmentOrderPayloadOrderActionRemoveProduct
) extends ZuoraAmendmentOrderPayloadOrderAction
object ZuoraAmendmentOrderPayloadOrderActionRemove {
implicit val rw: ReadWriter[ZuoraAmendmentOrderPayloadOrderActionRemove] = macroRW
}

case class ZuoraAmendmentOrderPayloadOrderActionAddProductChargeOverride(
productRatePlanChargeId: String,
pricing: Map[String, Map[String, BigDecimal]]
)
object ZuoraAmendmentOrderPayloadOrderActionAddProductChargeOverride {
implicit val rw: ReadWriter[ZuoraAmendmentOrderPayloadOrderActionAddProductChargeOverride] = macroRW
}

case class ZuoraAmendmentOrderPayloadOrderActionAddProduct(
productRatePlanId: String,
chargeOverrides: List[ZuoraAmendmentOrderPayloadOrderActionAddProductChargeOverride]
)
object ZuoraAmendmentOrderPayloadOrderActionAddProduct {
implicit val rw: ReadWriter[ZuoraAmendmentOrderPayloadOrderActionAddProduct] = macroRW
}

case class ZuoraAmendmentOrderPayloadOrderActionAdd(
triggerDates: List[ZuoraAmendmentOrderPayloadOrderActionTriggerDate],
addProduct: ZuoraAmendmentOrderPayloadOrderActionAddProduct
) extends ZuoraAmendmentOrderPayloadOrderAction
object ZuoraAmendmentOrderPayloadOrderActionAdd {
implicit val rw: ReadWriter[ZuoraAmendmentOrderPayloadOrderActionAdd] = macroRW
}

case class ZuoraAmendmentOrderPayloadSubscription(
subscriptionNumber: String,
orderActions: List[ZuoraAmendmentOrderPayloadOrderAction]
)
object ZuoraAmendmentOrderPayloadSubscription {
implicit val rw: ReadWriter[ZuoraAmendmentOrderPayloadSubscription] = macroRW
}

case class ZuoraAmendmentOrderPayloadProcessingOptions(runBilling: Boolean, collectPayment: Boolean)
object ZuoraAmendmentOrderPayloadProcessingOptions {
implicit val rw: ReadWriter[ZuoraAmendmentOrderPayloadProcessingOptions] = macroRW
}

case class ZuoraAmendmentOrderPayload(
orderDate: LocalDate,
existingAccountNumber: String,
subscriptions: List[ZuoraAmendmentOrderPayloadSubscription],
processingOptions: ZuoraAmendmentOrderPayloadProcessingOptions
)
object ZuoraAmendmentOrderPayload {
implicit val rw: ReadWriter[ZuoraAmendmentOrderPayload] = macroRW
}

0 comments on commit 61b4277

Please sign in to comment.