Search in sources :

Example 26 with Money

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);
}
Also used : Money(org.mifos.framework.util.helpers.Money)

Example 27 with Money

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;
}
Also used : Money(org.mifos.framework.util.helpers.Money)

Example 28 with Money

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);
}
Also used : Money(org.mifos.framework.util.helpers.Money)

Example 29 with Money

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);
}
Also used : Money(org.mifos.framework.util.helpers.Money)

Example 30 with Money

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);
}
Also used : Money(org.mifos.framework.util.helpers.Money)

Aggregations

Money (org.mifos.framework.util.helpers.Money)688 Test (org.junit.Test)326 Date (java.util.Date)110 ArrayList (java.util.ArrayList)93 LocalDate (org.joda.time.LocalDate)90 Date (java.sql.Date)85 AccountActionDateEntity (org.mifos.accounts.business.AccountActionDateEntity)80 DateTime (org.joda.time.DateTime)67 LoanBO (org.mifos.accounts.loan.business.LoanBO)64 MeetingBO (org.mifos.application.meeting.business.MeetingBO)57 AccountPaymentEntity (org.mifos.accounts.business.AccountPaymentEntity)56 BigDecimal (java.math.BigDecimal)53 ProductDefinitionException (org.mifos.accounts.productdefinition.exceptions.ProductDefinitionException)49 AccountException (org.mifos.accounts.exceptions.AccountException)48 PersonnelBO (org.mifos.customers.personnel.business.PersonnelBO)46 UserContext (org.mifos.security.util.UserContext)46 CustomerBO (org.mifos.customers.business.CustomerBO)39 MifosUser (org.mifos.security.MifosUser)35 RepaymentScheduleInstallment (org.mifos.accounts.loan.util.helpers.RepaymentScheduleInstallment)34 PaymentData (org.mifos.accounts.util.helpers.PaymentData)34