public void pay() { if (this.billData.getPaidAmount() == null) { Payment payer = new Payment(); this.billData.setPaidAmount(payer.generateDraft(this)); this.persist(); } }
public BigDecimal getFinalPayment() { /*if (this.paymentSchedule == null) { this.paymentSchedule = loanCalculator.calculatePaymentSchedule(); }*/ Iterator payments = this.paymentSchedule.getPayments(); Payment payment = null; while (payments.hasNext()) { payment = (Payment) payments.next(); } BigDecimal finalPayment = payment.getPrincipal().add(payment.getInterest()); ; finalPayment = finalPayment.setScale(2, BigDecimal.ROUND_HALF_UP); return finalPayment; }
public BigDecimal getMonthlyPayment() { /*if (this.paymentSchedule == null) { this.paymentSchedule = loanCalculator.calculatePaymentSchedule(); }*/ Iterator payments = this.paymentSchedule.getPayments(); BigDecimal monthlyPayment = null; if (payments.hasNext()) { Payment payment = (Payment) payments.next(); monthlyPayment = payment.getPrincipal().add(payment.getInterest()); monthlyPayment = monthlyPayment.setScale(2, BigDecimal.ROUND_HALF_UP); } return monthlyPayment; }