예제 #1
0
        public async Task InsertHistoricPayment()
        {
            var historicPayment = new PaymentModel
            {
                EventId = Guid.NewGuid(),
                LearningAimFrameworkCode   = 1,
                LearningAimFundingLineType = "funding line type",
                LearningAimPathwayCode     = 2,
                LearningAimProgrammeType   = 3,
                LearningAimReference       = "ZPROG001",
                LearningAimStandardCode    = 4,
                StartDate        = DateTime.Now.AddMonths(-2),
                Amount           = 100m,
                CollectionPeriod = new CollectionPeriod {
                    AcademicYear = 1920, Period = 1
                },
                ContractType           = ContractType.Act2,
                PriceEpisodeIdentifier = "pe-1",
                DeliveryPeriod         = 1,
                LearnerReferenceNumber = "abc",
                LearnerUln             = 123456,
                Ukprn           = TestSession.GenerateId(),
                FundingSource   = FundingSourceType.CoInvestedSfa,
                JobId           = TestSession.GenerateId(),
                TransactionType = TransactionType.Learning,
            };

            Context.Add(HistoricPayment, historicPayment);
            var dataContext = Container.Resolve <IPaymentsDataContext>();
            await dataContext.Payment.AddAsync(historicPayment);

            await dataContext.SaveChangesAsync();
        }
예제 #2
0
        public async Task LearnerReEmployed()
        {
            ImportR04Fm36();
            TestSession.FM36Global.UKPRN = TestSession.Provider.Ukprn;
            TestSession.FM36Global.Learners.ForEach(x => x.ULN            = TestSession.Learner.Uln);
            TestSession.FM36Global.Learners.ForEach(x => x.LearnRefNumber = TestSession.Learner.LearnRefNumber);

            var dcHelper = Scope.Resolve <IDcHelper>();
            await dcHelper.SendIlrSubmission(TestSession.FM36Global.Learners,
                                             TestSession.Provider.Ukprn,
                                             TestSession.CollectionPeriod.AcademicYear,
                                             TestSession.CollectionPeriod.Period,
                                             TestSession.Provider.JobId);

            await WaitForRequiredPayments(2);

            await EmployerMonthEndHelper.SendLevyMonthEndForEmployers(
                TestSession.GenerateId(),
                TestSession.Employers.Select(x => x.AccountId),
                TestSession.CollectionPeriod.AcademicYear,
                TestSession.CollectionPeriod.Period,
                MessageSession);

            await WaitForPayments(2);
        }
 public void ResetJob()
 {
     if (!Context.ContainsKey("new_feature"))
     {
         NewFeature = true;
     }
     TestSession.Providers.ForEach(p =>
     {
         var newJobId = TestSession.GenerateId();
         Console.WriteLine($"Using new job. Previous job id: { p.JobId }, new job id: {newJobId} for ukprn: {p.Ukprn}");
         p.JobId = newJobId;
     });
 }
예제 #4
0
        public async Task TheSameLearnerIsSubmittedButWithADifferentUkprn()
        {
            var command = Context.Get <ProcessLearnerCommand>(ProcessLearnerCommand);

            command.Ukprn = TestSession.GenerateId();
            command.JobId = TestSession.GenerateId(100000);

            var currentJobIds = Context.Get <List <long> >(JobIds);

            currentJobIds.Add(command.JobId);
            Context.Set <List <long> >(currentJobIds, JobIds);

            await MessageSession.Send(command);
        }
        public async Task AfterPeriodEndRunPaymentsAreGenerated(Table table)
        {
            await EmployerMonthEndHelper.SendLevyMonthEndForEmployers(
                TestSession.GenerateId(),
                TestSession.Employers.Select(x => x.AccountId),
                TestSession.CollectionPeriod.AcademicYear,
                TestSession.CollectionPeriod.Period,
                MessageSession);

            var expectedPayments = table.CreateSet <ProviderPayment>().ToList();

            expectedPayments.ForEach(ep => ep.Uln = learnerB.Uln);

            await WaitForIt(() => AssertExpectedPayments(expectedPayments), "Failed to wait for expected number of payments");
        }
