示例#1
0
        public static (FeeStatus FeeStatus, Fee Fee) GetTrainingFee(this MemberUser user)
        {
            if (user.HasPayedTrainingFeeThisSemester())
            {
                return(FeeStatus.Paid, null);
            }

            if (user.ExemptFromTrainingFee)
            {
                return(FeeStatus.Unpayable, null);
            }

            if (user.HasPayedMembershipThisYear())
            {
                return(
                    FeeStatus.Unpaid,
                    new Fee("Treningsavgift", TrainingFee, includesTraining: true)
                    );
            }

            return(
                FeeStatus.Unpaid,
                new Fee("Medlemskap og treningsavgift", MembershipFee + TrainingFee, includesMembership: true, includesTraining: true)
                );
        }
示例#2
0
        public void TestNoPayments()
        {
            var user = new MemberUser();

            user.HasPayedMembershipThisYear().ShouldBeFalse();
            user.HasPayedTrainingFeeThisSemester().ShouldBeFalse();
            user.HasPayedClassesFeeThisSemester().ShouldBeFalse();
        }
示例#3
0
        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();
        }
示例#4
0
        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();
            }
        }
示例#5
0
        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();
            }
        }
示例#6
0
 public static bool MustPayTrainingFee(this MemberUser user, EventSignupOptions options)
 => options.RequiresTrainingFee && !user.HasPayedTrainingFeeThisSemester() && !user.ExemptFromTrainingFee;