in handlers/new-product-api/src/main/scala/com/gu/newproduct/api/addsubscription/Handler.scala [69:84]
def apply(apiGatewayRequest: ApiGatewayRequest): Future[ApiResponse] = (for {
request <- apiGatewayRequest.bodyAsCaseClass[AddSubscriptionRequest]().withLogging("parsed request").toAsync
addSpecificProduct = request.planId match {
case _: SupporterPlusPlanId => addSupporterPlus
case _: ContributionPlanId => addContribution
case _: VoucherPlanId => addPaperSub
case _: HomeDeliveryPlanId => addPaperSub
case _: DigipackPlanId => addDigipackSub
case _: GuardianWeeklyDomestic => addGuardianWeeklyDomesticSub
case _: GuardianWeeklyRow => addGuardianWeeklyROWSub
case _: DigitalVoucherPlanId => addPaperSub
case _: NationalDeliveryPlanId => addPaperSub
case _: TierThreePlanId => addTierThree
}
subscriptionName <- addSpecificProduct.addProduct(request)
} yield ApiGatewayResponse(body = AddedSubscription(subscriptionName.value), statusCode = "200")).apiResponse