예제 #6
0
        private async Task SendMonthEndEvent()
        {
            MonthEndJobId = TestSession.GenerateId();
            Console.WriteLine($"Month end job id: {MonthEndJobId}");

            await CreateJob(DateTimeOffset.UtcNow, new List <GeneratedMessage>
            {
                new GeneratedMessage
                {
                    StartTime   = DateTimeOffset.Now,
                    MessageName = "ProcessProviderMonthEndCommand",
                    MessageId   = Guid.NewGuid()
                }
            },
                            JobType.ComponentAcceptanceTestMonthEndJob);
        }
예제 #7
0
        public async Task WhenASubmissionIsProcessedForthelevyLearner()
        {
            var dcHelper = Scope.Resolve <IDcHelper>();
            await dcHelper.SendIlrSubmission(TestSession.FM36Global.Learners,
                                             TestSession.Provider.Ukprn,
                                             TestSession.CollectionPeriod.AcademicYear,
                                             TestSession.CollectionPeriod.Period,
                                             TestSession.Provider.JobId);

            await WaitForRequiredPayments(6);

            await EmployerMonthEndHelper.SendLevyMonthEndForEmployers(
                TestSession.GenerateId(),
                TestSession.Employers.Select(x => x.AccountId),
                TestSession.CollectionPeriod.AcademicYear,
                TestSession.CollectionPeriod.Period,
                MessageSession);
        }
예제 #8
0
        private async Task AddApprenticeships(TestSession session, List <Learner> learners, DateTime startDate)
        {
            var dataContext     = Container.Resolve <IPaymentsDataContext>();
            var apprenticeships = learners.Select(learner => new ApprenticeshipModel
            {
                AccountId                   = session.Ukprn,
                AgreedOnDate                = startDate,
                AgreementId                 = "654321",
                Id                          = session.GenerateId(),
                EstimatedEndDate            = startDate.AddMonths(12),
                Ukprn                       = session.Ukprn,
                Uln                         = learner.Uln,
                FrameworkCode               = learner.Course.FrameworkCode,
                LegalEntityName             = "Test Company",
                IsLevyPayer                 = true,
                PathwayCode                 = learner.Course.PathwayCode,
                ProgrammeType               = learner.Course.ProgrammeType,
                StandardCode                = learner.Course.StandardCode,
                Status                      = ApprenticeshipStatus.Active,
                EstimatedStartDate          = startDate,
                ApprenticeshipPriceEpisodes = new List <ApprenticeshipPriceEpisodeModel>
                {
                    new ApprenticeshipPriceEpisodeModel
                    {
                        StartDate = startDate,
                        Cost      = 15000M
                    }
                }
            }).ToList();
            var ulns = apprenticeships.Select(appr => appr.Uln.ToString()).Join();
            var sql  = $"Delete from Payments2.ApprenticeshipDuplicate where ApprenticeshipId in (select Id from Payments2.Apprenticeship where Uln in ({ulns}))";
            await dataContext.Database.ExecuteSqlCommandAsync(sql);

            sql = $"Delete from Payments2.ApprenticeshipPriceEpisode where ApprenticeshipId in (select Id from Payments2.Apprenticeship where Uln in ({ulns}))";
            await dataContext.Database.ExecuteSqlCommandAsync(sql);

            sql = $"Delete from Payments2.Apprenticeship where Uln in ({ulns})";
            await dataContext.Database.ExecuteSqlCommandAsync(sql);

            dataContext.Apprenticeship.AddRange(apprenticeships);
            await dataContext.SaveChangesAsync();

            await ResetDataLockActors(learners).ConfigureAwait(false);
        }
예제 #9
0
        public async Task LearnerMadeRedundant()
        {
            ImportR03Fm36();

            TestSession.FM36Global.UKPRN = TestSession.Provider.Ukprn;
            TestSession.FM36Global.Learners.ForEach(x => x.ULN            = TestSession.Learner.Uln);
            TestSession.FM36Global.Learners.ForEach(x => x.LearnRefNumber = TestSession.Learner.LearnRefNumber);

            TestSession.Employers.Clear();
            TestSession.Employers.Add(new Employer {
                AccountId = TestSession.GenerateId(), Balance = 999999999, IsLevyPayer = true, AccountName = "employer 0"
            });
            TestSession.Employers.Add(new Employer {
                AccountId = TestSession.GenerateId(), Balance = 999999999, IsLevyPayer = true, AccountName = "employer 1"
            });

            foreach (var employer in TestSession.Employers)
            {
                await SaveLevyAccount(employer).ConfigureAwait(false);
            }

            ScriptInApprenticeshipsAndPriceEpisodes(); //This creates apprenticeships and apprenticeship prices episodes to match the apprenticeships in the FM36s and the scenario in the ticket

            var dcHelper = Scope.Resolve <IDcHelper>();
            await dcHelper.SendIlrSubmission(TestSession.FM36Global.Learners,
                                             TestSession.Provider.Ukprn,
                                             TestSession.CollectionPeriod.AcademicYear,
                                             TestSession.CollectionPeriod.Period,
                                             TestSession.Provider.JobId);

            await WaitForRequiredPayments(6);

            await EmployerMonthEndHelper.SendLevyMonthEndForEmployers(
                TestSession.GenerateId(),
                TestSession.Employers.Select(x => x.AccountId),
                TestSession.CollectionPeriod.AcademicYear,
                TestSession.CollectionPeriod.Period,
                MessageSession);

            await WaitForPayments(6);
        }
