public void TestNoPayments() { var user = new MemberUser(); user.HasPayedMembershipThisYear().ShouldBeFalse(); user.HasPayedTrainingFeeThisSemester().ShouldBeFalse(); user.HasPayedClassesFeeThisSemester().ShouldBeFalse(); }
public void TestPaidLastYear() { var user = new MemberUser { Payments = { Payment(paidAt: TimeProvider.UtcNow.AddYears(-1), membership: true, training: true, classes: true) } }; user.HasPayedMembershipThisYear().ShouldBeFalse(); user.HasPayedTrainingFeeThisSemester().ShouldBeFalse(); user.HasPayedClassesFeeThisSemester().ShouldBeFalse(); }
public static (FeeStatus FeeStatus, Fee Fee) GetClassesFee(this MemberUser user) { if (user.HasPayedClassesFeeThisSemester()) { return(FeeStatus.Paid, null); } if (user.ExemptFromClassesFee) { return(FeeStatus.Unpayable, null); } if (user.HasPayedTrainingFeeThisSemester()) { return( FeeStatus.Unpaid, new Fee("Kursavgift", ClassesFee - TrainingFee, includesClasses: true) ); } if (user.HasPayedMembershipThisYear()) { if (user.ExemptFromTrainingFee) { return( FeeStatus.Unpaid, new Fee("Kursavgift", ClassesFee - TrainingFee, includesClasses: true) ); } return( FeeStatus.Unpaid, new Fee("Kursavgift", ClassesFee, includesTraining: true, includesClasses: true) ); } if (user.ExemptFromTrainingFee) { return( FeeStatus.Unpaid, new Fee("Medlemskap og kursavgift", ClassesFee - TrainingFee + MembershipFee, includesMembership: true, includesClasses: true) ); } return( FeeStatus.Unpaid, new Fee("Medlemskap og kursavgift", MembershipFee + ClassesFee, includesMembership: true, includesTraining: true, includesClasses: true) ); }
public void TestPaidExemptFromFees() { using (TemporaryTime.Is(new DateTime(2019, 10, 2))) { var user = new MemberUser { ExemptFromClassesFee = true, ExemptFromTrainingFee = true }; user.HasPayedMembershipThisYear().ShouldBeFalse(); user.HasPayedTrainingFeeThisSemester().ShouldBeFalse(); user.HasPayedClassesFeeThisSemester().ShouldBeFalse(); } }
public void TestPaidMembershipThisFallSemester() { using (TemporaryTime.Is(new DateTime(2019, 10, 2))) { var user = new MemberUser { Payments = { Payment(paidAt: TimeProvider.UtcNow.AddMonths(-1), membership: true, training: false, classes: false) } }; user.HasPayedMembershipThisYear().ShouldBeTrue(); user.HasPayedTrainingFeeThisSemester().ShouldBeFalse(); user.HasPayedClassesFeeThisSemester().ShouldBeFalse(); } }
public static bool MustPayClassesFee(this MemberUser user, EventSignupOptions options) => options.RequiresClassesFee && !user.HasPayedClassesFeeThisSemester() && !user.ExemptFromClassesFee;