def catalogZuoraPlanReads()

in app/com/gu/memsub/subsv2/reads/CatJsonReads.scala [59:72]


  def catalogZuoraPlanReads(productType: Option[String], pid: ProductId): Reads[CatalogZuoraPlan] =
    (json: JsValue) => {
      ((__ \ "id").read[String].map(ProductRatePlanId) and
        (__ \ "name").read[String] and
        (__ \ "description").readNullable[String].map(_.mkString) and
        Reads.pure(pid) and
        (__ \ "Saving__c").readNullable[String] and
        (__ \ "productRatePlanCharges").read[List[ZuoraCharge]](niceListReads(catalogZuoraPlanChargeReads)) and
        (__ \ "productRatePlanCharges").read[Map[ProductRatePlanChargeId, Benefit]](listOfProductsReads) and
        (__ \ "status").read[Status] and
        (__ \ "FrontendId__c").readNullable[String].map(_.flatMap(FrontendId.get)) and
        Reads.pure(productType)
        ) (CatalogZuoraPlan.apply _).reads(json)
    }