From 610d76e5504bf0ad37aa3ac8e97a93b7db894ede Mon Sep 17 00:00:00 2001 From: Kevin Date: Tue, 25 Jun 2019 14:53:05 +0100 Subject: [PATCH] CON-399-stop-date-rule-changes --- .../StopApprenticeshipCommandHandler.cs | 13 +++++++------ 1 file changed, 7 insertions(+), 6 deletions(-) diff --git a/src/SFA.DAS.Commitments.Application/Commands/UpdateApprenticeshipStatus/StopApprenticeshipCommandHandler.cs b/src/SFA.DAS.Commitments.Application/Commands/UpdateApprenticeshipStatus/StopApprenticeshipCommandHandler.cs index 96209ccd40..64fdc27473 100644 --- a/src/SFA.DAS.Commitments.Application/Commands/UpdateApprenticeshipStatus/StopApprenticeshipCommandHandler.cs +++ b/src/SFA.DAS.Commitments.Application/Commands/UpdateApprenticeshipStatus/StopApprenticeshipCommandHandler.cs @@ -163,13 +163,14 @@ private void ValidateChangeDateForStop(DateTime dateOfChange, Apprenticeship app if ( dateOfChange.Date < apprenticeship.StartDate.Value.Date) throw new ValidationException("Invalid Date of Change. Date cannot be before the training start date."); - if ( apprenticeship.PaymentStatus != PaymentStatus.PendingApproval && - _academicYearValidator.Validate(dateOfChange.Date) == AcademicYearValidationResult.NotWithinFundingPeriod) + if (apprenticeship.PaymentStatus != PaymentStatus.Withdrawn) { - throw new ValidationException("Invalid Date of Change. Date cannot be before the academic year start date."); - } - - + if (apprenticeship.PaymentStatus != PaymentStatus.PendingApproval && + _academicYearValidator.Validate(dateOfChange.Date) == AcademicYearValidationResult.NotWithinFundingPeriod) + { + throw new ValidationException("Invalid Date of Change. Date cannot be before the academic year start date."); + } + } } }