public void ValidatePaymentsNotPaused(Guid pendingPaymentId, CollectionPeriod collectionPeriod) { var pendingPayment = GetPendingPaymentForValidationCheck(pendingPaymentId); var isValid = !Model.PausePayments; pendingPayment.AddValidationResult(PendingPaymentValidationResult.New(Guid.NewGuid(), collectionPeriod, ValidationStep.PaymentsNotPaused, isValid)); }
public void ValidateDaysInLearning(Guid pendingPaymentId, Learner matchedLearner, CollectionPeriod collectionPeriod) { var pendingPayment = GetPendingPaymentForValidationCheck(pendingPaymentId); var hasEnoughDaysInLearning = false; if (matchedLearner != null) { hasEnoughDaysInLearning = StartDate.Date.AddDays(matchedLearner.GetDaysInLearning(collectionPeriod)) >= pendingPayment.DueDate.Date; } pendingPayment.AddValidationResult(PendingPaymentValidationResult.New(Guid.NewGuid(), collectionPeriod, ValidationStep.HasDaysInLearning, hasEnoughDaysInLearning)); }
public void ValidateHasNoDataLocks(Guid pendingPaymentId, Learner matchedLearner, CollectionPeriod collectionPeriod) { var pendingPayment = GetPendingPaymentForValidationCheck(pendingPaymentId); var hasDataLock = false; if (matchedLearner != null) { hasDataLock = matchedLearner.SubmissionData.SubmissionFound && matchedLearner.SubmissionData.LearningData.HasDataLock == true; } pendingPayment.AddValidationResult(PendingPaymentValidationResult.New(Guid.NewGuid(), collectionPeriod, ValidationStep.HasNoDataLocks, !hasDataLock)); }
public void ValidateHasLearningRecord(Guid pendingPaymentId, Learner learner, CollectionPeriod collectionPeriod) { var pendingPayment = GetPendingPaymentForValidationCheck(pendingPaymentId); var hasLearningRecord = false; if (learner != null && learner.SubmissionData.SubmissionFound) { hasLearningRecord = learner.SubmissionData.LearningData.LearningFound; } pendingPayment.AddValidationResult(PendingPaymentValidationResult.New(Guid.NewGuid(), collectionPeriod, ValidationStep.HasLearningRecord, hasLearningRecord)); }
public void ValidateIsInLearning(Guid pendingPaymentId, Learner matchedLearner, CollectionPeriod collectionPeriod) { var pendingPayment = GetPendingPaymentForValidationCheck(pendingPaymentId); var isInLearning = false; if (matchedLearner != null) { isInLearning = matchedLearner.SubmissionData.SubmissionFound && matchedLearner.SubmissionData.LearningData.IsInlearning == true; } pendingPayment.AddValidationResult(PendingPaymentValidationResult.New(Guid.NewGuid(), collectionPeriod, ValidationStep.IsInLearning, isInLearning)); }
public void AddValidationResult(PendingPaymentValidationResult validationResult) { var existing = Model .PendingPaymentValidationResultModels .SingleOrDefault(v => v.Step.Equals(validationResult.Step) && v.CollectionPeriod.AcademicYear == validationResult.CollectionPeriod.AcademicYear && v.CollectionPeriod.PeriodNumber == validationResult.CollectionPeriod.PeriodNumber); if (existing != null) { Model.PendingPaymentValidationResultModels.Remove(existing); } Model.PendingPaymentValidationResultModels.Add(validationResult.GetModel()); }
public void ValidatePendingPaymentBankDetails(Guid pendingPaymentId, Accounts.Account account, CollectionPeriod collectionPeriod) { if (Account.Id != account.Id) { throw new InvalidPendingPaymentException($"Unable to validate PendingPayment {pendingPaymentId} of ApprenticeshipIncentive {Model.Id} because the provided Account record does not match the one against the incentive."); } var pendingPayment = GetPendingPaymentForValidationCheck(pendingPaymentId); var legalEntity = account.GetLegalEntity(pendingPayment.Account.AccountLegalEntityId); var isValid = !string.IsNullOrEmpty(legalEntity.VrfVendorId); pendingPayment.AddValidationResult(PendingPaymentValidationResult.New(Guid.NewGuid(), collectionPeriod, ValidationStep.HasBankDetails, isValid)); }
public void ValidateMinimumRequiredAgreementVersion(Guid pendingPaymentId, Accounts.Account account, CollectionPeriod collectionPeriod) { if (account == null || Account.Id != account.Id) { throw new InvalidPendingPaymentException($"Unable to validate PendingPayment {pendingPaymentId} of ApprenticeshipIncentive {Model.Id} because the provided Account record does not match the one against the incentive."); } var pendingPayment = GetPendingPaymentForValidationCheck(pendingPaymentId); var legalEntity = account.GetLegalEntity(pendingPayment.Account.AccountLegalEntityId); var isValid = legalEntity.SignedAgreementVersion >= MinimumAgreementVersion.MinimumRequiredVersion; pendingPayment.AddValidationResult(PendingPaymentValidationResult.New(Guid.NewGuid(), collectionPeriod, ValidationStep.HasSignedMinVersion, isValid)); }
private void ValidateSubmissionFound(Guid pendingPaymentId, Learner learner, CollectionPeriod collectionPeriod) { var pendingPayment = GetPendingPaymentForValidationCheck(pendingPaymentId); pendingPayment.AddValidationResult(PendingPaymentValidationResult.New(Guid.NewGuid(), collectionPeriod, ValidationStep.HasIlrSubmission, learner.SubmissionData.SubmissionFound)); }