private void SendDelinquentPaymentNotification(LoanPayment payment, Client client)
 {
     mailService.SendMessage(
         SendDelinquentPaymentNotificationSubject,
         String.Format(SendDelinquentPaymentNotificationBody, client.FirstName, payment.Amount),
         client.Email);
 }
 private void ReCalculatePayment(LoanPayment payment, DateTime date, LoanProduct product)
 {
     if (payment.Date < date)
     {
         payment.Fine += product.FineDayPercentage * payment.Amount;
     }
 }
示例#3
0
 public void TryPayLoanPayment(LoanPayment loanPayment)
 {
     Contract.Requires<ArgumentNullException>(loanPayment.IsNotNull());
     Account account = loanPayment.TakenLoan.Client.PrimaryAccount;
     account.Amount = TryPayLoanPayment(account.Amount, loanPayment);
     CheckLoanPaymentStatus(loanPayment);
     CheckTakenLoanStatus(loanPayment.TakenLoan);
     this.gangsterBankUnitOfWork.ClientsRepository.CreateOrUpdate(loanPayment.TakenLoan.Client);
 }
 private void ProceedPayment(LoanPayment payment, DateTime date, Client client)
 {
     var paymentDate = payment.Date;
     if (paymentDate < date)
     {
         this.SendDelinquentPaymentNotification(payment, client);
     }
     else if (paymentDate == date)
     {
         this.SendTodayPaymentNotification(payment, client);
     }
     else if (paymentDate < date.AddDays(3))
     {
         this.Send3DayPaymentNotification(payment, client);
     }
 }
示例#5
0
 private static void CheckLoanPaymentStatus(LoanPayment loanPayment)
 {
     if (loanPayment.Fine == 0 && loanPayment.Amount == 0)
     {
         loanPayment.Status = loanPayment.Date.Date < DateTime.Now.Date
                                  ? LoanPaymentStatus.PaidWithDelay
                                  : LoanPaymentStatus.Paid;
     }
 }
示例#6
0
        private static decimal TryPayLoanPayment(decimal amount, LoanPayment loanPayment)
        {
            amount = PayRequiredPaymentAmount(amount, loanPayment.Fine, newAmount => loanPayment.Fine = newAmount);
            amount = PayRequiredPaymentAmount(amount, loanPayment.Amount, newAmount => loanPayment.Amount = newAmount);

            return amount;
        }