use of org.mifos.framework.util.helpers.Money in project head by mifos.
the class LoanBO method waivePenaltyAmountDue.
private void waivePenaltyAmountDue() throws AccountException {
List<AccountActionDateEntity> accountActionDateList = getApplicableIdsForNextInstallmentAndArrears();
LoanScheduleEntity accountActionDateEntity = (LoanScheduleEntity) accountActionDateList.get(accountActionDateList.size() - 1);
Money principal = new Money(getCurrency());
Money interest = new Money(getCurrency());
Money fee = new Money(getCurrency());
Money chargeWaived = accountActionDateEntity.waivePenaltyCharges();
if (chargeWaived != null && chargeWaived.isGreaterThanZero()) {
updateTotalPenaltyAmount(chargeWaived);
updateAccountActivity(principal, interest, fee, chargeWaived, userContext.getId(), LoanConstants.PENALTY_WAIVED);
waiveChargesFromMemberAccounts(LoanConstants.PENALTY_WAIVED);
}
try {
getlegacyLoanDao().createOrUpdate(this);
} catch (PersistenceException e) {
throw new AccountException(e);
}
}
use of org.mifos.framework.util.helpers.Money in project head by mifos.
the class LoanBO method getTotalInterestToBePaid.
public Money getTotalInterestToBePaid() {
Money amount = new Money(getCurrency());
List<AccountActionDateEntity> actionDateList = getAllInstallments();
for (AccountActionDateEntity accountActionDateEntity : actionDateList) {
LoanScheduleEntity loanScheduleEntity = (LoanScheduleEntity) accountActionDateEntity;
amount = amount.add(loanScheduleEntity.getInterest());
}
return amount;
}
use of org.mifos.framework.util.helpers.Money in project head by mifos.
the class LoanPenaltyScheduleEntity method waiveCharges.
protected Money waiveCharges() {
Money chargeWaived = new Money(accountPenalty.getAccount().getCurrency());
chargeWaived = chargeWaived.add(getPenaltyDue());
setPenaltyAmount(getPenaltyAmountPaid());
return chargeWaived;
}
use of org.mifos.framework.util.helpers.Money in project head by mifos.
the class LoanPenaltyScheduleEntity method adjustPenalties.
void adjustPenalties(PenaltiesTrxnDetailEntity penaltiesTrxnDetailEntity) {
Money penaltyAmntAdjusted = penaltiesTrxnDetailEntity.getPenaltyAmount();
setPenaltyAmountPaid(getPenaltyAmountPaid().add(penaltyAmntAdjusted));
}
use of org.mifos.framework.util.helpers.Money in project head by mifos.
the class LoanScheduleEntity method payPenalty.
private Money payPenalty(final Money amount) {
Money payable = min(amount, (getPenalty().subtract(getPenaltyPaid())));
Money balance = amount;
allocatePenalty(payable);
for (LoanPenaltyScheduleEntity loanPenaltyScheduleEntity : getLoanPenaltyScheduleEntities()) {
balance = loanPenaltyScheduleEntity.payPenalty(balance);
Integer penaltyId = loanPenaltyScheduleEntity.getLoanPenaltyScheduleEntityId();
if (penaltyId == null) {
// special workaround for MIFOS-4517
penaltyId = loanPenaltyScheduleEntity.hashCode();
}
Money penaltyAllocated = loanPenaltyScheduleEntity.getPenaltyAllocated();
paymentAllocation.allocateForPenalty(penaltyId, penaltyAllocated);
}
return amount.subtract(payable);
}
Aggregations