예제 #10
0
        public async Task WhenAProcessLearnerCommandIsHandledByTheProcessLearnerService()
        {
            var command = new ProcessLearnerCommand
            {
                JobId                 = TestSession.GenerateId(100000),
                CollectionPeriod      = 1,
                CollectionYear        = 1920,
                CommandId             = Guid.NewGuid(),
                IlrFileName           = "SomeFile",
                IlrSubmissionDateTime = DateTime.Now,
                Ukprn                 = TestSession.GenerateId(),
                Learner               = GetFm36Learner()
            };

            Context.Add(ProcessLearnerCommand, command);
            Context.Add(JobIds, new List <long> {
                command.JobId
            });

            await MessageSession.Send(command);
        }
        public async Task LevyLearnerMadeRedundant()
        {
            ImportR07Fm36ForNonRedundantLevyLearner();

            await SetUpMatchingCommitment();

            var dcHelper = Scope.Resolve <IDcHelper>();
            await dcHelper.SendIlrSubmission(TestSession.FM36Global.Learners,
                                             TestSession.Provider.Ukprn,
                                             TestSession.CollectionPeriod.AcademicYear,
                                             TestSession.CollectionPeriod.Period,
                                             TestSession.Provider.JobId);

            await WaitForRequiredPayments(14);

            await EmployerMonthEndHelper.SendLevyMonthEndForEmployers(
                TestSession.GenerateId(),
                TestSession.Employers.Select(x => x.AccountId),
                TestSession.CollectionPeriod.AcademicYear,
                TestSession.CollectionPeriod.Period,
                MessageSession);

            await WaitForPayments(14);
        }
예제 #12
0
        public async Task HandleRemovedLearner()
        {
            var payment = Context.Get <PaymentModel>(HistoricPayment);

            var removedLearnerEvent = new IdentifiedRemovedLearningAim
            {
                JobId            = TestSession.GenerateId(),
                CollectionPeriod = new CollectionPeriod {
                    AcademicYear = 1920, Period = 5
                },
                IlrSubmissionDateTime = DateTime.Now,
                Ukprn        = payment.Ukprn,
                ContractType = ContractType.Act2,
                LearningAim  = new LearningAim
                {
                    FrameworkCode   = 1,
                    FundingLineType = "funding line type",
                    PathwayCode     = 2,
                    ProgrammeType   = 3,
                    Reference       = "ZPROG001",
                    StandardCode    = 4,
                    StartDate       = DateTime.Now.AddMonths(-2),
                },
                Learner = new Learner
                {
                    ReferenceNumber = "abc",
                }
            };

            Context.Add(IdentifiedRemovedLearningAim, removedLearnerEvent);
            Context.Add(JobIds, new List <long> {
                removedLearnerEvent.JobId
            });

            await MessageSession.Publish(removedLearnerEvent);
        }
        private async Task SendMonthEndEvent()
        {
            MonthEndJobId = TestSession.GenerateId();
            Console.WriteLine($"Month end job id: {MonthEndJobId}");
            var monthEndCommand = new ProcessProviderMonthEndCommand
            {
                Ukprn            = TestSession.Ukprn,
                JobId            = MonthEndJobId,
                CollectionPeriod = CollectionPeriodFactory.CreateFromAcademicYearAndPeriod(AcademicYear, CollectionPeriod),
            };

            await CreateJob(DateTimeOffset.UtcNow, new List <GeneratedMessage>
            {
                new GeneratedMessage
                {
                    StartTime   = monthEndCommand.RequestTime,
                    MessageName = monthEndCommand.GetType().FullName,
                    MessageId   = monthEndCommand.CommandId
                }
            },
                            JobType.ComponentAcceptanceTestMonthEndJob);

            await MessageSession.Send(monthEndCommand).ConfigureAwait(false);
        }
        public async Task ThereAreLessThan6MonthsRemainingOfPlannedLearning()
        {
            ImportR07Fm36ToMakeLearnerRedundant();

            await SetUpMatchingCommitment();

            CreateDataLockForCommitment(CommitmentIdentifier);

            TestSession.RegenerateJobId();

            var dcHelper = Scope.Resolve <IDcHelper>();
            await dcHelper.SendIlrSubmission(TestSession.FM36Global.Learners,
                                             TestSession.Provider.Ukprn,
                                             TestSession.CollectionPeriod.AcademicYear,
                                             TestSession.CollectionPeriod.Period,
                                             TestSession.Provider.JobId);

            await EmployerMonthEndHelper.SendLevyMonthEndForEmployers(
                TestSession.GenerateId(),
                TestSession.Employers.Select(x => x.AccountId),
                TestSession.CollectionPeriod.AcademicYear,
                TestSession.CollectionPeriod.Period,
                MessageSession);
        }
