private void SetupClawbacks()
        {
            _clawback1 = _fixture.Build <ClawbackPayment>()
                         .With(x => x.ApprenticeshipIncentiveId, _apprenticeshipIncentive1.Id)
                         .With(x => x.PendingPaymentId, _pendingPayment1.Id)
                         .With(x => x.AccountId, _account1.Id)
                         .With(x => x.AccountLegalEntityId, _account1.AccountLegalEntityId)
                         .Without(x => x.DateClawbackSent)
                         .Create();

            var sentClawback = _fixture.Build <ClawbackPayment>()
                               .With(x => x.ApprenticeshipIncentiveId, _apprenticeshipIncentive1.Id)
                               .With(x => x.PendingPaymentId, _pendingPayment1.Id)
                               .With(x => x.AccountId, _account1.Id)
                               .With(x => x.AccountLegalEntityId, _account1.AccountLegalEntityId)
                               .Create();

            var clawbacks = new List <ClawbackPayment>()
            {
                _clawback1,
                sentClawback
            };

            _context.ClawbackPayments.AddRange(clawbacks);
            _context.SaveChanges();
        }
Ejemplo n.º 2
0
            internal void AddClawbackPayment(bool sent)
            {
                Payment = _fixture.Build <Payment>()
                          .With(d => d.PendingPaymentId, PendingPaymentModel2.Id)
                          .With(d => d.AccountId, AccountModel.Id)
                          .With(d => d.AccountLegalEntityId, AccountModel.AccountLegalEntityId)
                          .With(d => d.ApprenticeshipIncentiveId, ApprenticeshipIncentiveModel.Id)
                          .With(d => d.PaymentPeriod, PendingPaymentModel2.PeriodNumber)
                          .With(d => d.PaymentYear, PendingPaymentModel2.PaymentYear)
                          .Without(d => d.PaidDate)
                          .Create();

                ClawbackPayment = _fixture.Build <ClawbackPayment>()
                                  .With(d => d.PendingPaymentId, PendingPaymentModel2.Id)
                                  .With(d => d.PaymentId, Payment.Id)
                                  .With(d => d.DateClawbackSent, sent ? DateTime.Now.AddDays(-1) : (DateTime?)null)
                                  .With(d => d.AccountId, AccountModel.Id)
                                  .With(d => d.AccountLegalEntityId, AccountModel.AccountLegalEntityId)
                                  .With(d => d.ApprenticeshipIncentiveId, ApprenticeshipIncentiveModel.Id)
                                  .With(d => d.CollectionPeriod, PendingPaymentModel2.PeriodNumber)
                                  .With(d => d.CollectionPeriodYear, PendingPaymentModel2.PaymentYear)
                                  .Create();
            }
 public static ClawbackPayment Map(this ClawbackPaymentModel model)
 {
     return(ClawbackPayment.Get(model));
 }
