def amendmentOrdersPayload()

in lambda/src/main/scala/pricemigrationengine/migrations/SupporterPlus2024Migration.scala [334:384]


  def amendmentOrdersPayload(
      orderDate: LocalDate,
      accountNumber: String,
      subscriptionNumber: String,
      effectDate: LocalDate,
      removeRatePlanId: String,
      productRatePlanId: String,
      existingBaseProductRatePlanChargeId: String,
      existingContributionRatePlanChargeId: String,
      newBaseAmount: BigDecimal,
      newContributionAmount: BigDecimal
  ): ZuoraAmendmentOrderPayload = {
    val triggerDates = List(
      ZuoraAmendmentOrderPayloadOrderActionTriggerDate("ContractEffective", effectDate),
      ZuoraAmendmentOrderPayloadOrderActionTriggerDate("ServiceActivation", effectDate),
      ZuoraAmendmentOrderPayloadOrderActionTriggerDate("CustomerAcceptance", effectDate)
    )
    val actionRemove = ZuoraAmendmentOrderPayloadOrderActionRemove(
      `type` = "RemoveProduct",
      triggerDates = triggerDates,
      removeProduct = ZuoraAmendmentOrderPayloadOrderActionRemoveProduct(removeRatePlanId)
    )
    val actionAdd = ZuoraAmendmentOrderPayloadOrderActionAdd(
      `type` = "AddProduct",
      triggerDates = triggerDates,
      addProduct = ZuoraAmendmentOrderPayloadOrderActionAddProduct(
        productRatePlanId = productRatePlanId,
        chargeOverrides = List(
          ZuoraAmendmentOrderPayloadOrderActionAddProductChargeOverride(
            productRatePlanChargeId = existingBaseProductRatePlanChargeId,
            pricing = Map("recurringFlatFee" -> Map("listPrice" -> newBaseAmount))
          ),
          ZuoraAmendmentOrderPayloadOrderActionAddProductChargeOverride(
            productRatePlanChargeId = existingContributionRatePlanChargeId,
            pricing = Map("recurringFlatFee" -> Map("listPrice" -> newContributionAmount))
          )
        )
      )
    )
    val orderActions = List(actionRemove, actionAdd)
    val subscriptions = List(
      ZuoraAmendmentOrderPayloadSubscription(subscriptionNumber, orderActions)
    )
    val processingOptions = ZuoraAmendmentOrderPayloadProcessingOptions(runBilling = false, collectPayment = false)
    ZuoraAmendmentOrderPayload(
      orderDate = orderDate,
      existingAccountNumber = accountNumber,
      subscriptions = subscriptions,
      processingOptions = processingOptions
    )
  }