예제 #15
0
 public async Task ThenASubmissionSuccessEventIsReceived(string outcome)
 {
     var dcHelper = Scope.Resolve <IDcHelper>();
     await dcHelper.SendIlrSubmissionEvent(TestSession.Provider.Ukprn, AcademicYear, CollectionPeriod,
                                           TestSession.GenerateId(), outcome == "Success");
 }
        public static ApprenticeshipModel CreateApprenticeshipModel(Apprenticeship apprenticeshipSpec, TestSession testSession)
        {
            if (apprenticeshipSpec.ApprenticeshipId == default(long))
            {
                apprenticeshipSpec.ApprenticeshipId = testSession.GenerateId();
            }

            if (apprenticeshipSpec.Ukprn == default(long))
            {
                if (string.IsNullOrWhiteSpace(apprenticeshipSpec.Provider))
                {
                    apprenticeshipSpec.Ukprn = testSession.Ukprn;
                }
                else
                {
                    apprenticeshipSpec.Ukprn = testSession.GetProviderByIdentifier(apprenticeshipSpec.Provider).Ukprn;
                }
            }

            var employer = testSession.GetEmployer(apprenticeshipSpec.Employer);

            if (apprenticeshipSpec.AccountId == default(long))
            {
                apprenticeshipSpec.AccountId = employer.AccountId;
            }

            if (!string.IsNullOrEmpty(apprenticeshipSpec.SendingEmployer) && !apprenticeshipSpec.SenderAccountId.HasValue)
            {
                apprenticeshipSpec.SenderAccountId = testSession.GetEmployer(apprenticeshipSpec.SendingEmployer).AccountId;
            }

            if (apprenticeshipSpec.Uln == default(long))
            {
                var learnerId = string.IsNullOrWhiteSpace(apprenticeshipSpec.Identifier)
                    ? testSession.Learner.LearnerIdentifier
                    : apprenticeshipSpec.LearnerId;

                apprenticeshipSpec.Uln = testSession.GetLearner(apprenticeshipSpec.Ukprn, learnerId).Uln;
            }

            var apprenticeshipModel = new ApprenticeshipModel
            {
                Id        = apprenticeshipSpec.ApprenticeshipId,
                Ukprn     = apprenticeshipSpec.Ukprn,
                AccountId = apprenticeshipSpec.AccountId,
                TransferSendingEmployerAccountId = apprenticeshipSpec.SenderAccountId,
                Uln                = apprenticeshipSpec.Uln,
                FrameworkCode      = apprenticeshipSpec.FrameworkCode ?? 0, //TODO change when app bug is fixed
                ProgrammeType      = apprenticeshipSpec.ProgrammeType ?? 0,
                PathwayCode        = apprenticeshipSpec.PathwayCode ?? 0,
                StandardCode       = apprenticeshipSpec.StandardCode ?? 0,
                Priority           = apprenticeshipSpec.Priority,
                Status             = apprenticeshipSpec.Status.ToApprenticeshipPaymentStatus(),
                LegalEntityName    = "Test SFA",
                EstimatedStartDate = apprenticeshipSpec.StartDate.ToDate(),
                EstimatedEndDate   = apprenticeshipSpec.EndDate.ToDate(),
                AgreedOnDate       = string.IsNullOrWhiteSpace(apprenticeshipSpec.AgreedOnDate) ?
                                     DateTime.UtcNow :
                                     apprenticeshipSpec.AgreedOnDate.ToDate(),
                StopDate = string.IsNullOrWhiteSpace(apprenticeshipSpec.StopEffectiveFrom) ?
                           default(DateTime?) :
                           apprenticeshipSpec.StopEffectiveFrom.ToDate(),
                IsLevyPayer = employer.IsLevyPayer,
                ApprenticeshipEmployerType = GetApprenticeshipEmployerType(apprenticeshipSpec.EmployerType)
            };

            return(apprenticeshipModel);
        }