Ejemplo n.º 4
0
        public LearningResumedSteps(TestContext testContext)
        {
            _testContext = testContext;
            _fixture     = new Fixture();

            _plannedStartDate = new DateTime(2020, 11, 10);
            _breakInLearning  = 15;
            _accountModel     = _fixture.Create <Account>();
            _periodNumber     = 1;

            _apprenticeshipIncentive = _fixture.Build <ApprenticeshipIncentive>()
                                       .With(p => p.DateOfBirth, new DateTime(1995, 10, 15)) // under 25
                                       .With(p => p.AccountId, _accountModel.Id)
                                       .With(p => p.AccountLegalEntityId, _accountModel.AccountLegalEntityId)
                                       .With(p => p.HasPossibleChangeOfCircumstances, false)
                                       .With(p => p.StartDate, _plannedStartDate)
                                       .With(p => p.RefreshedLearnerForEarnings, true)
                                       .With(p => p.PausePayments, false)
                                       .With(p => p.Status, IncentiveStatus.Stopped)
                                       .With(p => p.BreakInLearnings, new List <ApprenticeshipBreakInLearning>())
                                       .With(p => p.Phase, Phase.Phase1)
                                       .Create();

            _apprenticeshipBreakInLearning = _fixture
                                             .Build <ApprenticeshipBreakInLearning>()
                                             .With(b => b.ApprenticeshipIncentiveId, _apprenticeshipIncentive.Id)
                                             .With(b => b.StartDate, new DateTime(2021, 02, 08))
                                             .With(b => b.EndDate, (DateTime?)null)
                                             .Create();

            _pendingPayment = _fixture.Build <PendingPayment>()
                              .With(p => p.AccountId, _accountModel.Id)
                              .With(p => p.ApprenticeshipIncentiveId, _apprenticeshipIncentive.Id)
                              .With(p => p.DueDate, new DateTime(2021, 02, 07))
                              .With(p => p.ClawedBack, false)
                              .With(p => p.EarningType, EarningType.FirstPayment)
                              .With(p => p.PaymentYear, (short)2021)
                              .With(p => p.PeriodNumber, (byte)7)
                              .With(p => p.Amount, 750)
                              .Without(p => p.PaymentMadeDate)
                              .Create();

            _payment = _fixture.Build <Payment>()
                       .With(d => d.PendingPaymentId, _pendingPayment.Id)
                       .With(d => d.AccountId, _accountModel.Id)
                       .With(d => d.AccountLegalEntityId, _accountModel.AccountLegalEntityId)
                       .With(d => d.ApprenticeshipIncentiveId, _apprenticeshipIncentive.Id)
                       .With(d => d.PaymentPeriod, _pendingPayment.PeriodNumber)
                       .With(d => d.PaymentYear, _pendingPayment.PaymentYear)
                       .With(d => d.PaidDate, _pendingPayment.DueDate)
                       .With(d => d.Amount, _pendingPayment.Amount)
                       .Create();

            _clawbackPayment = _fixture.Build <ClawbackPayment>()
                               .With(d => d.PendingPaymentId, _pendingPayment.Id)
                               .With(d => d.PaymentId, _payment.Id)
                               .With(d => d.DateClawbackSent, _pendingPayment.DueDate.AddDays(5))
                               .With(d => d.AccountId, _accountModel.Id)
                               .With(d => d.AccountLegalEntityId, _accountModel.AccountLegalEntityId)
                               .With(d => d.ApprenticeshipIncentiveId, _apprenticeshipIncentive.Id)
                               .With(d => d.CollectionPeriod, _pendingPayment.PeriodNumber)
                               .With(d => d.CollectionPeriodYear, _pendingPayment.PaymentYear)
                               .Create();
        }
        public WithdrawalByEmployerSteps(TestContext testContext) : base(testContext)
        {
            _testContext      = testContext;
            _fixture          = new Fixture();
            _connectionString = _testContext.SqlDatabase.DatabaseInfo.ConnectionString;

            _application    = _fixture.Create <IncentiveApplication>();
            _apprenticeship = _fixture
                              .Build <IncentiveApplicationApprenticeship>()
                              .With(a => a.IncentiveApplicationId, _application.Id)
                              .With(a => a.WithdrawnByEmployer, false)
                              .Create();

            _apprenticeship2 = _fixture
                               .Build <IncentiveApplicationApprenticeship>()
                               .With(a => a.IncentiveApplicationId, _application.Id)
                               .With(a => a.ULN, _apprenticeship.ULN)
                               .With(a => a.WithdrawnByEmployer, false)
                               .Create();

            _apprenticeshipIncentive = _fixture
                                       .Build <ApprenticeshipIncentive>()
                                       .With(i => i.IncentiveApplicationApprenticeshipId, _apprenticeship.Id)
                                       .With(i => i.AccountLegalEntityId, _application.AccountLegalEntityId)
                                       .With(i => i.AccountId, _application.AccountId)
                                       .With(i => i.ULN, _apprenticeship.ULN)
                                       .With(i => i.Status, IncentiveStatus.Active)
                                       .Create();

            _pendingPayment = _fixture
                              .Build <PendingPayment>()
                              .With(p => p.ApprenticeshipIncentiveId, _apprenticeshipIncentive.Id)
                              .With(i => i.AccountId, _apprenticeshipIncentive.AccountId)
                              .With(i => i.AccountLegalEntityId, _apprenticeshipIncentive.AccountLegalEntityId)
                              .With(p => p.PaymentMadeDate, (DateTime?)null)
                              .With(p => p.ClawedBack, false)
                              .Create();

            _paidPendingPayment = _fixture
                                  .Build <PendingPayment>()
                                  .With(p => p.ApprenticeshipIncentiveId, _apprenticeshipIncentive.Id)
                                  .With(i => i.AccountId, _apprenticeshipIncentive.AccountId)
                                  .With(i => i.AccountLegalEntityId, _apprenticeshipIncentive.AccountLegalEntityId)
                                  .With(p => p.ClawedBack, false)
                                  .Create();

            _clawedbackPaidPendingPayment = _fixture
                                            .Build <PendingPayment>()
                                            .With(p => p.ApprenticeshipIncentiveId, _apprenticeshipIncentive.Id)
                                            .With(i => i.AccountId, _apprenticeshipIncentive.AccountId)
                                            .With(i => i.AccountLegalEntityId, _apprenticeshipIncentive.AccountLegalEntityId)
                                            .With(p => p.ClawedBack, true)
                                            .Create();

            _payment = _fixture
                       .Build <Payment>()
                       .With(p => p.ApprenticeshipIncentiveId, _apprenticeshipIncentive.Id)
                       .With(i => i.AccountId, _apprenticeshipIncentive.AccountId)
                       .With(i => i.AccountLegalEntityId, _apprenticeshipIncentive.AccountLegalEntityId)
                       .With(p => p.PendingPaymentId, _paidPendingPayment.Id)
                       .Create();

            _payment2 = _fixture
                        .Build <Payment>()
                        .With(p => p.ApprenticeshipIncentiveId, _apprenticeshipIncentive.Id)
                        .With(i => i.AccountId, _apprenticeshipIncentive.AccountId)
                        .With(i => i.AccountLegalEntityId, _apprenticeshipIncentive.AccountLegalEntityId)
                        .With(p => p.PendingPaymentId, _clawedbackPaidPendingPayment.Id)
                        .Create();

            _clawedBackPayment = _fixture
                                 .Build <ClawbackPayment>()
                                 .With(p => p.ApprenticeshipIncentiveId, _apprenticeshipIncentive.Id)
                                 .With(i => i.AccountId, _apprenticeshipIncentive.AccountId)
                                 .With(i => i.AccountLegalEntityId, _apprenticeshipIncentive.AccountLegalEntityId)
                                 .With(i => i.PendingPaymentId, _clawedbackPaidPendingPayment.Id)
                                 .With(i => i.PaymentId, _payment2.Id)
                                 .With(i => i.Amount, _clawedbackPaidPendingPayment.Amount * -1)
                                 .Create();

            _pendingPaymentValidationResult = _fixture
                                              .Build <PendingPaymentValidationResult>()
                                              .With(p => p.PendingPaymentId, _pendingPayment.Id)
                                              .With(p => p.Step, "Invalid")
                                              .With(p => p.PeriodNumber, 1)
                                              .With(p => p.PaymentYear, 2021)
                                              .Create();
        }