Ejemplo n.º 1
0
        private async Task SendReminder(RegistrationsRemindersInvitationsResponse.Registration registration)
        {
            try
            {
                _logger.LogInformation($"Getting Apprenticeship Details for ApprenticeshipId {registration.ApprenticeshipId}");
                var apprenticeship =
                    await _commitmentsV2Service.GetApprenticeshipDetails(registration.ApprenticeshipId);

                _logger.LogInformation($"Sending Invitation for Apprentice {registration.ApprenticeId}");
                await _apprenticeLoginService.SendInvitation(new SendInvitationModel
                {
                    SourceId           = registration.ApprenticeId,
                    Email              = registration.Email,
                    GivenName          = apprenticeship.FirstName,
                    FamilyName         = apprenticeship.LastName,
                    OrganisationName   = registration.EmployerName,
                    ApprenticeshipName = apprenticeship.CourseName
                });

                _logger.LogInformation($"Updating Registration for Apprentice {registration.ApprenticeId}");
                await _apprenticeCommitmentsService.InvitationReminderSent(registration.ApprenticeId, DateTime.UtcNow);
            }
            catch (Exception e)
            {
                _logger.LogError(e, $"Error Sending a Reminder for Apprentice {registration.ApprenticeId}");
            }
        }
        public async Task WhenApprenticeshipIsFoundAndTheAccountIdMatches(
            long accountId,
            long apprenticeshipId,
            [Frozen] Mock <IInternalApiClient <CommitmentsV2Configuration> > client)
        {
            ClientReturnsApprenticeshipWith(client, accountId, apprenticeshipId);

            var sut      = new CommitmentsV2Service(client.Object);
            var response = await sut.GetApprenticeshipDetails(accountId, apprenticeshipId);

            response.EmployerAccountId.Should().Be(accountId);
            response.Id.Should().Be(apprenticeshipId);
        }
Ejemplo n.º 3
0
        private async Task <(TrainingProviderResponse, Apis.CommitmentsV2InnerApi.ApprenticeshipResponse, StandardApiResponse course)> GetExternalData(CreateApprenticeshipCommand command)
        {
            var trainingProviderTask = _trainingProviderService.GetTrainingProviderDetails(command.TrainingProviderId);

            var apprenticeTask = _commitmentsService.GetApprenticeshipDetails(
                command.EmployerAccountId,
                command.ApprenticeshipId);

            await Task.WhenAll(trainingProviderTask, apprenticeTask);

            var course = await _coursesService.GetCourse(apprenticeTask.Result.CourseCode);

            return(trainingProviderTask.Result, apprenticeTask.Result, course);
        }