private void SendDelinquentPaymentNotification(LoanPayment payment, Client client)
 {
     mailService.SendMessage(
         SendDelinquentPaymentNotificationSubject,
         String.Format(SendDelinquentPaymentNotificationBody, client.FirstName, payment.Amount),
         client.Email);
 }
Ejemplo n.º 2
0
 private void ReCalculatePayment(LoanPayment payment, DateTime date, LoanProduct product)
 {
     if (payment.Date < date)
     {
         payment.Fine += product.FineDayPercentage * payment.Amount;
     }
 }
Ejemplo n.º 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);
     }
 }
Ejemplo n.º 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;
     }
 }
Ejemplo n.º 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;
        }