public override void Given()
        {
            ProfileId           = 11;
            _mockLearnerDetails = new SoaLearnerRecordDetailsViewModel
            {
                ProfileId    = ProfileId,
                Uln          = 1234567890,
                LearnerName  = "John Smith",
                DateofBirth  = DateTime.Now.AddYears(-20),
                ProviderName = "Barsley College",

                TlevelTitle     = "Design, Surveying and Planning for Construction",
                PathwayName     = "Design, Surveying and Planning for Construction(60358300)",
                PathwayGrade    = "A*",
                SpecialismName  = "Building Services Design (ZTLOS003)",
                SpecialismGrade = "None",

                IsEnglishAndMathsAchieved = true,
                HasLrsEnglishAndMaths     = false,
                IsSendLearner             = true,
                IndustryPlacementStatus   = IndustryPlacementStatus.NotCompleted,

                HasPathwayResult             = false,
                IsNotWithdrawn               = false,
                IsLearnerRegistered          = true,
                IsIndustryPlacementAdded     = true,
                IsIndustryPlacementCompleted = false,

                ProviderAddress = new AddressViewModel {
                    DepartmentName = "Operations", OrganisationName = "College Ltd", AddressLine1 = "10, House", AddressLine2 = "Street", Town = "Birmingham", Postcode = "B1 1AA"
                },
            };

            StatementOfAchievementLoader.GetSoaLearnerRecordDetailsAsync(ProviderUkprn, ProfileId).Returns(_mockLearnerDetails);
        }
Exemplo n.º 2
0
 public override void Given()
 {
     ProfileId = 11;
     SoaLearnerRecordDetailsViewModel = new SoaLearnerRecordDetailsViewModel {
         ProfileId = ProfileId
     };
     StatementOfAchievementLoader.GetSoaLearnerRecordDetailsAsync(ProviderUkprn, ProfileId).Returns(_mockLearnerDetails);
 }
        public override void Given()
        {
            CreateMapper();
            ProviderUkprn = 987654321;

            SoaLearnerRecordDetailsViewModel = new SoaLearnerRecordDetailsViewModel
            {
                ProfileId     = 10,
                Uln           = 1234567890,
                LearnerName   = "John Smith",
                DateofBirth   = DateTime.Now.AddYears(-20),
                ProviderName  = "Barsley College",
                ProviderUkprn = 456789123,

                TlevelTitle           = "Design, Surveying and Planning for Construction",
                RegistrationPathwayId = 1,
                PathwayDisplayName    = "Design, Surveying and Planning for Construction (60358300)",
                PathwayName           = "Design, Surveying and Planning for Construction",
                PathwayCode           = "60358300",
                PathwayGrade          = "A*",
                SpecialismDisplayName = "Building Services Design (ZTLOS003)",
                SpecialismName        = "Building Services Design",
                SpecialismCode        = "ZTLOS003",
                SpecialismGrade       = "None",

                IsEnglishAndMathsAchieved = true,
                HasLrsEnglishAndMaths     = false,
                IsSendLearner             = true,
                IndustryPlacementStatus   = IndustryPlacementStatus.NotCompleted,

                HasPathwayResult             = false,
                IsNotWithdrawn               = false,
                IsLearnerRegistered          = true,
                IsIndustryPlacementAdded     = true,
                IsIndustryPlacementCompleted = false,

                ProviderAddress = new AddressViewModel {
                    AddressId = 10, DepartmentName = "Operations", OrganisationName = "College Ltd", AddressLine1 = "10, House", AddressLine2 = "Street", Town = "Birmingham", Postcode = "B1 1AA"
                },
            };

            _expectedApiResult = new SoaPrintingResponse {
                Uln = SoaLearnerRecordDetailsViewModel.Uln, LearnerName = SoaLearnerRecordDetailsViewModel.LearnerName, IsSuccess = true
            };

            InternalApiClient.CreateSoaPrintingRequestAsync(Arg.Any <SoaPrintingRequest>()).Returns(_expectedApiResult);

            Loader = new StatementOfAchievementLoader(InternalApiClient, Mapper);
        }
