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; } }
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); } }
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; } }
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; }