private void AnEmployerHasAnApplicationWithAnAgreementVersionThatNeedsSigning(Guid applicationId) { _testData = new TestData.Account.WithInitialApplicationForASingleEntity(); _testContext.TestDataStore.Add("HashedAccountId", _testData.HashedAccountId); _testContext.TestDataStore.Add("HashedAccountLegalEntityId", _testData.HashedAccountLegalEntityId); _testContext.AddOrReplaceClaim(EmployerClaimTypes.Account, _testData.HashedAccountId); ClawbackStatusModel clawbackStatus = null; var applications = new List <ApprenticeApplicationModel> { _fixture.Build <ApprenticeApplicationModel>() .With(p => p.AccountId, _testData.AccountId) .With(p => p.FirstPaymentStatus, _fixture.Build <PaymentStatusModel>() .With(p => p.RequiresNewEmployerAgreement, true) .With(p => p.PaymentIsStopped, false) .With(p => p.WithdrawnByCompliance, false) .With(p => p.WithdrawnByEmployer, false) .With(p => p.EmploymentCheckPassed, true) .Without(p => p.IsClawedBack) .Create() ) .With(p => p.FirstClawbackStatus, clawbackStatus) .With(p => p.SecondClawbackStatus, clawbackStatus) .Create() }; var getApplications = new GetApplicationsModel { ApprenticeApplications = applications, FirstSubmittedApplicationId = applicationId }; _testContext.EmployerIncentivesApi.MockServer .Given( Request .Create() .WithPath( $"/accounts/{_testData.AccountId}/legalentity/{_testData.AccountLegalEntityId}/applications") .UsingGet() ) .RespondWith( Response.Create() .WithStatusCode(HttpStatusCode.OK) .WithBody(JsonConvert.SerializeObject(getApplications))); }
private void AnEmployerHasASingleSubmittedApplication(Guid applicationId, BankDetailsStatus bankDetailsStatus = BankDetailsStatus.Completed) { _testData = new TestData.Account.WithInitialApplicationForASingleEntity(); _testContext.TestDataStore.Add("HashedAccountId", _testData.HashedAccountId); _testContext.TestDataStore.Add("HashedAccountLegalEntityId", _testData.HashedAccountLegalEntityId); _testContext.AddOrReplaceClaim(EmployerClaimTypes.Account, _testData.HashedAccountId); ClawbackStatusModel clawbackStatus = null; var applications = new List <ApprenticeApplicationModel> { _fixture.Build <ApprenticeApplicationModel>() .With(p => p.AccountId, _testData.AccountId) .With(p => p.FirstClawbackStatus, clawbackStatus) .With(p => p.SecondClawbackStatus, clawbackStatus) .With(p => p.FirstPaymentStatus, _fixture.Build <PaymentStatusModel>().Without(p => p.IsClawedBack).With(p => p.EmploymentCheckPassed, true).Create()) .With(p => p.SecondPaymentStatus, _fixture.Build <PaymentStatusModel>().Without(p => p.IsClawedBack).With(p => p.EmploymentCheckPassed, true).Create()) .Create() }; applications[0].Status = "Submitted"; var getApplications = new GetApplicationsModel { ApprenticeApplications = applications, BankDetailsStatus = bankDetailsStatus, FirstSubmittedApplicationId = applicationId }; _testContext.EmployerIncentivesApi.MockServer .Given( Request .Create() .WithPath( $"/accounts/{_testData.AccountId}/legalentity/{_testData.AccountLegalEntityId}/applications") .UsingGet() ) .RespondWith( Response.Create() .WithStatusCode(HttpStatusCode.OK) .WithBody(JsonConvert.SerializeObject(getApplications))); }
private void AnApplicationWithAnUnsentClawedBackPayment(Guid applicationId) { _testData = new TestData.Account.WithInitialApplicationForASingleEntity(); _testContext.TestDataStore.Add("HashedAccountId", _testData.HashedAccountId); _testContext.TestDataStore.Add("HashedAccountLegalEntityId", _testData.HashedAccountLegalEntityId); _testContext.AddOrReplaceClaim(EmployerClaimTypes.Account, _testData.HashedAccountId); var clawbackStatus = new ClawbackStatusModel { ClawbackDate = _fixture.Create <DateTime>(), // unset still has a clawback date ClawbackAmount = _fixture.Create <decimal>(), OriginalPaymentDate = _fixture.Create <DateTime>() }; var applications = new List <ApprenticeApplicationModel> { _fixture.Build <ApprenticeApplicationModel>() .With(p => p.AccountId, _testData.AccountId) .With(p => p.FirstClawbackStatus, clawbackStatus) .Without(p => p.SecondClawbackStatus) .Create() }; var getApplications = new GetApplicationsModel { ApprenticeApplications = applications, FirstSubmittedApplicationId = applicationId }; _testContext.EmployerIncentivesApi.MockServer .Given( Request .Create() .WithPath( $"/accounts/{_testData.AccountId}/legalentity/{_testData.AccountLegalEntityId}/applications") .UsingGet() ) .RespondWith( Response.Create() .WithStatusCode(HttpStatusCode.OK) .WithBody(JsonConvert.SerializeObject(getApplications))); }