Exemplo n.º 4
0
        public override void Given()
        {
            ProfileId           = 11;
            _mockLearnerDetails = new SoaLearnerRecordDetailsViewModel
            {
                ProfileId   = ProfileId,
                LearnerName = "John Smith",

                IsLearnerRegistered      = false,
                IsNotWithdrawn           = true,
                IsIndustryPlacementAdded = false,
            };

            StatementOfAchievementLoader.GetSoaLearnerRecordDetailsAsync(ProviderUkprn, ProfileId).Returns(_mockLearnerDetails);
        }
Exemplo n.º 5
0
        public override void Given()
        {
            _profileId = 11;

            _mockLearnerDetails = new SoaLearnerRecordDetailsViewModel
            {
                ProfileId                    = _profileId,
                IsLearnerRegistered          = true,
                IsNotWithdrawn               = false,
                IsIndustryPlacementAdded     = true,
                HasPathwayResult             = true,
                IsIndustryPlacementCompleted = true,
                LastPrintRequestedDate       = DateTime.UtcNow
            };

            StatementOfAchievementLoader.GetSoaLearnerRecordDetailsAsync(ProviderUkprn, _profileId).Returns(_mockLearnerDetails);
        }
        public async Task <IActionResult> SubmitRequestSoaCheckAndSubmitAsync(SoaLearnerRecordDetailsViewModel viewModel)
        {
            var soaDetails = await _statementOfAchievementLoader.GetSoaLearnerRecordDetailsAsync(User.GetUkPrn(), viewModel.ProfileId);

            if (soaDetails == null || !soaDetails.IsValid)
            {
                return(RedirectToRoute(RouteConstants.PageNotFound));
            }

            var response = await _statementOfAchievementLoader.CreateSoaPrintingRequestAsync(User.GetUkPrn(), soaDetails);

            if (response.IsSuccess)
            {
                await _cacheService.SetAsync(string.Concat(CacheKey, Constants.RequestSoaConfirmation), new SoaConfirmationViewModel { Uln = response.Uln, Name = response.LearnerName }, CacheExpiryTime.XSmall);

                return(RedirectToRoute(RouteConstants.RequestSoaConfirmation));
            }
            else
            {
                _logger.LogWarning(LogEvent.AddLearnerRecordFailed, $"Unable to request statement of achievement for UniqueLearnerNumber: {viewModel.Uln}. Method: SubmitRequestSoaCheckAndSubmitAsync, Ukprn: {User.GetUkPrn()}, User: {User.GetUserEmail()}");
                return(RedirectToRoute(RouteConstants.Error, new { StatusCode = 500 }));
            }
        }
