public static decimal GetRefundableAmount(this Booking booking, DateTime forDate) { var refundableAmount = booking.Rooms.Sum(room => room.Price.Amount * (decimal)room.DeadlineDetails.GetRefundableFraction(forDate)); return(MoneyRounder.Ceil(refundableAmount, booking.Currency)); }
public static MoneyAmount GetCancellationPenalty(this Booking booking, DateTime forDate) { var penalty = booking.TotalPrice - booking.GetRefundableAmount(forDate); return(new MoneyAmount(penalty, booking.Currency)); }