use of org.mifos.framework.util.helpers.Money in project head by mifos.
the class LoanScheduleEntity method payComponents.
public void payComponents(Installment installment, MifosCurrency currency, Date paymentDate) {
initPaymentAllocation(currency);
allocatePrincipal(new Money(currency, installment.getCurrentPrincipalPaid()));
allocateInterest(new Money(currency, installment.getCurrentInterestPaid()));
allocateExtraInterest(new Money(currency, installment.getCurrentExtraInterestPaid()));
payFees(new Money(currency, installment.getCurrentFeesPaid()));
allocateMiscFees(new Money(currency, installment.getCurrentMiscFeesPaid()));
allocatePenalty(new Money(currency, installment.getCurrentPenaltyPaid()));
allocateMiscPenalty(new Money(currency, installment.getCurrentMiscPenaltyPaid()));
updateInterest(installment, currency);
setExtraInterest(new Money(currency, installment.getExtraInterest()));
recordPayment(paymentDate);
}
use of org.mifos.framework.util.helpers.Money in project head by mifos.
the class LoanScheduleEntity method payComponents.
public Money payComponents(Money paymentAmount, Date paymentDate) {
initPaymentAllocation(paymentAmount.getCurrency());
Money balanceAmount = paymentAmount;
balanceAmount = payMiscPenalty(balanceAmount);
balanceAmount = payPenalty(balanceAmount);
balanceAmount = payMiscFees(balanceAmount);
balanceAmount = payFees(balanceAmount);
balanceAmount = payInterest(balanceAmount);
balanceAmount = payPrincipal(balanceAmount);
recordPayment(paymentDate);
return balanceAmount;
}
use of org.mifos.framework.util.helpers.Money in project head by mifos.
the class LoanScheduleEntity method reducePrincipalBy.
private Money reducePrincipalBy(final Money amount) {
Money reducedBy = min(amount, getPrincipalDue());
this.principal = this.principal.subtract(reducedBy);
return amount.subtract(reducedBy);
}
use of org.mifos.framework.util.helpers.Money in project head by mifos.
the class LoanScheduleEntity method updatePaymentDetailsForAdjustment.
public void updatePaymentDetailsForAdjustment(LoanTrxnDetailEntity loanReverseTrxn) {
CalculatedInterestOnPayment interestOnPayment = loanReverseTrxn.getCalculatedInterestOnPayment();
Money overdueInterestPaid = calculateExtraInterestPaid(interestOnPayment);
principalPaid = principalPaid.add(loanReverseTrxn.getPrincipalAmount());
interest = calculateAdjustedInterest(interestOnPayment, overdueInterestPaid, loanReverseTrxn);
interestPaid = interestPaid.add(loanReverseTrxn.getInterestAmount()).add(overdueInterestPaid);
penaltyPaid = penaltyPaid.add(loanReverseTrxn.getPenaltyAmount());
miscPenaltyPaid = miscPenaltyPaid.add(loanReverseTrxn.getMiscPenaltyAmount());
miscFeePaid = miscFeePaid.add(loanReverseTrxn.getMiscFeeAmount());
extraInterestPaid = extraInterestPaid.subtract(overdueInterestPaid);
}
use of org.mifos.framework.util.helpers.Money in project head by mifos.
the class LoanScheduleEntity method payMiscPenalty.
private Money payMiscPenalty(final Money amount) {
Money payable = min(amount, getMiscPenaltyDue());
allocateMiscPenalty(payable);
return amount.subtract(payable);
}
Aggregations