Exemplo n.º 7
0
        public override void Given()
        {
            ProfileId           = 11;
            _mockLearnerDetails = new SoaLearnerRecordDetailsViewModel
            {
                ProfileId   = ProfileId,
                Uln         = 1234567890,
                LearnerName = "John Smith",

                IsEnglishAndMathsAchieved = true,
                HasLrsEnglishAndMaths     = false,
                IsSendLearner             = true,
                IndustryPlacementStatus   = IndustryPlacementStatus.Completed,

                HasPathwayResult             = true,
                IsNotWithdrawn               = false,
                IsLearnerRegistered          = true,
                IsIndustryPlacementAdded     = true,
                IsIndustryPlacementCompleted = true,
            };

            StatementOfAchievementLoader.GetSoaLearnerRecordDetailsAsync(ProviderUkprn, ProfileId).Returns(_mockLearnerDetails);
        }
 public async override Task When()
 {
     ActualResult = await Loader.GetSoaLearnerRecordDetailsAsync(ProviderUkprn, ProfileId);
 }
        public async Task <SoaPrintingResponse> CreateSoaPrintingRequestAsync(long providerUkprn, SoaLearnerRecordDetailsViewModel viewModel)
        {
            var request = _mapper.Map <SoaPrintingRequest>(viewModel, opt => opt.Items["providerUkprn"] = providerUkprn);

            return(await _internalApiClient.CreateSoaPrintingRequestAsync(request));
        }
        public override void Given()
        {
            CreateMapper();
            ProviderUkprn = 987654321;

            SoaLearnerRecordDetailsViewModel = new SoaLearnerRecordDetailsViewModel
            {
                ProfileId     = 10,
                Uln           = 1234567890,
                LearnerName   = "John Smith",
                DateofBirth   = DateTime.Now.AddYears(-20),
                ProviderName  = "Barsley College",
                ProviderUkprn = 456789123,

                TlevelTitle           = "Design, Surveying and Planning for Construction",
                RegistrationPathwayId = 1,
                PathwayDisplayName    = "Design, Surveying and Planning for Construction (60358300)",
                PathwayName           = "Design, Surveying and Planning for Construction",
                PathwayCode           = "60358300",
                PathwayGrade          = "A*",
                SpecialismDisplayName = "Building Services Design (ZTLOS003)",
                SpecialismName        = "Building Services Design",
                SpecialismCode        = "ZTLOS003",
                SpecialismGrade       = "None",

                IsEnglishAndMathsAchieved = true,
                HasLrsEnglishAndMaths     = false,
                IsSendLearner             = true,
                IndustryPlacementStatus   = IndustryPlacementStatus.NotCompleted,

                HasPathwayResult             = false,
                IsNotWithdrawn               = false,
                IsLearnerRegistered          = true,
                IsIndustryPlacementAdded     = true,
                IsIndustryPlacementCompleted = false,

                ProviderAddress = new AddressViewModel {
                    AddressId = 10, DepartmentName = "Operations", OrganisationName = "College Ltd", AddressLine1 = "10, House", AddressLine2 = "Street", Town = "Birmingham", Postcode = "B1 1AA"
                },
            };

            _expectedLearningDetails = new LearningDetails
            {
                TLevelTitle            = SoaLearnerRecordDetailsViewModel.TlevelTitle,
                Grade                  = null,
                Date                   = DateTime.UtcNow.ToSoaFormat(),
                Core                   = SoaLearnerRecordDetailsViewModel.PathwayName,
                CoreGrade              = SoaLearnerRecordDetailsViewModel.PathwayGrade,
                OccupationalSpecialism = new List <OccupationalSpecialismDetails>
                {
                    new OccupationalSpecialismDetails
                    {
                        Specialism = SoaLearnerRecordDetailsViewModel.SpecialismName,
                        Grade      = SoaLearnerRecordDetailsViewModel.SpecialismGrade
                    }
                },
                IndustryPlacement = SoaLearnerRecordDetailsViewModel.IsIndustryPlacementCompleted ? Constants.IndustryPlacementCompleted : Constants.IndustryPlacementNotCompleted,
                EnglishAndMaths   = SoaLearnerRecordDetailsViewModel.IsEnglishAndMathsAchieved ? Constants.EnglishAndMathsMet : Constants.EnglishAndMathsNotMet
            };

            _expectedSoaPrintingDetails = new SoaPrintingDetails
            {
                Uln               = SoaLearnerRecordDetailsViewModel.Uln,
                Name              = SoaLearnerRecordDetailsViewModel.LearnerName,
                Dateofbirth       = SoaLearnerRecordDetailsViewModel.DateofBirth.ToDobFormat(),
                ProviderName      = SoaLearnerRecordDetailsViewModel.ProviderDisplayName,
                TlevelTitle       = SoaLearnerRecordDetailsViewModel.TlevelTitle,
                Core              = SoaLearnerRecordDetailsViewModel.PathwayDisplayName,
                CoreGrade         = SoaLearnerRecordDetailsViewModel.PathwayGrade,
                Specialism        = SoaLearnerRecordDetailsViewModel.SpecialismDisplayName,
                SpecialismGrade   = SoaLearnerRecordDetailsViewModel.SpecialismGrade,
                EnglishAndMaths   = SoaLearnerRecordDetailsViewModel.GetEnglishAndMathsStatusDisplayText,
                IndustryPlacement = SoaLearnerRecordDetailsViewModel.GetIndustryPlacementDisplayText,
                ProviderAddress   = new Models.Contracts.ProviderAddress.Address
                {
                    AddressId        = SoaLearnerRecordDetailsViewModel.ProviderAddress.AddressId,
                    DepartmentName   = SoaLearnerRecordDetailsViewModel.ProviderAddress.DepartmentName,
                    OrganisationName = SoaLearnerRecordDetailsViewModel.ProviderAddress.OrganisationName,
                    AddressLine1     = SoaLearnerRecordDetailsViewModel.ProviderAddress.AddressLine1,
                    AddressLine2     = SoaLearnerRecordDetailsViewModel.ProviderAddress.AddressLine2,
                    Town             = SoaLearnerRecordDetailsViewModel.ProviderAddress.Town,
                    Postcode         = SoaLearnerRecordDetailsViewModel.ProviderAddress.Postcode
                }
            };
        }