예제 #17
0
        //todo rename this to have commitment in the method name. Convert the pairs of commitment and pe ids to key value pairs and defaults second one to null
        protected async Task SetupTestCommitmentData(string commitmentIdentifier1, string priceEpisodeIdentifier1,
                                                     string commitmentIdentifier2 = null, string priceEpisodeIdentifier2 = null)
        {
            var learner = TestSession.FM36Global.Learners.Single();

            learner.ULN            = TestSession.Learner.Uln;
            learner.LearnRefNumber = TestSession.Learner.LearnRefNumber;

            var priceEpisode1     = learner.PriceEpisodes.Single(y => y.PriceEpisodeIdentifier == priceEpisodeIdentifier1);
            var learningDelivery1 = learner.LearningDeliveries.Single(x => x.AimSeqNumber == priceEpisode1.PriceEpisodeValues.PriceEpisodeAimSeqNumber);

            LearningDelivery learningDelivery2;
            PriceEpisode     priceEpisode2;

            if (string.IsNullOrWhiteSpace(priceEpisodeIdentifier2))
            {
                priceEpisode2     = priceEpisode1;
                learningDelivery2 = learningDelivery1;
            }
            else
            {
                priceEpisode2     = learner.PriceEpisodes.Single(y => y.PriceEpisodeIdentifier == priceEpisodeIdentifier2);
                learningDelivery2 = learner.LearningDeliveries.Single(x => x.AimSeqNumber == priceEpisode2.PriceEpisodeValues.PriceEpisodeAimSeqNumber);
            }

            var ids = new List <long> {
                TestSession.GenerateId(), TestSession.GenerateId()
            };

            var commitment1 = new ApprenticeshipBuilder()
                              .BuildSimpleApprenticeship(TestSession, learningDelivery1.LearningDeliveryValues, ids.Min())
                              .WithALevyPayingEmployer()
                              .WithApprenticeshipPriceEpisode(priceEpisode1.PriceEpisodeValues)
                              .ToApprenticeshipModel();

            TestSession.Apprenticeships.GetOrAdd(commitmentIdentifier1, commitment1);
            testDataContext.Apprenticeship.Add(commitment1);
            testDataContext.ApprenticeshipPriceEpisode.AddRange(commitment1.ApprenticeshipPriceEpisodes);

            if (commitmentIdentifier2 != null)
            {
                var commitment2 = new ApprenticeshipBuilder()
                                  .BuildSimpleApprenticeship(TestSession, learningDelivery2.LearningDeliveryValues, ids.Max())
                                  .WithALevyPayingEmployer()
                                  .WithApprenticeshipPriceEpisode(priceEpisode2.PriceEpisodeValues)
                                  .ToApprenticeshipModel();

                TestSession.Apprenticeships.GetOrAdd(commitmentIdentifier2, commitment2);
                testDataContext.Apprenticeship.Add(commitment2);
                testDataContext.ApprenticeshipPriceEpisode.AddRange(commitment2.ApprenticeshipPriceEpisodes);
            }

            var levyModel = TestSession.Employer.ToModel();

            levyModel.Balance = 1000000000;

            if (!testDataContext.LevyAccount.Any(x => x.AccountId == levyModel.AccountId))
            {
                testDataContext.LevyAccount.Add(levyModel);
            }
            await testDataContext.SaveChangesAsync();

            TestSession.FM36Global.UKPRN = TestSession.Provider.Ukprn;
        }
        private async Task CreatePaymentModel(Table table, bool missingApprenticeshipId = false)
        {
            var payments       = table.CreateSet <ProviderPayment>().ToList();
            var jobId          = TestSession.GenerateId();
            var paymentHistory = new List <PaymentModel>();

            foreach (var providerPayment in payments)
            {
                var apprenticeship = TestSession.Apprenticeships[CommitmentIdentifierB];

                var payment = new PaymentModel
                {
                    JobId                       = jobId,
                    CollectionPeriod            = providerPayment.ParsedCollectionPeriod,
                    DeliveryPeriod              = providerPayment.ParsedDeliveryPeriod.Period,
                    Ukprn                       = TestSession.Provider.Ukprn,
                    LearnerUln                  = learnerB.Uln,
                    LearnerReferenceNumber      = learnerB.LearnRefNumber,
                    SfaContributionPercentage   = 0.95m,
                    TransactionType             = providerPayment.TransactionType,
                    ContractType                = ContractType.Act1,
                    PriceEpisodeIdentifier      = PriceEpisodeIdentifierB,
                    LearningAimPathwayCode      = 1,
                    LearningAimReference        = "ZPROG001",
                    LearningAimStandardCode     = 0,
                    IlrSubmissionDateTime       = DateTime.Now,
                    LearningAimFundingLineType  = "19+ Apprenticeship (Employer on App Service)",
                    LearningAimFrameworkCode    = 418,
                    LearningAimProgrammeType    = 20,
                    AccountId                   = apprenticeship?.AccountId,
                    TransferSenderAccountId     = apprenticeship?.TransferSendingEmployerAccountId,
                    StartDate                   = DateTime.UtcNow,
                    PlannedEndDate              = DateTime.UtcNow,
                    ActualEndDate               = DateTime.UtcNow,
                    CompletionStatus            = 1,
                    CompletionAmount            = 9000M,
                    InstalmentAmount            = 600M,
                    NumberOfInstalments         = 12,
                    ReportingAimFundingLineType = "19+ Apprenticeship (Employer on App Service) Levy funding",
                    ApprenticeshipEmployerType  = ApprenticeshipEmployerType.Levy,
                    LearningStartDate           = TestSession.FM36Global.Learners[1].LearningDeliveries.First().LearningDeliveryValues.LearnStartDate,
                    ApprenticeshipId            = missingApprenticeshipId && (providerPayment.LevyPayments < 0 || providerPayment.SfaCoFundedPayments < 0 || providerPayment.EmployerCoFundedPayments < 0)
                                        ? null : apprenticeship?.Id,
                    ApprenticeshipPriceEpisodeId = missingApprenticeshipId && (providerPayment.LevyPayments < 0 || providerPayment.SfaCoFundedPayments < 0 || providerPayment.EmployerCoFundedPayments < 0)
                        ? null : apprenticeship?.ApprenticeshipPriceEpisodes.First().Id,
                };

                if (providerPayment.LevyPayments != 0)
                {
                    var levyPayment = payment.Clone();
                    levyPayment.CollectionPeriod = providerPayment.ParsedCollectionPeriod.Clone();
                    levyPayment.EventId          = Guid.NewGuid();
                    levyPayment.Amount           = providerPayment.LevyPayments;
                    levyPayment.FundingSource    = FundingSourceType.Levy;

                    paymentHistory.Add(levyPayment);
                }

                if (providerPayment.SfaCoFundedPayments != 0)
                {
                    var sfaCoFundedPayments = payment.Clone();
                    sfaCoFundedPayments.CollectionPeriod = providerPayment.ParsedCollectionPeriod.Clone();
                    sfaCoFundedPayments.EventId          = Guid.NewGuid();
                    sfaCoFundedPayments.Amount           = providerPayment.SfaCoFundedPayments;
                    sfaCoFundedPayments.FundingSource    = FundingSourceType.CoInvestedSfa;

                    paymentHistory.Add(sfaCoFundedPayments);
                }

                if (providerPayment.EmployerCoFundedPayments != 0)
                {
                    var employerCoFundedPayments = payment.Clone();
                    employerCoFundedPayments.CollectionPeriod = providerPayment.ParsedCollectionPeriod.Clone();
                    employerCoFundedPayments.EventId          = Guid.NewGuid();
                    employerCoFundedPayments.Amount           = providerPayment.EmployerCoFundedPayments;
                    employerCoFundedPayments.FundingSource    = FundingSourceType.CoInvestedEmployer;

                    paymentHistory.Add(employerCoFundedPayments);
                }
            }

            await DataContext.Payment.AddRangeAsync(paymentHistory);

            await DataContext.SaveChangesAsync().ConfigureAwait(false);
        }