public PlansModel GetPlanDetailByPlanGuId()

in src/Services/Services/PlanService.cs [74:128]


    public PlansModel GetPlanDetailByPlanGuId(Guid planGuId)
    {
        var existingPlan = this.plansRepository.GetByInternalReference(planGuId);
        var planAttributes = this.plansRepository.GetPlanAttributes(planGuId, existingPlan.OfferId);
        var planEvents = this.plansRepository.GetEventsByPlan(planGuId, existingPlan.OfferId);
        var offerDetails = this.offerRepository.GetOfferById(existingPlan.OfferId);

        PlansModel plan = new PlansModel
        {
            Id = existingPlan.Id,
            PlanId = existingPlan.PlanId,
            IsmeteringSupported = existingPlan.IsmeteringSupported,
            OfferID = existingPlan.OfferId,
            DisplayName = existingPlan.DisplayName,
            Description = existingPlan.Description,
            PlanGUID = existingPlan.PlanGuid,
            OfferName = offerDetails.OfferName,
        };

        plan.PlanAttributes = new List<PlanAttributesModel>();

        foreach (var attribute in planAttributes)
        {
            PlanAttributesModel planAttributesmodel = new PlanAttributesModel()
            {
                OfferAttributeId = attribute.OfferAttributeId,
                PlanAttributeId = attribute.PlanAttributeId,
                PlanId = existingPlan.PlanGuid,
                DisplayName = attribute.DisplayName,
                IsEnabled = attribute.IsEnabled,
                Type = attribute.Type,
            };
            plan.PlanAttributes.Add(planAttributesmodel);
        }

        plan.PlanEvents = new List<PlanEventsModel>();

        foreach (var events in planEvents)
        {
            PlanEventsModel planEventsModel = new PlanEventsModel()
            {
                Id = events.Id,
                PlanId = events.PlanId,
                Isactive = events.Isactive,
                SuccessStateEmails = events.SuccessStateEmails,
                FailureStateEmails = events.FailureStateEmails,
                EventName = events.EventsName,
                EventId = events.EventId,
                CopyToCustomer = events.CopyToCustomer,
            };
            plan.PlanEvents.Add(planEventsModel);
        }

        return plan;
    }