Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Allow a zero annual salary #255

Merged
merged 1 commit into from
Aug 2, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Original file line number Diff line number Diff line change
Expand Up @@ -31,7 +31,7 @@ public class UkStudentLoanCalculationDtoValidator : AbstractValidator<UkStudentL
{
public UkStudentLoanCalculationDtoValidator()
{
RuleFor(x => x.AnnualSalaryBeforeTax).GreaterThan(0);
RuleFor(x => x.AnnualSalaryBeforeTax).GreaterThanOrEqualTo(0);
RuleFor(x => x.BirthDate).NotNull().Must(x => x <= DateTimeOffset.Now.AddYears(-15)).When(x =>
x.Loans.Any(x => x.LoanType == UkStudentLoanType.Type1 && x.AcademicYearLoanTakenOut <= 2005) ||
x.Loans.Any(x => x.LoanType == UkStudentLoanType.Type4 && x.AcademicYearLoanTakenOut <= 2006));
Expand Down
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
{
"annualSalaryBeforeTax": 0,
"annualSalaryBeforeTax": -1,
"loans": [
{
"loanType": "Type1",
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,7 @@
"Only one loan of each type allowed."
],
"AnnualSalaryBeforeTax": [
"'Annual Salary Before Tax' must be greater than '0'."
"'Annual Salary Before Tax' must be greater than or equal to '0'."
],
"Loans[0].CourseEndDate": [
"'Course End Date' must not be empty."
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -43,7 +43,7 @@ public static IEnumerable<object[]> ValidLoanDataSupplied()
AcademicYearLoanTakenOut = 2005,
}
},
AnnualSalaryBeforeTax = 1

}
},
new object[]
Expand All @@ -61,7 +61,6 @@ public static IEnumerable<object[]> ValidLoanDataSupplied()
CourseEndDate = DateTime.Now
}
},
AnnualSalaryBeforeTax = 1
}
},
new object[]
Expand All @@ -80,7 +79,6 @@ public static IEnumerable<object[]> ValidLoanDataSupplied()
CourseEndDate = DateTime.Now
}
},
AnnualSalaryBeforeTax = 1
}
},
new object[]
Expand All @@ -98,7 +96,6 @@ public static IEnumerable<object[]> ValidLoanDataSupplied()
CourseEndDate = DateTime.Now
}
},
AnnualSalaryBeforeTax = 1
}
},
new object[]
Expand All @@ -116,7 +113,6 @@ public static IEnumerable<object[]> ValidLoanDataSupplied()
StudyingPartTime = false
}
},
AnnualSalaryBeforeTax = 1
}
},
new object[]
Expand All @@ -133,7 +129,6 @@ public static IEnumerable<object[]> ValidLoanDataSupplied()
CourseEndDate = DateTime.Now,
}
},
AnnualSalaryBeforeTax = 1
}
},
new object[]
Expand All @@ -149,7 +144,6 @@ public static IEnumerable<object[]> ValidLoanDataSupplied()
StudyingPartTime = false,
}
},
AnnualSalaryBeforeTax = 1
}
},
new object[]
Expand Down Expand Up @@ -179,7 +173,6 @@ public static IEnumerable<object[]> ValidLoanDataSupplied()
CourseEndDate = DateTime.Now,
}
},
AnnualSalaryBeforeTax = 1
}
},
new object[]
Expand All @@ -196,7 +189,6 @@ public static IEnumerable<object[]> ValidLoanDataSupplied()
CourseEndDate = DateTime.Now,
}
},
AnnualSalaryBeforeTax = 1,
VoluntaryRepayments = new List<VoluntaryRepayment>
{
new()
Expand Down Expand Up @@ -272,7 +264,7 @@ public void Validate_WithBasicInvalidData_ShouldFailValidation()
CourseEndDate = null, // Must be set for type 2
}
},
AnnualSalaryBeforeTax = 0,
AnnualSalaryBeforeTax = -1,
BirthDate = DateTime.Now.AddYears(-14),
SalaryAdjustments = new List<Adjustment>
{
Expand Down Expand Up @@ -343,7 +335,6 @@ public void Validate_WithALoanRequiringParticularFieldsAndDataNotCorrect_ShouldF
AcademicYearLoanTakenOut = data.AcademicYearLoanTakenOut
},
},
AnnualSalaryBeforeTax = 1,
BirthDate = data.BirthDate
};

Expand Down
Loading